diff options
author | Milan Crha <mcrha@redhat.com> | 2009-04-25 01:40:31 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-04-25 01:40:31 +0800 |
commit | 2403bbcdd196745314786af3b6318de56ef3948e (patch) | |
tree | a40b172dec814a8f7c214979c7735a46d2c73c08 /plugins/google-account-setup | |
parent | 23df769955ea54f756a579c19964df87ae6fd5c8 (diff) | |
download | gsoc2013-evolution-2403bbcdd196745314786af3b6318de56ef3948e.tar.gz gsoc2013-evolution-2403bbcdd196745314786af3b6318de56ef3948e.tar.zst gsoc2013-evolution-2403bbcdd196745314786af3b6318de56ef3948e.zip |
Use new ESourceList API (simplifies code)
** Part of fix for bug #569652
Diffstat (limited to 'plugins/google-account-setup')
-rw-r--r-- | plugins/google-account-setup/ChangeLog | 13 | ||||
-rw-r--r-- | plugins/google-account-setup/google-contacts-source.c | 49 | ||||
-rw-r--r-- | plugins/google-account-setup/google-contacts-source.h | 2 | ||||
-rw-r--r-- | plugins/google-account-setup/google-source.c | 2 |
4 files changed, 16 insertions, 50 deletions
diff --git a/plugins/google-account-setup/ChangeLog b/plugins/google-account-setup/ChangeLog index 03cf6b4e3e..43513257b7 100644 --- a/plugins/google-account-setup/ChangeLog +++ b/plugins/google-account-setup/ChangeLog @@ -1,5 +1,18 @@ 2009-04-24 Milan Crha <mcrha@redhat.com> + ** Part of fix for bug #569652 + + * google-contacts-source.h: (manage_google_group): + * google-contacts-source.c: (manage_google_group): + Removed. + + * google-contacts-source.c: (ensure_google_contacts_source_group), + (remove_google_contacts_source_group): + * google-source.c: (ensure_google_source_group): + Use new ESourceList API (simplifies code). + +2009-04-24 Milan Crha <mcrha@redhat.com> + ** Fix for bug #572348 * google-source.c: Remove deprecated Gtk+ symbols. diff --git a/plugins/google-account-setup/google-contacts-source.c b/plugins/google-account-setup/google-contacts-source.c index 6d9697194b..00b7ebc2a5 100644 --- a/plugins/google-account-setup/google-contacts-source.c +++ b/plugins/google-account-setup/google-contacts-source.c @@ -37,51 +37,6 @@ #include "google-contacts-source.h" -/** - * manage_google_group: - * Searches for a 'Google' source group and ensures it has the correct - * name. If only_return is set to true, then only returns found group. - * Otherwise returns NULL. - **/ -ESourceGroup * -manage_google_group (ESourceList *slist, gboolean only_return) -{ - GSList *groups, *g; - ESourceGroup *group = NULL; - - g_return_val_if_fail (slist != NULL, NULL); - - groups = e_source_list_peek_groups (slist); - for (g = groups; g; g = g->next) { - group = E_SOURCE_GROUP (g->data); - - if (group && e_source_group_peek_base_uri (group) && - g_ascii_strncasecmp ("google://", e_source_group_peek_base_uri (group), 9) == 0) - break; - - group = NULL; - } - - if (only_return) - return group; - - if (group) { - e_source_group_set_name (group, _("Google")); - } else { - group = e_source_group_new (_("Google"), "google://"); - - if (!e_source_list_add_group (slist, group, -1)) { - g_warning ("Could not add Google source group!"); - } else { - e_source_list_sync (slist, NULL); - } - - g_object_unref (group); - } - - return NULL; -} - void ensure_google_contacts_source_group (void) { @@ -93,7 +48,7 @@ ensure_google_contacts_source_group (void) return; } - manage_google_group (source_list, FALSE); + e_source_list_ensure_group (source_list, _("Google"), "google://", FALSE); g_object_unref (source_list); } @@ -109,7 +64,7 @@ remove_google_contacts_source_group (void) return; } - group = manage_google_group (source_list, TRUE); + group = e_source_list_peek_group_by_base_uri (source_list, "google://"); if (group) { GSList *sources; diff --git a/plugins/google-account-setup/google-contacts-source.h b/plugins/google-account-setup/google-contacts-source.h index b4fd5d6b77..54c21d18a6 100644 --- a/plugins/google-account-setup/google-contacts-source.h +++ b/plugins/google-account-setup/google-contacts-source.h @@ -28,6 +28,4 @@ void ensure_google_contacts_source_group (void); void remove_google_contacts_source_group (void); -ESourceGroup *manage_google_group (ESourceList *slist, gboolean only_return); - #endif diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index a5b846076f..c296ab687f 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -78,7 +78,7 @@ ensure_google_source_group (void) return; } - manage_google_group (slist, FALSE); + e_source_list_ensure_group (slist, _("Google"), "google://", FALSE); g_object_unref (slist); } |