Handled extra parameter of closed signal

This commit is contained in:
Matthias Clasen 2008-08-24 01:30:18 +00:00
parent c55aec216c
commit ef4c0eff7c
2 changed files with 112 additions and 1 deletions

View File

@ -0,0 +1,105 @@
diff -U0 libnotify-0.4.4/ChangeLog.closed-reason libnotify-0.4.4/ChangeLog
--- libnotify-0.4.4/ChangeLog.closed-reason 2007-02-28 05:11:47.000000000 +0000
+++ libnotify-0.4.4/ChangeLog 2008-08-14 15:35:07.000000000 +0100
@@ -0,0 +1,10 @@
+Tue Mar 18 21:51:32 PDT 2008 Christian Hammond <chipx86@chipx86.com>
+
+ * libnotify/notification.c:
+ * libnotify/notification.h:
+ * libnotify/notify.c:
+ * libnotify/notify-marshal.list:
+ * NEWS:
+ - Add support for sending the closed reason in the signal handler.
+ Closes ticket #139.
+
diff -up libnotify-0.4.4/libnotify/notification.c.closed-reason libnotify-0.4.4/libnotify/notification.c
--- libnotify-0.4.4/libnotify/notification.c.closed-reason 2008-08-14 15:34:40.000000000 +0100
+++ libnotify-0.4.4/libnotify/notification.c 2008-08-14 15:35:07.000000000 +0100
@@ -47,7 +47,7 @@
static void notify_notification_class_init(NotifyNotificationClass *klass);
static void notify_notification_init(NotifyNotification *sp);
static void notify_notification_finalize(GObject *object);
-static void _close_signal_handler(DBusGProxy *proxy, guint32 id,
+static void _close_signal_handler(DBusGProxy *proxy, guint32 id, guint32 reason,
NotifyNotification *notification);
static void _action_signal_handler(DBusGProxy *proxy, guint32 id,
@@ -155,7 +155,7 @@ notify_notification_class_init(NotifyNot
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(NotifyNotificationClass, closed),
NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_INT);
g_object_class_install_property(object_class, PROP_SUMMARY,
g_param_spec_string("summary", "Summary",
@@ -678,13 +678,13 @@ notify_notification_set_geometry_hints(N
}
static void
-_close_signal_handler(DBusGProxy *proxy, guint32 id,
+_close_signal_handler(DBusGProxy *proxy, guint32 id, guint32 reason,
NotifyNotification *notification)
{
if (id == notification->priv->id)
{
g_object_ref(G_OBJECT(notification));
- g_signal_emit(notification, signals[SIGNAL_CLOSED], 0);
+ g_signal_emit(notification, signals[SIGNAL_CLOSED], 0, reason);
notification->priv->id = 0;
g_object_unref(G_OBJECT(notification));
}
diff -up libnotify-0.4.4/libnotify/notification.h.closed-reason libnotify-0.4.4/libnotify/notification.h
--- libnotify-0.4.4/libnotify/notification.h.closed-reason 2008-08-14 15:34:40.000000000 +0100
+++ libnotify-0.4.4/libnotify/notification.h 2008-08-14 15:35:07.000000000 +0100
@@ -63,7 +63,7 @@ struct _NotifyNotificationClass
GObjectClass parent_class;
/* Signals */
- void (*closed)(NotifyNotification *notification);
+ void (*closed)(NotifyNotification *notification, gint reason);
};
/*
diff -up libnotify-0.4.4/libnotify/notify.c.closed-reason libnotify-0.4.4/libnotify/notify.c
--- libnotify-0.4.4/libnotify/notify.c.closed-reason 2007-02-15 10:28:46.000000000 +0000
+++ libnotify-0.4.4/libnotify/notify.c 2008-08-14 15:35:07.000000000 +0100
@@ -72,13 +72,19 @@ notify_init(const char *app_name)
NOTIFY_DBUS_CORE_INTERFACE);
dbus_g_connection_unref(bus);
+ dbus_g_object_register_marshaller(notify_marshal_VOID__UINT_UINT,
+ G_TYPE_NONE,
+ G_TYPE_UINT,
+ G_TYPE_UINT, G_TYPE_INVALID);
+
dbus_g_object_register_marshaller(notify_marshal_VOID__UINT_STRING,
G_TYPE_NONE,
G_TYPE_UINT,
G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_add_signal(_proxy, "NotificationClosed",
- G_TYPE_UINT, G_TYPE_INVALID);
+ G_TYPE_UINT, G_TYPE_UINT,
+ G_TYPE_INVALID);
dbus_g_proxy_add_signal(_proxy, "ActionInvoked",
G_TYPE_UINT, G_TYPE_STRING,
G_TYPE_INVALID);
diff -up libnotify-0.4.4/libnotify/notify-marshal.list.closed-reason libnotify-0.4.4/libnotify/notify-marshal.list
--- libnotify-0.4.4/libnotify/notify-marshal.list.closed-reason 2006-01-11 07:49:04.000000000 +0000
+++ libnotify-0.4.4/libnotify/notify-marshal.list 2008-08-14 15:35:07.000000000 +0100
@@ -1 +1,2 @@
+VOID:UINT,UINT
VOID:UINT,STRING
diff -up libnotify-0.4.4/NEWS.closed-reason libnotify-0.4.4/NEWS
--- libnotify-0.4.4/NEWS.closed-reason 2007-02-28 05:07:27.000000000 +0000
+++ libnotify-0.4.4/NEWS 2008-08-14 15:35:07.000000000 +0100
@@ -1,6 +1,8 @@
version 0.4.4 (27-February-2007):
* Fixed a bug where a notification's ID could be reset when a different
notification was closed. Patch by jylefort. (Bug #94)
+ * Added support for sending the closed reason in the "closed" signal
+ handler. (Ticket #139)
* Fixed a crash when the D-BUS proxy was not being freed on notify_uninit,
which was problematic when used in a loadable module. (Bug #92)
* Fixed a crash when a signal handler for the notification's closed signal

View File

@ -8,11 +8,13 @@
Summary: libnotify notification library
Name: libnotify
Version: 0.4.4
Release: 11%{?dist}
Release: 12%{?dist}
URL: http://www.galago-project.org/specs/notification/
Source0: http://www.galago-project.org/files/releases/source/%{name}/%{name}-%{version}.tar.bz2
# Sent upstream via email
Patch0: libnotify-send-xid-2.patch
# From upstream, changeset 3005
Patch1: libnotify-closed-reason.patch
License: LGPLv2+
Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -47,6 +49,7 @@ development of programs using %{name}.
%prep
%setup -q
%patch0 -p0 -b .send-xid
%patch1 -p1 -b .closed-reason
%build
@ -87,6 +90,9 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/gtk-doc/html/libnotify/*
%changelog
* Sat Aug 23 2008 Matthias Clasen <mclasen@redhat.com> - 0.4.4-12
- Handle extra parameter of the closed signal
* Tue Jun 10 2008 Colin Walters <walters@redhat.com> - 0.4.4-11
- Add patch neccessary for reliable notification positioning