From 753c60fc67a0a56a5f119c14ffa54ea9af95c208 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 9 Nov 2010 08:48:33 -0500 Subject: Drop backward-compatibility cruft. --- addressbook/gui/merging/eab-contact-merging.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index b97fb8e1f3..dd99a12dce 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -34,9 +34,6 @@ #include "e-util/e-util-private.h" #include -/* backend-compatibility cruft */ -#include "e-util/gtk-compat.h" - typedef struct dropdown_data dropdown_data; typedef enum { E_CONTACT_MERGING_ADD, -- cgit v1.2.3 From ba05584de52f5f953eee7e458ebf4d45da5a3319 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 13 Jan 2011 22:55:52 -0500 Subject: Dialogs no longer have separators. --- addressbook/gui/merging/eab-contact-merging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index dd99a12dce..1aababe57a 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -221,7 +221,7 @@ mergeit (EContactMergingLookup *lookup) gint row = -1; gint value = 0, result; - dialog = (GtkDialog *)(gtk_dialog_new_with_buttons (_("Merge Contact"), NULL, GTK_DIALOG_NO_SEPARATOR, NULL)); + dialog = (GtkDialog *)(gtk_dialog_new_with_buttons (_("Merge Contact"), NULL, 0, NULL)); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); content_area = gtk_dialog_get_content_area (dialog); -- cgit v1.2.3 From 8a186c3588d3598857c36e2122fa68d01eba30fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 8 May 2011 13:24:42 -0400 Subject: Coding style cleanups. --- addressbook/gui/merging/eab-contact-merging.c | 44 +++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 1aababe57a..25a4a47634 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -247,8 +247,8 @@ mergeit (EContactMergingLookup *lookup) /*we match all the string fields of the already existing contact and the new contact.*/ for (field = E_CONTACT_FULL_NAME; field != (E_CONTACT_LAST_SIMPLE_STRING -1); field++) { dropdown_data *data = NULL; - string = (gchar *)e_contact_get_const (lookup->contact, field); - string1 = (gchar *)e_contact_get_const (lookup->match, field); + string = (gchar *) e_contact_get_const (lookup->contact, field); + string1 = (gchar *) e_contact_get_const (lookup->match, field); /*the field must exist in the new as well as the duplicate contact*/ if (string && *string) { @@ -258,7 +258,7 @@ mergeit (EContactMergingLookup *lookup) || field == E_CONTACT_EMAIL_3 || field == E_CONTACT_EMAIL_4) && (num_of_email < 4)) { EContactField use_field = field; row++; - str = (gchar *)e_contact_get_const (lookup->contact, use_field); + str = (gchar *) e_contact_get_const (lookup->contact, use_field); switch (num_of_email) { case 0: @@ -294,8 +294,8 @@ mergeit (EContactMergingLookup *lookup) } label = gtk_label_new (_("Email")); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*)label, FALSE, FALSE, 0); - gtk_table_attach_defaults (table, (GtkWidget *)hbox, 0, 1, row, row + 1); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) label, FALSE, FALSE, 0); + gtk_table_attach_defaults (table, (GtkWidget *) hbox, 0, 1, row, row + 1); dropdown = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dropdown), string); @@ -311,22 +311,22 @@ mergeit (EContactMergingLookup *lookup) g_signal_connect (dropdown, "changed", G_CALLBACK(dropdown_changed), data); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*)dropdown, FALSE, FALSE, 0); - gtk_table_attach_defaults (table, (GtkWidget *)hbox, 1, 2, row, row + 1); - gtk_widget_show ((GtkWidget *)dropdown); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) dropdown, FALSE, FALSE, 0); + gtk_table_attach_defaults (table, (GtkWidget *) hbox, 1, 2, row, row + 1); + gtk_widget_show ((GtkWidget *) dropdown); continue; } if (((field == E_CONTACT_FULL_NAME) && (!g_ascii_strcasecmp (string, string1)))) { row++; label = gtk_label_new (e_contact_pretty_name (field)); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*)label, FALSE, FALSE, 0); - gtk_table_attach_defaults (table, (GtkWidget *)hbox, 0, 1, row, row + 1); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) label, FALSE, FALSE, 0); + gtk_table_attach_defaults (table, (GtkWidget *) hbox, 0, 1, row, row + 1); label = gtk_label_new (string); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*)label, FALSE, FALSE, 0); - gtk_table_attach_defaults (table, (GtkWidget*)hbox, 1, 2, row, row + 1); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) label, FALSE, FALSE, 0); + gtk_table_attach_defaults (table, (GtkWidget*) hbox, 1, 2, row, row + 1); continue; } @@ -335,8 +335,8 @@ mergeit (EContactMergingLookup *lookup) row++; label = gtk_label_new (e_contact_pretty_name (field)); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*)label, FALSE, FALSE, 0); - gtk_table_attach_defaults (table, (GtkWidget *)hbox, 0, 1, row, row + 1); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) label, FALSE, FALSE, 0); + gtk_table_attach_defaults (table, (GtkWidget *) hbox, 0, 1, row, row + 1); data = g_new0 (dropdown_data, 1); dropdown = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dropdown), string); @@ -352,13 +352,13 @@ mergeit (EContactMergingLookup *lookup) data->match = lookup->match; if (field == E_CONTACT_NICKNAME || field == E_CONTACT_GIVEN_NAME) - gtk_widget_set_sensitive ((GtkWidget *)dropdown, FALSE); + gtk_widget_set_sensitive ((GtkWidget *) dropdown, FALSE); g_signal_connect (dropdown, "changed", G_CALLBACK(dropdown_changed), data); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*)dropdown, FALSE, FALSE, 0); - gtk_table_attach_defaults (table, (GtkWidget *)hbox, 1, 2, row, row + 1); - gtk_widget_show_all ((GtkWidget *)dropdown); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) dropdown, FALSE, FALSE, 0); + gtk_table_attach_defaults (table, (GtkWidget *) hbox, 1, 2, row, row + 1); + gtk_widget_show_all ((GtkWidget *) dropdown); } } } @@ -368,7 +368,7 @@ mergeit (EContactMergingLookup *lookup) gtk_box_pack_start (GTK_BOX (content_area), GTK_WIDGET (scrolled_window), TRUE, TRUE, 0); gtk_widget_show (scrolled_window); g_signal_connect (dialog, "map-event", G_CALLBACK (dialog_map), table); - gtk_widget_show_all ((GtkWidget *)table); + gtk_widget_show_all ((GtkWidget *) table); result = gtk_dialog_run (dialog); switch (result) @@ -403,7 +403,7 @@ check_if_same (EContact *contact, EContact *match) if ((field == E_CONTACT_EMAIL_1 || field == E_CONTACT_EMAIL_2 || field == E_CONTACT_EMAIL_3 || field == E_CONTACT_EMAIL_4) && (num_of_email<4)) { - str = (gchar *)e_contact_get_const (contact, field); + str = (gchar *) e_contact_get_const (contact, field); switch (num_of_email) { case 0: @@ -423,8 +423,8 @@ check_if_same (EContact *contact, EContact *match) } } else { - string = (gchar *)e_contact_get_const (contact, field); - string1 = (gchar *)e_contact_get_const (match, field); + string = (gchar *) e_contact_get_const (contact, field); + string1 = (gchar *) e_contact_get_const (match, field); if ((string && *string) && (string1 && *string1) && (g_ascii_strcasecmp (string1,string))) return FALSE; /*if the field entry exist in either of the contacts,we'll have to give the choice and thus merge button should be sensitive*/ -- cgit v1.2.3 From 756c8abcb840b8da588031f4a0d7e1fc979fab70 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 27 May 2011 15:23:07 +0200 Subject: Bug #646109 - Fix use of include to make sure translations work --- addressbook/gui/merging/eab-contact-merging.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 25a4a47634..49e9968074 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -23,7 +23,9 @@ * */ +#ifdef HAVE_CONFIG_H #include +#endif #include "eab-contact-merging.h" #include "eab-contact-compare.h" -- cgit v1.2.3 From 38790d8478e906a5c59d0c4a5216f297f305bfeb Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 14 Jun 2011 08:54:20 +0200 Subject: Do not use deprecated EBook/ECal API --- addressbook/gui/merging/eab-contact-merging.c | 141 ++++++++++++++++++-------- 1 file changed, 100 insertions(+), 41 deletions(-) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 49e9968074..99bb2d39fb 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -45,15 +45,15 @@ typedef enum { typedef struct { EContactMergingOpType op; - EBook *book; + EBookClient *book_client; /*contact is the new contact which the user has tried to add to the addressbook*/ EContact *contact; /*match is the duplicate contact already existing in the addressbook*/ EContact *match; GList *avoid; - EBookIdAsyncCallback id_cb; - EBookAsyncCallback cb; - EBookContactAsyncCallback c_cb; + EABMergingAsyncCallback cb; + EABMergingIdAsyncCallback id_cb; + EABMergingContactAsyncCallback c_cb; gpointer closure; } EContactMergingLookup; @@ -73,7 +73,7 @@ add_lookup (EContactMergingLookup *lookup) { if (running_merge_requests < SIMULTANEOUS_MERGING_REQUESTS) { running_merge_requests++; - eab_contact_locate_match_full (lookup->book, lookup->contact, lookup->avoid, match_query_callback, lookup); + eab_contact_locate_match_full (lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); } else { merging_queue = g_list_append (merging_queue, lookup); @@ -96,14 +96,14 @@ finished_lookup (void) merging_queue = g_list_remove_link (merging_queue, merging_queue); running_merge_requests++; - eab_contact_locate_match_full (lookup->book, lookup->contact, lookup->avoid, match_query_callback, lookup); + eab_contact_locate_match_full (lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); } } static void free_lookup (EContactMergingLookup *lookup) { - g_object_unref (lookup->book); + g_object_unref (lookup->book_client); g_object_unref (lookup->contact); g_list_free (lookup->avoid); if (lookup->match) @@ -112,12 +112,12 @@ free_lookup (EContactMergingLookup *lookup) } static void -final_id_cb (EBook *book, const GError *error, const gchar *id, gpointer closure) +final_id_cb (EBookClient *book_client, const GError *error, const gchar *id, gpointer closure) { EContactMergingLookup *lookup = closure; if (lookup->id_cb) - lookup->id_cb (lookup->book, error, id, lookup->closure); + lookup->id_cb (lookup->book_client, error, id, lookup->closure); free_lookup (lookup); @@ -125,12 +125,12 @@ final_id_cb (EBook *book, const GError *error, const gchar *id, gpointer closure } static void -final_cb_as_id (EBook *book, const GError *error, gpointer closure) +final_cb_as_id (EBookClient *book_client, const GError *error, gpointer closure) { EContactMergingLookup *lookup = closure; if (lookup->id_cb) - lookup->id_cb (lookup->book, error, lookup->contact ? e_contact_get_const (lookup->contact, E_CONTACT_UID) : NULL, lookup->closure); + lookup->id_cb (lookup->book_client, error, lookup->contact ? e_contact_get_const (lookup->contact, E_CONTACT_UID) : NULL, lookup->closure); free_lookup (lookup); @@ -138,12 +138,12 @@ final_cb_as_id (EBook *book, const GError *error, gpointer closure) } static void -final_cb (EBook *book, const GError *error, gpointer closure) +final_cb (EBookClient *book_client, const GError *error, gpointer closure) { EContactMergingLookup *lookup = closure; if (lookup->cb) - lookup->cb (lookup->book, error, lookup->closure); + lookup->cb (lookup->book_client, error, lookup->closure); free_lookup (lookup); @@ -151,26 +151,67 @@ final_cb (EBook *book, const GError *error, gpointer closure) } static void -doit (EContactMergingLookup *lookup, gboolean force_commit) +modify_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + EBookClient *book_client = E_BOOK_CLIENT (source_object); + EContactMergingLookup *lookup = user_data; + GError *error = NULL; + + g_return_if_fail (book_client != NULL); + g_return_if_fail (lookup != NULL); + + e_book_client_modify_contact_finish (book_client, result, &error); + + if (lookup->op == E_CONTACT_MERGING_ADD) + final_cb_as_id (book_client, error, lookup); + else + final_cb (book_client, error, lookup); + + if (error) + g_error_free (error); +} + +static void +add_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + EBookClient *book_client = E_BOOK_CLIENT (source_object); + EContactMergingLookup *lookup = user_data; + gchar *uid = NULL; + GError *error = NULL; + + g_return_if_fail (book_client != NULL); + g_return_if_fail (lookup != NULL); + + if (!e_book_client_add_contact_finish (book_client, result, &uid, &error)) + uid = NULL; + + final_id_cb (book_client, error, uid, lookup); + + if (error) + g_error_free (error); +} + +static void +doit (EContactMergingLookup *lookup, gboolean force_modify) { if (lookup->op == E_CONTACT_MERGING_ADD) { - if (force_commit) - e_book_commit_contact_async (lookup->book, lookup->contact, final_cb_as_id, lookup); + if (force_modify) + e_book_client_modify_contact (lookup->book_client, lookup->contact, NULL, modify_contact_ready_cb, lookup); else - e_book_add_contact_async (lookup->book, lookup->contact, final_id_cb, lookup); + e_book_client_add_contact (lookup->book_client, lookup->contact, NULL, add_contact_ready_cb, lookup); } else if (lookup->op == E_CONTACT_MERGING_COMMIT) - e_book_commit_contact_async (lookup->book, lookup->contact, final_cb, lookup); + e_book_client_modify_contact (lookup->book_client, lookup->contact, NULL, modify_contact_ready_cb, lookup); } static void cancelit (EContactMergingLookup *lookup) { - GError *error = g_error_new (E_BOOK_ERROR, E_BOOK_ERROR_CANCELLED, _("Cancelled")); + GError *error = e_client_error_create (E_CLIENT_ERROR_CANCELLED, NULL); if (lookup->op == E_CONTACT_MERGING_ADD) { - final_id_cb (lookup->book, error, NULL, lookup); + final_id_cb (lookup->book_client, error, NULL, lookup); } else if (lookup->op == E_CONTACT_MERGING_COMMIT) { - final_cb (lookup->book, error, lookup); + final_cb (lookup->book_client, error, lookup); } g_error_free (error); @@ -209,6 +250,26 @@ dropdown_changed (GtkWidget *dropdown, dropdown_data *data) return; } +static void +remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +{ + EBookClient *book_client = E_BOOK_CLIENT (source_object); + EContactMergingLookup *lookup = user_data; + GError *error = NULL; + + g_return_if_fail (book_client != NULL); + g_return_if_fail (lookup != NULL); + + e_book_client_remove_contact_finish (book_client, result, &error); + + if (error) { + g_debug ("%s: Failed to remove contact: %s", G_STRFUNC, error->message); + g_error_free (error); + } + + e_book_client_add_contact (book_client, lookup->contact, NULL, add_contact_ready_cb, lookup); +} + static gint mergeit (EContactMergingLookup *lookup) { @@ -373,12 +434,10 @@ mergeit (EContactMergingLookup *lookup) gtk_widget_show_all ((GtkWidget *) table); result = gtk_dialog_run (dialog); - switch (result) - { + switch (result) { case GTK_RESPONSE_OK: lookup->contact = lookup->match; - e_book_remove_contact_async (lookup->book, lookup->match, NULL, lookup); - e_book_add_contact_async (lookup->book, lookup->contact, final_id_cb, lookup); + e_book_client_remove_contact (lookup->book_client, lookup->match, NULL, remove_contact_ready_cb, lookup); value = 1; break; case GTK_RESPONSE_CANCEL: @@ -472,7 +531,7 @@ match_query_callback (EContact *contact, EContact *match, EABContactMatchType ty if (lookup->op == E_CONTACT_MERGING_FIND) { if (lookup->c_cb) - lookup->c_cb (lookup->book, NULL, (gint) type <= (gint) EAB_CONTACT_MATCH_VAGUE ? NULL : match, lookup->closure); + lookup->c_cb (lookup->book_client, NULL, (gint) type <= (gint) EAB_CONTACT_MATCH_VAGUE ? NULL : match, lookup->closure); free_lookup (lookup); finished_lookup (); @@ -547,17 +606,17 @@ match_query_callback (EContact *contact, EContact *match, EABContactMatchType ty } gboolean -eab_merging_book_add_contact (EBook *book, - EContact *contact, - EBookIdAsyncCallback cb, - gpointer closure) +eab_merging_book_add_contact (EBookClient *book_client, + EContact *contact, + EABMergingIdAsyncCallback cb, + gpointer closure) { EContactMergingLookup *lookup; lookup = g_new (EContactMergingLookup, 1); lookup->op = E_CONTACT_MERGING_ADD; - lookup->book = g_object_ref (book); + lookup->book_client = g_object_ref (book_client); lookup->contact = g_object_ref (contact); lookup->id_cb = cb; lookup->closure = closure; @@ -570,17 +629,17 @@ eab_merging_book_add_contact (EBook *book, } gboolean -eab_merging_book_commit_contact (EBook *book, - EContact *contact, - EBookAsyncCallback cb, - gpointer closure) +eab_merging_book_modify_contact (EBookClient *book_client, + EContact *contact, + EABMergingAsyncCallback cb, + gpointer closure) { EContactMergingLookup *lookup; lookup = g_new (EContactMergingLookup, 1); lookup->op = E_CONTACT_MERGING_COMMIT; - lookup->book = g_object_ref (book); + lookup->book_client = g_object_ref (book_client); lookup->contact = g_object_ref (contact); lookup->cb = cb; lookup->closure = closure; @@ -593,17 +652,17 @@ eab_merging_book_commit_contact (EBook *book, } gboolean -eab_merging_book_find_contact (EBook *book, - EContact *contact, - EBookContactAsyncCallback cb, - gpointer closure) +eab_merging_book_find_contact (EBookClient *book_client, + EContact *contact, + EABMergingContactAsyncCallback cb, + gpointer closure) { EContactMergingLookup *lookup; lookup = g_new (EContactMergingLookup, 1); lookup->op = E_CONTACT_MERGING_FIND; - lookup->book = g_object_ref (book); + lookup->book_client = g_object_ref (book_client); lookup->contact = g_object_ref (contact); lookup->c_cb = cb; lookup->closure = closure; -- cgit v1.2.3 From f59681796df8fe0138a1754abbe8ec781bc1535e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 1 Jul 2011 00:07:26 -0400 Subject: Coding style and whitespace cleanup. --- addressbook/gui/merging/eab-contact-merging.c | 46 ++++++++++++++++++++------- 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 99bb2d39fb..557af481bb 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -96,7 +96,9 @@ finished_lookup (void) merging_queue = g_list_remove_link (merging_queue, merging_queue); running_merge_requests++; - eab_contact_locate_match_full (lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); + eab_contact_locate_match_full ( + lookup->book_client, lookup->contact, + lookup->avoid, match_query_callback, lookup); } } @@ -112,7 +114,10 @@ free_lookup (EContactMergingLookup *lookup) } static void -final_id_cb (EBookClient *book_client, const GError *error, const gchar *id, gpointer closure) +final_id_cb (EBookClient *book_client, + const GError *error, + const gchar *id, + gpointer closure) { EContactMergingLookup *lookup = closure; @@ -125,12 +130,19 @@ final_id_cb (EBookClient *book_client, const GError *error, const gchar *id, gpo } static void -final_cb_as_id (EBookClient *book_client, const GError *error, gpointer closure) +final_cb_as_id (EBookClient *book_client, + const GError *error, + gpointer closure) { EContactMergingLookup *lookup = closure; if (lookup->id_cb) - lookup->id_cb (lookup->book_client, error, lookup->contact ? e_contact_get_const (lookup->contact, E_CONTACT_UID) : NULL, lookup->closure); + lookup->id_cb ( + lookup->book_client, error, + lookup->contact ? + e_contact_get_const ( + lookup->contact, E_CONTACT_UID) : NULL, + lookup->closure); free_lookup (lookup); @@ -138,7 +150,9 @@ final_cb_as_id (EBookClient *book_client, const GError *error, gpointer closure) } static void -final_cb (EBookClient *book_client, const GError *error, gpointer closure) +final_cb (EBookClient *book_client, + const GError *error, + gpointer closure) { EContactMergingLookup *lookup = closure; @@ -151,7 +165,9 @@ final_cb (EBookClient *book_client, const GError *error, gpointer closure) } static void -modify_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +modify_contact_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EContactMergingLookup *lookup = user_data; @@ -172,7 +188,9 @@ modify_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer } static void -add_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +add_contact_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EContactMergingLookup *lookup = user_data; @@ -251,7 +269,9 @@ dropdown_changed (GtkWidget *dropdown, dropdown_data *data) } static void -remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) +remove_contact_ready_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) { EBookClient *book_client = E_BOOK_CLIENT (source_object); EContactMergingLookup *lookup = user_data; @@ -262,12 +282,16 @@ remove_contact_ready_cb (GObject *source_object, GAsyncResult *result, gpointer e_book_client_remove_contact_finish (book_client, result, &error); - if (error) { - g_debug ("%s: Failed to remove contact: %s", G_STRFUNC, error->message); + if (error != NULL) { + g_warning ( + "%s: Failed to remove contact: %s", + G_STRFUNC, error->message); g_error_free (error); } - e_book_client_add_contact (book_client, lookup->contact, NULL, add_contact_ready_cb, lookup); + e_book_client_add_contact ( + book_client, lookup->contact, NULL, + add_contact_ready_cb, lookup); } static gint -- cgit v1.2.3 From fcbbdfbd18e15b4ee8322a0217cf03a689a5e033 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- addressbook/gui/merging/eab-contact-merging.c | 58 ++++++++++++++++----------- 1 file changed, 34 insertions(+), 24 deletions(-) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 557af481bb..70e43fa284 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -210,7 +210,8 @@ add_contact_ready_cb (GObject *source_object, } static void -doit (EContactMergingLookup *lookup, gboolean force_modify) +doit (EContactMergingLookup *lookup, + gboolean force_modify) { if (lookup->op == E_CONTACT_MERGING_ADD) { if (force_modify) @@ -236,7 +237,9 @@ cancelit (EContactMergingLookup *lookup) } static void -dialog_map (GtkWidget *window, GdkEvent *event, GtkWidget *table) +dialog_map (GtkWidget *window, + GdkEvent *event, + GtkWidget *table) { GtkAllocation allocation; gint h, w; @@ -256,7 +259,8 @@ dialog_map (GtkWidget *window, GdkEvent *event, GtkWidget *table) } static void -dropdown_changed (GtkWidget *dropdown, dropdown_data *data) +dropdown_changed (GtkWidget *dropdown, + dropdown_data *data) { gchar *str; str = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (dropdown)); @@ -357,7 +361,7 @@ mergeit (EContactMergingLookup *lookup) use_field = E_CONTACT_EMAIL_2; break; } - else/*Either the new contact has no email OR the email already exist in the duplicate contact*/ + else/*Either the new contact has no email OR the email already exist in the duplicate contact */ continue; case 2: /*New contact has email and it is equal to neither of the 2 emails in the duplicate contact*/ @@ -381,7 +385,7 @@ mergeit (EContactMergingLookup *lookup) } label = gtk_label_new (_("Email")); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) label, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget *) label, FALSE, FALSE, 0); gtk_table_attach_defaults (table, (GtkWidget *) hbox, 0, 1, row, row + 1); dropdown = gtk_combo_box_text_new (); @@ -398,7 +402,7 @@ mergeit (EContactMergingLookup *lookup) g_signal_connect (dropdown, "changed", G_CALLBACK(dropdown_changed), data); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) dropdown, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget *) dropdown, FALSE, FALSE, 0); gtk_table_attach_defaults (table, (GtkWidget *) hbox, 1, 2, row, row + 1); gtk_widget_show ((GtkWidget *) dropdown); continue; @@ -407,13 +411,13 @@ mergeit (EContactMergingLookup *lookup) row++; label = gtk_label_new (e_contact_pretty_name (field)); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) label, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget *) label, FALSE, FALSE, 0); gtk_table_attach_defaults (table, (GtkWidget *) hbox, 0, 1, row, row + 1); label = gtk_label_new (string); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) label, FALSE, FALSE, 0); - gtk_table_attach_defaults (table, (GtkWidget*) hbox, 1, 2, row, row + 1); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget *) label, FALSE, FALSE, 0); + gtk_table_attach_defaults (table, (GtkWidget *) hbox, 1, 2, row, row + 1); continue; } @@ -422,7 +426,7 @@ mergeit (EContactMergingLookup *lookup) row++; label = gtk_label_new (e_contact_pretty_name (field)); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) label, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget *) label, FALSE, FALSE, 0); gtk_table_attach_defaults (table, (GtkWidget *) hbox, 0, 1, row, row + 1); data = g_new0 (dropdown_data, 1); dropdown = gtk_combo_box_text_new (); @@ -443,7 +447,7 @@ mergeit (EContactMergingLookup *lookup) g_signal_connect (dropdown, "changed", G_CALLBACK(dropdown_changed), data); hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget*) dropdown, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), (GtkWidget *) dropdown, FALSE, FALSE, 0); gtk_table_attach_defaults (table, (GtkWidget *) hbox, 1, 2, row, row + 1); gtk_widget_show_all ((GtkWidget *) dropdown); } @@ -475,7 +479,8 @@ mergeit (EContactMergingLookup *lookup) } static gboolean -check_if_same (EContact *contact, EContact *match) +check_if_same (EContact *contact, + EContact *match) { EContactField field; GList *email_attr_list; @@ -487,7 +492,7 @@ check_if_same (EContact *contact, EContact *match) num_of_email = g_list_length (email_attr_list); if ((field == E_CONTACT_EMAIL_1 || field == E_CONTACT_EMAIL_2 - || field == E_CONTACT_EMAIL_3 || field == E_CONTACT_EMAIL_4) && (num_of_email<4)) { + || field == E_CONTACT_EMAIL_3 || field == E_CONTACT_EMAIL_4) && (num_of_email < 4)) { str = (gchar *) e_contact_get_const (contact, field); switch (num_of_email) { @@ -522,7 +527,9 @@ check_if_same (EContact *contact, EContact *match) } static void -response (GtkWidget *dialog, gint response, EContactMergingLookup *lookup) +response (GtkWidget *dialog, + gint response, + EContactMergingLookup *lookup) { static gint merge_response; @@ -547,7 +554,10 @@ response (GtkWidget *dialog, gint response, EContactMergingLookup *lookup) } static void -match_query_callback (EContact *contact, EContact *match, EABContactMatchType type, gpointer closure) +match_query_callback (EContact *contact, + EContact *match, + EABContactMatchType type, + gpointer closure) { EContactMergingLookup *lookup = closure; gint flag; @@ -631,9 +641,9 @@ match_query_callback (EContact *contact, EContact *match, EABContactMatchType ty gboolean eab_merging_book_add_contact (EBookClient *book_client, - EContact *contact, - EABMergingIdAsyncCallback cb, - gpointer closure) + EContact *contact, + EABMergingIdAsyncCallback cb, + gpointer closure) { EContactMergingLookup *lookup; @@ -654,9 +664,9 @@ eab_merging_book_add_contact (EBookClient *book_client, gboolean eab_merging_book_modify_contact (EBookClient *book_client, - EContact *contact, - EABMergingAsyncCallback cb, - gpointer closure) + EContact *contact, + EABMergingAsyncCallback cb, + gpointer closure) { EContactMergingLookup *lookup; @@ -677,9 +687,9 @@ eab_merging_book_modify_contact (EBookClient *book_client, gboolean eab_merging_book_find_contact (EBookClient *book_client, - EContact *contact, - EABMergingContactAsyncCallback cb, - gpointer closure) + EContact *contact, + EABMergingContactAsyncCallback cb, + gpointer closure) { EContactMergingLookup *lookup; -- cgit v1.2.3 From 8530a18ce7c059543f611fcd404539ebc33925b8 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 26 Sep 2011 09:58:45 +0200 Subject: Invalid unref when merging contacts --- addressbook/gui/merging/eab-contact-merging.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 70e43fa284..f791eab114 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -464,7 +464,8 @@ mergeit (EContactMergingLookup *lookup) switch (result) { case GTK_RESPONSE_OK: - lookup->contact = lookup->match; + 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; -- cgit v1.2.3 From e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 27 Sep 2011 01:13:42 -0400 Subject: Miscellaneous cleanups from the account-mgmt branch. Reducing diff noise so I can see important changes easier when comparing branches. A few API changes, but nothing that affects functionality. --- addressbook/gui/merging/eab-contact-merging.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'addressbook/gui/merging/eab-contact-merging.c') diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index f791eab114..1e70b97d77 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -73,7 +73,10 @@ add_lookup (EContactMergingLookup *lookup) { if (running_merge_requests < SIMULTANEOUS_MERGING_REQUESTS) { running_merge_requests++; - eab_contact_locate_match_full (lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); + eab_contact_locate_match_full ( + lookup->book_client, + lookup->contact, lookup->avoid, + match_query_callback, lookup); } else { merging_queue = g_list_append (merging_queue, lookup); @@ -97,8 +100,9 @@ finished_lookup (void) running_merge_requests++; eab_contact_locate_match_full ( - lookup->book_client, lookup->contact, - lookup->avoid, match_query_callback, lookup); + lookup->book_client, + lookup->contact, lookup->avoid, + match_query_callback, lookup); } } @@ -138,8 +142,8 @@ final_cb_as_id (EBookClient *book_client, if (lookup->id_cb) lookup->id_cb ( - lookup->book_client, error, - lookup->contact ? + lookup->book_client, + error, lookup->contact ? e_contact_get_const ( lookup->contact, E_CONTACT_UID) : NULL, lookup->closure); @@ -566,7 +570,11 @@ match_query_callback (EContact *contact, if (lookup->op == E_CONTACT_MERGING_FIND) { if (lookup->c_cb) - lookup->c_cb (lookup->book_client, NULL, (gint) type <= (gint) EAB_CONTACT_MATCH_VAGUE ? NULL : match, lookup->closure); + lookup->c_cb ( + lookup->book_client, NULL, + (gint) type <= (gint) + EAB_CONTACT_MATCH_VAGUE ? NULL : match, + lookup->closure); free_lookup (lookup); finished_lookup (); -- cgit v1.2.3