diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-02-19 03:50:01 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-02-19 03:50:01 +0800 |
commit | 92a3fce79c8acb244bcaf23d22e38e3f21f80c36 (patch) | |
tree | 77ae0b13721c71f4fa4dc0c914048c29f34062dc | |
parent | 61e2e0005520a20913d8271b5bc80ca94a594671 (diff) | |
download | gsoc2013-evolution-92a3fce79c8acb244bcaf23d22e38e3f21f80c36.tar.gz gsoc2013-evolution-92a3fce79c8acb244bcaf23d22e38e3f21f80c36.tar.zst gsoc2013-evolution-92a3fce79c8acb244bcaf23d22e38e3f21f80c36.zip |
EMemoListSelector: Inherit from EClientSelector.
Use e_client_selector_get_client() to obtain an EClient.
-rw-r--r-- | calendar/gui/e-memo-list-selector.c | 32 | ||||
-rw-r--r-- | calendar/gui/e-memo-list-selector.h | 6 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-sidebar.c | 6 |
3 files changed, 28 insertions, 16 deletions
diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c index b5fd4216e0..f52a2a6bcf 100644 --- a/calendar/gui/e-memo-list-selector.c +++ b/calendar/gui/e-memo-list-selector.c @@ -38,7 +38,7 @@ struct _EMemoListSelectorPrivate { G_DEFINE_TYPE ( EMemoListSelector, e_memo_list_selector, - E_TYPE_SOURCE_SELECTOR) + E_TYPE_CLIENT_SELECTOR) static gboolean memo_list_selector_update_single_object (ECalClient *client, @@ -128,7 +128,8 @@ client_connect_cb (GObject *source_object, g_return_if_fail (uid != 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 ( @@ -204,8 +205,8 @@ memo_list_selector_process_data (ESourceSelector *selector, source = e_source_registry_ref_source (registry, source_uid); if (source != NULL) { - e_cal_client_connect ( - source, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL, + e_client_selector_get_client ( + E_CLIENT_SELECTOR (selector), source, NULL, client_connect_cb, g_strdup (old_uid)); g_object_unref (source); } @@ -236,7 +237,8 @@ client_connect_for_drop_cb (GObject *source_object, g_return_if_fail (dd != 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 ( @@ -314,8 +316,8 @@ memo_list_selector_data_dropped (ESourceSelector *selector, dd->action = action; dd->list = cal_comp_selection_get_string_list (selection_data); - e_cal_client_connect ( - destination, E_CAL_CLIENT_SOURCE_TYPE_MEMOS, NULL, + e_client_selector_get_client ( + E_CLIENT_SELECTOR (selector), destination, NULL, client_connect_for_drop_cb, dd); return TRUE; @@ -349,12 +351,22 @@ e_memo_list_selector_init (EMemoListSelector *selector) } GtkWidget * -e_memo_list_selector_new (ESourceRegistry *registry) +e_memo_list_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_MEMO_LIST_SELECTOR, + "client-cache", client_cache, "extension-name", E_SOURCE_EXTENSION_MEMO_LIST, "registry", registry, NULL); + + g_object_unref (registry); + + return widget; } diff --git a/calendar/gui/e-memo-list-selector.h b/calendar/gui/e-memo-list-selector.h index 532fd312c6..e29bfb3133 100644 --- a/calendar/gui/e-memo-list-selector.h +++ b/calendar/gui/e-memo-list-selector.h @@ -54,16 +54,16 @@ typedef struct _EMemoListSelectorClass EMemoListSelectorClass; typedef struct _EMemoListSelectorPrivate EMemoListSelectorPrivate; struct _EMemoListSelector { - ESourceSelector parent; + EClientSelector parent; EMemoListSelectorPrivate *priv; }; struct _EMemoListSelectorClass { - ESourceSelectorClass parent_class; + EClientSelectorClass parent_class; }; GType e_memo_list_selector_get_type (void); -GtkWidget * e_memo_list_selector_new (ESourceRegistry *registry); +GtkWidget * e_memo_list_selector_new (EClientCache *client_cache); G_END_DECLS diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c index 74942fa5fd..3040c2ccc1 100644 --- a/modules/calendar/e-memo-shell-sidebar.c +++ b/modules/calendar/e-memo-shell-sidebar.c @@ -495,7 +495,7 @@ memo_shell_sidebar_constructed (GObject *object) EShellView *shell_view; EShellWindow *shell_window; EShellSidebar *shell_sidebar; - ESourceRegistry *registry; + EClientCache *client_cache; GtkContainer *container; GtkWidget *widget; AtkObject *a11y; @@ -523,8 +523,8 @@ memo_shell_sidebar_constructed (GObject *object) container = GTK_CONTAINER (widget); - registry = e_shell_get_registry (shell); - widget = e_memo_list_selector_new (registry); + client_cache = e_shell_get_client_cache (shell); + widget = e_memo_list_selector_new (client_cache); e_source_selector_set_select_new (E_SOURCE_SELECTOR (widget), TRUE); gtk_container_add (container, widget); a11y = gtk_widget_get_accessible (widget); |