[evolution] Bug 696715 - ESelectNamesEditable needs an EClientCache



commit 4c5e629f518fa03610e69c970337d9f7d625a50b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Mar 27 21:16:56 2013 -0400

    Bug 696715 - ESelectNamesEditable needs an EClientCache

 calendar/gui/e-select-names-editable.c |   12 +++---------
 calendar/gui/e-select-names-editable.h |    2 +-
 calendar/gui/e-select-names-renderer.c |    7 ++++++-
 3 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/calendar/gui/e-select-names-editable.c b/calendar/gui/e-select-names-editable.c
index b9a2b1d..2cc4a76 100644
--- a/calendar/gui/e-select-names-editable.c
+++ b/calendar/gui/e-select-names-editable.c
@@ -49,19 +49,13 @@ e_select_names_editable_init (ESelectNamesEditable *esne)
 }
 
 GtkWidget *
-e_select_names_editable_new (void)
+e_select_names_editable_new (EClientCache *client_cache)
 {
-       EShell *shell;
-
-       /* Might be cleaner to have 'registry' passed in, but the call chain
-        * of this widget doesn't have access that low in the functions, thus
-        * making the change without (private) API break. */
-       shell = e_shell_get_default ();
+       g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
 
        return g_object_new (
                E_TYPE_SELECT_NAMES_EDITABLE,
-               "registry", e_shell_get_registry (shell),
-               NULL);
+               "client-cache", client_cache, NULL);
 }
 
 gchar *
diff --git a/calendar/gui/e-select-names-editable.h b/calendar/gui/e-select-names-editable.h
index 84e499b..6fae41a 100644
--- a/calendar/gui/e-select-names-editable.h
+++ b/calendar/gui/e-select-names-editable.h
@@ -62,7 +62,7 @@ struct _ESelectNamesEditableClass {
 
 GType          e_select_names_editable_get_type
                                                (void) G_GNUC_CONST;
-GtkWidget *    e_select_names_editable_new     (void);
+GtkWidget *    e_select_names_editable_new     (EClientCache *client_cache);
 gchar *                e_select_names_editable_get_email
                                                (ESelectNamesEditable *esne);
 GList *                e_select_names_editable_get_emails
diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c
index 8450d9b..0154745 100644
--- a/calendar/gui/e-select-names-renderer.c
+++ b/calendar/gui/e-select-names-renderer.c
@@ -225,6 +225,7 @@ select_names_renderer_start_editing (GtkCellRenderer *cell,
 {
        ESelectNamesRenderer *sn_cell = E_SELECT_NAMES_RENDERER (cell);
        GtkCellRendererText *text_cell = GTK_CELL_RENDERER_TEXT (cell);
+       EClientCache *client_cache;
        GtkWidget *editable;
        gboolean is_editable;
        gfloat xalign;
@@ -237,7 +238,9 @@ select_names_renderer_start_editing (GtkCellRenderer *cell,
        if (!is_editable)
                return NULL;
 
-       editable = e_select_names_editable_new ();
+       client_cache = e_select_names_renderer_ref_client_cache (sn_cell);
+
+       editable = e_select_names_editable_new (client_cache);
        gtk_entry_set_has_frame (GTK_ENTRY (editable), FALSE);
        gtk_entry_set_alignment (GTK_ENTRY (editable), xalign);
        if (sn_cell->priv->email != NULL && *sn_cell->priv->email != '\0')
@@ -254,6 +257,8 @@ select_names_renderer_start_editing (GtkCellRenderer *cell,
        sn_cell->priv->editable = g_object_ref (editable);
        sn_cell->priv->path = g_strdup (path);
 
+       g_object_unref (client_cache);
+
        return GTK_CELL_EDITABLE (editable);
 }
 


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