[evolution/account-mgmt: 18/25] Adapt calendar/gui to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/account-mgmt: 18/25] Adapt calendar/gui to the new ESource API.
- Date: Tue, 18 Jan 2011 18:48:44 +0000 (UTC)
commit 1f921a9ef5d0c73ecf00e1997131a1bcc870f1e5
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Dec 13 16:05:32 2010 -0500
Adapt calendar/gui to the new ESource API.
calendar/gui/alarm-notify/config-data.h | 1 -
calendar/gui/comp-util.c | 2 +
calendar/gui/comp-util.h | 2 +
calendar/gui/dialogs/Makefile.am | 7 ++--
calendar/gui/dialogs/calendar-setup.c | 48 ++++++++++++++++++-------
calendar/gui/dialogs/calendar-setup.h | 3 +-
calendar/gui/dialogs/comp-editor.c | 4 +-
calendar/gui/dialogs/e-send-options-utils.c | 4 ++-
calendar/gui/dialogs/e-send-options-utils.h | 2 +-
calendar/gui/dialogs/event-page.c | 8 ++++-
calendar/gui/dialogs/memo-page.c | 10 +++++-
calendar/gui/dialogs/select-source-dialog.c | 41 ++++++++-------------
calendar/gui/dialogs/task-page.c | 8 ++++-
calendar/gui/e-cal-component-preview.c | 2 +-
calendar/gui/e-cal-config.c | 2 +
calendar/gui/e-cal-event.c | 5 +--
calendar/gui/e-cal-event.h | 4 +--
calendar/gui/e-cal-model.c | 50 +++++++++++++++++++------
calendar/gui/e-calendar-selector.c | 45 ++++++-----------------
calendar/gui/e-calendar-selector.h | 3 +-
calendar/gui/e-calendar-view.c | 6 +++-
calendar/gui/e-day-view.c | 2 +-
calendar/gui/e-meeting-list-view.c | 11 ++++--
calendar/gui/e-meeting-store.c | 26 ++++++++++---
calendar/gui/e-memo-list-selector.c | 53 ++++++++-------------------
calendar/gui/e-memo-list-selector.h | 3 +-
calendar/gui/e-task-list-selector.c | 53 ++++++++-------------------
calendar/gui/e-task-list-selector.h | 3 +-
28 files changed, 208 insertions(+), 200 deletions(-)
---
diff --git a/calendar/gui/alarm-notify/config-data.h b/calendar/gui/alarm-notify/config-data.h
index 61a3053..9e12eef 100644
--- a/calendar/gui/alarm-notify/config-data.h
+++ b/calendar/gui/alarm-notify/config-data.h
@@ -30,7 +30,6 @@
#include <libical/ical.h>
#include <libecal/e-cal.h>
#include <gconf/gconf-client.h>
-#include <libedataserver/e-source-list.h>
GConfClient *config_data_get_conf_client (void);
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 7dae182..8f38fb5 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -746,6 +746,7 @@ update_objects (ECal *client, icalcomponent *icalcomp)
return TRUE;
}
+#if 0 /* ACCOUNT_MGMT */
/**
* cal_comp_process_source_list_drop:
* Processes the drop signal over the ESourceList.
@@ -865,6 +866,7 @@ cal_comp_process_source_list_drop (ECal *destination, icalcomponent *comp, GdkDr
return success;
}
+#endif /* ACCOUNT_MGMT */
void
comp_util_sanitize_recurrence_master (ECalComponent *comp, ECal *client)
diff --git a/calendar/gui/comp-util.h b/calendar/gui/comp-util.h
index 0467f31..dde577a 100644
--- a/calendar/gui/comp-util.h
+++ b/calendar/gui/comp-util.h
@@ -72,7 +72,9 @@ GSList *cal_comp_selection_get_string_list (GtkSelectionData *data);
void cal_comp_set_dtstart_with_oldzone (ECal *client, ECalComponent *comp, const ECalComponentDateTime *pdate);
void cal_comp_set_dtend_with_oldzone (ECal *client, ECalComponent *comp, const ECalComponentDateTime *pdate);
+#if 0 /* ACCOUNT_MGMT */
gboolean cal_comp_process_source_list_drop (ECal *destination, icalcomponent *comp, GdkDragAction action, const gchar *source_uid, ESourceList *source_list);
+#endif /* ACCOUNT_MGMT */
void comp_util_sanitize_recurrence_master (ECalComponent *comp, ECal *client);
gchar *icalcomp_suggest_filename (icalcomponent *icalcomp, const gchar *default_name);
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index 38e0c47..3ede83e 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -20,12 +20,15 @@ libcal_dialogs_la_CPPFLAGS = \
ecalendarincludedir = $(privincludedir)/calendar/gui/dialogs
+# ACCOUNT_MGMT: Disabled sources:
+# calendar-setup.h
+# calendar-setup.c
+
ecalendarinclude_HEADERS = \
comp-editor-page.h \
comp-editor.h \
alarm-dialog.h \
alarm-list-dialog.h \
- calendar-setup.h \
cancel-comp.h \
changed-comp.h \
comp-editor-util.h \
@@ -59,8 +62,6 @@ libcal_dialogs_la_SOURCES = \
alarm-dialog.h \
alarm-list-dialog.c \
alarm-list-dialog.h \
- calendar-setup.c \
- calendar-setup.h \
cancel-comp.c \
cancel-comp.h \
changed-comp.c \
diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c
index c03e53f..00a7b37 100644
--- a/calendar/gui/dialogs/calendar-setup.c
+++ b/calendar/gui/dialogs/calendar-setup.c
@@ -66,7 +66,7 @@ eccp_check_complete (EConfig *ec, const gchar *pageid, gpointer data)
const gchar *tmp;
ESource *source;
- tmp = e_source_peek_name (sdialog->source);
+ tmp = e_source_get_name (sdialog->source);
valid = tmp && tmp[0] && ((source = e_source_group_peek_source_by_name (sdialog->source_group, tmp)) == NULL || source == sdialog->original_source);
return valid;
@@ -75,6 +75,7 @@ eccp_check_complete (EConfig *ec, const gchar *pageid, gpointer data)
static void
eccp_commit (EConfig *ec, GSList *items, gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
CalendarSourceDialog *sdialog = data;
xmlNodePtr xml;
GtkWindow *window;
@@ -98,6 +99,7 @@ eccp_commit (EConfig *ec, GSList *items, gpointer data)
window = e_shell_get_active_window (e_shell_get_default ());
if (window)
gtk_widget_queue_draw (GTK_WIDGET (window));
+#endif /* ACCOUNT_MGMT */
}
static void
@@ -119,6 +121,7 @@ eccp_free (EConfig *ec, GSList *items, gpointer data)
static void
eccp_type_changed (GtkComboBox *dropdown, CalendarSourceDialog *sdialog)
{
+#if 0 /* ACCOUNT_MGMT */
gint id = gtk_combo_box_get_active (dropdown);
GtkTreeModel *model;
GtkTreeIter iter;
@@ -137,11 +140,13 @@ eccp_type_changed (GtkComboBox *dropdown, CalendarSourceDialog *sdialog)
e_source_set_relative_uri (sdialog->source, "");
e_config_target_changed ((EConfig *) sdialog->config, E_CONFIG_TARGET_CHANGED_REBUILD);
+#endif /* ACCOUNT_MGMT */
}
static GtkWidget *
eccp_get_source_type (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
static GtkWidget *label, *type;
guint row;
CalendarSourceDialog *sdialog = data;
@@ -207,6 +212,8 @@ eccp_get_source_type (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0);
return type;
+#endif /* ACCOUNT_MGMT */
+ return NULL;
}
static void
@@ -219,6 +226,7 @@ name_changed (GtkEntry *entry, ECalConfigTargetSource *t)
static GtkWidget *
eccp_get_source_name (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
static GtkWidget *label, *entry;
guint row;
ECalConfigTargetSource *t = (ECalConfigTargetSource *) ec->target;
@@ -244,22 +252,25 @@ eccp_get_source_name (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
gtk_entry_set_text (GTK_ENTRY (entry), e_source_peek_name (source));
return entry;
+#endif /* ACCOUNT_MGMT */
+ return NULL;
}
static void
offline_status_changed_cb (GtkWidget *widget, CalendarSourceDialog *sdialog)
{
-
+#if 0 /* ACCOUNT_MGMT */
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
e_source_set_property (sdialog->source, "offline_sync", "1");
else
e_source_set_property (sdialog->source, "offline_sync", "0");
-
+#endif /* ACCOUNT_MGMT */
}
static GtkWidget *
eccp_general_offline (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
CalendarSourceDialog *sdialog = data;
GtkWidget *offline_setting = NULL;
const gchar *offline_sync;
@@ -289,11 +300,14 @@ eccp_general_offline (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
if (is_local)
gtk_widget_hide (offline_setting);
return offline_setting;
+#endif /* ACCOUNT_MGMT */
+ return NULL;
}
static void
color_changed (GtkColorButton *color_button, ECalConfigTargetSource *target)
{
+#if 0 /* ACCOUNT_MGMT */
ESource *source = target->source;
gchar color_spec[16];
GdkColor color;
@@ -302,6 +316,7 @@ color_changed (GtkColorButton *color_button, ECalConfigTargetSource *target)
g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x",
color.red, color.green, color.blue);
e_source_set_color_spec (source, color_spec);
+#endif /* ACCOUNT_MGMT */
}
static const gchar *
@@ -326,6 +341,7 @@ choose_initial_color (void)
static GtkWidget *
eccp_get_source_color (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
+#if 0 /* ACCOUNT_MGMT */
CalendarSourceDialog *sdialog = data;
static GtkWidget *label, *color_button;
guint row;
@@ -368,6 +384,8 @@ eccp_get_source_color (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWid
G_CALLBACK (color_changed), ec->target);
return color_button;
+#endif /* ACCOUNT_MGMT */
+ return NULL;
}
static ECalConfigItem eccp_items[] = {
@@ -407,14 +425,14 @@ static ECalConfigItem ecmp_items[] = {
* cs_load_sources:
* @sdialog: dialog where to load sources list
* @conf_key: configuration key where to get sources' list
- * @group: can be NULL
*
* Loads list of sources from @conf_key.
*/
static void
-cs_load_sources (CalendarSourceDialog *sdialog, const gchar *conf_key, ESourceGroup *group)
+cs_load_sources (CalendarSourceDialog *sdialog, const gchar *conf_key)
{
+#if 0 /* ACCOUNT_MGMT */
GConfClient *gconf;
g_return_if_fail (sdialog != NULL && conf_key != NULL);
@@ -429,6 +447,7 @@ cs_load_sources (CalendarSourceDialog *sdialog, const gchar *conf_key, ESourceGr
if (group)
sdialog->source_group = (ESourceGroup *)group;
+#endif /* ACCOUNT_MGMT */
}
/**
@@ -439,8 +458,9 @@ cs_load_sources (CalendarSourceDialog *sdialog, const gchar *conf_key, ESourceGr
* Show calendar properties for @source.
**/
void
-calendar_setup_edit_calendar (GtkWindow *parent, ESource *source, ESourceGroup *group)
+calendar_setup_edit_calendar (GtkWindow *parent, ESource *source)
{
+#if 0 /* ACCOUNT_MGMT */
CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1);
gchar *xml;
ECalConfig *ec;
@@ -451,8 +471,7 @@ calendar_setup_edit_calendar (GtkWindow *parent, ESource *source, ESourceGroup *
if (source) {
const gchar *color_spec;
- sdialog->original_source = source;
- g_object_ref (source);
+ sdialog->original_source = g_object_ref (source);
sdialog->source_group = e_source_peek_group (source);
xml = e_source_to_standalone_xml (source);
sdialog->source = e_source_new_from_standalone_xml (xml);
@@ -487,17 +506,19 @@ calendar_setup_edit_calendar (GtkWindow *parent, ESource *source, ESourceGroup *
e_config_target_changed ((EConfig *)ec, E_CONFIG_TARGET_CHANGED_STATE);
return;
+#endif /* ACCOUNT_MGMT */
}
void
calendar_setup_new_calendar (GtkWindow *parent)
{
- calendar_setup_edit_calendar (parent, NULL, NULL);
+ calendar_setup_edit_calendar (parent, NULL);
}
void
calendar_setup_edit_task_list (GtkWindow *parent, ESource *source)
{
+#if 0 /* ACCOUNT_MGMT */
CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1);
gchar *xml;
ECalConfig *ec;
@@ -508,8 +529,7 @@ calendar_setup_edit_task_list (GtkWindow *parent, ESource *source)
if (source) {
const gchar *color_spec;
- sdialog->original_source = source;
- g_object_ref (source);
+ sdialog->original_source = g_object_ref (source);
sdialog->source_group = e_source_peek_group (source);
xml = e_source_to_standalone_xml (source);
sdialog->source = e_source_new_from_standalone_xml (xml);
@@ -543,6 +563,7 @@ calendar_setup_edit_task_list (GtkWindow *parent, ESource *source)
e_config_target_changed ((EConfig *)ec, E_CONFIG_TARGET_CHANGED_STATE);
return;
+#endif /* ACCOUNT_MGMT */
}
void
@@ -554,6 +575,7 @@ calendar_setup_new_task_list (GtkWindow *parent)
void
calendar_setup_edit_memo_list (GtkWindow *parent, ESource *source)
{
+#if 0 /* ACCOUNT_MGMT */
CalendarSourceDialog *sdialog = g_new0 (CalendarSourceDialog, 1);
gchar *xml;
ECalConfig *ec;
@@ -564,8 +586,7 @@ calendar_setup_edit_memo_list (GtkWindow *parent, ESource *source)
if (source) {
const gchar *color_spec;
- sdialog->original_source = source;
- g_object_ref (source);
+ sdialog->original_source = g_object_ref (source);
sdialog->source_group = e_source_peek_group (source);
xml = e_source_to_standalone_xml (source);
sdialog->source = e_source_new_from_standalone_xml (xml);
@@ -599,6 +620,7 @@ calendar_setup_edit_memo_list (GtkWindow *parent, ESource *source)
e_config_target_changed ((EConfig *)ec, E_CONFIG_TARGET_CHANGED_STATE);
return;
+#endif /* ACCOUNT_MGMT */
}
void
diff --git a/calendar/gui/dialogs/calendar-setup.h b/calendar/gui/dialogs/calendar-setup.h
index 18dc042..2c57f7b 100644
--- a/calendar/gui/dialogs/calendar-setup.h
+++ b/calendar/gui/dialogs/calendar-setup.h
@@ -26,11 +26,10 @@
#include <gtk/gtk.h>
#include <libedataserver/e-source.h>
-#include <libedataserver/e-source-group.h>
G_BEGIN_DECLS
-void calendar_setup_edit_calendar (GtkWindow *parent, ESource *source, ESourceGroup *group);
+void calendar_setup_edit_calendar (GtkWindow *parent, ESource *source);
void calendar_setup_new_calendar (GtkWindow *parent);
void calendar_setup_edit_task_list (GtkWindow *parent, ESource *source);
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 08b6ac7..dcb59ce 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -862,7 +862,7 @@ action_save_cb (GtkAction *action,
e_alert_submit (
E_ALERT_SINK (editor),
"calendar:prompt-read-only-cal-editor",
- e_source_peek_name (
+ e_source_get_display_name (
e_cal_get_source (priv->client)),
NULL);
return;
@@ -2059,7 +2059,7 @@ prompt_and_save_changes (CompEditor *editor, gboolean send)
e_alert_submit (
E_ALERT_SINK (editor),
"calendar:prompt-read-only-cal-editor",
- e_source_peek_name (
+ e_source_get_display_name (
e_cal_get_source (priv->client)),
NULL);
/* don't discard changes when selected readonly calendar */
diff --git a/calendar/gui/dialogs/e-send-options-utils.c b/calendar/gui/dialogs/e-send-options-utils.c
index b21352d..93388b4 100644
--- a/calendar/gui/dialogs/e-send-options-utils.c
+++ b/calendar/gui/dialogs/e-send-options-utils.c
@@ -29,6 +29,7 @@
void
e_send_options_utils_set_default_data (ESendOptionsDialog *sod, ESource *source, const gchar *type)
{
+#if 0 /* ACCOUNT_MGMT */
ESendOptionsGeneral *gopts = NULL;
ESendOptionsStatusTracking *sopts;
GConfClient *gconf = gconf_client_get_default ();
@@ -44,7 +45,7 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod, ESource *source,
else
source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources");
- uid = e_source_peek_uid (source);
+ uid = e_source_get_uid (source);
source = e_source_list_peek_source_by_uid (source_list, uid);
/* priority */
@@ -147,6 +148,7 @@ e_send_options_utils_set_default_data (ESendOptionsDialog *sod, ESource *source,
}
g_object_unref (gconf);
+#endif /* ACCOUNT_MGMT */
}
void
diff --git a/calendar/gui/dialogs/e-send-options-utils.h b/calendar/gui/dialogs/e-send-options-utils.h
index c1a63a2..3ec7542 100644
--- a/calendar/gui/dialogs/e-send-options-utils.h
+++ b/calendar/gui/dialogs/e-send-options-utils.h
@@ -27,7 +27,7 @@
#include "misc/e-send-options.h"
#include <libecal/e-cal-component.h>
-#include <libedataserver/e-source-list.h>
+#include <libedataserver/e-source.h>
void e_send_options_utils_set_default_data
(ESendOptionsDialog *sod,
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 06ba147..1395811 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -2303,7 +2303,9 @@ get_widgets (EventPage *epage)
priv->source_selector = GW ("source");
+#if 0 /* ACCOUNT_MGMT */
e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/calendar/sources");
+#endif /* ACCOUNT_MGMT */
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
@@ -2656,7 +2658,7 @@ source_changed_cb (ESourceComboBox *source_combo_box, EventPage *epage)
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
_("Unable to open the calendar '%s'."),
- e_source_peek_name (source));
+ e_source_get_display_name (source));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
} else {
@@ -2695,6 +2697,7 @@ set_subscriber_info_string (EventPage *epage, const gchar *backend_address)
client = comp_editor_get_client (editor);
source = e_cal_get_source (client);
+#if 0 /* ACCOUNT_MGMT */
if (e_source_get_property (source, "subscriber")) {
g_free (epage->priv->subscriber_info_text);
/* Translators: This string is used when we are creating an Event
@@ -2704,6 +2707,7 @@ set_subscriber_info_string (EventPage *epage, const gchar *backend_address)
g_free (epage->priv->subscriber_info_text);
epage->priv->subscriber_info_text = NULL;
}
+#endif /* ACCOUNT_MGMT */
if (!check_starts_in_the_past (epage))
event_page_set_info_string (epage, epage->priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, epage->priv->subscriber_info_text);
@@ -3120,8 +3124,10 @@ event_page_select_organizer (EventPage *epage, const gchar *backend_address)
if (client)
source = e_cal_get_source (client);
+#if 0 /* ACCOUNT_MGMT */
if (source)
user_addr = e_source_get_property (source, "subscriber");
+#endif /* ACCOUNT_MGMT */
if (user_addr)
subscribed_cal = TRUE;
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index dc0e9ae..5fcbf7c 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -477,6 +477,7 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp)
c_store = e_name_selector_model_peek_contact_store (model);
books = e_contact_store_get_books (c_store);
+#if 0 /* ACCOUNT_MGMT */
for (l = books; l; l = l->next) {
EBook *b = l->data;
if (g_str_equal (uri, e_book_get_uri (b))) {
@@ -484,6 +485,7 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp)
break;
}
}
+#endif /* ACCOUNT_MGMT */
if (book) {
GList *contacts = NULL;
@@ -848,7 +850,9 @@ get_widgets (MemoPage *mpage)
priv->source_selector = GW ("source");
#undef GW
+#if 0 /* ACCOUNT_MGMT */
e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/memos/sources");
+#endif /* ACCOUNT_MGMT */
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
@@ -908,7 +912,7 @@ source_changed_cb (ESourceComboBox *source_combo_box,
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
_("Unable to open memos in '%s'."),
- e_source_peek_name (source));
+ e_source_get_display_name (source));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
} else {
@@ -942,6 +946,7 @@ set_subscriber_info_string (MemoPage *mpage,
client = comp_editor_get_client (editor);
source = e_cal_get_source (client);
+#if 0 /* ACCOUNT_MGMT */
if (e_source_get_property (source, "subscriber")) {
g_free (mpage->priv->subscriber_info_text);
/* Translators: This string is used when we are creating a Memo
@@ -951,6 +956,7 @@ set_subscriber_info_string (MemoPage *mpage,
g_free (mpage->priv->subscriber_info_text);
mpage->priv->subscriber_info_text = NULL;
}
+#endif /* ACCOUNT_MGMT */
if (!check_starts_in_the_past (mpage))
memo_page_set_info_string (mpage, mpage->priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, mpage->priv->subscriber_info_text);
@@ -1110,8 +1116,10 @@ memo_page_select_organizer (MemoPage *mpage, const gchar *backend_address)
if (client)
source = e_cal_get_source (client);
+#if 0 /* ACCOUNT_MGMT */
if (source)
user_addr = e_source_get_property (source, "subscriber");
+#endif /* ACCOUNT_MGMT */
if (user_addr)
subscribed_cal = TRUE;
diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c
index e517819..9c9c897 100644
--- a/calendar/gui/dialogs/select-source-dialog.c
+++ b/calendar/gui/dialogs/select-source-dialog.c
@@ -26,6 +26,7 @@
#endif
#include <glib/gi18n.h>
+#include <libecal/e-source-calendar.h>
#include <libedataserverui/e-source-selector-dialog.h>
#include "select-source-dialog.h"
@@ -38,26 +39,23 @@ ESource *
select_source_dialog (GtkWindow *parent, ECalSourceType obj_type, ESource *except_source)
{
GtkWidget *dialog;
- ESourceList *source_list;
+ ESourceRegistry *registry;
ESource *selected_source = NULL;
- const gchar *gconf_key;
- GConfClient *conf_client;
+ const gchar *extension_name;
const gchar *icon_name = NULL;
if (obj_type == E_CAL_SOURCE_TYPE_EVENT)
- gconf_key = "/apps/evolution/calendar/sources";
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
else if (obj_type == E_CAL_SOURCE_TYPE_TODO)
- gconf_key = "/apps/evolution/tasks/sources";
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
else if (obj_type == E_CAL_SOURCE_TYPE_JOURNAL)
- gconf_key = "/apps/evolution/memos/sources";
+ extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
else
return NULL;
- conf_client = gconf_client_get_default ();
- source_list = e_source_list_new_for_gconf (conf_client, gconf_key);
-
/* create the dialog */
- dialog = e_source_selector_dialog_new (parent, source_list);
+ registry = e_source_registry_get_default ();
+ dialog = e_source_selector_dialog_new (parent, registry, extension_name);
if (obj_type == E_CAL_SOURCE_TYPE_EVENT)
icon_name = "x-office-calendar";
@@ -72,24 +70,15 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type, ESource *excep
if (except_source)
g_object_set_data (G_OBJECT (dialog), "except-source", except_source);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
- selected_source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog));
- if (selected_source) {
- gchar *absolute_uri;
-
- /* set the absolute URI on the source we keep around, since the group
- will be unrefed */
- absolute_uri = e_source_build_absolute_uri (selected_source);
- e_source_set_absolute_uri (selected_source, (const gchar *) absolute_uri);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+ goto exit;
- g_object_ref (selected_source);
- g_free (absolute_uri);
- }
- } else
- selected_source = NULL;
+ selected_source = e_source_selector_dialog_peek_primary_selection (
+ E_SOURCE_SELECTOR_DIALOG (dialog));
+ if (selected_source != NULL)
+ g_object_ref (selected_source);
- g_object_unref (conf_client);
- g_object_unref (source_list);
+exit:
gtk_widget_destroy (dialog);
return selected_source;
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 9b2df7d..92166d0 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -1446,7 +1446,9 @@ get_widgets (TaskPage *tpage)
gtk_box_pack_start (GTK_BOX (priv->list_box), sw, TRUE, TRUE, 0);
priv->source_selector = e_builder_get_widget (priv->builder, "source");
+#if 0 /* ACCOUNT_MGMT */
e_util_set_source_combo_box_list (priv->source_selector, "/apps/evolution/tasks/sources");
+#endif /* ACCOUNT_MGMT */
gtk_label_set_mnemonic_widget (GTK_LABEL (priv->calendar_label), priv->source_selector);
@@ -1746,7 +1748,7 @@ source_changed_cb (ESourceComboBox *source_combo_box, TaskPage *tpage)
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
_("Unable to open tasks in '%s'."),
- e_source_peek_name (source));
+ e_source_get_display_name (source));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
} else {
@@ -1784,6 +1786,7 @@ set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address)
client = comp_editor_get_client (editor);
source = e_cal_get_source (client);
+#if 0 /* ACCOUNT_MGMT */
if (e_source_get_property (source, "subscriber")) {
g_free (tpage->priv->subscriber_info_text);
/* Translators: This string is used when we are creating a Task
@@ -1793,6 +1796,7 @@ set_subscriber_info_string (TaskPage *tpage, const gchar *backend_address)
g_free (tpage->priv->subscriber_info_text);
tpage->priv->subscriber_info_text = NULL;
}
+#endif /* ACCOUNT_MGMT */
if (!check_starts_in_the_past (tpage))
task_page_set_info_string (tpage, tpage->priv->subscriber_info_text ? GTK_STOCK_DIALOG_INFO : NULL, tpage->priv->subscriber_info_text);
@@ -1998,8 +2002,10 @@ task_page_select_organizer (TaskPage *tpage, const gchar *backend_address)
if (client)
source = e_cal_get_source (client);
+#if 0 /* ACCOUNT_MGMT */
if (source)
user_addr = e_source_get_property (source, "subscriber");
+#endif /* ACCOUNT_MGMT */
if (user_addr)
subscribed_cal = TRUE;
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index dc23153..914403e 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -92,7 +92,7 @@ update_comp_info (ECalComponentPreview *preview,
gint *sequence = NULL;
gint comp_sequence;
- cal_uid = g_strdup (e_source_peek_uid (e_cal_get_source (ecal)));
+ cal_uid = g_strdup (e_source_get_uid (e_cal_get_source (ecal)));
e_cal_component_get_uid (comp, &uid);
comp_uid = g_strdup (uid);
e_cal_component_get_last_modified (comp, &itm);
diff --git a/calendar/gui/e-cal-config.c b/calendar/gui/e-cal-config.c
index 10dc316..c87a3be 100644
--- a/calendar/gui/e-cal-config.c
+++ b/calendar/gui/e-cal-config.c
@@ -25,6 +25,8 @@
#endif
#include <gtk/gtk.h>
+#include <gconf/gconf-client.h>
+
#include "e-cal-config.h"
static GObjectClass *ecp_parent_class;
diff --git a/calendar/gui/e-cal-event.c b/calendar/gui/e-cal-event.c
index 7d0a9d1..8d2e6d8 100644
--- a/calendar/gui/e-cal-event.c
+++ b/calendar/gui/e-cal-event.c
@@ -47,8 +47,6 @@ ece_target_free (EEvent *ev, EEventTarget *t)
ECalEventTargetBackend *s = (ECalEventTargetBackend *) t;
if (s->shell_backend)
g_object_unref (s->shell_backend);
- if (s->source_list)
- g_object_unref (s->source_list);
break; }
}
@@ -95,12 +93,11 @@ e_cal_event_peek (void)
}
ECalEventTargetBackend *
-e_cal_event_target_new_module (ECalEvent *ece, EShellBackend *shell_backend, ESourceList *source_list, guint32 flags)
+e_cal_event_target_new_module (ECalEvent *ece, EShellBackend *shell_backend, guint32 flags)
{
ECalEventTargetBackend *t = e_event_target_new (&ece->event, E_CAL_EVENT_TARGET_BACKEND, sizeof (*t));
t->shell_backend = g_object_ref (shell_backend);
- t->source_list = g_object_ref (source_list);
t->target.mask = ~flags;
return t;
diff --git a/calendar/gui/e-cal-event.h b/calendar/gui/e-cal-event.h
index 8d72a93..b194207 100644
--- a/calendar/gui/e-cal-event.h
+++ b/calendar/gui/e-cal-event.h
@@ -25,7 +25,6 @@
#define __E_CAL_EVENT_H__
#include <glib-object.h>
-#include <libedataserver/e-source-list.h>
#include "e-util/e-event.h"
#include "shell/e-shell-backend.h"
@@ -49,7 +48,6 @@ typedef struct _ECalEventTargetBackend ECalEventTargetBackend;
struct _ECalEventTargetBackend {
EEventTarget target;
EShellBackend *shell_backend;
- ESourceList *source_list;
};
struct _ECalEvent {
@@ -64,7 +62,7 @@ struct _ECalEventClass {
GType e_cal_event_get_type (void);
ECalEvent* e_cal_event_peek (void);
-ECalEventTargetBackend* e_cal_event_target_new_module (ECalEvent *ece, EShellBackend *shell_backend, ESourceList *source_list, guint32 flags);
+ECalEventTargetBackend* e_cal_event_target_new_module (ECalEvent *ece, EShellBackend *shell_backend, guint32 flags);
G_END_DECLS
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index b4a7cf2..3757e7d 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -31,7 +31,9 @@
#include <glib/gi18n.h>
#include <libedataserver/e-flag.h>
#include <libedataserver/e-time-utils.h>
+#include <libedataserver/e-source-selectable.h>
#include <libecal/e-cal-time-util.h>
+#include <libecal/e-source-calendar.h>
#include "comp-util.h"
#include "e-cal-model.h"
#include "itip-utils.h"
@@ -1542,15 +1544,19 @@ ecm_value_to_string (ETableModel *etm, gint col, gconstpointer value)
typedef struct {
const gchar *color;
- GList *uris;
+ GList *uids;
} AssignedColorData;
static const gchar *
ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
{
ESource *source;
+ ESourceSelectable *extension;
const gchar *color_spec;
+ const gchar *extension_name;
+ const gchar *uid;
gint i, first_empty = 0;
+
static AssignedColorData assigned_colors[] = {
{ "#BECEDD", NULL }, /* 190 206 221 Blue */
{ "#E2F0EF", NULL }, /* 226 240 239 Light Blue */
@@ -1566,34 +1572,48 @@ ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+ switch (e_cal_get_source_type (comp_data->client)) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ extension_name = E_SOURCE_EXTENSION_MEMO_LIST;
+ break;
+ default:
+ g_return_val_if_reached (NULL);
+ }
+
source = e_cal_get_source (comp_data->client);
- color_spec = e_source_peek_color_spec (source);
+ extension = e_source_get_extension (source, extension_name);
+ color_spec = e_source_selectable_get_color (extension);
+
if (color_spec != NULL) {
g_free (comp_data->color);
comp_data->color = g_strdup (color_spec);
return comp_data->color;
}
+ uid = e_source_get_uid (source);
+
for (i = 0; i < G_N_ELEMENTS (assigned_colors); i++) {
GList *l;
- if (assigned_colors[i].uris == NULL) {
+ if (assigned_colors[i].uids == NULL) {
first_empty = i;
continue;
}
- for (l = assigned_colors[i].uris; l != NULL; l = l->next) {
- if (!strcmp ((const gchar *) l->data,
- e_cal_get_uri (comp_data->client)))
- {
+ for (l = assigned_colors[i].uids; l != NULL; l = l->next)
+ if (g_strcmp0 (l->data, uid) == 0)
return assigned_colors[i].color;
- }
- }
}
/* return the first unused color */
- assigned_colors[first_empty].uris = g_list_append (assigned_colors[first_empty].uris,
- g_strdup (e_cal_get_uri (comp_data->client)));
+ assigned_colors[first_empty].uids = g_list_append (
+ assigned_colors[first_empty].uids, g_strdup (uid));
return assigned_colors[first_empty].color;
}
@@ -1983,6 +2003,7 @@ e_cal_model_get_client_list (ECalModel *model)
ECal *
e_cal_model_get_client_for_uri (ECalModel *model, const gchar *uri)
{
+#if 0 /* ACCOUNT_MGMT */
GList *l;
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
@@ -1994,6 +2015,7 @@ e_cal_model_get_client_for_uri (ECalModel *model, const gchar *uri)
if (!strcmp (uri, e_cal_get_uri (client_data->client)))
return client_data->client;
}
+#endif /* ACCOUNT_MGMT */
return NULL;
}
@@ -2605,9 +2627,13 @@ add_new_client (ECalModel *model, ECal *client, gboolean do_query)
if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED) {
update_e_cal_view_for_client (model, client_data);
} else {
+ ESource *source;
+ const gchar *display_name;
gchar *msg;
- msg = g_strdup_printf (_("Opening %s"), e_cal_get_uri (client));
+ source = e_cal_get_source (client);
+ display_name = e_source_get_display_name (source);
+ msg = g_strdup_printf (_("Opening %s"), display_name);
e_cal_model_update_status_message (model, msg, -1.0);
g_free (msg);
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
index 915c970..fd58a50 100644
--- a/calendar/gui/e-calendar-selector.c
+++ b/calendar/gui/e-calendar-selector.c
@@ -21,6 +21,7 @@
#include "e-calendar-selector.h"
#include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
#include "e-util/e-selection.h"
#include "common/authentication.h"
@@ -32,7 +33,10 @@ struct _ECalendarSelectorPrivate {
gint dummy_value;
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ ECalendarSelector,
+ e_calendar_selector,
+ E_TYPE_SOURCE_SELECTOR)
static gboolean
calendar_selector_update_single_object (ECal *client,
@@ -148,11 +152,10 @@ exit:
}
static void
-calendar_selector_class_init (ECalendarSelectorClass *class)
+e_calendar_selector_class_init (ECalendarSelectorClass *class)
{
ESourceSelectorClass *source_selector_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ECalendarSelectorPrivate));
source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
@@ -160,7 +163,7 @@ calendar_selector_class_init (ECalendarSelectorClass *class)
}
static void
-calendar_selector_init (ECalendarSelector *selector)
+e_calendar_selector_init (ECalendarSelector *selector)
{
selector->priv = E_CALENDAR_SELECTOR_GET_PRIVATE (selector);
@@ -171,39 +174,13 @@ calendar_selector_init (ECalendarSelector *selector)
e_drag_dest_add_calendar_targets (GTK_WIDGET (selector));
}
-GType
-e_calendar_selector_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo type_info = {
- sizeof (ECalendarSelectorClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) calendar_selector_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (ECalendarSelector),
- 0, /* n_preallocs */
- (GInstanceInitFunc) calendar_selector_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_SOURCE_SELECTOR, "ECalendarSelector",
- &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
-e_calendar_selector_new (ESourceList *source_list)
+e_calendar_selector_new (ESourceRegistry *registry)
{
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
return g_object_new (
E_TYPE_CALENDAR_SELECTOR,
- "source-list", source_list, NULL);
+ "extension-name", E_SOURCE_EXTENSION_CALENDAR,
+ "registry", registry, NULL);
}
diff --git a/calendar/gui/e-calendar-selector.h b/calendar/gui/e-calendar-selector.h
index 65d9a2f..d8aec73 100644
--- a/calendar/gui/e-calendar-selector.h
+++ b/calendar/gui/e-calendar-selector.h
@@ -21,7 +21,6 @@
#ifndef E_CALENDAR_SELECTOR_H
#define E_CALENDAR_SELECTOR_H
-#include <libedataserver/e-source-list.h>
#include <libedataserverui/e-source-selector.h>
/* Standard GObject macros */
@@ -59,7 +58,7 @@ struct _ECalendarSelectorClass {
};
GType e_calendar_selector_get_type (void);
-GtkWidget * e_calendar_selector_new (ESourceList *source_list);
+GtkWidget * e_calendar_selector_new (ESourceRegistry *registry);
G_END_DECLS
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 868b411..bb21f58 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1442,7 +1442,11 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view,
if (e_cal_is_read_only (default_client, &readonly, NULL) && readonly) {
GtkWidget *widget;
- widget = e_alert_dialog_new_for_args (parent, "calendar:prompt-read-only-cal", e_source_peek_name (e_cal_get_source (default_client)), NULL);
+ widget = e_alert_dialog_new_for_args (
+ parent, "calendar:prompt-read-only-cal",
+ e_source_get_display_name (
+ e_cal_get_source (default_client)),
+ NULL);
g_signal_connect ((GtkDialog *)widget, "response", G_CALLBACK (gtk_widget_destroy),
widget);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index e762bda..b1fc73d 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -7805,7 +7805,7 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
comp_str = icalcomponent_as_ical_string_r (vcal);
if (comp_str) {
ESource *source = e_cal_get_source (event->comp_data->client);
- const gchar *source_uid = e_source_peek_uid (source);
+ const gchar *source_uid = e_source_get_uid (source);
GdkAtom target;
gchar *tmp;
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index f3c5cb8..88bd94d 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -767,7 +767,7 @@ process_section (EMeetingListView *view, GList *destinations, icalparameter_role
ENameSelectorModel *model;
EContactStore *c_store;
GList *books, *l;
- gchar *uri = e_contact_get (contact, E_CONTACT_BOOK_URI);
+ gchar *uid = e_contact_get (contact, E_CONTACT_BOOK_URI);
dialog = e_name_selector_peek_dialog (view->priv->name_selector);
model = e_name_selector_dialog_peek_model (dialog);
@@ -775,9 +775,12 @@ process_section (EMeetingListView *view, GList *destinations, icalparameter_role
books = e_contact_store_get_books (c_store);
for (l = books; l; l = l->next) {
- EBook *b = l->data;
- if (g_str_equal (uri, e_book_get_uri (b))) {
- book = b;
+ ESource *source;
+
+ source = e_book_get_source (l->data);
+
+ if (g_strcmp0 (uid, e_source_get_uid (source)) == 0) {
+ book = E_BOOK (l->data);
break;
}
}
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index db1a8ef..839c637 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -1708,15 +1708,24 @@ async_read (GObject *source_object, GAsyncResult *res, gpointer data)
}
static void
-soup_authenticate (SoupSession *session, SoupMessage *msg, SoupAuth *auth, gboolean retrying, gpointer data)
+soup_authenticate (SoupSession *session,
+ SoupMessage *msg,
+ SoupAuth *auth,
+ gboolean retrying,
+ EMeetingStoreQueueData *qdata)
{
SoupURI *suri;
+ ECal *cal;
+ ESource *source;
const gchar *orig_uri;
gboolean tried = FALSE;
g_return_if_fail (msg != NULL);
g_return_if_fail (auth != NULL);
+ cal = e_meeting_store_get_client (qdata->store);
+ source = e_cal_get_source (cal);
+
orig_uri = g_object_get_data (G_OBJECT (msg), "orig-uri");
g_return_if_fail (orig_uri != NULL);
@@ -1736,7 +1745,7 @@ soup_authenticate (SoupSession *session, SoupMessage *msg, SoupAuth *auth, gbool
} else {
gchar *password;
- password = e_passwords_get_password ("Calendar", orig_uri);
+ password = e_passwords_get_password (source);
if (password) {
soup_auth_authenticate (auth, suri->user, password);
tried = TRUE;
@@ -1767,9 +1776,12 @@ soup_authenticate (SoupSession *session, SoupMessage *msg, SoupAuth *auth, gbool
g_string_append_printf (description, _("Failure reason: %s"), msg->reason_phrase);
}
- password = e_passwords_ask_password (_("Enter password"), "Calendar", orig_uri, description->str,
- E_PASSWORDS_REMEMBER_FOREVER | E_PASSWORDS_SECRET | E_PASSWORDS_ONLINE | (retrying ? E_PASSWORDS_REPROMPT : 0),
- &remember, NULL);
+ password = e_passwords_ask_password (
+ source, "", description->str,
+ E_PASSWORDS_REMEMBER_FOREVER |
+ E_PASSWORDS_SECRET | E_PASSWORDS_ONLINE |
+ (retrying ? E_PASSWORDS_REPROMPT : 0),
+ &remember, NULL);
g_string_free (description, TRUE);
@@ -1852,7 +1864,9 @@ download_with_libsoup (const gchar *uri, EMeetingStoreQueueData *qdata)
g_object_set_data_full (G_OBJECT (msg), "orig-uri", g_strdup (uri), g_free);
session = soup_session_async_new ();
- g_signal_connect (session, "authenticate", G_CALLBACK (soup_authenticate), NULL);
+ g_signal_connect (
+ session, "authenticate",
+ G_CALLBACK (soup_authenticate), qdata);
proxy = e_proxy_new ();
e_proxy_setup_proxy (proxy);
diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c
index 8e0ae7c..d279b21 100644
--- a/calendar/gui/e-memo-list-selector.c
+++ b/calendar/gui/e-memo-list-selector.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
#include "e-util/e-selection.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/comp-util.h"
@@ -34,7 +35,10 @@ struct _EMemoListSelectorPrivate {
gint dummy_value;
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EMemoListSelector,
+ e_memo_list_selector,
+ E_TYPE_SOURCE_SELECTOR)
static gboolean
memo_list_selector_update_single_object (ECal *client,
@@ -103,8 +107,8 @@ memo_list_selector_process_data (ESourceSelector *selector,
icalcomponent *icalcomp,
GdkDragAction action)
{
- ESourceList *source_list;
ESource *source;
+ ESourceRegistry *registry;
icalcomponent *tmp_icalcomp = NULL;
const gchar *uid;
gchar *old_uid = NULL;
@@ -142,10 +146,10 @@ memo_list_selector_process_data (ESourceSelector *selector,
if (!success || action != GDK_ACTION_MOVE)
goto exit;
- source_list = e_source_selector_get_source_list (selector);
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_source_selector_get_registry (selector);
+ source = e_source_registry_lookup_by_uid (registry, source_uid);
- if (!E_IS_SOURCE (source) || e_source_get_readonly (source))
+ if (!E_IS_SOURCE (source))
goto exit;
client = e_auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
@@ -219,11 +223,10 @@ exit:
}
static void
-memo_list_selector_class_init (EMemoListSelectorClass *class)
+e_memo_list_selector_class_init (EMemoListSelectorClass *class)
{
ESourceSelectorClass *source_selector_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMemoListSelectorPrivate));
source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
@@ -231,7 +234,7 @@ memo_list_selector_class_init (EMemoListSelectorClass *class)
}
static void
-memo_list_selector_init (EMemoListSelector *selector)
+e_memo_list_selector_init (EMemoListSelector *selector)
{
selector->priv = E_MEMO_LIST_SELECTOR_GET_PRIVATE (selector);
@@ -242,39 +245,13 @@ memo_list_selector_init (EMemoListSelector *selector)
e_drag_dest_add_calendar_targets (GTK_WIDGET (selector));
}
-GType
-e_memo_list_selector_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo type_info = {
- sizeof (EMemoListSelectorClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) memo_list_selector_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMemoListSelector),
- 0, /* n_preallocs */
- (GInstanceInitFunc) memo_list_selector_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_SOURCE_SELECTOR, "EMemoListSelector",
- &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
-e_memo_list_selector_new (ESourceList *source_list)
+e_memo_list_selector_new (ESourceRegistry *registry)
{
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
return g_object_new (
E_TYPE_MEMO_LIST_SELECTOR,
- "source-list", source_list, NULL);
+ "extension-name", E_SOURCE_EXTENSION_MEMO_LIST,
+ "registry", registry, NULL);
}
diff --git a/calendar/gui/e-memo-list-selector.h b/calendar/gui/e-memo-list-selector.h
index c10cff2..62dc0e1 100644
--- a/calendar/gui/e-memo-list-selector.h
+++ b/calendar/gui/e-memo-list-selector.h
@@ -26,7 +26,6 @@
#ifndef E_MEMO_LIST_SELECTOR_H
#define E_MEMO_LIST_SELECTOR_H
-#include <libedataserver/e-source-list.h>
#include <libedataserverui/e-source-selector.h>
/* Standard GObject macros */
@@ -64,7 +63,7 @@ struct _EMemoListSelectorClass {
};
GType e_memo_list_selector_get_type (void);
-GtkWidget * e_memo_list_selector_new (ESourceList *source_list);
+GtkWidget * e_memo_list_selector_new (ESourceRegistry *registry);
G_END_DECLS
diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c
index 317d7ca..ebbbe8d 100644
--- a/calendar/gui/e-task-list-selector.c
+++ b/calendar/gui/e-task-list-selector.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <libecal/e-cal.h>
+#include <libecal/e-source-calendar.h>
#include "e-util/e-selection.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/comp-util.h"
@@ -34,7 +35,10 @@ struct _ETaskListSelectorPrivate {
gint dummy_value;
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ ETaskListSelector,
+ e_task_list_selector,
+ E_TYPE_SOURCE_SELECTOR)
static gboolean
task_list_selector_update_single_object (ECal *client,
@@ -104,8 +108,8 @@ task_list_selector_process_data (ESourceSelector *selector,
icalcomponent *icalcomp,
GdkDragAction action)
{
- ESourceList *source_list;
ESource *source;
+ ESourceRegistry *registry;
icalcomponent *tmp_icalcomp = NULL;
const gchar *uid;
gchar *old_uid = NULL;
@@ -143,10 +147,10 @@ task_list_selector_process_data (ESourceSelector *selector,
if (!success || action != GDK_ACTION_MOVE)
goto exit;
- source_list = e_source_selector_get_source_list (selector);
- source = e_source_list_peek_source_by_uid (source_list, source_uid);
+ registry = e_source_selector_get_registry (selector);
+ source = e_source_registry_lookup_by_uid (registry, source_uid);
- if (!E_IS_SOURCE (source) || e_source_get_readonly (source))
+ if (!E_IS_SOURCE (source))
goto exit;
client = e_auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
@@ -220,11 +224,10 @@ exit:
}
static void
-task_list_selector_class_init (ETaskListSelectorClass *class)
+e_task_list_selector_class_init (ETaskListSelectorClass *class)
{
ESourceSelectorClass *source_selector_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ETaskListSelectorPrivate));
source_selector_class = E_SOURCE_SELECTOR_CLASS (class);
@@ -232,7 +235,7 @@ task_list_selector_class_init (ETaskListSelectorClass *class)
}
static void
-task_list_selector_init (ETaskListSelector *selector)
+e_task_list_selector_init (ETaskListSelector *selector)
{
selector->priv = E_TASK_LIST_SELECTOR_GET_PRIVATE (selector);
@@ -243,39 +246,13 @@ task_list_selector_init (ETaskListSelector *selector)
e_drag_dest_add_calendar_targets (GTK_WIDGET (selector));
}
-GType
-e_task_list_selector_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo type_info = {
- sizeof (ETaskListSelectorClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) task_list_selector_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (ETaskListSelector),
- 0, /* n_preallocs */
- (GInstanceInitFunc) task_list_selector_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_SOURCE_SELECTOR, "ETaskListSelector",
- &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
-e_task_list_selector_new (ESourceList *source_list)
+e_task_list_selector_new (ESourceRegistry *registry)
{
- g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
return g_object_new (
E_TYPE_TASK_LIST_SELECTOR,
- "source-list", source_list, NULL);
+ "extension-name", E_SOURCE_EXTENSION_TASK_LIST,
+ "registry", registry, NULL);
}
diff --git a/calendar/gui/e-task-list-selector.h b/calendar/gui/e-task-list-selector.h
index 847a221..735611a 100644
--- a/calendar/gui/e-task-list-selector.h
+++ b/calendar/gui/e-task-list-selector.h
@@ -26,7 +26,6 @@
#ifndef E_TASK_LIST_SELECTOR_H
#define E_TASK_LIST_SELECTOR_H
-#include <libedataserver/e-source-list.h>
#include <libedataserverui/e-source-selector.h>
/* Standard GObject macros */
@@ -64,7 +63,7 @@ struct _ETaskListSelectorClass {
};
GType e_task_list_selector_get_type (void);
-GtkWidget * e_task_list_selector_new (ESourceList *source_list);
+GtkWidget * e_task_list_selector_new (ESourceRegistry *registry);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]