[evolution/wip/gsettings] Remove redundant EAccountList utilities.
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/gsettings] Remove redundant EAccountList utilities.
- Date: Wed, 29 Jun 2011 17:28:47 +0000 (UTC)
commit 801450b0f391a90ce1b2726ecb571026819673b9
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Apr 26 09:20:50 2011 -0400
Remove redundant EAccountList utilities.
Kill itip_addresses_get() and itip_addresses_get_default(), and use
e_get_account_list() and e_get_default_account() instead.
calendar/gui/dialogs/event-editor.c | 3 +-
calendar/gui/dialogs/event-page.c | 5 ++-
calendar/gui/dialogs/memo-page.c | 5 ++-
calendar/gui/dialogs/task-editor.c | 3 +-
calendar/gui/dialogs/task-page.c | 5 ++-
calendar/gui/e-cal-model.c | 3 +-
calendar/gui/itip-utils.c | 37 +++++---------------
calendar/gui/itip-utils.h | 3 --
mail/em-filter-source-element.c | 10 ++---
modules/calendar/e-cal-shell-view-private.h | 1 +
modules/calendar/e-cal-shell-view.c | 2 +-
modules/calendar/e-memo-shell-migrate.c | 9 +++--
plugins/groupwise-features/camel-gw-listener.c | 8 +---
.../groupwise-features/groupwise-account-setup.c | 4 +-
plugins/groupwise-features/gw-ui.c | 4 ++-
plugins/itip-formatter/itip-formatter.c | 5 ++-
16 files changed, 45 insertions(+), 62 deletions(-)
---
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 808df90..b66063d 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -33,6 +33,7 @@
#include <glib/gi18n.h>
#include <misc/e-dateedit.h>
+#include <e-util/e-account-utils.h>
#include <e-util/e-plugin-ui.h>
#include <e-util/e-util-private.h>
#include <e-util/e-ui-manager.h>
@@ -677,7 +678,7 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
EAccount *account;
EIterator *it;
- accounts = itip_addresses_get ();
+ accounts = e_get_account_list ();
for (it = e_list_get_iterator ((EList *)accounts);
e_iterator_is_valid (it);
e_iterator_next (it)) {
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index ccbbcd0..9560f59 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -43,6 +43,7 @@
#include "../e-timezone-entry.h"
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-categories-config.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-dialog-widgets.h"
@@ -3153,7 +3154,7 @@ event_page_select_organizer (EventPage *epage, const gchar *backend_address)
ESource *source = NULL;
const gchar *user_addr = NULL;
- def_account = itip_addresses_get_default ();
+ def_account = e_get_default_account ();
if (def_account && def_account->enabled)
def_address = g_strdup_printf("%s <%s>", def_account->id->name, def_account->id->address);
@@ -3230,7 +3231,7 @@ event_page_construct (EventPage *epage,
return NULL;
}
- priv->accounts = itip_addresses_get ();
+ priv->accounts = e_get_account_list ();
for (it = e_list_get_iterator ((EList *)priv->accounts);
e_iterator_is_valid (it);
e_iterator_next (it)) {
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 424b3e3..6e5313e 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -42,6 +42,7 @@
#include "misc/e-buffer-tagger.h"
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-categories-config.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-dialog-widgets.h"
@@ -1081,7 +1082,7 @@ memo_page_select_organizer (MemoPage *mpage, const gchar *backend_address)
ESource *source = NULL;
const gchar *user_addr = NULL;
- def_account = itip_addresses_get_default ();
+ def_account = e_get_default_account ();
if (def_account && def_account->enabled)
def_address = g_strdup_printf("%s <%s>", def_account->id->name, def_account->id->address);
@@ -1153,7 +1154,7 @@ memo_page_construct (MemoPage *mpage)
}
if (flags & COMP_EDITOR_IS_SHARED) {
- priv->accounts = itip_addresses_get ();
+ priv->accounts = e_get_account_list ();
for (it = e_list_get_iterator ((EList *)priv->accounts);
e_iterator_is_valid (it);
e_iterator_next (it)) {
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 91d4598..2deee3b 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include "e-util/e-account-utils.h"
#include "e-util/e-plugin-ui.h"
#include "e-util/e-util-private.h"
@@ -425,7 +426,7 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
EAccount *account;
EIterator *it;
- accounts = itip_addresses_get ();
+ accounts = e_get_account_list ();
for (it = e_list_get_iterator ((EList *)accounts);
e_iterator_is_valid (it);
e_iterator_next (it)) {
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index f416d53..0ddd325 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -46,6 +46,7 @@
#include "task-page.h"
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-dialog-widgets.h"
#include "e-util/e-categories-config.h"
#include "e-util/e-util-private.h"
@@ -2004,7 +2005,7 @@ task_page_select_organizer (TaskPage *tpage, const gchar *backend_address)
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage));
client = comp_editor_get_client (editor);
- def_account = itip_addresses_get_default ();
+ def_account = e_get_default_account ();
if (def_account && def_account->enabled)
def_address = g_strdup_printf("%s <%s>", def_account->id->name, def_account->id->address);
@@ -2081,7 +2082,7 @@ task_page_construct (TaskPage *tpage,
return NULL;
}
- priv->accounts = itip_addresses_get ();
+ priv->accounts = e_get_account_list ();
for (it = e_list_get_iterator ((EList *)priv->accounts);
e_iterator_is_valid (it);
e_iterator_next (it)) {
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 9fd9332..ef3c062 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -37,6 +37,7 @@
#include "itip-utils.h"
#include "misc.h"
#include "e-util/e-util.h"
+#include "e-util/e-account-utils.h"
#include "e-util/e-extensible.h"
#include "e-util/e-util-enumtypes.h"
@@ -703,7 +704,7 @@ e_cal_model_init (ECalModel *model)
model->priv->kind = ICAL_NO_COMPONENT;
model->priv->flags = 0;
- model->priv->accounts = itip_addresses_get ();
+ model->priv->accounts = e_get_account_list ();
model->priv->use_24_hour_format = TRUE;
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 6163d59..8e96deb 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -28,6 +28,7 @@
#include <libedataserver/e-time-utils.h>
#include <gtk/gtk.h>
#include <libical/ical.h>
+#include <e-util/e-account-utils.h>
#include <e-util/e-dialog-utils.h>
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-util.h>
@@ -60,26 +61,6 @@ static icalproperty_method itip_methods_enum[] = {
ICAL_METHOD_DECLINECOUNTER,
};
-static EAccountList *accounts = NULL;
-
-EAccountList *
-itip_addresses_get (void)
-{
- if (accounts == NULL) {
- GConfClient *gconf_client = gconf_client_get_default ();
- accounts = e_account_list_new (gconf_client);
- g_object_unref (gconf_client);
- }
-
- return accounts;
-}
-
-EAccount *
-itip_addresses_get_default (void)
-{
- return (EAccount *)e_account_list_get_default (itip_addresses_get ());
-}
-
gboolean
itip_organizer_is_user_ex (ECalComponent *comp, ECal *client, gboolean skip_cap_test)
{
@@ -113,7 +94,7 @@ itip_organizer_is_user_ex (ECalComponent *comp, ECal *client, gboolean skip_cap_
}
user_org = e_account_list_find (
- itip_addresses_get (),
+ e_get_account_list (),
E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
}
@@ -142,7 +123,7 @@ itip_sentby_is_user (ECalComponent *comp, ECal *client)
if (organizer.sentby != NULL) {
strip = itip_strip_mailto (organizer.sentby);
user_sentby = e_account_list_find (
- itip_addresses_get (),
+ e_get_account_list (),
E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
}
@@ -209,7 +190,7 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client)
gchar *address = NULL;
e_cal_component_get_attendee_list (comp, &attendees);
- al = itip_addresses_get ();
+ al = e_get_account_list ();
if (client)
e_cal_get_cal_address (client, &address, NULL);
@@ -269,7 +250,7 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client)
/* We could not find the attendee in the component, so just give the default
account address if the email address is not set in the backend */
/* FIXME do we have a better way ? */
- a = itip_addresses_get_default ();
+ a = e_get_default_account ();
address = g_strdup ((a != NULL) ? a->id->address : "");
e_cal_component_free_attendee_list (attendees);
@@ -919,7 +900,7 @@ comp_limit_attendees (ECalComponent *comp)
g_free (attendee);
attendee_text = g_strstrip (attendee_text);
found = match = e_account_list_find (
- itip_addresses_get (),
+ e_get_account_list (),
E_ACCOUNT_FIND_ID_ADDRESS,
attendee_text) != NULL;
@@ -930,7 +911,7 @@ comp_limit_attendees (ECalComponent *comp)
attendee_sentby_text = g_strdup (itip_strip_mailto (attendee_sentby));
attendee_sentby_text = g_strstrip (attendee_sentby_text);
found = match = e_account_list_find (
- itip_addresses_get (),
+ e_get_account_list (),
E_ACCOUNT_FIND_ID_ADDRESS,
attendee_sentby_text) != NULL;
}
@@ -963,7 +944,7 @@ comp_sentby (ECalComponent *comp, ECal *client)
e_cal_component_get_organizer (comp, &organizer);
if (!organizer.value) {
- EAccount *a = itip_addresses_get_default ();
+ EAccount *a = e_get_default_account ();
organizer.value = g_strdup_printf ("MAILTO:%s", a->id->address);
organizer.sentby = NULL;
@@ -991,7 +972,7 @@ comp_sentby (ECalComponent *comp, ECal *client)
}
if (!itip_organizer_is_user (comp, client) && !itip_sentby_is_user (comp, client)) {
- EAccount *a = itip_addresses_get_default ();
+ EAccount *a = e_get_default_account ();
organizer.value = g_strdup (organizer.value);
organizer.sentby = g_strdup_printf ("MAILTO:%s", a->id->address);
diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h
index 6e27d89..5f320f8 100644
--- a/calendar/gui/itip-utils.h
+++ b/calendar/gui/itip-utils.h
@@ -48,9 +48,6 @@ struct CalMimeAttach {
guint length;
};
-EAccountList *itip_addresses_get (void);
-EAccount *itip_addresses_get_default (void);
-
gboolean itip_organizer_is_user (ECalComponent *comp, ECal *client);
gboolean itip_organizer_is_user_ex (ECalComponent *comp, ECal *client, gboolean skip_cap_test);
gboolean itip_sentby_is_user (ECalComponent *comp, ECal *client);
diff --git a/mail/em-filter-source-element.c b/mail/em-filter-source-element.c
index ab4c049..ee6785f 100644
--- a/mail/em-filter-source-element.c
+++ b/mail/em-filter-source-element.c
@@ -32,7 +32,8 @@
#include <gtk/gtk.h>
#include <camel/camel.h>
#include <libedataserver/e-sexp.h>
-#include <libedataserver/e-account-list.h>
+
+#include <e-util/e-account-utils.h>
#include "filter/e-filter-part.h"
@@ -342,15 +343,12 @@ em_filter_source_element_get_sources (EMFilterSourceElement *fs)
{
EAccountList *accounts;
const EAccount *account;
- GConfClient *gconf;
EIterator *it;
gchar *uri;
CamelURL *url;
/* should this get the global object from mail? */
- gconf = gconf_client_get_default ();
- accounts = e_account_list_new (gconf);
- g_object_unref (gconf);
+ accounts = e_get_account_list ();
for (it = e_list_get_iterator ((EList *)accounts);
e_iterator_is_valid (it);
@@ -369,6 +367,6 @@ em_filter_source_element_get_sources (EMFilterSourceElement *fs)
g_free (uri);
}
}
+
g_object_unref (it);
- g_object_unref (accounts);
}
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 0f92350..b3b4092 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -32,6 +32,7 @@
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-sexp.h>
+#include "e-util/e-account-utils.h"
#include "e-util/e-selection.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-file-utils.h"
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index ce2e258..b81b453 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -474,7 +474,7 @@ cal_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (EVENT_MEETING_NEW);
- visible = itip_addresses_get_default () != NULL;
+ visible = e_get_default_account () != NULL;
gtk_action_set_visible (action, visible);
}
diff --git a/modules/calendar/e-memo-shell-migrate.c b/modules/calendar/e-memo-shell-migrate.c
index a41c4e1..b760990 100644
--- a/modules/calendar/e-memo-shell-migrate.c
+++ b/modules/calendar/e-memo-shell-migrate.c
@@ -24,12 +24,11 @@
#include <string.h>
#include <glib/gi18n.h>
#include <camel/camel.h>
-#include <libedataserver/e-account.h>
-#include <libedataserver/e-account-list.h>
#include <libedataserver/e-source.h>
#include <libedataserver/e-source-group.h>
#include <libedataserver/e-source-list.h>
+#include "e-util/e-account-utils.h"
#include "calendar/gui/calendar-config-keys.h"
#include "shell/e-shell.h"
@@ -249,7 +248,9 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend,
CamelURL *url;
EIterator *it;
GConfClient *gconf_client = gconf_client_get_default ();
- al = e_account_list_new (gconf_client);
+
+ al = e_get_account_list ();
+
for (it = e_list_get_iterator ((EList *)al);
e_iterator_is_valid (it);
e_iterator_next (it)) {
@@ -260,7 +261,7 @@ e_memo_shell_backend_migrate (EShellBackend *shell_backend,
add_gw_esource (source_list, a->name, _("Notes"), url, gconf_client);
camel_url_free (url);
}
- g_object_unref (al);
+
g_object_unref (gconf_client);
}
diff --git a/plugins/groupwise-features/camel-gw-listener.c b/plugins/groupwise-features/camel-gw-listener.c
index 28efe5c..ed73953 100644
--- a/plugins/groupwise-features/camel-gw-listener.c
+++ b/plugins/groupwise-features/camel-gw-listener.c
@@ -31,9 +31,9 @@
#include <e-gw-connection.h>
#include <libedataserverui/e-passwords.h>
#include "e-util/e-alert-dialog.h"
-#include <libedataserver/e-account.h>
#include <libecal/e-cal.h>
#include <shell/e-shell.h>
+#include <e-util/e-account-utils.h>
/*stores some info about all currently existing groupwise accounts
list of GwAccountInfo structures */
@@ -934,7 +934,6 @@ account_changed (EAccountList *account_listener, EAccount *account)
static void
prune_proxies (void) {
- GConfClient *client = gconf_client_get_default ();
EAccountList *account_list;
ESourceList *sources;
ESourceGroup *group;
@@ -948,10 +947,7 @@ prune_proxies (void) {
E_CAL_SOURCE_TYPE_JOURNAL
};
- account_list = e_account_list_new (client);
- /* Is this being leaked */
- g_object_unref (client);
-
+ account_list = e_get_account_list ();
e_account_list_prune_proxies (account_list);
for (i=0; i<3; i++) {
diff --git a/plugins/groupwise-features/groupwise-account-setup.c b/plugins/groupwise-features/groupwise-account-setup.c
index 335a3b5..f232bab 100644
--- a/plugins/groupwise-features/groupwise-account-setup.c
+++ b/plugins/groupwise-features/groupwise-account-setup.c
@@ -27,6 +27,7 @@
#include <gconf/gconf-client.h>
#include "shell/es-event.h"
#include <string.h>
+#include <e-util/e-account-utils.h>
#define GROUPWISE_BASE_URI "groupwise://"
@@ -88,8 +89,8 @@ ensure_mandatory_esource_properties (EPlugin *ep, ESEventTargetUpgrade *target)
EAccountList *al;
EIterator *it;
+ al = e_get_account_list ();
client = gconf_client_get_default ();
- al = e_account_list_new (client);
for (it = e_list_get_iterator ((EList *)al);
e_iterator_is_valid (it);
@@ -103,7 +104,6 @@ ensure_mandatory_esource_properties (EPlugin *ep, ESEventTargetUpgrade *target)
set_esource_props ("/apps/evolution/tasks/sources", a, client, a->name);
set_esource_props ("/apps/evolution/memos/sources", a, client, a->name);
}
- g_object_unref (al);
g_object_unref (client);
}
diff --git a/plugins/groupwise-features/gw-ui.c b/plugins/groupwise-features/gw-ui.c
index 3ca262b..0d64bd9 100644
--- a/plugins/groupwise-features/gw-ui.c
+++ b/plugins/groupwise-features/gw-ui.c
@@ -20,6 +20,8 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <e-util/e-account-utils.h>
+
#include <shell/e-shell-view.h>
#include <shell/e-shell-window.h>
@@ -319,7 +321,7 @@ is_meeting_owner (ECalComponent *comp, ECal *client)
}
if (!ret_val)
- ret_val = e_account_list_find (itip_addresses_get (), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
+ ret_val = e_account_list_find (e_get_account_list (), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL;
g_free (email);
return ret_val;
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index dcf3874..f2455ad 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -41,6 +41,7 @@
#include <mail/mail-tools.h>
#include <mail/mail-mt.h>
#include <libedataserver/e-account-list.h>
+#include <e-util/e-account-utils.h>
#include <e-util/e-alert-dialog.h>
#include <e-util/e-mktemp.h>
#include <calendar/gui/itip-utils.h>
@@ -964,7 +965,7 @@ change_status (icalcomponent *ical_comp, const gchar *address, icalparameter_par
} else {
EAccount *a;
- a = itip_addresses_get_default ();
+ a = e_get_default_account ();
prop = icalproperty_new_attendee (a->id->address);
icalcomponent_add_property (ical_comp, prop);
@@ -2323,7 +2324,7 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
info = (struct _itip_puri *) em_format_find_puri ((EMFormat *)efh, pobject->classid);
/* Accounts */
- info->accounts = itip_addresses_get ();
+ info->accounts = e_get_account_list ();
/* Source Lists and open ecal clients */
for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]