[Galago-commits] r2430 - in trunk/notification-daemon: . data po src

galago-commits at freedesktop.org galago-commits at freedesktop.org
Sun Jan 15 16:09:09 PST 2006


Author: chipx86
Date: 2006-01-15 16:09:06 -0800 (Sun, 15 Jan 2006)
New Revision: 2430

Added:
   trunk/notification-daemon/data/
   trunk/notification-daemon/data/Makefile.am
   trunk/notification-daemon/data/notification-daemon.schemas.in
   trunk/notification-daemon/po/
   trunk/notification-daemon/po/POTFILES.in
Modified:
   trunk/notification-daemon/
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/Makefile.am
   trunk/notification-daemon/autogen.sh
   trunk/notification-daemon/configure.ac
   trunk/notification-daemon/src/Makefile.am
   trunk/notification-daemon/src/daemon.c
   trunk/notification-daemon/src/daemon.h
   trunk/notification-daemon/src/engines.c
Log:
Added GConf support. The theme can now be set through gconf-editor.



Property changes on: trunk/notification-daemon
___________________________________________________________________
Name: svn:ignore
   - ABOUT-NLS
Doxyfile
Makefile.in
Makefile
aclocal.m4
autom4te*.cache
confdefs.h
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
intl
libtool
ltconfig
ltmain.sh
m4
missing
mkinstalldirs
stamp-h
stamp-h1
stamp-h.in
tags
.todo.*
.*.swp
.*.swo
*.conf
*.diff
*.patch
*.pc
*.service
*.spec

   + ABOUT-NLS
Doxyfile
Makefile.in
Makefile
aclocal.m4
autom4te*.cache
confdefs.h
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
intl
intltool*
libtool
ltconfig
ltmain.sh
m4
missing
mkinstalldirs
stamp-h
stamp-h1
stamp-h.in
tags
.todo.*
.*.swp
.*.swo
*.conf
*.diff
*.patch
*.pc
*.service
*.spec


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/ChangeLog	2006-01-16 00:09:06 UTC (rev 2430)
@@ -1,3 +1,17 @@
+Sun Jan 15 16:07:00 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	A data/Makefile.am:
+	A data/notification-daemon.schemas.in:
+	A po/POTFILES.in:
+	* src/daemon.c:
+	* src/daemon.h:
+	* src/engines.c:
+	* src/Makefile.am:
+	* Makefile.am:
+	* autogen.sh:
+	* configure.ac:
+	  - Added GConf support. The theme can now be set through gconf-editor.
+
 Sun Jan 15 14:49:49 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/engines.c:

Modified: trunk/notification-daemon/Makefile.am
===================================================================
--- trunk/notification-daemon/Makefile.am	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/Makefile.am	2006-01-16 00:09:06 UTC (rev 2430)
@@ -1,4 +1,4 @@
-SUBDIRS = src themes
+SUBDIRS = data po src themes
 
 servicedir       = $(DBUS_SERVICES_DIR)
 service_DATA     = notification-daemon.service

Modified: trunk/notification-daemon/autogen.sh
===================================================================
--- trunk/notification-daemon/autogen.sh	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/autogen.sh	2006-01-16 00:09:06 UTC (rev 2430)
@@ -1,58 +1,22 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
 
-DIE=0
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
 
-PACKAGE=notification-daemon
+PKG_NAME="Notification Daemon"
 
-echo "Generating configuration files for $PACKAGE, please wait..."
-
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
-	echo
-	echo "You must have autoconf installed to compile $PACKAGE."
-	echo "Download the appropriate package for your distribution,"
-	echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-	DIE=1
+(test -f $srcdir/configure.ac \
+  && test -d $srcdir/src) || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level notification-daemon directory"
+    exit 1
 }
 
-(libtool --version) < /dev/null > /dev/null 2>&1 || {
-	echo
-	echo "You must have libtool installed to compile $PACKAGE."
-	echo "Download the appropriate package for your distribution,"
-	echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-	DIE=1
-}
 
-(automake --version) < /dev/null > /dev/null 2>&1 || {
-	echo
-	echo "You must have automake installed to compile $PACKAGE."
-	echo "Download the appropriate package for your distribution,"
-	echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-	DIE=1
+which gnome-autogen.sh || {
+    echo "You need to install gnome-common from the GNOME CVS"
+    exit 1
 }
 
-[ $DIE -eq 1 ] && exit 1;
-
-echo "  libtoolize --copy --force"
-libtoolize --copy --force
-echo "  aclocal $ACLOCAL_FLAGS"
-aclocal $ACLOCAL_FLAGS
-echo "  autoheader"
-autoheader
-echo "  automake --add-missing"
-automake --add-missing
-echo "  autoconf"
-autoconf
-
-if [ -x config.status -a -z "$*" ]; then
-	./config.status --recheck
-else
-	if test -z "$*"; then
-		echo "I am going to run ./configure with no arguments - if you wish"
-		echo "to pass any to it, please specify them on the $0  command line."
-		echo "If you do not wish to run ./configure, press  Ctrl-C now."
-		trap 'echo "configure aborted" ; exit 0' 1 2 15
-		sleep 1
-	fi
-	./configure "$@";
-fi
+USE_GNOME2_MACROS=1 . gnome-autogen.sh

Modified: trunk/notification-daemon/configure.ac
===================================================================
--- trunk/notification-daemon/configure.ac	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/configure.ac	2006-01-16 00:09:06 UTC (rev 2430)
@@ -65,11 +65,18 @@
 AC_EXEEXT
 
 AM_PROG_LIBTOOL
+AC_PROG_INTLTOOL
 
+ALL_LINGUAS=
+GETTEXT_PACKAGE=notification-daemon
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package])
+AM_GLIB_GNU_GETTEXT
+
 AC_CHECK_LIB([popt], [poptGetArg], , AC_MSG_ERROR([Popt is required]))
 
 REQ_DBUS_VERSION=0.36
-pkg_modules="gtk+-2.0 >= 2.2.2 glib-2.0 >= 2.2.2, dbus-1 >= $REQ_DBUS_VERSION, dbus-glib-1 >= $REQ_DBUS_VERSION libsexy >= 0.1.3"
+pkg_modules="gtk+-2.0 >= 2.2.2 glib-2.0 >= 2.2.2, dbus-1 >= $REQ_DBUS_VERSION, dbus-glib-1 >= $REQ_DBUS_VERSION libsexy >= 0.1.3 gconf-2.0"
 PKG_CHECK_MODULES(NOTIFICATION_DAEMON, [$pkg_modules])
 AC_SUBST(NOTIFICATION_DAEMON_CFLAGS)
 AC_SUBST(NOTIFICATION_DAEMON_LIBS)
@@ -87,6 +94,14 @@
 AC_SUBST(GDK_CFLAGS)
 AC_SUBST(GDK_LIBS)
 
+AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+
+if test "x$GCONFTOOL" = "xno"; then
+	AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with Gconf])
+fi
+
+AM_GCONF_SOURCE_2
+
 dnl
 dnl Check the D-BUS version.
 dnl
@@ -142,6 +157,8 @@
 AC_CONFIG_FILES([
 Makefile
 notification-daemon.service
+data/Makefile
+po/Makefile.in
 src/Makefile
 themes/Makefile
 themes/bubble/Makefile


Property changes on: trunk/notification-daemon/data
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
Makefile
notification-daemon.schemas


Added: trunk/notification-daemon/data/Makefile.am
===================================================================
--- trunk/notification-daemon/data/Makefile.am	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/data/Makefile.am	2006-01-16 00:09:06 UTC (rev 2430)
@@ -0,0 +1,18 @@
+schemasdir       = $(GCONF_SCHEMA_FILE_DIR)
+schemas_in_files = notification-daemon.schemas.in
+schemas_DATA     = $(schemas_in_files:.schemas.in=.schemas)
+ at INTLTOOL_SCHEMAS_RULE@
+
+if GCONF_SCHEMAS_INSTALL
+install-data-local:
+	if test -z "$(DESTDIR)"; then \
+		for p in $(schemas_DATA); do \
+			GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p; \
+		done \
+	fi
+else
+install-data-local:
+endif
+
+EXTRA_DIST = $(schemas_in_files)
+CLEANFILES = $(schemas_DATA)

Added: trunk/notification-daemon/data/notification-daemon.schemas.in
===================================================================
--- trunk/notification-daemon/data/notification-daemon.schemas.in	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/data/notification-daemon.schemas.in	2006-01-16 00:09:06 UTC (rev 2430)
@@ -0,0 +1,17 @@
+<gconfschemafile>
+ <schemalist>
+
+  <schema>
+   <key>/schemas/apps/notification-daemon/theme</key>
+   <applyto>/apps/notification-daemon/theme</applyto>
+   <owner>notification-daemon</owner>
+   <type>string</type>
+   <default>standard</default>
+   <locale name="C">
+    <short>Current theme</short>
+    <long>The theme used when displaying notifications.</long>
+   </locale>
+  </schema>
+
+ </schemalist>
+</gconfschemafile>


Property changes on: trunk/notification-daemon/po
___________________________________________________________________
Name: svn:ignore
   + Makefile.in.in
Makefile.in
Makefile
POTFILES
.intltool*


Added: trunk/notification-daemon/po/POTFILES.in
===================================================================
--- trunk/notification-daemon/po/POTFILES.in	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/po/POTFILES.in	2006-01-16 00:09:06 UTC (rev 2430)
@@ -0,0 +1 @@
+data/notification-daemon.schemas.in

Modified: trunk/notification-daemon/src/Makefile.am
===================================================================
--- trunk/notification-daemon/src/Makefile.am	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/src/Makefile.am	2006-01-16 00:09:06 UTC (rev 2430)
@@ -18,5 +18,5 @@
 INCLUDES = \
 	-I$(top_srcdir) \
 	$(NOTIFICATION_DAEMON_CFLAGS) \
-	-DENGINES_DIR=\"$(LIBDIR)/notification-daemon/engines\"
+	-DENGINES_DIR=\"$(libdir)/notification-daemon/engines\"
 

Modified: trunk/notification-daemon/src/daemon.c
===================================================================
--- trunk/notification-daemon/src/daemon.c	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/src/daemon.c	2006-01-16 00:09:06 UTC (rev 2430)
@@ -28,11 +28,11 @@
 #include <string.h>
 #include <stdio.h>
 
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <glib/gi18n.h>
 #include <glib.h>
 #include <glib-object.h>
-#include <glib/gi18n.h>
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib.h>
 #include <gtk/gtk.h>
 
 struct _NotifyTimeout
@@ -54,6 +54,8 @@
   GSList *poptart_stack;
 };
 
+static GConfClient *gconf_client = NULL;
+
 #define CHECK_DBUS_VERSION(major, minor) \
 	(DBUS_MAJOR_VER > (major) || \
 	 (DBUS_MAJOR_VER == (major) && DBUS_MINOR_VER >= (minor)))
@@ -809,6 +811,12 @@
   return TRUE;
 }
 
+GConfClient *
+get_gconf_client(void)
+{
+	return gconf_client;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -822,7 +830,12 @@
 
   g_message ("initializing glib type system");
   gtk_init (&argc, &argv);
+  gconf_init(argc, argv, NULL);
 
+  gconf_client = gconf_client_get_default();
+  gconf_client_add_dir(gconf_client, "/apps/notification-daemon/theme",
+					   GCONF_CLIENT_PRELOAD_NONE, NULL);
+
   error = NULL;
   connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
 
@@ -860,6 +873,8 @@
 
   gtk_main();
 
+  g_object_unref(G_OBJECT(gconf_client));
+
   return 0;
 }
 

Modified: trunk/notification-daemon/src/daemon.h
===================================================================
--- trunk/notification-daemon/src/daemon.h	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/src/daemon.h	2006-01-16 00:09:06 UTC (rev 2430)
@@ -22,6 +22,7 @@
 #ifndef NOTIFY_DAEMON_H
 #define NOTIFY_DAEMON_H
 
+#include <gconf/gconf-client.h>
 #include <glib.h>
 #include <glib-object.h>
 
@@ -80,5 +81,7 @@
                                                    guint id,
                                                    GError **error);
 
+GConfClient *get_gconf_client(void);
+
 G_END_DECLS
 #endif /* NOTIFY_DAEMON_H */

Modified: trunk/notification-daemon/src/engines.c
===================================================================
--- trunk/notification-daemon/src/engines.c	2006-01-15 22:53:45 UTC (rev 2429)
+++ trunk/notification-daemon/src/engines.c	2006-01-16 00:09:06 UTC (rev 2430)
@@ -1,3 +1,4 @@
+#include <gconf/gconf-client.h>
 #include "engines.h"
 
 typedef struct
@@ -21,22 +22,30 @@
 
 } ThemeEngine;
 
+static guint theme_prop_notify_id = 0;
 static ThemeEngine *active_engine = NULL;
-/* static GList *engines = NULL; */
 
 static ThemeEngine *
-load_theme_engine(const char *filename)
+load_theme_engine(const char *name)
 {
-	ThemeEngine *engine = g_new0(ThemeEngine, 1);
+	ThemeEngine *engine;
+	char *filename;
+	char *path;
 
+	filename = g_strdup_printf("lib%s.so", name);
+	path = g_build_filename(ENGINES_DIR, filename, NULL);
+	g_free(filename);
+
+	printf("Loading path '%s'\n", path);
+	engine = g_new0(ThemeEngine, 1);
 	engine->ref_count = 1;
-	engine->module = g_module_open(filename, G_MODULE_BIND_LAZY);
+	engine->module = g_module_open(path, G_MODULE_BIND_LAZY);
 
+	g_free(path);
+
 	if (engine->module == NULL)
 	{
 		g_free(engine);
-		g_error("The default theme engine doesn't exist. Your install "
-				"likely isn't complete.");
 		return NULL;
 	}
 
@@ -77,14 +86,57 @@
 	g_free(engine);
 }
 
+static void
+theme_changed_cb(GConfClient *client, guint cnxn_id, GConfEntry *entry,
+				 gpointer user_data)
+{
+	if (active_engine == NULL)
+		return;
+
+	active_engine->ref_count--;
+
+	if (active_engine->ref_count == 0)
+		destroy_engine(active_engine);
+
+	/* This is no longer the true active engine, so reset this. */
+	active_engine = NULL;
+}
+
 static ThemeEngine *
 get_theme_engine(void)
 {
 	if (active_engine == NULL)
 	{
-		/* XXX */
-		active_engine = load_theme_engine(ENGINES_DIR"/libstandard.so");
-		g_assert(active_engine != NULL);
+		GConfClient *client = get_gconf_client();
+		char *enginename = gconf_client_get_string(client,
+			"/apps/notification-daemon/theme", NULL);
+
+		if (theme_prop_notify_id == 0)
+		{
+			theme_prop_notify_id = gconf_client_notify_add(client,
+				"/apps/notification-daemon/theme", theme_changed_cb, NULL,
+				NULL, NULL);
+		}
+
+		if (enginename == NULL)
+		{
+			active_engine = load_theme_engine("standard");
+			g_assert(active_engine != NULL);
+		}
+		else
+		{
+			active_engine = load_theme_engine(enginename);
+
+			if (active_engine == NULL)
+			{
+				g_warning("Unable to load theme engine '%s'", enginename);
+				active_engine = load_theme_engine("standard");
+			}
+
+			g_free(enginename);
+
+			g_assert(active_engine != NULL);
+		}
 	}
 
 	return active_engine;



More information about the galago-commits mailing list