[Galago-commits] r2354 - in trunk/libnotify-ng: . libnotify

galago-commits at freedesktop.org galago-commits at freedesktop.org
Fri Dec 2 13:03:43 PST 2005


Author: johnp
Date: 2005-12-02 13:03:40 -0800 (Fri, 02 Dec 2005)
New Revision: 2354

Modified:
   trunk/libnotify-ng/ChangeLog
   trunk/libnotify-ng/libnotify/notifynotification.c
Log:
* libnotify/notifynotification.c (notify_notification_show_and_forget):
new method that shows and then unrefs the NotifyNotification object.
use this if you just want to fire off a quick notification.

* various compiler warning cleanups


Modified: trunk/libnotify-ng/ChangeLog
===================================================================
--- trunk/libnotify-ng/ChangeLog	2005-12-02 20:36:46 UTC (rev 2353)
+++ trunk/libnotify-ng/ChangeLog	2005-12-02 21:03:40 UTC (rev 2354)
@@ -1,3 +1,22 @@
+Fri Dec 02 2005  John (J5) Palmieri <johnp at redhat.com>
+
+	* libnotify/notifynotification.c (notify_notification_show_and_forget):
+	new method that shows and then unrefs the NotifyNotification object.
+	use this if you just want to fire off a quick notification.
+
+	* various compiler warning cleanups
+
+Fri Dec 02 2005  John (J5) Palmieri <johnp at redhat.com>
+
+	* libnotify/notifynotification.c (SIGNAL_TYPE_CLOSED): "closed" glib
+	signal added
+	(notify_notification_clear_hints): New API for clearing out the 
+	hints hash
+	(notify_notification_ref, notify_notification_unref): removed - use
+	g_object_ref/unref
+
+	* tests/*: Various changes to the test binaries
+
 Thu Nov 10 14:00:00 EST 2005  John (J5) Palmieri <johnp at redhat.com>
 
 	* Complete rewrite and first import to libnotify-ng module in SVN

Modified: trunk/libnotify-ng/libnotify/notifynotification.c
===================================================================
--- trunk/libnotify-ng/libnotify/notifynotification.c	2005-12-02 20:36:46 UTC (rev 2353)
+++ trunk/libnotify-ng/libnotify/notifynotification.c	2005-12-02 21:03:40 UTC (rev 2354)
@@ -186,7 +186,7 @@
     priv->user_data_free_func (priv->user_data);
 
   dbus_g_proxy_disconnect_signal (priv->proxy, "NotificationClosed", 
-                                  _close_signal_handler, 
+                                  (GCallback) _close_signal_handler, 
                                   object);
 
   g_free (obj->priv);
@@ -375,16 +375,6 @@
   return TRUE;
 }
 
-static DBusHandlerResult
-filter_func (DBusConnection     *connection,
-             DBusMessage        *message,
-             void               *user_data)
-{
-  g_message ("member %s", dbus_message_get_member (message));
-
-  return DBUS_HANDLER_RESULT_HANDLED;
-}
-
 static void 
 _close_signal_handler (DBusGProxy *proxy, 
                        guint32 id, 
@@ -399,8 +389,10 @@
                      0);
 }
 
-gboolean
-notify_notification_show (NotifyNotification *notification, GError **error)
+static gboolean
+_notify_notification_show_internal (NotifyNotification *notification, 
+                                    GError **error,
+                                    gboolean ignore_reply)
 {
   NotifyNotificationPrivate *priv;
   GError *tmp_error;
@@ -430,7 +422,7 @@
       dbus_g_proxy_add_signal (priv->proxy, "NotificationClosed",
                                G_TYPE_UINT, NULL);
       dbus_g_proxy_connect_signal (priv->proxy, "NotificationClosed", 
-                               _close_signal_handler, 
+                               (GCallback) _close_signal_handler, 
                                notification, NULL);
 
       dbus_g_connection_unref (bus);
@@ -440,7 +432,8 @@
   _notify_notification_update_applet_hints (notification);
 
   /*TODO: make this nonblocking */
-  dbus_g_proxy_call (priv->proxy, "Notify", &tmp_error,
+  if (!ignore_reply)
+    dbus_g_proxy_call (priv->proxy, "Notify", &tmp_error,
 		     G_TYPE_STRING, _notify_get_app_name (),
 		     G_TYPE_STRING,
 		     (priv->icon_name != NULL) ? priv->icon_name : "",
@@ -452,7 +445,20 @@
 							 G_TYPE_VALUE),
 		     priv->hints, G_TYPE_INT, priv->timeout, G_TYPE_INVALID,
 		     G_TYPE_UINT, &priv->id, G_TYPE_INVALID);
+  else
+    dbus_g_proxy_call_no_reply (priv->proxy, "Notify",
+		     G_TYPE_STRING, _notify_get_app_name (),
+		     G_TYPE_STRING,
+		     (priv->icon_name != NULL) ? priv->icon_name : "",
+		     G_TYPE_UINT, priv->id, G_TYPE_STRING, priv->summary,
+		     G_TYPE_STRING, priv->message,
+		     dbus_g_type_get_collection ("GSList", G_TYPE_STRING),
+		     priv->actions, dbus_g_type_get_map ("GHashTable",
+							 G_TYPE_STRING,
+							 G_TYPE_VALUE),
+		     priv->hints, G_TYPE_INT, priv->timeout, G_TYPE_INVALID);
 
+
   if (tmp_error != NULL)
     {
       g_propagate_error (error, tmp_error);
@@ -462,6 +468,25 @@
   return TRUE;
 }
 
+
+
+gboolean
+notify_notification_show (NotifyNotification *notification, GError **error)
+{
+  return _notify_notification_show_internal (notification, error, FALSE);
+}
+
+gboolean
+notify_notification_show_and_forget (NotifyNotification *notification, GError **error)
+{
+  gboolean result;
+
+  result =  _notify_notification_show_internal (notification, error, TRUE);
+  g_object_unref (G_OBJECT (notification));
+
+  return result;
+}
+
 void
 notify_notification_set_timeout (NotifyNotification * notification,
 				 gint timeout)



More information about the galago-commits mailing list