[evolution] EAddressbookSelector: Inherit from EClientSelector.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EAddressbookSelector: Inherit from EClientSelector.
- Date: Mon, 18 Feb 2013 20:41:20 +0000 (UTC)
commit c3ea33df618adcf49fc4294454e1ea1745544a62
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Feb 18 13:42:54 2013 -0500
EAddressbookSelector: Inherit from EClientSelector.
Use e_client_selector_get_client() to obtain an EClient.
addressbook/gui/widgets/e-addressbook-selector.c | 26 ++++++++++++++++------
addressbook/gui/widgets/e-addressbook-selector.h | 6 ++--
modules/addressbook/e-book-shell-sidebar.c | 8 +++---
3 files changed, 26 insertions(+), 14 deletions(-)
---
diff --git a/addressbook/gui/widgets/e-addressbook-selector.c
b/addressbook/gui/widgets/e-addressbook-selector.c
index 73a3334..0ae747f 100644
--- a/addressbook/gui/widgets/e-addressbook-selector.c
+++ b/addressbook/gui/widgets/e-addressbook-selector.c
@@ -65,7 +65,7 @@ static GtkTargetEntry drag_types[] = {
G_DEFINE_TYPE (
EAddressbookSelector,
e_addressbook_selector,
- E_TYPE_SOURCE_SELECTOR)
+ E_TYPE_CLIENT_SELECTOR)
static void
merge_context_next (MergeContext *merge_context)
@@ -257,7 +257,8 @@ target_client_connect_cb (GObject *source_object,
g_return_if_fail (merge_context != NULL);
- client = e_book_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 (
@@ -327,8 +328,9 @@ addressbook_selector_data_dropped (ESourceSelector *selector,
merge_context->remove_from_source = remove_from_source;
merge_context->pending_adds = TRUE;
- e_book_client_connect (
- destination, NULL, target_client_connect_cb, merge_context);
+ e_client_selector_get_client (
+ E_CLIENT_SELECTOR (selector), destination, NULL,
+ target_client_connect_cb, merge_context);
return TRUE;
}
@@ -381,14 +383,24 @@ e_addressbook_selector_init (EAddressbookSelector *selector)
}
GtkWidget *
-e_addressbook_selector_new (ESourceRegistry *registry)
+e_addressbook_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_ADDRESSBOOK_SELECTOR,
+ "client-cache", client_cache,
"extension-name", E_SOURCE_EXTENSION_ADDRESS_BOOK,
"registry", registry, NULL);
+
+ g_object_unref (registry);
+
+ return widget;
}
EAddressbookView *
diff --git a/addressbook/gui/widgets/e-addressbook-selector.h
b/addressbook/gui/widgets/e-addressbook-selector.h
index 663f586..3746bc3 100644
--- a/addressbook/gui/widgets/e-addressbook-selector.h
+++ b/addressbook/gui/widgets/e-addressbook-selector.h
@@ -49,16 +49,16 @@ typedef struct _EAddressbookSelectorClass EAddressbookSelectorClass;
typedef struct _EAddressbookSelectorPrivate EAddressbookSelectorPrivate;
struct _EAddressbookSelector {
- ESourceSelector parent;
+ EClientSelector parent;
EAddressbookSelectorPrivate *priv;
};
struct _EAddressbookSelectorClass {
- ESourceSelectorClass parent_class;
+ EClientSelectorClass parent_class;
};
GType e_addressbook_selector_get_type (void);
-GtkWidget * e_addressbook_selector_new (ESourceRegistry *registry);
+GtkWidget * e_addressbook_selector_new (EClientCache *client_cache);
EAddressbookView *
e_addressbook_selector_get_current_view
(EAddressbookSelector *selector);
diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c
index 6e9e348..094e825 100644
--- a/modules/addressbook/e-book-shell-sidebar.c
+++ b/modules/addressbook/e-book-shell-sidebar.c
@@ -94,7 +94,7 @@ book_shell_sidebar_constructed (GObject *object)
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
EShellSettings *shell_settings;
- ESourceRegistry *registry;
+ EClientCache *client_cache;
GtkContainer *container;
GtkWidget *widget;
@@ -123,8 +123,8 @@ book_shell_sidebar_constructed (GObject *object)
container = GTK_CONTAINER (widget);
- registry = e_shell_get_registry (shell);
- widget = e_addressbook_selector_new (registry);
+ client_cache = e_shell_get_client_cache (shell);
+ widget = e_addressbook_selector_new (client_cache);
gtk_container_add (GTK_CONTAINER (container), widget);
priv->selector = g_object_ref (widget);
gtk_widget_show (widget);
@@ -136,7 +136,7 @@ book_shell_sidebar_constructed (GObject *object)
G_BINDING_SYNC_CREATE,
(GBindingTransformFunc) e_binding_transform_uid_to_source,
(GBindingTransformFunc) e_binding_transform_source_to_uid,
- g_object_ref (registry),
+ e_client_cache_ref_registry (client_cache),
(GDestroyNotify) g_object_unref);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]