diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/ephy-new-bookmark.c | 23 | ||||
-rw-r--r-- | src/bookmarks/ephy-new-bookmark.h | 6 | ||||
-rw-r--r-- | src/ephy-history-window.c | 6 | ||||
-rw-r--r-- | src/ephy-shell.c | 72 | ||||
-rw-r--r-- | src/popup-commands.c | 6 | ||||
-rw-r--r-- | src/window-commands.c | 6 |
6 files changed, 67 insertions, 52 deletions
diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c index e3a50f3a5..6394a308f 100644 --- a/src/bookmarks/ephy-new-bookmark.c +++ b/src/bookmarks/ephy-new-bookmark.c @@ -177,9 +177,9 @@ ephy_new_bookmark_add (EphyNewBookmark *new_bookmark) } static void -ephy_new_bookmark_response_cb (GtkDialog *dialog, - int response_id, - EphyNewBookmark *new_bookmark) +response_cb (EphyNewBookmark *new_bookmark, + int response_id, + gpointer user_data) { switch (response_id) { @@ -270,7 +270,7 @@ ephy_new_bookmark_construct (EphyNewBookmark *editor) gtk_container_set_border_width (GTK_CONTAINER (editor), 6); g_signal_connect (G_OBJECT (editor), "response", - G_CALLBACK (ephy_new_bookmark_response_cb), + G_CALLBACK (response_cb), editor); gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (editor)->vbox), 12); @@ -397,3 +397,18 @@ ephy_new_bookmark_get_id (EphyNewBookmark *bookmark) return bookmark->priv->id; } +/* Convenience function for callers */ + +void +ephy_new_bookmark_response_cb (EphyNewBookmark *bookmark, + int response_id, + gpointer user_data) +{ + switch (response_id) + { + case GTK_RESPONSE_CANCEL: + case GTK_RESPONSE_OK: + gtk_widget_destroy (GTK_WIDGET (bookmark)); + break; + } +} diff --git a/src/bookmarks/ephy-new-bookmark.h b/src/bookmarks/ephy-new-bookmark.h index 7e351dc55..39c1f2f4a 100644 --- a/src/bookmarks/ephy-new-bookmark.h +++ b/src/bookmarks/ephy-new-bookmark.h @@ -65,6 +65,12 @@ void ephy_new_bookmark_set_smarturl (EphyNewBookmark *bookmark, gulong ephy_new_bookmark_get_id (EphyNewBookmark *bookmark); +/* Convenience function for callers */ + +void ephy_new_bookmark_response_cb (EphyNewBookmark *bookmark, + int response_id, + gpointer user_data); + G_END_DECLS diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index dcbaf2e89..cb6fc9a27 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -378,8 +378,10 @@ cmd_bookmark_page (EggAction *action, (bookmarks, window, location); ephy_new_bookmark_set_title (EPHY_NEW_BOOKMARK (new_bookmark), title); - gtk_dialog_run (GTK_DIALOG (new_bookmark)); - gtk_widget_destroy (new_bookmark); + g_signal_connect (G_OBJECT (new_bookmark), "response", + G_CALLBACK (ephy_new_bookmark_response_cb), + NULL); + gtk_widget_show (new_bookmark); } g_list_free (selection); } 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 diff --git a/src/popup-commands.c b/src/popup-commands.c index 2e2bb9080..a32a33618 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -162,8 +162,10 @@ popup_cmd_bookmark_link (EggAction *action, (EPHY_NEW_BOOKMARK (new_bookmark), title); ephy_new_bookmark_set_smarturl (EPHY_NEW_BOOKMARK (new_bookmark), rel); - gtk_dialog_run (GTK_DIALOG (new_bookmark)); - gtk_widget_destroy (new_bookmark); + g_signal_connect (G_OBJECT (new_bookmark), "response", + G_CALLBACK (ephy_new_bookmark_response_cb), + NULL); + gtk_widget_show (new_bookmark); } void diff --git a/src/window-commands.c b/src/window-commands.c index 8e128e775..032ce0775 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -282,8 +282,10 @@ window_cmd_file_bookmark_page (EggAction *action, (EPHY_NEW_BOOKMARK (new_bookmark), title); ephy_new_bookmark_set_icon (EPHY_NEW_BOOKMARK (new_bookmark), icon); - gtk_dialog_run (GTK_DIALOG (new_bookmark)); - gtk_widget_destroy (new_bookmark); + g_signal_connect (G_OBJECT (new_bookmark), "response", + G_CALLBACK (ephy_new_bookmark_response_cb), + NULL); + gtk_widget_show (new_bookmark); } void |