aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--Makefile.am1
-rw-r--r--TODO4
-rw-r--r--lib/ephy-file-helpers.c33
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c126
-rw-r--r--src/bookmarks/ephy-bookmarks-import.c21
-rw-r--r--src/bookmarks/ephy-bookmarks-import.h8
7 files changed, 134 insertions, 72 deletions
diff --git a/ChangeLog b/ChangeLog
index 2054d2a97..cb44896a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2005-01-19 Christian Persch <chpe@cvs.gnome.org>
+ * lib/ephy-file-helpers.c: (ephy_find_file_recursive):
+ * src/bookmarks/ephy-bookmarks-editor.c: (add_bookmarks_files),
+ (add_bookmarks_source), (import_dialog_response_cb),
+ (cmd_bookmarks_import):
+ * src/bookmarks/ephy-bookmarks-import.c: (ephy_bookmarks_import):
+ * src/bookmarks/ephy-bookmarks-import.h:
+
+ Show profile name for mozilla bookmarks, so we can distinguish between
+ different profiles. Don't show firefox bookmarks as mozilla bookmarks.
+ Fixes bug #143982.
+
+2005-01-19 Christian Persch <chpe@cvs.gnome.org>
+
* lib/ephy-langs.c:
More translator comments.
diff --git a/Makefile.am b/Makefile.am
index 8503c2f35..856e7a8e3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,6 +13,7 @@ EXTRA_DIST = \
xmldocs.make \
omf.make \
COPYING.README \
+ HACKING \
MAINTAINERS \
ChangeLog-20030925 \
ChangeLog-20040912
diff --git a/TODO b/TODO
index e71968283..712ce4e2d 100644
--- a/TODO
+++ b/TODO
@@ -11,3 +11,7 @@ Stuff to port to new glib/gtk+ APIs:
- port Downloads directory button in prefs to GtkFileChooserButton
(but wait for bugs #154388, #154390, #154392, #154394)
+Stuff to do when dropping support for mozilla < 1.7:
+- use dependent strings
+- use gtk_moz_embed_set_app_components
+
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index bc11f8e27..5be893dc6 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -268,31 +268,34 @@ ephy_ensure_dir_exists (const char *dir)
static void
ephy_find_file_recursive (const char *path,
- const char *fname, GSList **l,
- gint depth, gint maxdepth)
+ const char *fname,
+ GSList **list,
+ gint depth,
+ gint maxdepth)
{
- GDir *d = g_dir_open (path, 0, NULL);
- const gchar *f;
- if (d)
+ GDir *dir;
+ const gchar *file;
+
+ dir = g_dir_open (path, 0, NULL);
+ if (dir != NULL)
{
- while ((f = g_dir_read_name (d)))
+ while ((file = g_dir_read_name (dir)))
{
- char *new_path = g_build_filename (path, f, NULL);
if (depth < maxdepth)
{
- ephy_find_file_recursive (new_path, fname, l,
+ char *new_path = g_build_filename (path, file, NULL);
+ ephy_find_file_recursive (new_path, fname, list,
depth + 1, maxdepth);
+ g_free (new_path);
}
- if (!strcmp (f, fname))
- {
- *l = g_slist_prepend (*l, new_path);
- }
- else
+ if (strcmp (file, fname) == 0)
{
- g_free (new_path);
+ char *new_path = g_build_filename (path, file, NULL);
+ *list = g_slist_prepend (*list, new_path);
}
}
- g_dir_close (d);
+
+ g_dir_close (dir);
}
}
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 561ac497a..7af62ced3 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -540,29 +540,74 @@ show_properties_dialog (EphyBookmarksEditor *editor,
(editor->priv->bookmarks, bookmark, GTK_WIDGET (editor));
}
-static void
-add_bookmarks_source (GtkListStore *store,
- const char *desc,
- const char *dir,
- const char *filename,
- int max_depth)
+static GSList *
+add_bookmarks_files (const char *dir,
+ const char *filename,
+ int max_depth)
{
- GtkTreeIter iter;
- GSList *l;
+ GSList *list;
char *path;
path = g_build_filename (g_get_home_dir (), dir, NULL);
- l = ephy_file_find (path, filename, max_depth);
+ list = ephy_file_find (path, filename, max_depth);
g_free (path);
- if (l)
+ return list;
+}
+
+static void
+add_bookmarks_source (const char *file,
+ GtkListStore *store)
+{
+ GtkTreeIter iter;
+ char **path;
+ char *description = NULL;
+ int len, i;
+
+ path = g_strsplit (file, G_DIR_SEPARATOR_S, -1);
+ g_return_if_fail (path != NULL);
+
+ len = g_strv_length (path);
+
+ for (i = len - 2; i >= 0 && description == NULL; --i)
{
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, desc, 1, l->data, -1);
+ const char *p = (const char *) path[i];
+
+ g_return_if_fail (p != NULL);
+
+ if (strcmp (p, "firefox") == 0)
+ {
+ description = g_strdup (_("Firefox"));
+ }
+ else if (strcmp (p, ".firefox") == 0)
+ {
+ description = g_strdup (_("Firebird"));
+ }
+ else if (strcmp (p, ".phoenix") == 0)
+ {
+ description = g_strdup (_("Firebird"));
+ }
+ else if (strcmp (p, ".mozilla") == 0)
+ {
+ description = g_strdup_printf (_("Mozilla \"%s\" profile"), path[i+1]);
+ }
+ else if (strcmp (p, ".galeon") == 0)
+ {
+ description = g_strdup (_("Galeon"));
+ }
+ else if (strcmp (p, "konqueror") == 0)
+ {
+ description = g_strdup (_("Konqueror"));
+ }
}
- g_slist_foreach (l, (GFunc) g_free, NULL);
- g_slist_free (l);
+ if (description != NULL)
+ {
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, description, 1, file, -1);
+
+ g_free (description);
+ }
}
static void
@@ -587,25 +632,23 @@ import_from_file_response_cb (GtkDialog *dialog, gint response,
}
static void
-import_dialog_response_cb (GtkDialog *dialog, gint response,
+import_dialog_response_cb (GtkDialog *dialog,
+ gint response,
EphyBookmarksEditor *editor)
{
if (response == GTK_RESPONSE_OK)
{
GtkTreeIter iter;
- char *filename;
+ const char *filename;
GtkWidget *combo;
GtkTreeModel *model;
- int active;
GValue value = { 0, };
combo = g_object_get_data (G_OBJECT (dialog), "combo_box");
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
- active = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
- gtk_tree_model_iter_nth_child (model, &iter, NULL, active);
+ gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter);
gtk_tree_model_get_value (model, &iter, 1, &value);
- filename = g_strdup (g_value_get_string (&value));
- g_value_unset (&value);
+ filename = g_value_get_string (&value);
if (filename == NULL)
{
@@ -619,7 +662,7 @@ import_dialog_response_cb (GtkDialog *dialog, gint response,
ephy_file_chooser_add_mime_filter
(dialog,
- _("Firefox/Firebird/Mozilla bookmarks"),
+ _("Firefox/Mozilla bookmarks"),
"application/x-mozilla-bookmarks", NULL);
ephy_file_chooser_add_mime_filter
@@ -647,7 +690,7 @@ import_dialog_response_cb (GtkDialog *dialog, gint response,
ephy_bookmarks_import (editor->priv->bookmarks, filename);
}
- g_free (filename);
+ g_value_unset (&value);
}
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -747,16 +790,17 @@ cmd_bookmarks_import (GtkAction *action,
GtkListStore *store;
GtkTreeIter iter;
GtkTreeModel *sortmodel;
+ GSList *files;
dialog = gtk_dialog_new_with_buttons (_("Import Bookmarks"),
- GTK_WINDOW (editor),
- GTK_DIALOG_DESTROY_WITH_PARENT |
- GTK_DIALOG_NO_SEPARATOR,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- _("I_mport"),
- GTK_RESPONSE_OK,
- NULL);
+ GTK_WINDOW (editor),
+ GTK_DIALOG_DESTROY_WITH_PARENT |
+ GTK_DIALOG_NO_SEPARATOR,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ _("I_mport"),
+ GTK_RESPONSE_OK,
+ NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
@@ -776,16 +820,16 @@ cmd_bookmarks_import (GtkAction *action,
store = GTK_LIST_STORE (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING));
- add_bookmarks_source (store, _("Firebird"),
- FIREBIRD_BOOKMARKS_DIR, "bookmarks.html", 4);
- add_bookmarks_source (store, _("Firefox"),
- FIREFOX_BOOKMARKS_DIR, "bookmarks.html", 4);
- add_bookmarks_source (store, _("Galeon"),
- GALEON_BOOKMARKS_DIR, "bookmarks.xbel", 0);
- add_bookmarks_source (store, _("Konqueror"),
- KDE_BOOKMARKS_DIR, "bookmarks.xml", 0);
- add_bookmarks_source (store, _("Mozilla"),
- MOZILLA_BOOKMARKS_DIR, "bookmarks.html", 4);
+ files = add_bookmarks_files (FIREFOX_BOOKMARKS_DIR_0, "bookmarks.html", 2);
+ files = g_slist_concat (add_bookmarks_files (FIREFOX_BOOKMARKS_DIR_1, "bookmarks.html", 2), files);
+ /* FIREFOX_BOOKMARKS_DIR_2 is subdir of MOZILLA_BOOKMARKS_DIR, so don't search it twice */
+ files = g_slist_concat (add_bookmarks_files (MOZILLA_BOOKMARKS_DIR, "bookmarks.html", 2), files);
+ files = g_slist_concat (add_bookmarks_files (GALEON_BOOKMARKS_DIR, "bookmarks.xbel", 0), files);
+ files = g_slist_concat (add_bookmarks_files (KDE_BOOKMARKS_DIR, "bookmarks.xml", 0), files);
+
+ g_slist_foreach (files, (GFunc) add_bookmarks_source, store);
+ g_slist_foreach (files, (GFunc) g_free, NULL);
+ g_slist_free (files);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, _("File"), 1, NULL, -1);
diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c
index 52fb3386d..bc1a5ed59 100644
--- a/src/bookmarks/ephy-bookmarks-import.c
+++ b/src/bookmarks/ephy-bookmarks-import.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2003, 2004 Marco Pesenti Gritti
- * Copyright (C) 2003, 2004 Christian Persch
+ * Copyright (C) 2003, 2004, 2005 Christian Persch
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,24 +68,20 @@ gboolean
ephy_bookmarks_import (EphyBookmarks *bookmarks,
const char *filename)
{
- GnomeVFSURI *uri;
const char *type;
gboolean success = FALSE;
if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
- uri = gnome_vfs_uri_new (filename);
- type = gnome_vfs_get_mime_type_common (uri);
+ type = gnome_vfs_get_file_mime_type (filename, NULL, FALSE);
- LOG ("Importing bookmarks of type %s", type)
+ LOG ("Importing bookmarks of type %s", type ? type : "(null)")
if (type == NULL)
{
- gnome_vfs_uri_unref (uri);
- return FALSE;
+ g_warning ("Couldn't determine the type of the bookmarks file %s!\n", filename);
}
-
- if (strcmp (type, "application/x-mozilla-bookmarks") == 0)
+ else if (strcmp (type, "application/x-mozilla-bookmarks") == 0)
{
success = ephy_bookmarks_import_mozilla (bookmarks, filename);
}
@@ -99,8 +95,9 @@ ephy_bookmarks_import (EphyBookmarks *bookmarks,
success = ephy_bookmarks_import_rdf (bookmarks, filename);
}
else if (strstr (filename, MOZILLA_BOOKMARKS_DIR) != NULL ||
- strstr (filename, FIREBIRD_BOOKMARKS_DIR) != NULL ||
- strstr (filename, FIREFOX_BOOKMARKS_DIR) != NULL)
+ strstr (filename, FIREFOX_BOOKMARKS_DIR_0) != NULL ||
+ strstr (filename, FIREFOX_BOOKMARKS_DIR_1) != NULL ||
+ strstr (filename, FIREFOX_BOOKMARKS_DIR_2) != NULL)
{
success = ephy_bookmarks_import_mozilla (bookmarks, filename);
}
@@ -111,8 +108,6 @@ ephy_bookmarks_import (EphyBookmarks *bookmarks,
}
/* else FIXME: put up some UI to warn user about unrecognised format? */
- gnome_vfs_uri_unref (uri);
-
return success;
}
diff --git a/src/bookmarks/ephy-bookmarks-import.h b/src/bookmarks/ephy-bookmarks-import.h
index 8938baef7..43e5db551 100644
--- a/src/bookmarks/ephy-bookmarks-import.h
+++ b/src/bookmarks/ephy-bookmarks-import.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2003 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004, 2005 Christian Persch
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,8 +27,9 @@
G_BEGIN_DECLS
#define MOZILLA_BOOKMARKS_DIR ".mozilla"
-#define FIREBIRD_BOOKMARKS_DIR ".phoenix"
-#define FIREFOX_BOOKMARKS_DIR ".firefox"
+#define FIREFOX_BOOKMARKS_DIR_0 ".phoenix"
+#define FIREFOX_BOOKMARKS_DIR_1 ".firefox"
+#define FIREFOX_BOOKMARKS_DIR_2 ".mozilla/firefox"
#define GALEON_BOOKMARKS_DIR ".galeon"
#define KDE_BOOKMARKS_DIR ".kde/share/apps/konqueror"