From 4a3be1113e2218e9c1b82c079a3e229eac5614f1 Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Fri, 2 Dec 2005 21:03:40 +0000 Subject: [PATCH] * 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 --- ChangeLog | 19 ++++++++++++ libnotify/notifynotification.c | 55 ++++++++++++++++++++++++---------- 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5b1561..04d1b8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Fri Dec 02 2005 John (J5) Palmieri + + * 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 + + * 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 * Complete rewrite and first import to libnotify-ng module in SVN diff --git a/libnotify/notifynotification.c b/libnotify/notifynotification.c index 66e849e..050e79c 100644 --- a/libnotify/notifynotification.c +++ b/libnotify/notifynotification.c @@ -186,7 +186,7 @@ notify_notification_finalize (GObject * object) 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 @@ notify_notification_set_user_data (NotifyNotification * notification, 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 @@ _close_signal_handler (DBusGProxy *proxy, 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 @@ notify_notification_show (NotifyNotification *notification, GError **error) 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_show (NotifyNotification *notification, GError **error) _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,6 +445,19 @@ notify_notification_show (NotifyNotification *notification, GError **error) 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) { @@ -462,6 +468,25 @@ notify_notification_show (NotifyNotification *notification, GError **error) 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)