diff options
author | David Bordoley <bordoley@msu.edu> | 2003-04-26 00:31:05 +0800 |
---|---|---|
committer | Dave Bordoley <Bordoley@src.gnome.org> | 2003-04-26 00:31:05 +0800 |
commit | e22d66b927f60c384f96c47aa5d4519ceb4f9c47 (patch) | |
tree | 0390a6dcd3e6e35385c310f2bf9058c40894f113 /src/ephy-shell.c | |
parent | 98f768009939e3b06f2777ccb4307245f0637f36 (diff) | |
download | gsoc2013-epiphany-e22d66b927f60c384f96c47aa5d4519ceb4f9c47.tar gsoc2013-epiphany-e22d66b927f60c384f96c47aa5d4519ceb4f9c47.tar.gz gsoc2013-epiphany-e22d66b927f60c384f96c47aa5d4519ceb4f9c47.tar.bz2 gsoc2013-epiphany-e22d66b927f60c384f96c47aa5d4519ceb4f9c47.tar.lz gsoc2013-epiphany-e22d66b927f60c384f96c47aa5d4519ceb4f9c47.tar.xz gsoc2013-epiphany-e22d66b927f60c384f96c47aa5d4519ceb4f9c47.tar.zst gsoc2013-epiphany-e22d66b927f60c384f96c47aa5d4519ceb4f9c47.zip |
Hookup to the response signal instead of using gtk_dialog_run. Prevents us
2003-04-25 David Bordoley <bordoley@msu.edu>
* src/ephy-history-window.c: (cmd_bookmark_page):
* src/popup-commands.c: (popup_cmd_bookmark_link):
* src/window-commands.c: (window_cmd_file_bookmark_page):
Hookup to the response signal instead of using gtk_dialog_run.
Prevents us from going modal.
* src/bookmarks/ephy-new-bookmark.c: (response_cb),
(ephy_new_bookmark_response_cb):
* src/bookmarks/ephy-new-bookmark.h
Add a convenience callback function, that callers can
use to destroy the dialog after a response.
* src/ephy-shell.c: (ephy_shell_command_cb):
Use a callback to the gtk_widget_destroy on the "response"
signal instead of using gtk_dialog_run. eg. don't go modal.
Some code cleanups too.
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 |