[evolution] ETaskListSelector: Inherit from EClientSelector.



commit ac7c1d3c75d67bfd365af0547e0a63571d6270c9
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Feb 18 14:58:48 2013 -0500

    ETaskListSelector: Inherit from EClientSelector.
    
    Use e_client_selector_get_client() to obtain an EClient.

 calendar/gui/e-task-list-selector.c     |   32 +++++++++++++++++++++---------
 calendar/gui/e-task-list-selector.h     |    6 ++--
 modules/calendar/e-task-shell-sidebar.c |    6 ++--
 3 files changed, 28 insertions(+), 16 deletions(-)
---
diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c
index c82ef40..e48b962 100644
--- a/calendar/gui/e-task-list-selector.c
+++ b/calendar/gui/e-task-list-selector.c
@@ -38,7 +38,7 @@ struct _ETaskListSelectorPrivate {
 G_DEFINE_TYPE (
        ETaskListSelector,
        e_task_list_selector,
-       E_TYPE_SOURCE_SELECTOR)
+       E_TYPE_CLIENT_SELECTOR)
 
 static gboolean
 task_list_selector_update_single_object (ECalClient *client,
@@ -129,7 +129,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 (
@@ -206,8 +207,8 @@ task_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);
        }
@@ -238,7 +239,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 (
@@ -316,8 +318,8 @@ task_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_TASKS, NULL,
+       e_client_selector_get_client (
+               E_CLIENT_SELECTOR (selector), destination, NULL,
                client_connect_for_drop_cb, dd);
 
        return TRUE;
@@ -351,12 +353,22 @@ e_task_list_selector_init (ETaskListSelector *selector)
 }
 
 GtkWidget *
-e_task_list_selector_new (ESourceRegistry *registry)
+e_task_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_TASK_LIST_SELECTOR,
+               "client-cache", client_cache,
                "extension-name", E_SOURCE_EXTENSION_TASK_LIST,
                "registry", registry, NULL);
+
+       g_object_unref (registry);
+
+       return widget;
 }
diff --git a/calendar/gui/e-task-list-selector.h b/calendar/gui/e-task-list-selector.h
index df79d5f..1c0ba17 100644
--- a/calendar/gui/e-task-list-selector.h
+++ b/calendar/gui/e-task-list-selector.h
@@ -54,16 +54,16 @@ typedef struct _ETaskListSelectorClass ETaskListSelectorClass;
 typedef struct _ETaskListSelectorPrivate ETaskListSelectorPrivate;
 
 struct _ETaskListSelector {
-       ESourceSelector parent;
+       EClientSelector parent;
        ETaskListSelectorPrivate *priv;
 };
 
 struct _ETaskListSelectorClass {
-       ESourceSelectorClass parent_class;
+       EClientSelectorClass parent_class;
 };
 
 GType          e_task_list_selector_get_type   (void);
-GtkWidget *    e_task_list_selector_new        (ESourceRegistry *registry);
+GtkWidget *    e_task_list_selector_new        (EClientCache *client_cache);
 
 G_END_DECLS
 
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index bdd5c4d..143f59a 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -495,7 +495,7 @@ task_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 @@ task_shell_sidebar_constructed (GObject *object)
 
        container = GTK_CONTAINER (widget);
 
-       registry = e_shell_get_registry (shell);
-       widget = e_task_list_selector_new (registry);
+       client_cache = e_shell_get_client_cache (shell);
+       widget = e_task_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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]