aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks-editor.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-09-28 17:50:20 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-09-28 17:50:20 +0800
commit0bd5c2029fe4b3c4d4268071afce36db2a77a080 (patch)
tree3e2616d45f5cf8346f2a418d3efd5b7ec687829d /src/bookmarks/ephy-bookmarks-editor.c
parent6d4057eecb2f6cb916984d3c81403061b010214d (diff)
downloadgsoc2013-epiphany-0bd5c2029fe4b3c4d4268071afce36db2a77a080.tar
gsoc2013-epiphany-0bd5c2029fe4b3c4d4268071afce36db2a77a080.tar.gz
gsoc2013-epiphany-0bd5c2029fe4b3c4d4268071afce36db2a77a080.tar.bz2
gsoc2013-epiphany-0bd5c2029fe4b3c4d4268071afce36db2a77a080.tar.lz
gsoc2013-epiphany-0bd5c2029fe4b3c4d4268071afce36db2a77a080.tar.xz
gsoc2013-epiphany-0bd5c2029fe4b3c4d4268071afce36db2a77a080.tar.zst
gsoc2013-epiphany-0bd5c2029fe4b3c4d4268071afce36db2a77a080.zip
The file picker dir can be NULL, check before trying to expand tilde.
2003-09-28 Marco Pesenti Gritti <marco@gnome.org> * embed/mozilla/mozilla-embed-single.cpp: The file picker dir can be NULL, check before trying to expand tilde. * src/bookmarks/ephy-bookmarks-editor.c: (import_dialog_response_cb), (cmd_bookmarks_import): Implement import from a file
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 27b8cca71..d1ce672a4 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -499,20 +499,35 @@ add_bookmarks_source_menu (GtkWidget *menu,
static void
import_dialog_response_cb (GtkDialog *dialog, gint response,
- GtkWidget *optionmenu)
+ EphyBookmarksEditor *editor)
{
if (response == GTK_RESPONSE_OK)
{
char *filename;
- GtkWidget *item, *menu;
- EphyBookmarks *bookmarks;
+ GtkWidget *item, *menu, *optionmenu;
+ optionmenu = g_object_get_data (G_OBJECT (dialog), "option_menu");
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);
+ if (filename == NULL)
+ {
+ const char *title;
+ EphyEmbedSingle *single;
+
+ title = _("Import bookmarks from file");
+ single = ephy_embed_shell_get_embed_single
+ (EPHY_EMBED_SHELL (ephy_shell));
+ ephy_embed_single_show_file_picker
+ (single, GTK_WIDGET (editor), title, NULL,
+ NULL, modeOpen, &filename, NULL, NULL);
+ }
+
+ if (filename != NULL)
+ {
+ ephy_bookmarks_import (editor->priv->bookmarks, filename);
+ }
}
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -525,7 +540,7 @@ cmd_bookmarks_import (GtkAction *action,
GtkWidget *dialog;
GtkWidget *label;
GtkWidget *vbox;
- GtkWidget *menu;
+ GtkWidget *menu, *item;
GtkWidget *option_menu;
dialog = gtk_dialog_new_with_buttons (_("Import Bookmarks"),
@@ -566,14 +581,19 @@ cmd_bookmarks_import (GtkAction *action,
add_bookmarks_source_menu (menu, _("Konqueror bookmarks"),
KDE_BOOKMARKS_DIR, "bookmarks.xml", 0);
+ item = gtk_menu_item_new_with_mnemonic (_("Import from a file"));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show (item);
+
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_object_set_data (G_OBJECT (dialog), "option_menu", option_menu);
g_signal_connect (dialog, "response",
G_CALLBACK (import_dialog_response_cb),
- option_menu);
+ editor);
gtk_widget_show (dialog);
}