[evolution/kill-bonobo] Use new ESourceList API (simplifies code)
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution/kill-bonobo] Use new ESourceList API (simplifies code)
- Date: Tue, 28 Apr 2009 14:29:17 -0400 (EDT)
commit d49d7cb2f73c578e48d02f8241cdb6771379210f
Author: Milan Crha <mcrha redhat com>
Date: Fri Apr 24 19:40:31 2009 +0200
Use new ESourceList API (simplifies code)
** Part of fix for bug #569652
---
addressbook/ChangeLog | 7 +++
calendar/ChangeLog | 9 ++++
plugins/caldav/ChangeLog | 7 +++
plugins/caldav/caldav-source.c | 32 +------------
plugins/google-account-setup/ChangeLog | 13 +++++
.../google-account-setup/google-contacts-source.c | 49 +-------------------
.../google-account-setup/google-contacts-source.h | 2 -
plugins/google-account-setup/google-source.c | 2 +-
plugins/webdav-account-setup/ChangeLog | 9 ++++
.../webdav-account-setup/webdav-contacts-source.c | 47 +------------------
10 files changed, 52 insertions(+), 125 deletions(-)
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 55337e6..a51d82e 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,12 @@
2009-04-24 Milan Crha <mcrha redhat com>
+ ** Part of fix for bug #569652
+
+ * gui/component/addressbook-component.c: (ensure_sources):
+ Use new ESourceList API (simplifies code).
+
+2009-04-24 Milan Crha <mcrha redhat com>
+
** Fix for bug #572348
* gui/component/ldap-config.glade:
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 6d4023c..f461af6 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,14 @@
2009-04-24 Milan Crha <mcrha redhat com>
+ ** Part of fix for bug #569652
+
+ * gui/calendar-component.c: (ensure_sources):
+ * gui/memos-component.c: (ensure_sources):
+ * gui/tasks-component.c: (ensure_sources):
+ Use new ESourceList API (simplifies code).
+
+2009-04-24 Milan Crha <mcrha redhat com>
+
** Part of fix for bug #381132
* gui/apps_evolution_calendar.schemas.in:
diff --git a/plugins/caldav/ChangeLog b/plugins/caldav/ChangeLog
index 2fe681c..5f28deb 100644
--- a/plugins/caldav/ChangeLog
+++ b/plugins/caldav/ChangeLog
@@ -1,5 +1,12 @@
2009-04-24 Milan Crha <mcrha redhat com>
+ ** Part of fix for bug #569652
+
+ * caldav-source.c: (ensure_caldav_source_group):
+ Use new ESourceList API (simplifies code).
+
+2009-04-24 Milan Crha <mcrha redhat com>
+
** Fix for bug #572348
* caldav-source.c: Remove deprecated Gtk+ symbols.
diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c
index 00ca5ac..46e5103 100644
--- a/plugins/caldav/caldav-source.c
+++ b/plugins/caldav/caldav-source.c
@@ -55,43 +55,13 @@ static void
ensure_caldav_source_group (ECalSourceType source_type)
{
ESourceList *slist;
- GSList *groups, *g;
- ESourceGroup *group = NULL;
if (!e_cal_get_sources (&slist, source_type, NULL)) {
g_warning ("Could not get calendar source list from GConf!");
return;
}
- 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) && strncmp ("caldav://", e_source_group_peek_base_uri (group), 9) == 0)
- break;
-
- group = NULL;
- }
-
- if (group == NULL) {
- /* no such group has been found, create it */
- gboolean res;
-
- group = e_source_group_new (_("CalDAV"), "caldav://");
- res = e_source_list_add_group (slist, group, -1);
-
- if (res == FALSE) {
- g_warning ("Could not add CalDAV source group!");
- } else {
- e_source_list_sync (slist, NULL);
- }
-
- g_object_unref (group);
- } else {
- /* we found the group, change the name based on the actual language */
- e_source_group_set_name (group, _("CalDAV"));
- }
-
+ e_source_list_ensure_group (slist, _("CalDAV"), "caldav://", FALSE);
g_object_unref (slist);
}
diff --git a/plugins/google-account-setup/ChangeLog b/plugins/google-account-setup/ChangeLog
index 03cf6b4..4351325 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 6d96971..00b7ebc 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 b4fd5d6..54c21d1 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 a5b8460..c296ab6 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);
}
diff --git a/plugins/webdav-account-setup/ChangeLog b/plugins/webdav-account-setup/ChangeLog
index 354371c..ce72e9c 100644
--- a/plugins/webdav-account-setup/ChangeLog
+++ b/plugins/webdav-account-setup/ChangeLog
@@ -1,3 +1,12 @@
+2009-04-24 Milan Crha <mcrha redhat com>
+
+ ** Part of fix for bug #569652
+
+ * webdav-contacts-source.c: (find_webdav_group): Removed.
+ * webdav-contacts-source.c: (ensure_webdav_contacts_source_group),
+ (remove_webdav_contacts_source_group):
+ Use new ESourceList API (simplifies code).
+
2009-02-26 Matthew Barnes <mbarnes redhat com>
** Fixes part of bug #572950
diff --git a/plugins/webdav-account-setup/webdav-contacts-source.c b/plugins/webdav-account-setup/webdav-contacts-source.c
index 8edfa59..012a541 100644
--- a/plugins/webdav-account-setup/webdav-contacts-source.c
+++ b/plugins/webdav-account-setup/webdav-contacts-source.c
@@ -54,33 +54,10 @@ plugin_webdav_contacts(EPlugin *epl, EConfigHookItemFactoryData *data);
int
e_plugin_lib_enable(EPluginLib *ep, int enable);
-static ESourceGroup *
-find_webdav_group (ESourceList *slist)
-{
- 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 (BASE_URI, e_source_group_peek_base_uri (group), strlen (BASE_URI)) == 0)
- break;
-
- group = NULL;
- }
-
- return group;
-}
-
static void
ensure_webdav_contacts_source_group(void)
{
ESourceList *source_list;
- ESourceGroup *group;
source_list = e_source_list_new_for_gconf_default("/apps/evolution/addressbook/sources");
@@ -88,26 +65,8 @@ ensure_webdav_contacts_source_group(void)
return;
}
- group = find_webdav_group (source_list);
-
- if (group == NULL) {
- gboolean res;
-
- group = e_source_group_new(_("WebDAV"), BASE_URI);
- res = e_source_list_add_group(source_list, group, -1);
-
- if (res == FALSE) {
- g_warning("Could not add WebDAV source group!");
- } else {
- e_source_list_sync(source_list, NULL);
- }
-
- g_object_unref(group);
- } else {
- e_source_group_set_name (group, _("WebDAV"));
- }
-
- g_object_unref(source_list);
+ e_source_list_ensure_group (source_list, _("WebDAV"), BASE_URI, FALSE);
+ g_object_unref (source_list);
}
static void
@@ -122,7 +81,7 @@ remove_webdav_contacts_source_group(void)
return;
}
- group = find_webdav_group (source_list);
+ group = e_source_list_peek_group_by_base_uri (source_list, BASE_URI);
if (group) {
GSList *sources;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]