gnome-panel r11163 - trunk/applets/clock



Author: vuntz
Date: Mon Jun 30 17:33:20 2008
New Revision: 11163
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11163&view=rev

Log:
2008-06-30  Vincent Untz  <vuntz gnome org>

	Use the right color for tasks and appointments.
	Patch by Sjoerd Simons <sjoerd luon net>
	Fix bug #503581

	* calendar-client.c: (get_source_color): use e_source_peek_color_spec()
	instead of deprecated e_source_get_color()
	* calendar-window.c: (set_renderer_pixbuf_color_by_column): use
	gdk_color_parse()


Modified:
   trunk/applets/clock/ChangeLog
   trunk/applets/clock/calendar-client.c
   trunk/applets/clock/calendar-window.c

Modified: trunk/applets/clock/calendar-client.c
==============================================================================
--- trunk/applets/clock/calendar-client.c	(original)
+++ trunk/applets/clock/calendar-client.c	Mon Jun 30 17:33:20 2008
@@ -738,16 +738,12 @@
 get_source_color (ECal *esource)
 {
   ESource *source;
-  guint32  color;
 
   g_return_val_if_fail (E_IS_CAL (esource), NULL);
 
   source = e_cal_get_source (esource);
-  if (e_source_get_color (source, &color)) {
-    return g_strdup_printf ("%06x", color);
-  }
-  
-  return NULL;
+
+  return g_strdup (e_source_peek_color_spec (source));
 }
 
 static gchar *

Modified: trunk/applets/clock/calendar-window.c
==============================================================================
--- trunk/applets/clock/calendar-window.c	(original)
+++ trunk/applets/clock/calendar-window.c	Mon Jun 30 17:33:20 2008
@@ -522,14 +522,18 @@
 {
         char      *color_string;
         GdkPixbuf *pixbuf = NULL;
-        guint32    color;
+        GdkColor   color;
 
         gtk_tree_model_get (model, iter, column_number, &color_string, -1);
 
-        if (color_string) {
-                sscanf (color_string, "%06x", &color);
+        if (color_string && gdk_color_parse (color_string, &color)) {
                 pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 16, 16);
-                gdk_pixbuf_fill (pixbuf, color << 8);
+                /* GdkColor has 16 bits per color, gdk_pixbuf only uses 8 bits
+                 * per color. So just drop the least significant parts */
+                gdk_pixbuf_fill (pixbuf,
+				 (color.red   & 0xff00) << 16 |
+				 (color.green & 0xff00) << 8  | 
+				 (color.blue  & 0xff00));
 
                 g_object_set (renderer, "visible", pixbuf != NULL, "pixbuf", pixbuf, NULL);
 



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