[maemo-commits] [maemo-commits] r12320 - in projects/haf/trunk/hildon-notify: . tests

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jun 15 17:40:48 EEST 2007
Author: lucasr
Date: 2007-06-15 17:40:46 +0300 (Fri, 15 Jun 2007)
New Revision: 12320

Added:
   projects/haf/trunk/hildon-notify/tests/test-sound.c
Modified:
   projects/haf/trunk/hildon-notify/ChangeLog
Log:
2007-06-15  Lucas Rocha  <lucas.rocha at nokia.com>

	* tests/test-sound.c: added new test program for sound.


Modified: projects/haf/trunk/hildon-notify/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-notify/ChangeLog	2007-06-15 14:15:13 UTC (rev 12319)
+++ projects/haf/trunk/hildon-notify/ChangeLog	2007-06-15 14:40:46 UTC (rev 12320)
@@ -1,3 +1,7 @@
+2007-06-15  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* tests/test-sound.c: added new test program for sound.
+
 2007-06-08  Lucas Rocha  <lucas.rocha at nokia.com>
 
 	* configure.ac: post release version bump.

Added: projects/haf/trunk/hildon-notify/tests/test-sound.c
===================================================================
--- projects/haf/trunk/hildon-notify/tests/test-sound.c	2007-06-15 14:15:13 UTC (rev 12319)
+++ projects/haf/trunk/hildon-notify/tests/test-sound.c	2007-06-15 14:40:46 UTC (rev 12320)
@@ -0,0 +1,58 @@
+#include <glib.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include <hildon/hildon-notification.h>
+#include <libnotify/notify.h>
+
+static GMainLoop *loop;
+
+void 
+closed (NotifyNotification *n, gpointer user_data)
+{
+  g_debug ("NOTIFICATION CLOSED!");
+}
+
+gboolean
+close_notification (gpointer n)
+{
+  notify_notification_close (NOTIFY_NOTIFICATION (n), NULL);
+
+  return FALSE;
+}
+
+int
+main(int argc, char **argv)
+{
+  HildonNotification *n;
+  DBusConnection *conn;
+  
+  if (!notify_init ("D-Bus Action Test")) exit(1);
+  
+  conn = dbus_bus_get (DBUS_BUS_SESSION, NULL);
+  
+  loop = g_main_loop_new (NULL, FALSE);
+  
+  dbus_connection_setup_with_g_main (conn, NULL);
+  
+  n = hildon_notification_new ("John Doe", 
+  		               "Hi! How are you!?", 
+  			       "qgn_contact_group_chat_invitation", 
+  			       "chat");
+
+  hildon_notification_set_sound (n, "/usr/share/sounds/chat-start_new.wav");
+  
+  g_signal_connect (G_OBJECT (n), "closed", G_CALLBACK (closed), NULL);
+
+  if (!notify_notification_show (NOTIFY_NOTIFICATION (n), NULL)) 
+  {
+    g_warning ("Failed to send notification");
+
+    return 1;
+  }
+
+  g_main_loop_run (loop);
+  
+  return 0;
+}


More information about the maemo-commits mailing list