From e22d66b927f60c384f96c47aa5d4519ceb4f9c47 Mon Sep 17 00:00:00 2001 From: David Bordoley Date: Fri, 25 Apr 2003 16:31:05 +0000 Subject: Hookup to the response signal instead of using gtk_dialog_run. Prevents us 2003-04-25 David Bordoley * 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. --- src/bookmarks/ephy-new-bookmark.c | 23 +++++++++++++++++++---- src/bookmarks/ephy-new-bookmark.h | 6 ++++++ 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'src/bookmarks') 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 -- cgit v1.2.3