[evolution] ECalendarSelector: Inherit from EClientSelector.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] ECalendarSelector: Inherit from EClientSelector.
- Date: Mon, 18 Feb 2013 20:41:25 +0000 (UTC)
commit 61e2e0005520a20913d8271b5bc80ca94a594671
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Feb 18 14:35:29 2013 -0500
ECalendarSelector: Inherit from EClientSelector.
Use e_client_selector_get_client() to obtain an EClient.
calendar/gui/e-calendar-selector.c | 25 ++++++++++++++++++-------
calendar/gui/e-calendar-selector.h | 6 +++---
modules/calendar/e-cal-shell-sidebar.c | 6 +++---
3 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
index c0bbb4c..4ced766 100644
--- a/calendar/gui/e-calendar-selector.c
+++ b/calendar/gui/e-calendar-selector.c
@@ -35,7 +35,7 @@ struct _ECalendarSelectorPrivate {
G_DEFINE_TYPE (
ECalendarSelector,
e_calendar_selector,
- E_TYPE_SOURCE_SELECTOR)
+ E_TYPE_CLIENT_SELECTOR)
static gboolean
calendar_selector_update_single_object (ECalClient *client,
@@ -127,7 +127,8 @@ client_connect_cb (GObject *source_object,
g_return_if_fail (icalcomp != NULL);
- client = e_cal_client_connect_finish (result, &error);
+ client = e_client_selector_get_client_finish (
+ E_CLIENT_SELECTOR (source_object), result, &error);
/* Sanity check. */
g_return_if_fail (
@@ -190,8 +191,8 @@ calendar_selector_data_dropped (ESourceSelector *selector,
icalcomponent_set_uid (icalcomp, uid);
}
- e_cal_client_connect (
- destination, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, NULL,
+ e_client_selector_get_client (
+ E_CLIENT_SELECTOR (selector), destination, NULL,
client_connect_cb, icalcomp);
success = TRUE;
@@ -234,12 +235,22 @@ e_calendar_selector_init (ECalendarSelector *selector)
}
GtkWidget *
-e_calendar_selector_new (ESourceRegistry *registry)
+e_calendar_selector_new (EClientCache *client_cache)
{
- g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
+ ESourceRegistry *registry;
+ GtkWidget *widget;
+
+ g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
+
+ registry = e_client_cache_ref_registry (client_cache);
- return g_object_new (
+ widget = g_object_new (
E_TYPE_CALENDAR_SELECTOR,
+ "client-cache", client_cache,
"extension-name", E_SOURCE_EXTENSION_CALENDAR,
"registry", registry, NULL);
+
+ g_object_unref (registry);
+
+ return widget;
}
diff --git a/calendar/gui/e-calendar-selector.h b/calendar/gui/e-calendar-selector.h
index 50832ea..13d1689 100644
--- a/calendar/gui/e-calendar-selector.h
+++ b/calendar/gui/e-calendar-selector.h
@@ -49,16 +49,16 @@ typedef struct _ECalendarSelectorClass ECalendarSelectorClass;
typedef struct _ECalendarSelectorPrivate ECalendarSelectorPrivate;
struct _ECalendarSelector {
- ESourceSelector parent;
+ EClientSelector parent;
ECalendarSelectorPrivate *priv;
};
struct _ECalendarSelectorClass {
- ESourceSelectorClass parent_class;
+ EClientSelectorClass parent_class;
};
GType e_calendar_selector_get_type (void);
-GtkWidget * e_calendar_selector_new (ESourceRegistry *registry);
+GtkWidget * e_calendar_selector_new (EClientCache *client_cache);
G_END_DECLS
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index fc6c0dd..650b48b 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -533,7 +533,7 @@ cal_shell_sidebar_constructed (GObject *object)
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
EShellSettings *shell_settings;
- ESourceRegistry *registry;
+ EClientCache *client_cache;
ECalendarItem *calitem;
GtkWidget *container;
GtkWidget *widget;
@@ -589,8 +589,8 @@ cal_shell_sidebar_constructed (GObject *object)
container = widget;
- registry = e_shell_get_registry (shell);
- widget = e_calendar_selector_new (registry);
+ client_cache = e_shell_get_client_cache (shell);
+ widget = e_calendar_selector_new (client_cache);
e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE);
gtk_container_add (GTK_CONTAINER (container), widget);
a11y = gtk_widget_get_accessible (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]