[Galago-commits] r2454 - in trunk/libnotify: . libnotify tests tools
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Fri Jan 20 02:19:45 PST 2006
Author: chipx86
Date: 2006-01-20 02:19:44 -0800 (Fri, 20 Jan 2006)
New Revision: 2454
Modified:
trunk/libnotify/ChangeLog
trunk/libnotify/libnotify/notification.c
trunk/libnotify/libnotify/notification.h
trunk/libnotify/tests/test-basic.c
trunk/libnotify/tools/notify-send.c
Log:
Remove notify_notification_show_and_forget(). It's less confusing to have one show function, and require that the user unref. It also simplifies the code quite a bit.
Modified: trunk/libnotify/ChangeLog
===================================================================
--- trunk/libnotify/ChangeLog 2006-01-20 10:11:23 UTC (rev 2453)
+++ trunk/libnotify/ChangeLog 2006-01-20 10:19:44 UTC (rev 2454)
@@ -1,3 +1,13 @@
+Fri Jan 20 02:19:29 PST 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * libnotify/notification.c:
+ * libnotify/notification.h:
+ * tests/test-basic.c:
+ * tools/notify-send.c:
+ - Remove notify_notification_show_and_forget(). It's less confusing to
+ have one show function, and require that the user unref. It also
+ simplifies the code quite a bit.
+
Fri Jan 20 02:10:50 PST 2006 Christian Hammond <chipx86 at chipx86.com>
* libnotify/notification.c:
Modified: trunk/libnotify/libnotify/notification.c
===================================================================
--- trunk/libnotify/libnotify/notification.c 2006-01-20 10:11:23 UTC (rev 2453)
+++ trunk/libnotify/libnotify/notification.c 2006-01-20 10:19:44 UTC (rev 2454)
@@ -51,7 +51,7 @@
gchar *summary;
gchar *body;
- /* NULL to use icon data anything else to have server lookup icon */
+ /* NULL to use icon data. Anything else to have server lookup icon */
gchar *icon_name;
/*
@@ -74,19 +74,12 @@
DBusGProxy *proxy;
};
-typedef enum
+enum
{
SIGNAL_CLOSED,
LAST_SIGNAL
+};
-} NotifyNotificationSignalType;
-
-typedef struct
-{
- NotifyNotification *object;
-
-} NotifyNotificationSignal;
-
static guint signals[LAST_SIGNAL] = { 0 };
static GObjectClass *parent_class = NULL;
@@ -399,16 +392,19 @@
return (gchar **)g_array_free(a, FALSE);
}
-static gboolean
-_notify_notification_show_internal(NotifyNotification *notification,
- GError **error, gboolean ignore_reply)
+gboolean
+notify_notification_show(NotifyNotification *notification, GError **error)
{
- NotifyNotificationPrivate *priv = notification->priv;
+ NotifyNotificationPrivate *priv;
GError *tmp_error = NULL;
gchar **action_array;
+ g_return_val_if_fail(notification != NULL, FALSE);
+ g_return_val_if_fail(NOTIFY_IS_NOTIFICATION(notification), FALSE);
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
+ priv = notification->priv;
+
if (priv->proxy == NULL)
{
DBusGConnection *bus = dbus_g_bus_get(DBUS_BUS_SESSION, &tmp_error);
@@ -446,40 +442,21 @@
action_array = _gslist_to_string_array(priv->actions);
/* TODO: make this nonblocking */
+ dbus_g_proxy_call(
+ priv->proxy, "Notify", &tmp_error,
+ G_TYPE_STRING, notify_get_app_name(),
+ G_TYPE_UINT, priv->id,
+ G_TYPE_STRING, priv->icon_name != NULL ? priv->icon_name : "",
+ G_TYPE_STRING, priv->summary,
+ G_TYPE_STRING, priv->body,
+ G_TYPE_STRV, action_array,
+ dbus_g_type_get_map("GHashTable", G_TYPE_STRING,
+ G_TYPE_VALUE), priv->hints,
+ G_TYPE_INT, priv->timeout,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &priv->id,
+ G_TYPE_INVALID);
- if (ignore_reply)
- {
- dbus_g_proxy_call_no_reply(
- priv->proxy, "Notify",
- G_TYPE_STRING, notify_get_app_name(),
- G_TYPE_UINT, priv->id,
- G_TYPE_STRING, priv->icon_name != NULL ? priv->icon_name : "",
- G_TYPE_STRING, priv->summary,
- G_TYPE_STRING, priv->body,
- G_TYPE_STRV, action_array,
- dbus_g_type_get_map("GHashTable", G_TYPE_STRING,
- G_TYPE_VALUE), priv->hints,
- G_TYPE_INT, priv->timeout,
- G_TYPE_INVALID);
- }
- else
- {
- dbus_g_proxy_call(
- priv->proxy, "Notify", &tmp_error,
- G_TYPE_STRING, notify_get_app_name(),
- G_TYPE_UINT, priv->id,
- G_TYPE_STRING, priv->icon_name != NULL ? priv->icon_name : "",
- G_TYPE_STRING, priv->summary,
- G_TYPE_STRING, priv->body,
- G_TYPE_STRV, action_array,
- dbus_g_type_get_map("GHashTable", G_TYPE_STRING,
- G_TYPE_VALUE), priv->hints,
- G_TYPE_INT, priv->timeout,
- G_TYPE_INVALID,
- G_TYPE_UINT, &priv->id,
- G_TYPE_INVALID);
- }
-
/* Don't free the elements because they are owned by priv->actions */
g_free(action_array);
@@ -492,33 +469,6 @@
return TRUE;
}
-gboolean
-notify_notification_show(NotifyNotification *notification, GError **error)
-{
- g_return_val_if_fail(notification != NULL, FALSE);
- g_return_val_if_fail(NOTIFY_IS_NOTIFICATION(notification), FALSE);
- g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
-
- return _notify_notification_show_internal(notification, error, FALSE);
-}
-
-gboolean
-notify_notification_show_and_forget(NotifyNotification *notification,
- GError **error)
-{
- gboolean result;
-
- g_return_val_if_fail(notification != NULL, FALSE);
- g_return_val_if_fail(NOTIFY_IS_NOTIFICATION(notification), FALSE);
- g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
-
- 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)
Modified: trunk/libnotify/libnotify/notification.h
===================================================================
--- trunk/libnotify/libnotify/notification.h 2006-01-20 10:11:23 UTC (rev 2453)
+++ trunk/libnotify/libnotify/notification.h 2006-01-20 10:19:44 UTC (rev 2454)
@@ -98,9 +98,6 @@
gboolean notify_notification_show(NotifyNotification *notification,
GError **error);
-gboolean notify_notification_show_and_forget(NotifyNotification *notification,
- GError **error);
-
void notify_notification_set_timeout(NotifyNotification *notification,
gint timeout);
Modified: trunk/libnotify/tests/test-basic.c
===================================================================
--- trunk/libnotify/tests/test-basic.c 2006-01-20 10:11:23 UTC (rev 2453)
+++ trunk/libnotify/tests/test-basic.c 2006-01-20 10:19:44 UTC (rev 2454)
@@ -33,10 +33,12 @@
NULL, NULL);
notify_notification_set_timeout (n, 3000); //3 seconds
- if (!notify_notification_show_and_forget (n, NULL)) {
+ if (!notify_notification_show (n, NULL)) {
fprintf(stderr, "failed to send notification\n");
return 1;
}
+ g_object_unref(G_OBJECT(n));
+
return 0;
}
Modified: trunk/libnotify/tools/notify-send.c
===================================================================
--- trunk/libnotify/tools/notify-send.c 2006-01-20 10:11:23 UTC (rev 2453)
+++ trunk/libnotify/tools/notify-send.c 2006-01-20 10:19:44 UTC (rev 2454)
@@ -133,7 +133,8 @@
notify_notification_set_urgency(notify, urgency);
notify_notification_set_timeout(notify, expire_timeout);
- notify_notification_show_and_forget(notify, NULL);
+ notify_notification_show(notify, NULL);
+ g_object_unref(G_OBJECT(notify));
poptFreeContext(opt_ctx);
notify_uninit();
More information about the galago-commits
mailing list