diff options
author | Christian Perhristian Persch <chpe@cvs.gnome.org> | 2005-01-24 22:45:53 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-01-24 22:45:53 +0800 |
commit | fb90b369416a2b1bfb970d42df2a818772f3f426 (patch) | |
tree | 46244926eb67d740f600b5b12ab434fe6f60c801 /src/bookmarks/ephy-bookmarks-editor.c | |
parent | 42cfc33e3ce61e4cb52a0472dadea27dd4336734 (diff) | |
download | gsoc2013-epiphany-fb90b369416a2b1bfb970d42df2a818772f3f426.tar gsoc2013-epiphany-fb90b369416a2b1bfb970d42df2a818772f3f426.tar.gz gsoc2013-epiphany-fb90b369416a2b1bfb970d42df2a818772f3f426.tar.bz2 gsoc2013-epiphany-fb90b369416a2b1bfb970d42df2a818772f3f426.tar.lz gsoc2013-epiphany-fb90b369416a2b1bfb970d42df2a818772f3f426.tar.xz gsoc2013-epiphany-fb90b369416a2b1bfb970d42df2a818772f3f426.tar.zst gsoc2013-epiphany-fb90b369416a2b1bfb970d42df2a818772f3f426.zip |
Inform the user of failed bookmarks import.
2005-01-24 Christian Perhristian Persch <chpe@cvs.gnome.org>
* src/bookmarks/ephy-bookmarks-editor.c: (import_bookmarks):
Inform the user of failed bookmarks import.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 4bc02e83d..d503d079a 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -458,7 +458,7 @@ delete_topic_dialog_construct (GtkWindow *parent, const char *topic) { GtkWidget *dialog; - + dialog = gtk_message_dialog_new (GTK_WINDOW (parent), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, @@ -614,24 +614,59 @@ add_bookmarks_source (const char *file, } static void -import_from_file_response_cb (GtkDialog *dialog, gint response, +import_bookmarks (EphyBookmarksEditor *editor, + const char *filename) +{ + if (ephy_bookmarks_import (editor->priv->bookmarks, filename) == FALSE) + { + GtkWidget *dialog; + char *basename; + + basename = g_filename_display_basename (filename); + dialog = gtk_message_dialog_new (GTK_WINDOW (editor), + GTK_DIALOG_MODAL, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + _("Import failed")); + + gtk_window_set_title (GTK_WINDOW (dialog), _("Import Failed")); + gtk_message_dialog_format_secondary_text + (GTK_MESSAGE_DIALOG (dialog), + _("The bookmarks from \"%s\" were not imported."), + basename); + + gtk_window_group_add_window (GTK_WINDOW (editor)->group, + GTK_WINDOW (dialog)); + + gtk_dialog_run (GTK_DIALOG (dialog)); + + g_free (basename); + gtk_widget_destroy (dialog); + } +} + +static void +import_from_file_response_cb (GtkWidget *dialog, + int response, EphyBookmarksEditor *editor) { char *filename; + gtk_widget_hide (dialog); + if (response == GTK_RESPONSE_ACCEPT) { filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); if (filename != NULL) { - ephy_bookmarks_import (editor->priv->bookmarks, filename); + import_bookmarks (editor, filename); g_free (filename); } } - gtk_widget_destroy (GTK_WIDGET (dialog)); + gtk_widget_destroy (dialog); } static void @@ -690,7 +725,7 @@ import_dialog_response_cb (GtkDialog *dialog, } else { - ephy_bookmarks_import (editor->priv->bookmarks, filename); + import_bookmarks (editor, filename); } g_value_unset (&value); |