diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-12-17 22:29:11 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-12-17 22:30:50 +0800 |
commit | d17065a40d223194714e8c86b82e7adbabadb484 (patch) | |
tree | d9b39264814e28427b9861d42b4fb37eb9e71581 /addressbook | |
parent | 14d333f14e71885e770683010fa0ee48f77a63a0 (diff) | |
download | gsoc2013-evolution-d17065a40d223194714e8c86b82e7adbabadb484.tar gsoc2013-evolution-d17065a40d223194714e8c86b82e7adbabadb484.tar.gz gsoc2013-evolution-d17065a40d223194714e8c86b82e7adbabadb484.tar.bz2 gsoc2013-evolution-d17065a40d223194714e8c86b82e7adbabadb484.tar.lz gsoc2013-evolution-d17065a40d223194714e8c86b82e7adbabadb484.tar.xz gsoc2013-evolution-d17065a40d223194714e8c86b82e7adbabadb484.tar.zst gsoc2013-evolution-d17065a40d223194714e8c86b82e7adbabadb484.zip |
Fix compiler warnings.
gtk_dialog_new_with_buttons() requires some buttons, otherwise use
gtk_dialog_new() and set title/transient-for/etc properties manually.
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/gui/merging/eab-contact-merging.c | 43 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 22 |
2 files changed, 39 insertions, 26 deletions
diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 1e70b97d77..4efb4b8529 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -307,7 +307,7 @@ mergeit (EContactMergingLookup *lookup) { GtkWidget *scrolled_window, *label, *hbox, *dropdown; GtkWidget *content_area; - GtkDialog *dialog; + GtkWidget *dialog; GtkTable *table; EContactField field; gchar *str = NULL, *string = NULL, *string1 = NULL; @@ -316,25 +316,27 @@ mergeit (EContactMergingLookup *lookup) gint row = -1; gint value = 0, result; - dialog = (GtkDialog *)(gtk_dialog_new_with_buttons (_("Merge Contact"), NULL, 0, NULL)); + dialog = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (dialog), _("Merge Contact")); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - content_area = gtk_dialog_get_content_area (dialog); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_policy ( + GTK_SCROLLED_WINDOW (scrolled_window), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); table = (GtkTable *) gtk_table_new (20, 2, FALSE); gtk_container_set_border_width ((GtkContainer *) table, 12); gtk_table_set_row_spacings (table, 6); gtk_table_set_col_spacings (table, 2); - gtk_dialog_add_buttons ((GtkDialog *) dialog, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - _("_Merge"), GTK_RESPONSE_OK, - NULL); + gtk_dialog_add_buttons ( + GTK_DIALOG (dialog), + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + _("_Merge"), GTK_RESPONSE_OK, + NULL); email_attr_list = e_contact_get_attributes (lookup->match, E_CONTACT_EMAIL); num_of_email = g_list_length (email_attr_list); @@ -464,21 +466,24 @@ mergeit (EContactMergingLookup *lookup) gtk_widget_show (scrolled_window); g_signal_connect (dialog, "map-event", G_CALLBACK (dialog_map), table); gtk_widget_show_all ((GtkWidget *) table); - result = gtk_dialog_run (dialog); + result = gtk_dialog_run (GTK_DIALOG (dialog)); switch (result) { case GTK_RESPONSE_OK: - g_object_unref (lookup->contact); - lookup->contact = g_object_ref (lookup->match); - e_book_client_remove_contact (lookup->book_client, lookup->match, NULL, remove_contact_ready_cb, lookup); - value = 1; - break; + g_object_unref (lookup->contact); + lookup->contact = g_object_ref (lookup->match); + e_book_client_remove_contact ( + lookup->book_client, + lookup->match, NULL, + remove_contact_ready_cb, lookup); + value = 1; + break; case GTK_RESPONSE_CANCEL: default: - value = 0; - break; + value = 0; + break; } - gtk_widget_destroy (GTK_WIDGET (dialog)); + gtk_widget_destroy (dialog); g_list_free (email_attr_list); return value; } diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index befc8836ca..e3b8537caa 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -305,23 +305,31 @@ eab_select_source (ESource *except_source, if (!e_book_client_get_sources (&source_list, NULL)) return NULL; - dialog = gtk_dialog_new_with_buttons (_("Select Address Book"), parent, - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - NULL); + dialog = gtk_dialog_new_with_buttons ( + _("Select Address Book"), parent, + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, + NULL); gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 300); - gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT); - gtk_widget_set_sensitive (ok_button, FALSE); + gtk_dialog_set_response_sensitive ( + GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, FALSE); /* label = gtk_label_new (message); */ selector = e_source_selector_new (source_list); e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE); + + ok_button = gtk_dialog_get_widget_for_response ( + GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); + if (except_source) g_object_set_data ( G_OBJECT (ok_button), "except-source", - e_source_list_peek_source_by_uid (source_list, e_source_peek_uid (except_source))); + e_source_list_peek_source_by_uid ( + source_list, e_source_peek_uid (except_source))); + g_signal_connect ( selector, "primary_selection_changed", G_CALLBACK (source_selection_changed_cb), ok_button); |