diff options
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r-- | src/ephy-shell.c | 72 |
1 files changed, 30 insertions, 42 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 2f21091ac..1975d0f7c 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -141,6 +141,9 @@ ephy_shell_command_cb (EphyEmbedShell *shell, { EphyBookmarks *bookmarks; GtkWidget *dialog; + const gchar *message = NULL; + GtkMessageType message_type = GTK_MESSAGE_INFO; + EphyWindow *window; bookmarks = ephy_shell_get_bookmarks (EPHY_SHELL (shell)); @@ -148,72 +151,42 @@ ephy_shell_command_cb (EphyEmbedShell *shell, { if (ephy_bookmarks_import_mozilla (bookmarks, param)) { - dialog = gtk_message_dialog_new - (NULL, - GTK_DIALOG_MODAL, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - _("Mozilla bookmarks imported successfully.")); + message_type = GTK_MESSAGE_INFO; + message = _("Mozilla bookmarks imported successfully."); } else { - dialog = gtk_message_dialog_new - (NULL, - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Importing Mozilla bookmarks failed.")); + message_type = GTK_MESSAGE_ERROR; + message = _("Importing Mozilla bookmarks failed."); } - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); } else if (strcmp (command, "import-galeon-bookmarks") == 0) { if (ephy_bookmarks_import_xbel (bookmarks, param, _("Galeon"))) { - dialog = gtk_message_dialog_new - (NULL, - GTK_DIALOG_MODAL, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - _("Galeon bookmarks imported successfully.")); + message_type = GTK_MESSAGE_INFO; + message = _("Galeon bookmarks imported successfully."); } else { - dialog = gtk_message_dialog_new - (NULL, - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Importing Galeon bookmarks failed.")); + message_type = GTK_MESSAGE_ERROR; + message = _("Importing Galeon bookmarks failed."); } - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); } else if (strcmp (command, "import-konqueror-bookmarks") == 0) { if (ephy_bookmarks_import_xbel (bookmarks, param, _("Konqueror"))) { - dialog = gtk_message_dialog_new - (NULL, - GTK_DIALOG_MODAL, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - _("Konqueror bookmarks imported successfully.")); + message_type = GTK_MESSAGE_INFO; + message = _("Konqueror bookmarks imported successfully."); } else { - dialog = gtk_message_dialog_new - (NULL, - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Importing Konqueror bookmarks failed.")); + message_type = GTK_MESSAGE_ERROR; + message = _("Importing Konqueror bookmarks failed."); } - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); } else if (strcmp (command, "configure-network") == 0) { @@ -221,6 +194,21 @@ ephy_shell_command_cb (EphyEmbedShell *shell, NULL, FALSE); } + + if (message != NULL) + { + window = ephy_shell_get_active_window (EPHY_SHELL (shell)); + dialog = gtk_message_dialog_new (GTK_WINDOW (window), + GTK_DIALOG_DESTROY_WITH_PARENT, + message_type, + GTK_BUTTONS_OK, + message); + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + g_signal_connect_swapped (G_OBJECT (dialog), "response", + G_CALLBACK (gtk_widget_destroy), + G_OBJECT (dialog)); + gtk_widget_show (dialog); + } } static void |