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

galago-commits at freedesktop.org galago-commits at freedesktop.org
Fri Apr 21 15:23:21 PDT 2006


Author: chipx86
Date: 2006-04-21 15:23:17 -0700 (Fri, 21 Apr 2006)
New Revision: 2757

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/NEWS
   trunk/notification-daemon/configure.ac
   trunk/notification-daemon/src/engines.c
   trunk/notification-daemon/themes/Makefile.am
   trunk/notification-daemon/themes/standard/theme.c
Log:
- 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).
- Disabled the Bubble theme for this release. It's the source of too many bugs.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-04-21 21:39:06 UTC (rev 2756)
+++ trunk/notification-daemon/ChangeLog	2006-04-21 22:23:17 UTC (rev 2757)
@@ -1,3 +1,17 @@
+Fri Apr 21 15:21:45 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/engines.c:
+	* themes/Makefile.am:
+	* themes/standard/theme.c:
+	* NEWS:
+	* configure.ac:
+	  - 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).
+	  - Disabled the Bubble theme for this release. It's the source of too
+	    many bugs.
+
 Tue Apr 11 22:54:13 PDT 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* themes/bubble/eggnotificationbubblewidget.c:

Modified: trunk/notification-daemon/NEWS
===================================================================
--- trunk/notification-daemon/NEWS	2006-04-21 21:39:06 UTC (rev 2756)
+++ trunk/notification-daemon/NEWS	2006-04-21 22:23:17 UTC (rev 2757)
@@ -1,3 +1,11 @@
+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).
+	* Disabled the Bubble theme for this release. It's the source of too
+	  many bugs.
+
 version 0.3.4 (4-February-2006):
 	* Added a Close button to notifications. This closed ticket #8. Thanks
 	  to Michael Vogt for the basis of this patch.

Modified: trunk/notification-daemon/configure.ac
===================================================================
--- trunk/notification-daemon/configure.ac	2006-04-21 21:39:06 UTC (rev 2756)
+++ trunk/notification-daemon/configure.ac	2006-04-21 22:23:17 UTC (rev 2757)
@@ -3,7 +3,7 @@
 dnl ################################################################
 dnl # Initialize autoconf
 dnl ################################################################
-AC_INIT(notification-daemon, 0.3.4, galago-devel at lists.freedesktop.org)
+AC_INIT(notification-daemon, 0.3.4.90, galago-devel at lists.freedesktop.org)
 AC_PREREQ(2.50)
 AC_CONFIG_SRCDIR(config.h.in)
 AC_COPYRIGHT([Copyright 2006 Christian Hammond])
@@ -15,7 +15,7 @@
 NOTIFICATION_DAEMON_MAJOR_VERSION=0
 NOTIFICATION_DAEMON_MINOR_VERSION=3
 NOTIFICATION_DAEMON_MICRO_VERSION=4
-NOTIFICATION_DAEMON_DEVEL_VERSION=0
+NOTIFICATION_DAEMON_DEVEL_VERSION=90
 
 NOTIFICATION_DAEMON_VERSION=$NOTIFICATION_DAEMON_MAJOR_VERSION.$NOTIFICATION_DAEMON_MINOR_VERSION.$NOTIFICATION_DAEMON_MICRO_VERSION
 

Modified: trunk/notification-daemon/src/engines.c
===================================================================
--- trunk/notification-daemon/src/engines.c	2006-04-21 21:39:06 UTC (rev 2756)
+++ trunk/notification-daemon/src/engines.c	2006-04-21 22:23:17 UTC (rev 2757)
@@ -9,6 +9,11 @@
 	GModule *module;
 	guint ref_count;
 
+	gboolean (*theme_check_init)(unsigned int major_ver,
+								 unsigned int minor_ver,
+								 unsigned int micro_ver);
+	void (*get_theme_info)(char **theme_name, char **theme_ver,
+						   char **author, char **homepage);
 	GtkWindow *(*create_notification)(UrlClickedCb url_clicked_cb);
 	void (*destroy_notification)(GtkWindow *nw);
 	void (*show_notification)(GtkWindow *nw);
@@ -48,25 +53,21 @@
 	g_free(path);
 
 	if (engine->module == NULL)
-	{
-		g_free(engine);
-		return NULL;
-	}
+		goto error;
 
 #define BIND_REQUIRED_FUNC(name) \
 	if (!g_module_symbol(engine->module, #name, (gpointer *)&engine->name)) \
 	{ \
 		/* Too harsh! Fall back to default. */ \
 		g_error("Theme doesn't provide the required function '%s'", #name); \
-		if (!g_module_close(engine->module)) \
-			g_warning("%s: %s", filename, g_module_error()); \
-		\
-		g_free(engine); \
+		goto error; \
 	}
 
 #define BIND_OPTIONAL_FUNC(name) \
 	g_module_symbol(engine->module, #name, (gpointer *)&engine->name);
 
+	BIND_REQUIRED_FUNC(theme_check_init);
+	BIND_REQUIRED_FUNC(get_theme_info);
 	BIND_REQUIRED_FUNC(create_notification);
 	BIND_REQUIRED_FUNC(set_notification_text);
 	BIND_REQUIRED_FUNC(set_notification_icon);
@@ -81,7 +82,22 @@
 	BIND_OPTIONAL_FUNC(set_notification_hints);
 	BIND_OPTIONAL_FUNC(notification_tick);
 
+	if (!engine->theme_check_init(NOTIFICATION_DAEMON_MAJOR_VERSION,
+								  NOTIFICATION_DAEMON_MINOR_VERSION,
+								  NOTIFICATION_DAEMON_MICRO_VERSION))
+	{
+		g_error("Theme doesn't work with this version of notification-daemon");
+		goto error;
+	}
+
 	return engine;
+
+error:
+	if (engine->module != NULL && !g_module_close(engine->module))
+		g_warning("%s: %s", filename, g_module_error());
+
+	g_free(engine);
+	return NULL;
 }
 
 static void

Modified: trunk/notification-daemon/themes/Makefile.am
===================================================================
--- trunk/notification-daemon/themes/Makefile.am	2006-04-21 21:39:06 UTC (rev 2756)
+++ trunk/notification-daemon/themes/Makefile.am	2006-04-21 22:23:17 UTC (rev 2757)
@@ -1 +1,2 @@
-SUBDIRS = standard bubble
+SUBDIRS = standard
+DIST_SUBDIRS = $(SUBDIRS) bubble

Modified: trunk/notification-daemon/themes/standard/theme.c
===================================================================
--- trunk/notification-daemon/themes/standard/theme.c	2006-04-21 21:39:06 UTC (rev 2756)
+++ trunk/notification-daemon/themes/standard/theme.c	2006-04-21 22:23:17 UTC (rev 2757)
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include <gtk/gtk.h>
 #include <libsexy/sexy-url-label.h>
 
@@ -738,3 +740,27 @@
 		gtk_window_move(GTK_WINDOW(nw), x, y);
 	}
 }
+
+void
+get_theme_info(char **theme_name,
+			   char **theme_ver,
+			   char **author,
+			   char **homepage)
+{
+	*theme_name = g_strdup("Standard");
+	*theme_ver  = g_strdup_printf("%d.%d.%d",
+								  NOTIFICATION_DAEMON_MAJOR_VERSION,
+								  NOTIFICATION_DAEMON_MINOR_VERSION,
+								  NOTIFICATION_DAEMON_MICRO_VERSION);
+	*author = g_strdup("Christian Hammond");
+	*homepage = g_strdup("http://www.galago-project.org/");
+}
+
+gboolean
+theme_check_init(unsigned int major_ver, unsigned int minor_ver,
+				 unsigned int micro_ver)
+{
+	return major_ver == NOTIFICATION_DAEMON_MAJOR_VERSION &&
+	       minor_ver == NOTIFICATION_DAEMON_MINOR_VERSION &&
+	       micro_ver == NOTIFICATION_DAEMON_MICRO_VERSION;
+}



More information about the galago-commits mailing list