diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-09-28 17:50:20 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-09-28 17:50:20 +0800 |
commit | 0bd5c2029fe4b3c4d4268071afce36db2a77a080 (patch) | |
tree | 3e2616d45f5cf8346f2a418d3efd5b7ec687829d | |
parent | 6d4057eecb2f6cb916984d3c81403061b010214d (diff) | |
download | gsoc2013-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
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 7 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 34 |
3 files changed, 44 insertions, 9 deletions
@@ -1,3 +1,15 @@ +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 + 2003-09-27 Xan Lopez <xan@masilla.org> * configure.in: diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 8bbfc43c1..7e90f4065 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -1013,12 +1013,15 @@ impl_show_file_picker (EphyEmbedSingle *shell, FileFormat *file_formats, int *ret_file_format) { - gchar *expanded_directory; + char *expanded_directory = NULL; gresult result; GFilePicker *filePicker = new GFilePicker (file_formats); - expanded_directory = gnome_vfs_expand_initial_tilde (directory); + if (directory != NULL) + { + expanded_directory = gnome_vfs_expand_initial_tilde (directory); + } /* make sure the directory exists, and use the home directory * otherwise */ 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); } |