From 801450b0f391a90ce1b2726ecb571026819673b9 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 26 Apr 2011 09:20:50 -0400 Subject: 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 --- 8 files changed, 24 insertions(+), 40 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 808df901d3..b66063dd73 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -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 ccbbcd03bb..9560f590d2 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 424b3e370c..6e5313eec7 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 91d4598fdf..2deee3b6ec 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -32,6 +32,7 @@ #include #include +#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 f416d53d88..0ddd325448 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 9fd93324fb..ef3c0624df 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 6163d59fae..8e96deb3e4 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -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 6e27d890c8..5f320f871e 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); -- cgit v1.2.3