From d7aee7e7edfe1d76beba4246f50510479af955a7 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Tue, 12 Nov 2002 04:01:10 +0000 Subject: change signature to that of a weak ref notify function. (main): ::destroy 2002-11-11 Chris Toshok * gui/widgets/test-reflow.c (destroy_callback): change signature to that of a weak ref notify function. (main): ::destroy -> weak_ref. * gui/widgets/test-minicard.c (destroy_callback): change signature to that of a weak ref notify function. (main): ::destroy -> weak_ref. * gui/widgets/test-minicard-view.c (destroy_callback): change signature to that of a weak ref notify function. (main): ::destroy -> weak_ref. * gui/widgets/test-minicard-label.c (destroy_callback): change signature to that of a weak ref notify function. (main): ::destroy -> weak_ref. * gui/widgets/e-minicard-widget.c (e_minicard_widget_init): ifdef out the call to gnome_canvas_set_scroll_region. It doesn't seem necessary judging from the rest of the code, and it also crashes the addressbook if it's in. * gui/widgets/e-minicard-widget-test.c (destroy_callback): change signature to that of a weak ref notify function. (main): ::destroy -> weak_ref. * gui/widgets/e-minicard-control.c (free_struct): change signature to that of a weak ref notify function. (e_minicard_control_factory): ::destroy -> weak_ref. * gui/widgets/e-addressbook-view.c (e_addressbook_view_init): ::destroy -> weak_ref. (e_addressbook_view_print): same. (free_closure): change signature to that of a weak ref notify function. (e_contact_print_destroy): same. (invisible_destroyed): same. * gui/widgets/e-addressbook-util.c (e_addressbook_prompt_save_dialog): convert from GnomeDialog to GtkDialog. (e_addressbook_show_multiple_cards): same. * gui/contact-list-editor/e-contact-list-editor.c (prompt_to_save_changes): change response ids to use GTK_RESPONSE_. * gui/component/select-names/e-select-names-manager.c (clear_widget): new function. (e_select_names_manager_activate_dialog): ::destroy -> weak_ref. * gui/component/select-names/e-select-names.c (clear_widget): change signature to that of a weak ref notify function. (e_select_names_init): ::destroy -> weak_ref. * gui/component/e-address-popup.c (mini_wizard_destroy_cb): change signature to that of a weak ref notify function. (mini_wizard_new): ::destroy -> weak_ref. * gui/component/addressbook-config.c (addressbook_source_dialog_destroy): change signature to that of a weak ref notify function. (ldap_config_control_destroy_callback): same. (addressbook_add_server_druid): ::destroy -> weak_ref. (addressbook_edit_server_dialog): same. (ldap_config_control_new): same. * gui/component/addressbook.c (destroy_callback): change signature to that of a a weak ref notify function. (addressbook_factory_new_control): ::destroy -> weak_ref. * gui/merging/e-card-merging.c (response): rename clicked to this, and destroy the dialog here. (match_query_callback): ::clicked -> ::response * gui/merging/e-card-merging-book-commit-duplicate-detected.glade: convert. * gui/merging/e-card-duplicate-detected.glade: same. svn path=/trunk/; revision=18719 --- addressbook/gui/widgets/e-addressbook-util.c | 91 ++++++++++------------------ 1 file changed, 32 insertions(+), 59 deletions(-) (limited to 'addressbook/gui/widgets/e-addressbook-util.c') diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c index 93727b7e1b..76453d5616 100644 --- a/addressbook/gui/widgets/e-addressbook-util.c +++ b/addressbook/gui/widgets/e-addressbook-util.c @@ -60,19 +60,26 @@ gint e_addressbook_prompt_save_dialog (GtkWindow *parent) { GtkWidget *dialog; + gint response; - dialog = gnome_message_box_new (_("Do you want to save changes?"), - GNOME_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - GNOME_STOCK_BUTTON_CANCEL, - NULL); + dialog = gtk_message_dialog_new (parent, + (GtkDialogFlags)0, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, + _("Do you want to save changes?")); + gtk_dialog_add_buttons (GTK_DIALOG (dialog), + GTK_STOCK_YES, GTK_RESPONSE_YES, + GTK_STOCK_NO, GTK_RESPONSE_NO, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - gnome_dialog_grab_focus (GNOME_DIALOG (dialog), 0); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), parent); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); - return gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + + return response; } static void @@ -154,12 +161,6 @@ e_addressbook_show_contact_list_editor (EBook *book, ECard *card, return ce; } -typedef struct { - EBook *book; - GList *list; - gboolean editable; -} BookAndList; - static void view_cards (EBook *book, GList *list, gboolean editable) { @@ -172,24 +173,6 @@ view_cards (EBook *book, GList *list, gboolean editable) } } -static void -view_question_clicked (GtkObject *object, int button, BookAndList *bnl) -{ - GnomeDialog *dialog = GNOME_DIALOG (object); - switch (button) { - case 0: - view_cards (bnl->book, bnl->list, bnl->editable); - break; - } - gnome_dialog_close(dialog); -} - -static void -view_question_destroyed (GtkObject *object, GList *list) -{ - gtk_main_quit(); -} - void e_addressbook_show_multiple_cards (EBook *book, GList *list, @@ -198,32 +181,22 @@ e_addressbook_show_multiple_cards (EBook *book, if (list) { int length = g_list_length (list); if (length > 5) { - char *string; GtkWidget *dialog; - BookAndList bnl; - - bnl.book = book; - bnl.list = list; - bnl.editable = editable; - - dialog = gnome_dialog_new (_("Display Cards?"), - _("Display Cards"), - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - string = g_strdup_printf (_("Opening %d cards will open %d new windows as well.\n" - "Do you really want to display all of these cards?"), length, length); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), gtk_label_new (string), FALSE, FALSE, 0); - g_free (string); - - g_signal_connect (dialog, "destroy", - G_CALLBACK (view_question_destroyed), &bnl); - g_signal_connect (dialog, "clicked", - G_CALLBACK (view_question_clicked), &bnl); - - gtk_widget_show_all (dialog); - - gtk_main(); + gint response; + + dialog = gtk_message_dialog_new (NULL, + 0, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + _("Opening %d cards will open %d new windows as well.\n" + "Do you really want to display all of these cards?"), + length, + length); + + response = gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + if (response == GTK_RESPONSE_YES) + view_cards (book, list, editable); } else { view_cards (book, list, editable); } -- cgit v1.2.3