[Galago-commits] r2963 - in trunk/notification-daemon: . src/themes/standard

galago-commits at freedesktop.org galago-commits at freedesktop.org
Sat Jan 13 01:20:53 PST 2007


Author: chipx86
Date: 2007-01-13 01:20:46 -0800 (Sat, 13 Jan 2007)
New Revision: 2963

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/src/themes/standard/theme.c
Log:
Added a work in progress gradient-happy mode that must be enabled by defining ENABLE_GRADIENT_LOOK in theme.c.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2007-01-13 08:19:30 UTC (rev 2962)
+++ trunk/notification-daemon/ChangeLog	2007-01-13 09:20:46 UTC (rev 2963)
@@ -1,3 +1,9 @@
+Sat Jan 13 01:20:23 PST 2007  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/themes/standard/theme.c:
+	  - Added a work in progress gradient-happy mode that must be enabled by
+	    defining ENABLE_GRADIENT_LOOK in theme.c.
+
 Sat Jan 13 00:18:40 PST 2007  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/themes/standard/theme.c:

Modified: trunk/notification-daemon/src/themes/standard/theme.c
===================================================================
--- trunk/notification-daemon/src/themes/standard/theme.c	2007-01-13 08:19:30 UTC (rev 2962)
+++ trunk/notification-daemon/src/themes/standard/theme.c	2007-01-13 09:20:46 UTC (rev 2963)
@@ -58,18 +58,27 @@
 	URGENCY_CRITICAL
 };
 
+//#define ENABLE_GRADIENT_LOOK
+
+#ifdef ENABLE_GRADIENT_LOOK
+# define STRIPE_WIDTH  45
+#else
+# define STRIPE_WIDTH  30
+#endif
+
 #define WIDTH         400
 #define IMAGE_SIZE    32
 #define IMAGE_PADDING 10
-#define STRIPE_WIDTH  30
+#define SPACER_LEFT   30
 #define PIE_RADIUS    12
 #define PIE_WIDTH     (2 * PIE_RADIUS)
 #define PIE_HEIGHT    (2 * PIE_RADIUS)
 #define BODY_X_OFFSET (IMAGE_SIZE + 8)
-#define DEFAULT_ARROW_OFFSET  (STRIPE_WIDTH + 2)
+#define DEFAULT_ARROW_OFFSET  (SPACER_LEFT + 2)
 #define DEFAULT_ARROW_HEIGHT  14
 #define DEFAULT_ARROW_WIDTH   28
 #define BACKGROUND_OPACITY    0.92
+#define BOTTOM_GRADIENT_HEIGHT 30
 
 #if GTK_CHECK_VERSION(2, 8, 0)
 # define USE_CAIRO
@@ -86,6 +95,10 @@
 {
 	GtkStyle *style = gtk_widget_get_style(widget);
 	GdkColor *background_color = &style->base[GTK_STATE_NORMAL];
+#ifdef ENABLE_GRADIENT_LOOK
+	cairo_pattern_t *gradient;
+	int gradient_y = widget->allocation.height - BOTTOM_GRADIENT_HEIGHT;
+#endif
 
 	if (windata->enable_transparency)
 	{
@@ -104,6 +117,19 @@
 					widget->allocation.width,
 					widget->allocation.height);
 	cairo_fill(cr);
+
+#ifdef ENABLE_GRADIENT_LOOK
+	/* Add a very subtle gradient to the bottom of the notification */
+	gradient = cairo_pattern_create_linear(0, gradient_y, 0,
+										   widget->allocation.height);
+	cairo_pattern_add_color_stop_rgba(gradient, 0, 0, 0, 0, 0);
+	cairo_pattern_add_color_stop_rgba(gradient, 1, 0, 0, 0, 0.15);
+	cairo_rectangle(cr, 0, gradient_y, widget->allocation.width,
+					BOTTOM_GRADIENT_HEIGHT);
+	cairo_set_source(cr, gradient);
+	cairo_fill(cr);
+	cairo_pattern_destroy(gradient);
+#endif
 }
 #else /* !USE_CAIRO */
 static void
@@ -125,6 +151,13 @@
 {
 	GtkStyle *style = gtk_widget_get_style(widget);
 	GdkColor color;
+	int stripe_x = windata->main_hbox->allocation.x + 1;
+	int stripe_y = windata->main_hbox->allocation.y + 1;
+	int stripe_height = windata->main_hbox->allocation.height - 2;
+#ifdef ENABLE_GRADIENT_LOOK
+	cairo_pattern_t *gradient;
+	double r, g, b;
+#endif
 
 	switch (windata->urgency)
 	{
@@ -142,13 +175,23 @@
 			break;
 	}
 
+	cairo_rectangle(cr, stripe_x, stripe_y, STRIPE_WIDTH, stripe_height);
+
+#ifdef ENABLE_GRADIENT_LOOK
+	r = color.red   / 65535.0;
+	g = color.green / 65535.0;
+	b = color.blue  / 65535.0;
+
+	gradient = cairo_pattern_create_linear(stripe_x, 0, STRIPE_WIDTH, 0);
+	cairo_pattern_add_color_stop_rgba(gradient, 0, r, g, b, 1);
+	cairo_pattern_add_color_stop_rgba(gradient, 1, r, g, b, 0);
+	cairo_set_source(cr, gradient);
+	cairo_fill(cr);
+	cairo_pattern_destroy(gradient);
+#else
 	gdk_cairo_set_source_color(cr, &color);
-	cairo_rectangle(cr,
-			windata->main_hbox->allocation.x + 1,
-			windata->main_hbox->allocation.y + 1,
-			STRIPE_WIDTH,
-			windata->main_hbox->allocation.height - 2);
 	cairo_fill(cr);
+#endif
 }
 #else /* !USE_CAIRO */
 static void
@@ -707,7 +750,7 @@
 	spacer = gtk_image_new();
 	gtk_widget_show(spacer);
 	gtk_box_pack_start(GTK_BOX(hbox), spacer, FALSE, FALSE, 0);
-	gtk_widget_set_size_request(spacer, STRIPE_WIDTH, -1);
+	gtk_widget_set_size_request(spacer, SPACER_LEFT, -1);
 
 	windata->summary_label = gtk_label_new(NULL);
 	gtk_widget_show(windata->summary_label);



More information about the galago-commits mailing list