aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks-editor.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-06-09 19:49:43 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-06-09 19:49:43 +0800
commit50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd (patch)
tree4e8a7a54ff0f66f5c611e4cda2cb33138873cb6f /src/bookmarks/ephy-bookmarks-editor.c
parent715e6da7a85512491ac612dc5f97e48809ea5b4a (diff)
downloadgsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar
gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.gz
gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.bz2
gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.lz
gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.xz
gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.zst
gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.zip
Get rid of starthere: and default to google, as discussed with Seth. Add a
2003-06-09 Marco Pesenti Gritti <marco@it.gnome.org> * data/epiphany.schemas.in: * data/ui/epiphany-bookmark-editor-ui.xml.in: * embed/ephy-embed-shell.c: (ephy_embed_shell_class_init): * embed/mozilla/Makefile.am: * embed/mozilla/MozRegisterComponents.cpp: * lib/Makefile.am: * src/bookmarks/ephy-bookmark-action.c: (create_tool_item), (ephy_bookmark_action_sync_smart_url), (entry_activated_cb), (activate_cb), (connect_proxy), (ephy_bookmark_action_set_property), (ephy_bookmark_action_finalize), (ephy_bookmark_action_class_init), (sync_bookmark_properties), (ephy_bookmark_action_init): * src/bookmarks/ephy-bookmark-properties.c: (location_entry_changed_cb): * src/bookmarks/ephy-bookmarks-editor.c: (show_properties_dialog), (add_bookmarks_source_menu), (import_dialog_response_cb), (cmd_bookmarks_import): * src/bookmarks/ephy-bookmarks-import.c: (ephy_bookmarks_import), (mozilla_parse_bookmarks), (xbel_parse_folder), (xbel_parse_bookmarks), (ephy_bookmarks_import_xbel): * src/bookmarks/ephy-bookmarks-import.h: * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_autocompletion_source_foreach), (ephy_bookmarks_init_defaults), (update_topics_list), (update_has_smart_address), (ephy_bookmarks_add), (ephy_bookmarks_set_address): * src/bookmarks/ephy-bookmarks.h: * src/bookmarks/ephy-new-bookmark.c: (ephy_new_bookmark_finalize), (ephy_new_bookmark_add), (ephy_new_bookmark_init), (ephy_new_bookmark_set_title): * src/bookmarks/ephy-new-bookmark.h: * src/ephy-shell.c: (ephy_shell_init): * src/popup-commands.c: (popup_cmd_bookmark_link): Get rid of starthere: and default to google, as discussed with Seth. Add a way to import bookmarks from the editor. (you still cant specificy a file, that's sort of low priority for me, but we have a plan on how to do it). Allow to edit smart bookmarks in the user interface. The address field is used and when there is a %s, it's considered a smart url. (like mozilla does it).
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c112
1 files changed, 112 insertions, 0 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 616fa10b9..48dd0f7d3 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -35,6 +35,7 @@
#include "ephy-bookmarks-editor.h"
#include "ephy-bookmark-properties.h"
+#include "ephy-bookmarks-import.h"
#include "ephy-node-common.h"
#include "ephy-node-view.h"
#include "ephy-window.h"
@@ -101,6 +102,8 @@ static void cmd_delete (EggAction *action,
EphyBookmarksEditor *editor);
static void cmd_bookmark_properties (EggAction *action,
EphyBookmarksEditor *editor);
+static void cmd_bookmarks_import (EggAction *action,
+ EphyBookmarksEditor *editor);
static void cmd_add_topic (EggAction *action,
EphyBookmarksEditor *editor);
static void cmd_rename (EggAction *action,
@@ -171,6 +174,9 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
{ "Properties", N_("_Properties"), GTK_STOCK_PROPERTIES, "<alt>Return",
N_("View or modify the properties of the selected bookmark"),
G_CALLBACK (cmd_bookmark_properties), NULL },
+ { "Import", N_("_Import bookmarks..."), NULL, NULL,
+ N_("Import bookmarks from another browser or a bookmarks file"),
+ G_CALLBACK (cmd_bookmarks_import), NULL },
{ "Close", N_("_Close"), GTK_STOCK_CLOSE, "<control>W",
N_("Close the bookmarks window"),
G_CALLBACK (cmd_close), NULL },
@@ -441,6 +447,112 @@ show_properties_dialog (EphyBookmarksEditor *editor, EphyNode *node)
}
static void
+add_bookmarks_source_menu (GtkWidget *menu,
+ const char *desc,
+ const char *dir,
+ const char *filename)
+{
+ GSList *l;
+ char *path;
+
+ path = g_build_filename (g_get_home_dir (), dir, NULL);
+ l = ephy_file_find (path, filename, 4);
+ g_free (path);
+
+ if (l)
+ {
+ GtkWidget *item;
+
+ item = gtk_menu_item_new_with_label (desc);
+ gtk_widget_show (item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ g_object_set_data_full (G_OBJECT (item), "bookmarks_file",
+ g_strdup (l->data), g_free);
+ }
+
+ g_slist_foreach (l, (GFunc) g_free, NULL);
+ g_slist_free (l);
+}
+
+static void
+import_dialog_response_cb (GtkDialog *dialog, gint response,
+ GtkWidget *optionmenu)
+{
+ if (response == GTK_RESPONSE_OK)
+ {
+ char *filename;
+ GtkWidget *item, *menu;
+ EphyBookmarks *bookmarks;
+
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (optionmenu));
+ item = gtk_menu_get_active (GTK_MENU (menu));
+ filename = g_object_get_data (G_OBJECT (item), "bookmarks_file");
+
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ ephy_bookmarks_import (bookmarks, filename);
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+cmd_bookmarks_import (EggAction *action,
+ EphyBookmarksEditor *editor)
+{
+ GtkWidget *dialog;
+ GtkWidget *label;
+ GtkWidget *vbox;
+ GtkWidget *menu;
+ GtkWidget *option_menu;
+
+ 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,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_OK,
+ NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 12);
+
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (vbox);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox,
+ TRUE, TRUE, 0);
+
+ label = gtk_label_new (_("Choose the bookmarks source:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
+ gtk_widget_show (label);
+
+ menu = gtk_menu_new ();
+ gtk_widget_show (menu);
+
+ add_bookmarks_source_menu (menu, _("Mozilla bookmarks"),
+ ".mozilla", "bookmarks.html");
+ add_bookmarks_source_menu (menu, _("Galeon bookmarks"),
+ ".galeon", "bookmarks.xbel");
+ add_bookmarks_source_menu (menu, _("Konqueror bookmarks"),
+ ".kde/share/apps/konqueror",
+ "bookmarks.xml");
+
+ option_menu = gtk_option_menu_new ();
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
+ gtk_widget_show (option_menu);
+ gtk_box_pack_start (GTK_BOX (vbox), option_menu, TRUE, TRUE, 0);
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (import_dialog_response_cb),
+ option_menu);
+
+ gtk_widget_show (dialog);
+}
+
+static void
cmd_bookmark_properties (EggAction *action,
EphyBookmarksEditor *editor)
{