aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorLarry Ewing <lewing@ximian.com>2004-06-12 02:01:25 +0800
committerLarry Ewing <lewing@src.gnome.org>2004-06-12 02:01:25 +0800
commitef03909b1598cf22e9b36f431339cbe07f8e1bc6 (patch)
treeba43e23bea905a761de93dc3257fc9ac1e8bf3ad /widgets
parentdfea2682ce1283f50465246789720feb40a77c68 (diff)
downloadgsoc2013-evolution-ef03909b1598cf22e9b36f431339cbe07f8e1bc6.tar
gsoc2013-evolution-ef03909b1598cf22e9b36f431339cbe07f8e1bc6.tar.gz
gsoc2013-evolution-ef03909b1598cf22e9b36f431339cbe07f8e1bc6.tar.bz2
gsoc2013-evolution-ef03909b1598cf22e9b36f431339cbe07f8e1bc6.tar.lz
gsoc2013-evolution-ef03909b1598cf22e9b36f431339cbe07f8e1bc6.tar.xz
gsoc2013-evolution-ef03909b1598cf22e9b36f431339cbe07f8e1bc6.tar.zst
gsoc2013-evolution-ef03909b1598cf22e9b36f431339cbe07f8e1bc6.zip
make the source selector use a colock block instead of setting the
2004-06-11 Larry Ewing <lewing@ximian.com> * misc/e-source-selector.c: make the source selector use a colock block instead of setting the foreground to indicate the source color. svn path=/trunk/; revision=26313
Diffstat (limited to 'widgets')
-rw-r--r--widgets/ChangeLog6
-rw-r--r--widgets/misc/e-source-selector.c58
2 files changed, 50 insertions, 14 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog
index e1674cc07f..47f811c116 100644
--- a/widgets/ChangeLog
+++ b/widgets/ChangeLog
@@ -1,3 +1,9 @@
+2004-06-11 Larry Ewing <lewing@ximian.com>
+
+ * misc/e-source-selector.c: make the source selector use a colock
+ block instead of setting the foreground to indicate the source
+ color.
+
2004-05-20 Rodney Dawes <dobey@ximian.com>
* e-timezone-dialog/e-timezone-dialog.c (e_timezone_dialog_construct):
diff --git a/widgets/misc/e-source-selector.c b/widgets/misc/e-source-selector.c
index f26ce4030b..8983af5585 100644
--- a/widgets/misc/e-source-selector.c
+++ b/widgets/misc/e-source-selector.c
@@ -378,28 +378,55 @@ text_cell_data_func (GtkTreeViewColumn *column,
ESource *source;
guint32 color;
gboolean has_color;
-
+
g_assert (E_IS_SOURCE (data));
source = E_SOURCE (data);
-
+
g_object_set (renderer,
"text", e_source_peek_name (source),
"weight", PANGO_WEIGHT_NORMAL,
+ "foreground_set", FALSE,
NULL);
+ }
- has_color = e_source_get_color (source, &color);
- if (!has_color) {
- g_object_set (renderer,
- "foreground_set", FALSE,
- NULL);
- } else {
- char *color_string = g_strdup_printf ("#%06x", color);
- g_object_set (renderer,
- "foreground_set", TRUE,
- "foreground", color_string,
- NULL);
- g_free (color_string);
+ g_object_unref (data);
+}
+
+static void
+pixbuf_cell_data_func (GtkTreeViewColumn *column,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ ESourceSelector *selector)
+{
+ void *data;
+
+ gtk_tree_model_get (model, iter, 0, &data, -1);
+
+ if (E_IS_SOURCE_GROUP (data)) {
+ g_object_set (renderer,
+ "pixbuf", NULL,
+ NULL);
+ } else {
+ ESource *source;
+ guint32 color;
+ gboolean has_color;
+ GdkPixbuf *pixbuf;
+
+ g_assert (E_IS_SOURCE (data));
+ source = E_SOURCE (data);
+
+ if (e_source_get_color (source, &color)) {
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 16, 16);
+ gdk_pixbuf_fill (pixbuf, color << 8);
}
+
+ g_object_set (renderer,
+ "pixbuf", pixbuf,
+ NULL);
+
+ if (pixbuf)
+ g_object_unref (pixbuf);
}
g_object_unref (data);
@@ -710,6 +737,9 @@ init (ESourceSelector *selector)
column = gtk_tree_view_column_new ();
gtk_tree_view_append_column (GTK_TREE_VIEW (selector), column);
+ cell_renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_tree_view_column_pack_start (column, cell_renderer, FALSE);
+ gtk_tree_view_column_set_cell_data_func (column, cell_renderer, (GtkTreeCellDataFunc) pixbuf_cell_data_func, selector, NULL);
cell_renderer = gtk_cell_renderer_toggle_new ();
gtk_tree_view_column_pack_start (column, cell_renderer, FALSE);
gtk_tree_view_column_set_cell_data_func (column, cell_renderer, (GtkTreeCellDataFunc) toggle_cell_data_func, selector, NULL);