[Galago-commits] r2436 - in trunk/notification-daemon: . src

galago-commits at freedesktop.org galago-commits at freedesktop.org
Thu Jan 19 02:38:04 PST 2006


Author: chipx86
Date: 2006-01-19 02:38:02 -0800 (Thu, 19 Jan 2006)
New Revision: 2436

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/src/daemon.c
   trunk/notification-daemon/src/daemon.h
   trunk/notification-daemon/src/engines.c
Log:
Reorganize the code styles to match the style of the rest of Galago and of the previous libnotify.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-01-19 09:37:42 UTC (rev 2435)
+++ trunk/notification-daemon/ChangeLog	2006-01-19 10:38:02 UTC (rev 2436)
@@ -1,3 +1,11 @@
+Thu Jan 19 02:37:31 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* src/daemon.c:
+	* src/daemon.h:
+	* src/engines.c:
+	  - Reorganize the code styles to match the style of the rest of Galago
+	    and of the previous libnotify.
+
 Thu Jan 19 01:36:16 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* themes/standard/theme.c:

Modified: trunk/notification-daemon/src/daemon.c
===================================================================
--- trunk/notification-daemon/src/daemon.c	2006-01-19 09:37:42 UTC (rev 2435)
+++ trunk/notification-daemon/src/daemon.c	2006-01-19 10:38:02 UTC (rev 2436)
@@ -1,5 +1,6 @@
-/* notifydaemon.c - Implementation of the destop notification spec
+/* daemon.c - Implementation of the destop notification spec
  *
+ * Copyright (C) 2006 Christian Hammond <chipx86 at chipx86.com>
  * Copyright (C) 2005 John (J5) Palmieri <johnp at redhat.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -17,11 +18,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-
 #include "config.h"
-#include "daemon.h"
-#include "engines.h"
-#include "notificationdaemon-dbus-glue.h"
 
 #include <stdlib.h>
 #include <errno.h>
@@ -35,23 +32,27 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
+#include "daemon.h"
+#include "engines.h"
+#include "notificationdaemon-dbus-glue.h"
+
 struct _NotifyTimeout
 {
-   GTimeVal expiration;
-   gboolean has_timeout;
-   guint id;
+	GTimeVal expiration;
+	gboolean has_timeout;
+	guint id;
 
-   GtkWindow *nw;
+	GtkWindow *nw;
 };
 
 typedef struct _NotifyTimeout NotifyTimeout;
 
 struct _NotifyDaemonPrivate
 {
-  guint next_id;
-  guint timeout_source;
-  GHashTable *notification_hash;
-  GSList *poptart_stack;
+	guint next_id;
+	guint timeout_source;
+	GHashTable *notification_hash;
+	GSList *poptart_stack;
 };
 
 static GConfClient *gconf_client = NULL;
@@ -71,119 +72,109 @@
 };
 #endif /* D-BUS < 0.60 */
 
-static void notify_daemon_finalize (GObject * object);
-static void _emit_closed_signal (GObject *notify_widget);
+static void notify_daemon_finalize(GObject *object);
+static void _emit_closed_signal(GObject *notify_widget);
 
-G_DEFINE_TYPE (NotifyDaemon, notify_daemon, G_TYPE_OBJECT);
+G_DEFINE_TYPE(NotifyDaemon, notify_daemon, G_TYPE_OBJECT);
 
 static void
-notify_daemon_class_init (NotifyDaemonClass * daemon_class)
+notify_daemon_class_init(NotifyDaemonClass *daemon_class)
 {
-  GObjectClass *object_class;
+	GObjectClass *object_class = G_OBJECT_CLASS(daemon_class);
 
-  object_class = G_OBJECT_CLASS (daemon_class);
+	object_class->finalize = notify_daemon_finalize;
 
-  object_class->finalize = notify_daemon_finalize;
-
-  g_type_class_add_private (daemon_class, sizeof (NotifyDaemonPrivate));
+	g_type_class_add_private(daemon_class, sizeof(NotifyDaemonPrivate));
 }
 
 static void
-_notify_timeout_destroy (NotifyTimeout *nt)
+_notify_timeout_destroy(NotifyTimeout *nt)
 {
-  gtk_widget_destroy(GTK_WIDGET(nt->nw));
-  g_free(nt);
+	gtk_widget_destroy(GTK_WIDGET(nt->nw));
+	g_free(nt);
 }
 
 static void
-notify_daemon_init (NotifyDaemon * daemon)
+notify_daemon_init(NotifyDaemon *daemon)
 {
-  daemon->priv = G_TYPE_INSTANCE_GET_PRIVATE (daemon,
-					      NOTIFY_TYPE_DAEMON,
-					      NotifyDaemonPrivate);
+	daemon->priv = G_TYPE_INSTANCE_GET_PRIVATE(daemon, NOTIFY_TYPE_DAEMON,
+											   NotifyDaemonPrivate);
 
-  daemon->priv->next_id = 1;
-  daemon->priv->timeout_source = 0;
-  daemon->priv->notification_hash = g_hash_table_new_full ((GHashFunc) g_int_hash,
-                                                           (GEqualFunc) g_int_equal,
-                                                           (GDestroyNotify) g_free,
-                                                           (GDestroyNotify) _notify_timeout_destroy);
+	daemon->priv->next_id = 1;
+	daemon->priv->timeout_source = 0;
+	daemon->priv->notification_hash =
+		g_hash_table_new_full(g_int_hash, g_int_equal, g_free,
+							  (GDestroyNotify)_notify_timeout_destroy);
 }
 
 static void
-notify_daemon_finalize (GObject * object)
+notify_daemon_finalize(GObject *object)
 {
-  NotifyDaemon *daemon;
-  GObjectClass *parent_class;
+	NotifyDaemon *daemon;
+	GObjectClass *parent_class;
 
-  daemon = NOTIFY_DAEMON (object);
+	daemon = NOTIFY_DAEMON(object);
 
-  g_hash_table_destroy (daemon->priv->notification_hash);
-  g_slist_free (daemon->priv->poptart_stack);
+	g_hash_table_destroy(daemon->priv->notification_hash);
+	g_slist_free(daemon->priv->poptart_stack);
 
-  parent_class = G_OBJECT_CLASS (notify_daemon_parent_class);
+	parent_class = G_OBJECT_CLASS(notify_daemon_parent_class);
 
-  if (parent_class->finalize != NULL)
-    parent_class->finalize (object);
+	if (parent_class->finalize != NULL)
+		parent_class->finalize(object);
 }
 
 NotifyDaemon *
-notify_daemon_new (void)
+notify_daemon_new(void)
 {
-  NotifyDaemon *daemon;
-
-  daemon = g_object_new (NOTIFY_TYPE_DAEMON, NULL);
-
-  return daemon;
+	return g_object_new(NOTIFY_TYPE_DAEMON, NULL);
 }
 
 /*
- * XXX The notify_widget thing needs to be replaced with some struct.
+ *XXX The notify_widget thing needs to be replaced with some struct.
  */
 #if 0
 static void
-_emit_action_invoked_signal (GObject *notify_widget, gchar *action)
+_emit_action_invoked_signal(GObject *notify_widget, gchar *action)
 {
-  DBusConnection *con;
-  DBusError error;
+	DBusConnection *con;
+	DBusError error;
 
-  dbus_error_init (&error);
+	dbus_error_init(&error);
 
-  con = dbus_bus_get (DBUS_BUS_SESSION, &error);
+	con = dbus_bus_get(DBUS_BUS_SESSION, &error);
 
-  if (con == NULL)
-    {
-      g_warning ("Error sending ActionInvoked signal: %s", error.message);
-      dbus_error_free (&error);
-    }
-  else
-    {
-      DBusMessage *message;
+	if (con == NULL)
+	{
+		g_warning("Error sending ActionInvoked signal: %s", error.message);
+		dbus_error_free(&error);
+	}
+	else
+	{
+		DBusMessage *message;
+		gchar *dest;
+		guint id;
 
-      gchar *dest;
-      guint id;
+		message = dbus_message_new_signal("/org/freedesktop/Notifications",
+										  "org.freedesktop.Notifications",
+										  "ActionInvoked");
 
-      message = dbus_message_new_signal ("/org/freedesktop/Notifications",
-                                         "org.freedesktop.Notifications",
-                                         "ActionInvoked");
+		dest = g_object_get_data(notify_widget, "_notify_sender");
+		id = GPOINTER_TO_UINT(g_object_get_data(notify_widget, "_notify_id"));
 
-      dest = g_object_get_data (notify_widget,
-                                "_notify_sender");
-      id = GPOINTER_TO_UINT (g_object_get_data (notify_widget, "_notify_id"));
+		g_assert(dest != NULL);
 
-      g_assert (dest != NULL);
+		dbus_message_set_destination(message, dest);
+		dbus_message_append_args(message,
+								 DBUS_TYPE_UINT32, &id,
+								 DBUS_TYPE_STRING, &action,
+								 DBUS_TYPE_INVALID);
 
-      dbus_message_set_destination (message, dest);
-      dbus_message_append_args (message,
-                                DBUS_TYPE_UINT32, &id,
-                                DBUS_TYPE_STRING, &action,
-                                DBUS_TYPE_INVALID);
+		dbus_connection_send(con, message, NULL);
 
-      dbus_connection_send (con, message, NULL);
-
-      dbus_message_unref (message);
-      dbus_connection_unref (con);
-    }
+		dbus_message_unref(message);
+		dbus_connection_unref(con);
+	}
 }
 #endif
 
@@ -194,355 +185,345 @@
 }
 
 static void
-_emit_closed_signal (GObject *notify_widget)
+_emit_closed_signal(GObject *notify_widget)
 {
-  DBusConnection *con;
-  DBusError error;
+	DBusConnection *con;
+	DBusError error;
 
-  dbus_error_init (&error);
+	dbus_error_init(&error);
 
-  con = dbus_bus_get (DBUS_BUS_SESSION, &error);
+	con = dbus_bus_get(DBUS_BUS_SESSION, &error);
 
-  if (con == NULL)
-    {
-      g_warning ("Error sending Close signal: %s", error.message);
-      dbus_error_free (&error);
-    }
-  else
-    {
-      DBusMessage *message;
+	if (con == NULL)
+	{
+		g_warning("Error sending Close signal: %s", error.message);
+		dbus_error_free(&error);
+	}
+	else
+	{
+		DBusMessage *message;
+		gchar *dest;
+		guint id;
 
-      gchar *dest;
-      guint id;
+		message = dbus_message_new_signal("/org/freedesktop/Notifications",
+										  "org.freedesktop.Notifications",
+										  "NotificationClosed");
 
-      message = dbus_message_new_signal ("/org/freedesktop/Notifications",
-                                         "org.freedesktop.Notifications",
-                                         "NotificationClosed");
+		dest = g_object_get_data(notify_widget, "_notify_sender");
+		id = GPOINTER_TO_UINT(g_object_get_data(notify_widget, "_notify_id"));
 
-      dest = g_object_get_data (notify_widget,
-                                "_notify_sender");
-      id = GPOINTER_TO_UINT (g_object_get_data (notify_widget,
-                                                "_notify_id"));
+		g_assert(dest != NULL);
 
-      g_assert (dest != NULL);
+		dbus_message_set_destination(message, dest);
+		dbus_message_append_args(message,
+								 DBUS_TYPE_UINT32, &id,
+								 DBUS_TYPE_INVALID);
 
-      dbus_message_set_destination (message, dest);
-      dbus_message_append_args (message,
-                                DBUS_TYPE_UINT32, &id,
-                                DBUS_TYPE_INVALID);
+		dbus_connection_send(con, message, NULL);
 
-      dbus_connection_send (con, message, NULL);
-
-      dbus_message_unref (message);
-      dbus_connection_unref (con);
-    }
+		dbus_message_unref(message);
+		dbus_connection_unref(con);
+	}
 }
 
 static void
-_close_notification (NotifyDaemon *daemon,
-                     guint id)
+_close_notification(NotifyDaemon *daemon, guint id)
 {
-  NotifyDaemonPrivate *priv;
-  NotifyTimeout *nt;
+	NotifyDaemonPrivate *priv = daemon->priv;
+	NotifyTimeout *nt;
 
-  priv = daemon->priv;
+	nt = (NotifyTimeout *)g_hash_table_lookup(priv->notification_hash, &id);
 
-  nt = (NotifyTimeout *)
-          g_hash_table_lookup (priv->notification_hash, &id);
+	if (nt != NULL)
+	{
+		_emit_closed_signal(G_OBJECT(nt->nw));
 
-  if (nt)
-    {
-      _emit_closed_signal(G_OBJECT(nt->nw));
-
-	  theme_hide_notification(nt->nw);
-      g_hash_table_remove (priv->notification_hash, &id);
-    }
+		theme_hide_notification(nt->nw);
+		g_hash_table_remove(priv->notification_hash, &id);
+	}
 }
 
-
 static gboolean
-_is_expired (gpointer key,
-             gpointer value,
-             gpointer data)
+_is_expired(gpointer key, gpointer value, gpointer data)
 {
-  NotifyTimeout *nt;
-  gboolean *phas_more_timeouts;
-  GTimeVal now;
-  GTimeVal expiration;
+	NotifyTimeout *nt = (NotifyTimeout *)value;
+	gboolean *phas_more_timeouts = (gboolean *)data;
+	GTimeVal now;
+	GTimeVal expiration;
 
-  nt = (NotifyTimeout *) value;
-  phas_more_timeouts = data;
+	if (!nt->has_timeout)
+		return FALSE;
 
-  if (!nt->has_timeout)
-    return FALSE;
+	g_get_current_time(&now);
+	expiration = nt->expiration;
 
-  g_get_current_time (&now);
-  expiration = nt->expiration;
+	if (now.tv_sec > expiration.tv_sec)
+	{
+		_emit_closed_signal(G_OBJECT(nt->nw));
+		return TRUE;
+	}
+	else if (now.tv_sec == expiration.tv_sec &&
+			 now.tv_usec > expiration.tv_usec)
+	{
+		_emit_closed_signal(G_OBJECT(nt->nw));
+		return TRUE;
+	}
 
-  if (now.tv_sec > expiration.tv_sec)
-    {
-      _emit_closed_signal(G_OBJECT(nt->nw));
-      return TRUE;
-    }
-  else if (now.tv_sec == expiration.tv_sec)
-    {
-      if (now.tv_usec > expiration.tv_usec)
-        {
-          _emit_closed_signal (G_OBJECT (nt->nw));
-          return TRUE;
-        }
-    }
+	*phas_more_timeouts = TRUE;
 
-  *phas_more_timeouts = TRUE;
-
-  return FALSE;
+	return FALSE;
 }
 
 static gboolean
-_check_expiration (gpointer data)
+_check_expiration(gpointer data)
 {
-  NotifyDaemon *daemon;
-  gboolean has_more_timeouts;
+	NotifyDaemon *daemon = (NotifyDaemon *)data;
+	gboolean has_more_timeouts = FALSE;
 
-  has_more_timeouts = FALSE;
+	g_hash_table_foreach_remove(daemon->priv->notification_hash,
+								_is_expired, (gpointer)&has_more_timeouts);
 
-  daemon = (NotifyDaemon *) data;
+	if (!has_more_timeouts)
+		daemon->priv->timeout_source = 0;
 
-  g_hash_table_foreach_remove (daemon->priv->notification_hash,
-                                (GHRFunc) _is_expired,
-                                (gpointer) &has_more_timeouts);
-
-  if (!has_more_timeouts)
-    daemon->priv->timeout_source = 0;
-
-  return has_more_timeouts;
-
+	return has_more_timeouts;
 }
 
 static void
-_calculate_timeout (NotifyDaemon *daemon, NotifyTimeout *nt, int timeout)
+_calculate_timeout(NotifyDaemon *daemon, NotifyTimeout *nt, int timeout)
 {
-  if (timeout == 0)
-      nt->has_timeout = FALSE;
-  else
-    {
-      gulong usec;
+	if (timeout == 0)
+		nt->has_timeout = FALSE;
+	else
+	{
+		gulong usec;
 
-      nt->has_timeout = TRUE;
-      if (timeout == -1)
-        timeout = NOTIFY_DAEMON_DEFAULT_TIMEOUT;
+		nt->has_timeout = TRUE;
 
-      usec = timeout * 1000; /* convert from msec to usec */
-      g_get_current_time (&nt->expiration);
-      g_time_val_add (&nt->expiration, usec);
+		if (timeout == -1)
+			timeout = NOTIFY_DAEMON_DEFAULT_TIMEOUT;
 
-      if (daemon->priv->timeout_source == 0)
-        daemon->priv->timeout_source =
-          g_timeout_add (500,
-                         (GSourceFunc) _check_expiration,
-                         (gpointer) daemon);
-    }
+		usec = timeout * 1000;	/* convert from msec to usec */
+		g_get_current_time(&nt->expiration);
+		g_time_val_add(&nt->expiration, usec);
 
+		if (daemon->priv->timeout_source == 0)
+		{
+			daemon->priv->timeout_source = g_timeout_add(500,
+														 _check_expiration,
+														 daemon);
+		}
+	}
 }
 
 static guint
 _store_notification(NotifyDaemon *daemon, GtkWindow *nw, int timeout)
 {
-  NotifyDaemonPrivate *priv;
-  NotifyTimeout *nt;
-  guint id;
-  priv = daemon->priv;
-  id = 0;
+	NotifyDaemonPrivate *priv = daemon->priv;
+	NotifyTimeout *nt;
+	guint id = 0;
 
-  do
-    {
-      id = priv->next_id;
+	do
+	{
+		id = priv->next_id;
 
-      if (id != UINT_MAX)
-        priv->next_id++;
-      else
-        priv->next_id = 1;
+		if (id != UINT_MAX)
+			priv->next_id++;
+		else
+			priv->next_id = 1;
 
-      if (g_hash_table_lookup (priv->notification_hash, &id) != NULL)
-        id = 0;
-    }
-  while (id == 0);
+		if (g_hash_table_lookup(priv->notification_hash, &id) != NULL)
+			id = 0;
 
-  nt = (NotifyTimeout *) g_new0(NotifyTimeout, 1);
+	} while (id == 0);
 
-  nt->id = id;
-  nt->nw = nw;
+	nt = g_new0(NotifyTimeout, 1);
+	nt->id = id;
+	nt->nw = nw;
 
-  _calculate_timeout (daemon, nt, timeout);
+	_calculate_timeout(daemon, nt, timeout);
 
-  g_hash_table_insert (priv->notification_hash,
-                       g_memdup(&id, sizeof (guint)),
-                       (gpointer) nt);
+	g_hash_table_insert(priv->notification_hash,
+						g_memdup(&id, sizeof(guint)), nt);
 
-  return id;
+	return id;
 }
 
 static gboolean
 _notify_daemon_process_icon_data(NotifyDaemon *daemon, GtkWindow *nw,
 								 GValue *icon_data)
 {
-  const guchar *data;
-  gboolean has_alpha;
-  int bits_per_sample;
-  int width;
-  int height;
-  int rowstride;
-  int n_channels;
-  gsize expected_len;
-  GdkPixbuf *pixbuf;
+	const guchar *data = NULL;
+	gboolean has_alpha;
+	int bits_per_sample;
+	int width;
+	int height;
+	int rowstride;
+	int n_channels;
+	gsize expected_len;
+	GdkPixbuf *pixbuf;
+	GValueArray *image_struct;GValue *value;
+	GArray *tmp_array;
 
-  GValueArray *image_struct;
-  GValue *value;
-  GArray *tmp_array;
+	if (!G_VALUE_HOLDS(icon_data, G_TYPE_VALUE_ARRAY))
+	{
+		g_warning("_notify_daemon_process_icon_data expected a "
+				  "GValue of type GValueArray");
+		return FALSE;
+	}
 
-  data = NULL;
+	image_struct = (GValueArray *)g_value_get_boxed(icon_data);
+	value = g_value_array_get_nth(image_struct, 0);
 
-  if (!G_VALUE_HOLDS (icon_data, G_TYPE_VALUE_ARRAY))
-    {
-      g_warning ("_notify_daemon_process_icon_data expected a GValue of type GValueArray");
-      return FALSE;
-    }
+	if (value == NULL)
+	{
+		g_warning("_notify_daemon_process_icon_data expected position "
+				  "0 of the GValueArray to exist");
+		return FALSE;
+	}
 
-  image_struct = (GValueArray *) (g_value_get_boxed (icon_data));
+	if (!G_VALUE_HOLDS(value, G_TYPE_INT))
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 0 of the GValueArray to be of type int");
+		return FALSE;
+	}
 
-  value = g_value_array_get_nth (image_struct, 0);
-  if (!value)
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 0 of the GValueArray to exist");
-      return FALSE;
-    }
+	width = g_value_get_int(value);
+	value = g_value_array_get_nth(image_struct, 1);
 
-  if (!G_VALUE_HOLDS (value, G_TYPE_INT))
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 0 of the GValueArray to be of type int");
-      return FALSE;
-    }
+	if (value == NULL)
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 1 of the GValueArray to exist");
+		return FALSE;
+	}
 
-  width = g_value_get_int (value);
+	if (!G_VALUE_HOLDS(value, G_TYPE_INT))
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 1 of the GValueArray to be of type int");
+		return FALSE;
+	}
 
-  value = g_value_array_get_nth (image_struct, 1);
-  if (!value)
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 1 of the GValueArray to exist");
-      return FALSE;
-    }
+	height = g_value_get_int(value);
+	value = g_value_array_get_nth(image_struct, 2);
 
-  if (!G_VALUE_HOLDS (value, G_TYPE_INT))
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 1 of the GValueArray to be of type int");
-      return FALSE;
-    }
+	if (value == NULL)
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 2 of the GValueArray to exist");
+		return FALSE;
+	}
 
-  height = g_value_get_int (value);
+	if (!G_VALUE_HOLDS(value, G_TYPE_INT))
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 2 of the GValueArray to be of type int");
+		return FALSE;
+	}
 
-  value = g_value_array_get_nth (image_struct, 2);
-  if (!value)
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 2 of the GValueArray to exist");
-      return FALSE;
-    }
+	rowstride = g_value_get_int(value);
+	value = g_value_array_get_nth(image_struct, 3);
 
-  if (!G_VALUE_HOLDS (value, G_TYPE_INT))
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 2 of the GValueArray to be of type int");
-      return FALSE;
-    }
+	if (value == NULL)
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 3 of the GValueArray to exist");
+		return FALSE;
+	}
 
-  rowstride = g_value_get_int (value);
+	if (!G_VALUE_HOLDS(value, G_TYPE_BOOLEAN))
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 3 of the GValueArray to be of type gboolean");
+		return FALSE;
+	}
 
-  value = g_value_array_get_nth (image_struct, 3);
-  if (!value)
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 3 of the GValueArray to exist");
-      return FALSE;
-    }
+	has_alpha = g_value_get_boolean(value);
+	value = g_value_array_get_nth(image_struct, 4);
 
-  if (!G_VALUE_HOLDS (value, G_TYPE_BOOLEAN))
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 3 of the GValueArray to be of type gboolean");
-      return FALSE;
-    }
+	if (value == NULL)
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 4 of the GValueArray to exist");
+		return FALSE;
+	}
 
-  has_alpha = g_value_get_boolean (value);
+	if (!G_VALUE_HOLDS(value, G_TYPE_INT))
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 4 of the GValueArray to be of type int");
+		return FALSE;
+	}
 
-  value = g_value_array_get_nth (image_struct, 4);
-  if (!value)
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 4 of the GValueArray to exist");
-      return FALSE;
-    }
+	bits_per_sample = g_value_get_int(value);
+	value = g_value_array_get_nth(image_struct, 5);
 
-  if (!G_VALUE_HOLDS (value, G_TYPE_INT))
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 4 of the GValueArray to be of type int");
-      return FALSE;
-    }
+	if (value == NULL)
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 5 of the GValueArray to exist");
+		return FALSE;
+	}
 
-  bits_per_sample = g_value_get_int (value);
+	if (!G_VALUE_HOLDS(value, G_TYPE_INT))
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 5 of the GValueArray to be of type int");
+		return FALSE;
+	}
 
-  value = g_value_array_get_nth (image_struct, 5);
-  if (!value)
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 5 of the GValueArray to exist");
-      return FALSE;
-    }
+	n_channels = g_value_get_int(value);
+	value = g_value_array_get_nth(image_struct, 6);
 
-  if (!G_VALUE_HOLDS (value, G_TYPE_INT))
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 5 of the GValueArray to be of type int");
-      return FALSE;
-    }
+	if (value == NULL)
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 6 of the GValueArray to exist");
+		return FALSE;
+	}
 
-  n_channels = g_value_get_int (value);
+	if (!G_VALUE_HOLDS(value,
+					   dbus_g_type_get_collection("GArray", G_TYPE_UCHAR)))
+	{
+		g_warning("_notify_daemon_process_icon_data expected "
+				  "position 6 of the GValueArray to be of type GArray");
+		return FALSE;
+	}
 
+	tmp_array = (GArray *)g_value_get_boxed(value);
+	expected_len = (height - 1) * rowstride + width *
+	               ((n_channels * bits_per_sample + 7) / 8);
 
-  value = g_value_array_get_nth (image_struct, 6);
-  if (!value)
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 6 of the GValueArray to exist");
-      return FALSE;
-    }
+	if (expected_len != tmp_array->len)
+	{
+		g_warning("_notify_daemon_process_icon_data expected image "
+				  "data to be of length %i but got a length of %i",
+				  expected_len, tmp_array->len);
+		return FALSE;
+	}
 
-  if (!G_VALUE_HOLDS (value, dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR)))
-    {
-      g_warning ("_notify_daemon_process_icon_data expected possition 6 of the GValueArray to be of type GArray");
-      return FALSE;
-    }
-
-  tmp_array = (GArray *) g_value_get_boxed (value);
-  expected_len = (height -1) * rowstride + width * ((n_channels * bits_per_sample + 7) / 8);
-
-  if (expected_len != tmp_array->len)
-    {
-      g_warning ("_notify_daemon_process_icon_data expected image data to be of length %i but got a length of %i", expected_len, tmp_array->len);
-      return FALSE;
-    }
-
-  data = (guchar *)g_memdup (tmp_array->data, tmp_array->len);
+	data = (guchar *)g_memdup(tmp_array->data, tmp_array->len);
 	pixbuf = gdk_pixbuf_new_from_data(data, GDK_COLORSPACE_RGB, has_alpha,
 									  bits_per_sample, width, height,
 									  rowstride,
-									  (GdkPixbufDestroyNotify)g_free, NULL);
+									  (GdkPixbufDestroyNotify)g_free,
+									  NULL);
 	theme_set_notification_icon(nw, pixbuf);
 	g_object_unref(G_OBJECT(pixbuf));
 
-  return TRUE;
+	return TRUE;
 }
 
 #if 0
 static void
-_notification_daemon_handle_bubble_widget_action(GtkWidget *b, GtkWindow *nw)
+_notification_daemon_handle_bubble_widget_action(GtkWidget *b,
+												 GtkWindow *nw)
 {
-  gchar *action;
+	gchar *action = (gchar *)g_object_get_data(G_OBJECT(b), "_notify_action");
 
-  action = (gchar *) g_object_get_data (G_OBJECT (b), "_notify_action");
-
-  _emit_action_invoked_signal (G_OBJECT (nw), action);
+	_emit_action_invoked_signal(G_OBJECT(nw), action);
 }
 #endif
 
@@ -551,271 +532,246 @@
 												  GdkEventButton *button,
 												  NotifyDaemon *daemon)
 {
-  _close_notification(daemon,
-	GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(nw), "_notify_id")));
+	_close_notification(daemon,
+		GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(nw), "_notify_id")));
 }
 
 static void
 _remove_bubble_from_poptart_stack(GtkWindow *nw, NotifyDaemon *daemon)
 {
-  NotifyDaemonPrivate *priv;
-  GdkRectangle workarea;
-  GSList *remove_link;
-  GSList *link;
+	NotifyDaemonPrivate *priv = daemon->priv;
+	GdkRectangle workarea;
+	GSList *remove_link = NULL;
+	GSList *link;
+	gint x, y;
 
-  gint x, y;
+	workarea.x = 0;
+	workarea.y = 0;
+	workarea.width = gdk_screen_width();
+	workarea.height = gdk_screen_height();
 
-  priv = daemon->priv;
+	y = workarea.y + workarea.height;
+	x = 0;
 
-  link = priv->poptart_stack;
-  remove_link = NULL;
+	for (link = priv->poptart_stack; link != NULL; link = link->next)
+	{
+		GtkWindow *nw2 = link->data;
+		GtkRequisition req;
 
-  workarea.x = 0;
-  workarea.y = 0;
-  workarea.width  = gdk_screen_width();
-  workarea.height = gdk_screen_height();
+		if (nw2 != nw)
+		{
+			gtk_widget_size_request(GTK_WIDGET(nw2), &req);
 
-  y = workarea.y + workarea.height;
-  x = 0;
-  while (link)
-  {
-	  GtkWindow *nw2;
-      GtkRequisition req;
+			x = workarea.x + workarea.width - req.width;
+			y = y - req.height;
 
-	  nw2 = link->data;
+			theme_move_notification(nw2, x, y);
+		}
+		else
+		{
+			remove_link = link;
+		}
+	}
 
-      if (nw2 != nw)
-	  {
-		  printf ("dude\n");
-
-          gtk_widget_size_request(GTK_WIDGET(nw2), &req);
-
-          x = workarea.x + workarea.width - req.width;
-          y = y - req.height;
-
-		  theme_move_notification(nw2, x, y);
-	  }
-      else
-	  {
-		  remove_link = link;
-	  }
-
-      link = link->next;
-    }
-
-    if (remove_link)
-      priv->poptart_stack = g_slist_remove_link (priv->poptart_stack, remove_link);
+	if (remove_link)
+	{
+		priv->poptart_stack = g_slist_remove_link(priv->poptart_stack,
+												  remove_link);
+	}
 }
 
 static void
-_notify_daemon_add_bubble_to_poptart_stack(NotifyDaemon *daemon, GtkWindow *nw)
+_notify_daemon_add_bubble_to_poptart_stack(NotifyDaemon *daemon,
+										   GtkWindow *nw)
 {
-  NotifyDaemonPrivate *priv;
-  GtkRequisition req;
-  GdkRectangle workarea;
-  GSList *link;
-  gint x, y;
+	NotifyDaemonPrivate *priv = daemon->priv;
+	GtkRequisition req;
+	GdkRectangle workarea;
+	GSList *link;
+	gint x, y;
 
-  priv = daemon->priv;
+	gtk_widget_size_request(GTK_WIDGET(nw), &req);
 
-  gtk_widget_size_request(GTK_WIDGET(nw), &req);
+	workarea.x = 0;
+	workarea.y = 0;
+	workarea.width = gdk_screen_width();
+	workarea.height = gdk_screen_height();
 
-  workarea.x = 0;
-  workarea.y = 0;
-  workarea.width  = gdk_screen_width();
-  workarea.height = gdk_screen_height();
+	x = workarea.x + workarea.width - req.width;
+	y = workarea.y + workarea.height - req.height;
 
-  x = workarea.x + workarea.width - req.width;
-  y = workarea.y + workarea.height - req.height;
+	g_message("x %i y %i width %i height %i", x, y, req.width, req.height);
 
-  g_message ("x %i y %i width %i height %i", x, y, req.width, req.height);
+	theme_move_notification(nw, x, y);
 
-  theme_move_notification(nw, x, y);
+	for (link = priv->poptart_stack; link != NULL; link = link->next)
+	{
+		GtkWindow *nw2 = GTK_WINDOW(link->data);
 
-  link = priv->poptart_stack;
-  while (link)
-  {
-		GtkWindow *nw2;
-
-		nw2 = GTK_WINDOW(link->data);
 		gtk_widget_size_request(GTK_WIDGET(nw2), &req);
-
 		x = workarea.x + workarea.width - req.width;
 		y = y - req.height;
-		g_message ("x %i y %i width %i height %i", x, y, req.width, req.height);
+		g_message("x %i y %i width %i height %i", x, y, req.width, req.height);
 		theme_move_notification(nw2, x, y);
-
-		link = link->next;
 	}
 
 	g_signal_connect(G_OBJECT(nw), "destroy",
 					 G_CALLBACK(_remove_bubble_from_poptart_stack), daemon);
-	priv->poptart_stack = g_slist_prepend (priv->poptart_stack, nw);
+	priv->poptart_stack = g_slist_prepend(priv->poptart_stack, nw);
 }
 
-
-
 gboolean
-notify_daemon_notify_handler (NotifyDaemon *daemon,
-                              const gchar *app_name,
-                              const gchar *icon,
-                              guint id,
-                              const gchar *summary,
-                              const gchar *body,
-                              gchar **actions,
-                              GHashTable *hints,
-                              int timeout,
-                              DBusGMethodInvocation *context)
+notify_daemon_notify_handler(NotifyDaemon *daemon,
+							 const gchar *app_name,
+							 const gchar *icon,
+							 guint id,
+							 const gchar *summary,
+							 const gchar *body,
+							 gchar **actions,
+							 GHashTable *hints,
+							 int timeout, DBusGMethodInvocation *context)
 {
-  NotifyDaemonPrivate *priv;
-  NotifyTimeout *nt;
-  GtkWindow *nw;
-  GValue *data;
-  gboolean use_pos_data;
-  gint x, y;
-  guint return_id;
-  gchar *sender;
-  gint i;
+	NotifyDaemonPrivate *priv = daemon->priv;
+	NotifyTimeout *nt = NULL;
+	GtkWindow *nw = NULL;
+	GValue *data;
+	gboolean use_pos_data = FALSE;
+	gint x = 0;
+	gint y = 0;
+	guint return_id;
+	gchar *sender;
+	gint i;
 
-  x = 0;
-  y = 0;
+	if (id > 0)
+	{
+		nt = (NotifyTimeout *)g_hash_table_lookup(priv->notification_hash,
+												  &id);
+	}
 
-  nt = NULL;
+	if (nt == NULL)
+	{
+		nw = theme_create_notification();
+		id = 0;
+	}
+	else
+	{
+		nw = nt->nw;
+	}
 
-  priv = daemon->priv;
-  nw = NULL;
-  if (id > 0)
-    nt = (NotifyTimeout *)
-           g_hash_table_lookup (priv->notification_hash, &id);
+	theme_set_notification_text(nw, summary, body);
 
-  if (!nt)
-  {
-	  nw = theme_create_notification();
-      id = 0;
-  }
-  else
-	  nw = nt->nw;
+	/*
+	 *XXX This needs to handle file URIs and all that.
+	 */
+	/* set_icon_from_data(nw, icon); */
 
-  use_pos_data = FALSE;
+	/* deal with x, and y hints */
+	if ((data = (GValue *)g_hash_table_lookup(hints, "x")) != NULL)
+	{
+		x = g_value_get_int(data);
 
-  theme_set_notification_text(nw, summary, body);
-  /*
-   * XXX This needs to handle file URIs and all that.
-   */
-  /* set_icon_from_data(nw, icon); */
+		if ((data = (GValue *)g_hash_table_lookup(hints, "y")) != NULL)
+		{
+			y = g_value_get_int(data);
+			use_pos_data = TRUE;
+		}
+	}
 
-  /* deal with x, and y hints */
-  data = (GValue *) (g_hash_table_lookup (hints, "x"));
-  if (data)
-    {
-      x = g_value_get_int (data);
-      data = (GValue *) g_hash_table_lookup (hints, "y");
+	/* set up action buttons */
+	for (i = 0; actions[i] != NULL; i += 2)
+	{
+		gchar *l = actions[i + 1];
 
-      if (data)
-        {
-          y = g_value_get_int (data);
-          use_pos_data = TRUE;
-        }
-    }
+		if (l == NULL)
+		{
+			g_warning("Label not found for action %s. "
+					  "The protocol specifies that a label must "
+					  "follow an action in the actions array", actions[i]);
 
-  /* set up action buttons */
-  i = 0;
-  while (actions[i] != NULL)
-    {
-      gchar *l = actions[i + 1];
+			break;
+		}
 
-      if (l == NULL)
-        {
-          g_warning ("Label not found for action %s. "
-                     "The protocol specifies that a label must "
-                     "follow an action in the actions array", actions[i]);
+		theme_add_notification_action(nw, l, actions[i],
+									  G_CALLBACK(_action_invoked_cb));
 
-          break;
-        }
-
-	  theme_add_notification_action(nw, l, actions[i],
-									G_CALLBACK(_action_invoked_cb));
-
 #if 0
-      b = egg_notification_bubble_widget_create_button (nw, l);
+		b = egg_notification_bubble_widget_create_button(nw, l);
 
-      g_object_set_data_full (G_OBJECT (b),
-                              "_notify_action",
-                              g_strdup (actions[i]),
-                              (GDestroyNotify) g_free);
+		g_object_set_data_full(G_OBJECT(b),
+							   "_notify_action",
+							   g_strdup(actions[i]),
+							   (GDestroyNotify) g_free);
 
-      g_signal_connect (b,
-                        "clicked",
-                        (GCallback)_notification_daemon_handle_bubble_widget_action,
-                        nw);
+		g_signal_connect(b,
+						 "clicked",
+						 (GCallback)
+						 _notification_daemon_handle_bubble_widget_action,
+						 nw);
 #endif
+	}
 
-      i = i + 2;
-    }
+	if (use_pos_data)
+	{
+		theme_set_notification_arrow(nw, TRUE, 0, 0);
+		theme_move_notification(nw, x, y);
+	}
+	else
+	{
+		theme_set_notification_arrow(nw, FALSE, 0, 0);
+		_notify_daemon_add_bubble_to_poptart_stack(daemon, nw);
+	}
 
-  if (use_pos_data)
-  {
-	  theme_set_notification_arrow(nw, TRUE, 0, 0);
-	  theme_move_notification(nw, x, y);
-  }
-  else
-  {
-	  theme_set_notification_arrow(nw, FALSE, 0, 0);
-      _notify_daemon_add_bubble_to_poptart_stack (daemon, nw);
-  }
+	/* check for icon_data if icon == "" */
+	if (*icon == '\0')
+	{
+		data = (GValue *)g_hash_table_lookup(hints, "icon_data");
 
-  /* check for icon_data if icon == "" */
-  if (strcmp ("", icon) == 0)
-    {
-      data = (GValue *) (g_hash_table_lookup (hints, "icon_data"));
-      if (data)
-        _notify_daemon_process_icon_data(daemon, nw, data);
-    }
+		if (data)
+			_notify_daemon_process_icon_data(daemon, nw, data);
+	}
 
-  g_signal_connect(G_OBJECT(nw), "button-release-event",
-	G_CALLBACK(_notification_daemon_handle_bubble_widget_default), daemon);
+	g_signal_connect(
+		G_OBJECT(nw), "button-release-event",
+		G_CALLBACK(_notification_daemon_handle_bubble_widget_default), daemon);
 
-  theme_show_notification(nw);
+	theme_show_notification(nw);
 
-  if (id == 0)
-    return_id = _store_notification (daemon, nw, timeout);
-  else
-    return_id = id;
+	return_id = (id == 0 ? _store_notification(daemon, nw, timeout) : id);
 
 #if CHECK_DBUS_VERSION(0, 60)
-  sender = dbus_g_method_get_sender (context);
+	sender = dbus_g_method_get_sender(context);
 #else
-  sender = g_strdup(dbus_message_get_sender(
-	dbus_g_message_get_message(context->message)));
+	sender = g_strdup(dbus_message_get_sender(
+		dbus_g_message_get_message(context->message)));
 #endif
 
-  g_object_set_data(G_OBJECT(nw), "_notify_id", GUINT_TO_POINTER(return_id));
-  g_object_set_data_full(G_OBJECT(nw),
-						 "_notify_sender", sender, (GDestroyNotify)g_free);
+	g_object_set_data(G_OBJECT(nw), "_notify_id",
+					  GUINT_TO_POINTER(return_id));
+	g_object_set_data_full(G_OBJECT(nw), "_notify_sender", sender,
+						   (GDestroyNotify)g_free);
 
-  if (nt)
-    _calculate_timeout (daemon, nt, timeout);
+	if (nt)
+		_calculate_timeout(daemon, nt, timeout);
 
-  dbus_g_method_return (context, return_id);
+	dbus_g_method_return(context, return_id);
 
-  return TRUE;
+	return TRUE;
 }
 
 gboolean
-notify_daemon_close_notification_handler (NotifyDaemon *daemon,
-                                          guint id,
-                                          GError **error)
+notify_daemon_close_notification_handler(NotifyDaemon *daemon,
+										 guint id, GError ** error)
 {
-  _close_notification (daemon, id);
+	_close_notification(daemon, id);
 
-  return TRUE;
+	return TRUE;
 }
 
 gboolean
-notify_daemon_get_capabilities(NotifyDaemon *daemon,
-							   char ***caps)
+notify_daemon_get_capabilities(NotifyDaemon *daemon, char ***caps)
 {
 	*caps = g_new0(char *, 6);
+
 	(*caps)[0] = g_strdup("actions");
 	(*caps)[1] = g_strdup("body");
 	(*caps)[2] = g_strdup("body-hyperlinks");
@@ -848,63 +804,68 @@
 }
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
-  NotifyDaemon *daemon;
-  DBusGConnection *connection;
-  DBusGProxy *bus_proxy;
-  GError *error;
-  guint request_name_result;
-  g_log_set_always_fatal (G_LOG_LEVEL_ERROR
-			  | G_LOG_LEVEL_CRITICAL);
+	NotifyDaemon *daemon;
+	DBusGConnection *connection;
+	DBusGProxy *bus_proxy;
+	GError *error;
+	guint request_name_result;
 
-  g_message ("initializing glib type system");
-  gtk_init (&argc, &argv);
-  gconf_init(argc, argv, NULL);
+	g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
 
-  gconf_client = gconf_client_get_default();
-  gconf_client_add_dir(gconf_client, "/apps/notification-daemon/theme",
-					   GCONF_CLIENT_PRELOAD_NONE, NULL);
+	g_message("initializing glib type system");
+	gtk_init(&argc, &argv);
+	gconf_init(argc, argv, NULL);
 
-  error = NULL;
-  connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	gconf_client = gconf_client_get_default();
+	gconf_client_add_dir(gconf_client, "/apps/notification-daemon/theme",
+						 GCONF_CLIENT_PRELOAD_NONE, NULL);
 
-  if (connection == NULL)
-    {
-      g_printerr ("Failed to open connection to bus: %s\n",
-                  error->message);
-      g_error_free (error);
-      exit (1);
-    }
+	error = NULL;
+	connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
 
-  g_message ("register 'daemon' type with dbus-glib...");
-  dbus_g_object_type_install_info (NOTIFY_TYPE_DAEMON, &dbus_glib__object_info);
-  g_message ("'daemon' successfully registered");
+	if (connection == NULL)
+	{
+		g_printerr("Failed to open connection to bus: %s\n",
+				   error->message);
+		g_error_free(error);
+		exit(1);
+	}
 
-  bus_proxy = dbus_g_proxy_new_for_name (connection, "org.freedesktop.DBus",
-                                         "/org/freedesktop/DBus",
-                                         "org.freedesktop.DBus");
+	g_message("register 'daemon' type with dbus-glib...");
+	dbus_g_object_type_install_info(NOTIFY_TYPE_DAEMON,
+									&dbus_glib__object_info);
+	g_message("'daemon' successfully registered");
 
-  if (!dbus_g_proxy_call (bus_proxy, "RequestName", &error,
-                          G_TYPE_STRING, "org.freedesktop.Notifications",
-                          G_TYPE_UINT, 0,
-                          G_TYPE_INVALID,
-                          G_TYPE_UINT, &request_name_result,
-                          G_TYPE_INVALID))
-    g_error ("Could not aquire name: %s", error->message);
+	bus_proxy = dbus_g_proxy_new_for_name(connection,
+										  "org.freedesktop.DBus",
+										  "/org/freedesktop/DBus",
+										  "org.freedesktop.DBus");
 
-  g_message ("creating instance of 'daemon' object...");
-  daemon = notify_daemon_new ();
-  g_message ("'daemon' object created successfully");
+	if (!dbus_g_proxy_call(bus_proxy, "RequestName", &error,
+						   G_TYPE_STRING, "org.freedesktop.Notifications",
+						   G_TYPE_UINT, 0,
+						   G_TYPE_INVALID,
+						   G_TYPE_UINT, &request_name_result,
+						   G_TYPE_INVALID))
+	{
+		g_error("Could not aquire name: %s", error->message);
+	}
 
-  g_message ("exporting instance of 'daemon' object over the bus...");
-  dbus_g_connection_register_g_object (connection, "/org/freedesktop/Notifications", G_OBJECT (daemon));
-  g_message ("'daemon' object exported successfully");
+	g_message("creating instance of 'daemon' object...");
+	daemon = notify_daemon_new();
+	g_message("'daemon' object created successfully");
 
-  gtk_main();
+	g_message("exporting instance of 'daemon' object over the bus...");
+	dbus_g_connection_register_g_object(connection,
+										"/org/freedesktop/Notifications",
+										G_OBJECT(daemon));
+	g_message("'daemon' object exported successfully");
 
-  g_object_unref(G_OBJECT(gconf_client));
+	gtk_main();
 
-  return 0;
-}
+	g_object_unref(G_OBJECT(gconf_client));
 
+	return 0;
+}

Modified: trunk/notification-daemon/src/daemon.h
===================================================================
--- trunk/notification-daemon/src/daemon.h	2006-01-19 09:37:42 UTC (rev 2435)
+++ trunk/notification-daemon/src/daemon.h	2006-01-19 10:38:02 UTC (rev 2436)
@@ -1,9 +1,9 @@
-/* notifydaemon.h - Implementation of the destop notification spec
+/*
+ * daemon.h - Implementation of the destop notification spec
  *
+ * Copyright (C) 2006 Christian Hammond <chipx86 at chipx86.com>
  * Copyright (C) 2005 John (J5) Palmieri <johnp at redhat.com>
  *
- * Written by John (J5) Palmieri <johnp at redhat.com>
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
@@ -30,58 +30,65 @@
 #include <dbus/dbus-glib-lowlevel.h>
 
 G_BEGIN_DECLS
-#define NOTIFY_TYPE_DAEMON (notify_daemon_get_type ())
-#define NOTIFY_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NOTIFY_TYPE_DAEMON, NotifyDaemon))
-#define NOTIFY_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NOTIFY_TYPE_DAEMON, NotifyDaemonClass))
-#define NOTIFY_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NOTIFY_TYPE_DAEMON))
-#define NOTIFY_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NOTIFY_TYPE_DAEMON))
-#define NOTIFY_DAEMON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), NOTIFY_TYPE_DAEMON, NotifyDaemonClass))
 
+#define NOTIFY_TYPE_DAEMON (notify_daemon_get_type())
+#define NOTIFY_DAEMON(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST ((obj), NOTIFY_TYPE_DAEMON, NotifyDaemon))
+#define NOTIFY_DAEMON_CLASS(klass) \
+	(G_TYPE_CHECK_CLASS_CAST ((klass), NOTIFY_TYPE_DAEMON, NotifyDaemonClass))
+#define NOTIFY_IS_DAEMON(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), NOTIFY_TYPE_DAEMON))
+#define NOTIFY_IS_DAEMON_CLASS(klass) \
+	(G_TYPE_CHECK_CLASS_TYPE ((klass), NOTIFY_TYPE_DAEMON))
+#define NOTIFY_DAEMON_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS((obj), NOTIFY_TYPE_DAEMON, NotifyDaemonClass))
+
 #define NOTIFY_DAEMON_DEFAULT_TIMEOUT 7000
 
-typedef struct _NotifyDaemon NotifyDaemon;
-typedef struct _NotifyDaemonClass NotifyDaemonClass;
+typedef struct _NotifyDaemon        NotifyDaemon;
+typedef struct _NotifyDaemonClass   NotifyDaemonClass;
 typedef struct _NotifyDaemonPrivate NotifyDaemonPrivate;
 
 struct _NotifyDaemon
 {
-  GObject parent;
+	GObject parent;
 
-  /*< private > */
-  NotifyDaemonPrivate *priv;
+	/*< private > */
+	NotifyDaemonPrivate *priv;
 };
 
 struct _NotifyDaemonClass
 {
-  GObjectClass parent_class;
+	GObjectClass parent_class;
 };
 
 enum _NotifyDaemonError
 {
-  NOTIFY_DAEMON_ERROR_GENERIC = 0,
+	NOTIFY_DAEMON_ERROR_GENERIC = 0,
 };
 
 GType notify_daemon_get_type(void);
 
-NotifyDaemon *notify_daemon_new(void) G_GNUC_MALLOC;
+NotifyDaemon *notify_daemon_new(void)
+	G_GNUC_MALLOC;
 
 gboolean notify_daemon_notify_handler(NotifyDaemon *daemon,
 									  const gchar *app_name,
-                                      const gchar *icon,
-                                      guint id,
-                                      const gchar *summary,
-                                      const gchar *body,
-                                      gchar **actions,
-                                      GHashTable *hints,
-                                      int timeout,
-                                      DBusGMethodInvocation *context);
+									  const gchar *icon,
+									  guint id,
+									  const gchar *summary,
+									  const gchar *body,
+									  gchar **actions,
+									  GHashTable *hints,
+									  int timeout,
+									  DBusGMethodInvocation *context);
 
 gboolean notify_daemon_close_notification_handler(NotifyDaemon *daemon,
-												  guint id,
-												  GError **error);
+												  guint id, GError **error);
 
 gboolean notify_daemon_get_capabilities(NotifyDaemon *daemon,
 										char ***out_caps);
+
 gboolean notify_daemon_get_server_information(NotifyDaemon *daemon,
 											  char **out_name,
 											  char **out_vendor,
@@ -91,4 +98,5 @@
 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-19 09:37:42 UTC (rev 2435)
+++ trunk/notification-daemon/src/engines.c	2006-01-19 10:38:02 UTC (rev 2436)
@@ -1,4 +1,7 @@
+#include "config.h"
+
 #include <gconf/gconf-client.h>
+#include "daemon.h"
 #include "engines.h"
 
 typedef struct



More information about the galago-commits mailing list