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

galago-commits at freedesktop.org galago-commits at freedesktop.org
Sun Apr 23 20:25:36 PDT 2006


Author: chipx86
Date: 2006-04-23 20:25:32 -0700 (Sun, 23 Apr 2006)
New Revision: 2763

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/NEWS
   trunk/notification-daemon/src/daemon.c
   trunk/notification-daemon/src/engines.c
   trunk/notification-daemon/src/engines.h
   trunk/notification-daemon/themes/standard/theme.c
Log:
Bus updates!
- Fixed a bug where a notification would duplicate its actions when updated. This closes bug #30.
- Use cairo to render the countdown timer if using gtk 2.8.0+. This makes the countdown timer all antialiased and pretty.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-04-22 00:20:29 UTC (rev 2762)
+++ trunk/notification-daemon/ChangeLog	2006-04-24 03:25:32 UTC (rev 2763)
@@ -1,3 +1,19 @@
+Sun Apr 23 16:30:28 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/daemon.c:
+	* src/engines.c:
+	* src/engines.h:
+	* themes/standard/theme.c:
+	* NEWS:
+	  - Fixed a bug where a notification would duplicate its actions when
+	    updated. This closes bug #30.
+
+Sun Apr 23 15:48:14 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* themes/standard/theme.c:
+	  - Use cairo to render the countdown timer if using gtk 2.8.0+. This
+	    makes the countdown timer all antialiased and pretty.
+
 Fri Apr 21 17:17:40 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/daemon.c:

Modified: trunk/notification-daemon/NEWS
===================================================================
--- trunk/notification-daemon/NEWS	2006-04-22 00:20:29 UTC (rev 2762)
+++ trunk/notification-daemon/NEWS	2006-04-24 03:25:32 UTC (rev 2763)
@@ -1,8 +1,10 @@
 version 0.3.5:
-	* Add two new required theme functions: theme_check_init (which
-	  determines if the theme is compatible with the version of
-	  notification-daemon) and get_theme_info (which returns info on the
-	  theme).
+	* Add three new required theme functions:
+	  - theme_check_init - determines if the theme is compatible with the
+	    running version of notification-daemon.
+	  - get_theme_info - returns info on the theme.
+	  - clear_notification_actions - Clears the notification action buttons
+	    on the window.
 	* Disabled the Bubble theme for this release. It's the source of too
 	  many bugs.
 	* Fix the scaling of different icon sizes. Now small icons display as
@@ -12,6 +14,11 @@
 	* Fixed incorrect usage of GtkIconTheme. (Bug #38)
 	* Fixed notifications with a timeout of 2147484ms or longer expiring
 	  in less than a second. (Bug #22)
+	* Fixed a bug where a notification would duplicate its actions when
+	  updated. (Bug #30)
+	* The Standard theme's countdown timer is now rendered using Cairo when
+	  compiled against Gtk 2.8.0 or higher. This improves the timer by making
+	  it antialiased.
 
 version 0.3.4 (4-February-2006):
 	* Added a Close button to notifications. This closed ticket #8. Thanks

Modified: trunk/notification-daemon/src/daemon.c
===================================================================
--- trunk/notification-daemon/src/daemon.c	2006-04-22 00:20:29 UTC (rev 2762)
+++ trunk/notification-daemon/src/daemon.c	2006-04-24 03:25:32 UTC (rev 2763)
@@ -864,6 +864,10 @@
 		g_signal_connect(G_OBJECT(nw), "destroy",
 						 G_CALLBACK(_notification_destroyed_cb), daemon);
 	}
+	else
+	{
+		theme_clear_notification_actions(nw);
+	}
 
 	theme_set_notification_text(nw, summary, body);
 	theme_set_notification_hints(nw, hints);

Modified: trunk/notification-daemon/src/engines.c
===================================================================
--- trunk/notification-daemon/src/engines.c	2006-04-22 00:20:29 UTC (rev 2762)
+++ trunk/notification-daemon/src/engines.c	2006-04-24 03:25:32 UTC (rev 2763)
@@ -26,6 +26,7 @@
 								   int x, int y);
 	void (*add_notification_action)(GtkWindow *nw, const char *label,
 									const char *key, GCallback cb);
+	void (*clear_notification_actions)(GtkWindow *nw);
 	void (*move_notification)(GtkWindow *nw, int x, int y);
 	void (*set_notification_timeout)(GtkWindow *nw, glong timeout);
 	void (*notification_tick)(GtkWindow *nw, glong timeout);
@@ -73,6 +74,7 @@
 	BIND_REQUIRED_FUNC(set_notification_icon);
 	BIND_REQUIRED_FUNC(set_notification_arrow);
 	BIND_REQUIRED_FUNC(add_notification_action);
+	BIND_REQUIRED_FUNC(clear_notification_actions);
 	BIND_REQUIRED_FUNC(move_notification);
 
 	BIND_OPTIONAL_FUNC(destroy_notification);
@@ -279,6 +281,13 @@
 }
 
 void
+theme_clear_notification_actions(GtkWindow *nw)
+{
+	ThemeEngine *engine = g_object_get_data(G_OBJECT(nw), "_theme_engine");
+	engine->clear_notification_actions(nw);
+}
+
+void
 theme_move_notification(GtkWindow *nw, int x, int y)
 {
 	ThemeEngine *engine = g_object_get_data(G_OBJECT(nw), "_theme_engine");

Modified: trunk/notification-daemon/src/engines.h
===================================================================
--- trunk/notification-daemon/src/engines.h	2006-04-22 00:20:29 UTC (rev 2762)
+++ trunk/notification-daemon/src/engines.h	2006-04-24 03:25:32 UTC (rev 2763)
@@ -19,6 +19,7 @@
 								  int x, int y);
 void theme_add_notification_action(GtkWindow *nw, const char *label,
 								   const char *key, GCallback cb);
+void theme_clear_notification_actions(GtkWindow *nw);
 void theme_move_notification(GtkWindow *nw, int x, int y);
 
 #endif /* _ENGINES_H_ */

Modified: trunk/notification-daemon/themes/standard/theme.c
===================================================================
--- trunk/notification-daemon/themes/standard/theme.c	2006-04-22 00:20:29 UTC (rev 2762)
+++ trunk/notification-daemon/themes/standard/theme.c	2006-04-24 03:25:32 UTC (rev 2763)
@@ -58,8 +58,9 @@
 #define IMAGE_SIZE    32
 #define IMAGE_PADDING 10
 #define STRIPE_WIDTH  30
-#define PIE_WIDTH     24
-#define PIE_HEIGHT    24
+#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_HEIGHT  14
@@ -417,13 +418,25 @@
 
 	if (windata->timeout > 0)
 	{
-		GdkGC *pie_gc = style->bg_gc[GTK_STATE_ACTIVE];
 		gdouble pct = (gdouble)windata->remaining / (gdouble)windata->timeout;
 
+#if GTK_CHECK_VERSION(2, 8, 0)
+		cairo_t *cr;
+
+		cr = gdk_cairo_create(GDK_DRAWABLE(windata->pie_countdown->window));
+		gdk_cairo_set_source_color(cr, &style->bg[GTK_STATE_ACTIVE]);
+
+		cairo_move_to(cr, PIE_RADIUS, PIE_RADIUS);
+		cairo_arc_negative(cr, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS,
+						   -G_PI_2, -(pct * G_PI * 2) - G_PI_2);
+		cairo_line_to(cr, PIE_RADIUS, PIE_RADIUS);
+		cairo_fill(cr);
+#else
 		gdk_draw_arc(GDK_DRAWABLE(windata->pie_countdown->window),
-					 pie_gc, TRUE,
+					 style->bg_gc[GTK_STATE_ACTIVE], TRUE,
 					 0, 0, PIE_WIDTH, PIE_HEIGHT,
 					 90 * 64, pct * 360.0 * 64.0);
+#endif
 	}
 
 	return TRUE;
@@ -512,14 +525,26 @@
 					 G_CALLBACK(action_clicked_cb), cb);
 }
 
+void
+clear_notification_actions(GtkWindow *nw)
+{
+	WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
+
+	windata->pie_countdown = NULL;
+
+	gtk_widget_hide(windata->actions_box);
+	gtk_container_foreach(GTK_CONTAINER(windata->actions_box),
+						  (GtkCallback)gtk_object_destroy, NULL);
+}
+
 #define ADD_POINT(_x, _y, shapeoffset_x, shapeoffset_y) \
-	do { \
+	G_STMT_START { \
 		windata->border_points[i].x = (_x); \
 		windata->border_points[i].y = (_y); \
 		shape_points[i].x = (_x) + (shapeoffset_x); \
 		shape_points[i].y = (_y) + (shapeoffset_y); \
 		i++;\
-	} while (0)
+	} G_STMT_END
 
 static void
 create_border_with_arrow(GtkWidget *nw, WindowData *windata)



More information about the galago-commits mailing list