[evolution/gnome-3-8] ESelectNamesRenderer: Add a "client-cache" construct-only property.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-8] ESelectNamesRenderer: Add a "client-cache" construct-only property.
- Date: Thu, 28 Mar 2013 03:19:00 +0000 (UTC)
commit 33e7c282016cf18c446fc3ea8beebc5006f0c877
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Mar 27 20:51:02 2013 -0400
ESelectNamesRenderer: Add a "client-cache" construct-only property.
(cherry picked from commit 5ece5b9483db0ca246eea687c4e883d38306aff4)
calendar/gui/e-meeting-list-view.c | 7 +++-
calendar/gui/e-select-names-renderer.c | 61 +++++++++++++++++++++++++++++--
calendar/gui/e-select-names-renderer.h | 6 ++-
3 files changed, 67 insertions(+), 7 deletions(-)
---
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 6d6414a..e211d21 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -607,6 +607,7 @@ build_table (EMeetingListView *lview)
GtkCellRenderer *renderer;
GtkTreeView *view = GTK_TREE_VIEW (lview);
EMeetingListViewPrivate *priv;
+ EClientCache *client_cache;
GHashTable *edit_table;
GtkTreeViewColumn *col;
gint pos;
@@ -616,7 +617,9 @@ build_table (EMeetingListView *lview)
gtk_tree_view_set_headers_visible (view, TRUE);
gtk_tree_view_set_rules_hint (view, TRUE);
- renderer = e_select_names_renderer_new ();
+ client_cache = e_name_selector_ref_client_cache (priv->name_selector);
+
+ renderer = e_select_names_renderer_new (client_cache);
g_object_set (renderer, "editable", TRUE, NULL);
/* The extra space is just a hack to occupy more space for Attendee */
pos = gtk_tree_view_insert_column_with_attributes (
@@ -702,6 +705,8 @@ build_table (EMeetingListView *lview)
g_hash_table_insert (edit_table, GINT_TO_POINTER (E_MEETING_STORE_STATUS_COL), renderer);
priv->renderers = edit_table;
+
+ g_object_unref (client_cache);
}
static void
diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c
index 8b8f20a..8450d9b 100644
--- a/calendar/gui/e-select-names-renderer.c
+++ b/calendar/gui/e-select-names-renderer.c
@@ -24,8 +24,6 @@
#include <config.h>
#endif
-#include "e-util/e-util.h"
-
#include "e-select-names-editable.h"
#include "e-select-names-renderer.h"
@@ -34,6 +32,7 @@
((obj), E_TYPE_SELECT_NAMES_RENDERER, ESelectNamesRendererPrivate))
struct _ESelectNamesRendererPrivate {
+ EClientCache *client_cache;
ESelectNamesEditable *editable;
gchar *path;
@@ -43,6 +42,7 @@ struct _ESelectNamesRendererPrivate {
enum {
PROP_0,
+ PROP_CLIENT_CACHE,
PROP_NAME,
PROP_EMAIL
};
@@ -113,12 +113,28 @@ cleanup:
}
static void
+select_names_renderer_set_client_cache (ESelectNamesRenderer *renderer,
+ EClientCache *client_cache)
+{
+ g_return_if_fail (E_IS_CLIENT_CACHE (client_cache));
+ g_return_if_fail (renderer->priv->client_cache == NULL);
+
+ renderer->priv->client_cache = g_object_ref (client_cache);
+}
+
+static void
select_names_renderer_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_CLIENT_CACHE:
+ select_names_renderer_set_client_cache (
+ E_SELECT_NAMES_RENDERER (object),
+ g_value_get_object (value));
+ return;
+
case PROP_NAME:
e_select_names_renderer_set_name (
E_SELECT_NAMES_RENDERER (object),
@@ -142,6 +158,13 @@ select_names_renderer_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_CLIENT_CACHE:
+ g_value_take_object (
+ value,
+ e_select_names_renderer_ref_client_cache (
+ E_SELECT_NAMES_RENDERER (object)));
+ return;
+
case PROP_NAME:
g_value_set_string (
value,
@@ -167,6 +190,7 @@ select_names_renderer_dispose (GObject *object)
priv = E_SELECT_NAMES_RENDERER_GET_PRIVATE (object);
+ g_clear_object (&priv->client_cache);
g_clear_object (&priv->editable);
/* Chain up to parent's dispose() method. */
@@ -250,6 +274,23 @@ e_select_names_renderer_class_init (ESelectNamesRendererClass *class)
renderer_class = GTK_CELL_RENDERER_CLASS (class);
renderer_class->start_editing = select_names_renderer_start_editing;
+ /**
+ * ESelectNamesRenderer:client-cache:
+ *
+ * Cache of shared #EClient instances.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_CLIENT_CACHE,
+ g_param_spec_object (
+ "client-cache",
+ "Client Cache",
+ "Cache of shared EClient instances",
+ E_TYPE_CLIENT_CACHE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (
object_class,
PROP_NAME,
@@ -292,9 +333,21 @@ e_select_names_renderer_init (ESelectNamesRenderer *renderer)
}
GtkCellRenderer *
-e_select_names_renderer_new (void)
+e_select_names_renderer_new (EClientCache *client_cache)
{
- return g_object_new (E_TYPE_SELECT_NAMES_RENDERER, NULL);
+ g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL);
+
+ return g_object_new (
+ E_TYPE_SELECT_NAMES_RENDERER,
+ "client-cache", client_cache, NULL);
+}
+
+EClientCache *
+e_select_names_renderer_ref_client_cache (ESelectNamesRenderer *renderer)
+{
+ g_return_val_if_fail (E_IS_SELECT_NAMES_RENDERER (renderer), NULL);
+
+ return g_object_ref (renderer->priv->client_cache);
}
const gchar *
diff --git a/calendar/gui/e-select-names-renderer.h b/calendar/gui/e-select-names-renderer.h
index 472a88f..9b48318 100644
--- a/calendar/gui/e-select-names-renderer.h
+++ b/calendar/gui/e-select-names-renderer.h
@@ -24,7 +24,7 @@
#ifndef E_SELECT_NAMES_RENDERER_H
#define E_SELECT_NAMES_RENDERER_H
-#include <gtk/gtk.h>
+#include <e-util/e-util.h>
/* Standard GObject macros */
#define E_TYPE_SELECT_NAMES_RENDERER \
@@ -68,7 +68,9 @@ struct _ESelectNamesRendererClass {
GType e_select_names_renderer_get_type
(void) G_GNUC_CONST;
GtkCellRenderer *
- e_select_names_renderer_new (void);
+ e_select_names_renderer_new (EClientCache *client_cache);
+EClientCache * e_select_names_renderer_ref_client_cache
+ (ESelectNamesRenderer *renderer);
const gchar * e_select_names_renderer_get_name
(ESelectNamesRenderer *renderer);
void e_select_names_renderer_set_name
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]