Add support for the "replaces" protocol field.
Update SPECIFICATION with clarifications from Maciej
This commit is contained in:
parent
fa61f33b98
commit
6ba11f0bdb
|
@ -1,3 +1,6 @@
|
|||
Tue Jul 13 23:58:54 2004 Mike Hearn <mike@navi.cx>
|
||||
* SPECIFICATION: CloseNotification sends NotificationClosed signal.
|
||||
|
||||
Mon Jul 5 00:12:03 2004 Mike Hearn <mike@navi.cx>
|
||||
* tools/notify-send.c (main): Treat expiry times < current time
|
||||
as timeouts from current instant
|
||||
|
|
|
@ -185,18 +185,20 @@ The following messages must be supported by all implementations.
|
|||
"body": Supports body text. Some implementations may only show the
|
||||
summary (for instance, onscreen displays, marquee/scrollers)
|
||||
|
||||
"markup": Supports markup in the body text.
|
||||
"markup": Supports markup in the body text. If marked up text is sent
|
||||
to a server that does not give this cap, the markup will show
|
||||
through as regular text so must be stripped clientside.
|
||||
|
||||
"static-image" : Supports display of exactly 1 frame of any given
|
||||
image array. This value is mutually exclusive with
|
||||
"multi-image", it is a protocol error for the
|
||||
server to specify both. The client may still
|
||||
specify multiple frames even if this cap is
|
||||
missing, however the server is free to ignore them
|
||||
and use only the primary frame.
|
||||
|
||||
server to specify both.
|
||||
|
||||
"multi-image": The server will render an animation of all the frames
|
||||
in a given image array.
|
||||
in a given image array. The client may still specify
|
||||
multiple frames even if this cap and/or static-image
|
||||
is missing, however the server is free to ignore them
|
||||
and use only the primary frame.
|
||||
|
||||
"sound": The server will play the specified sound. Even if this cap
|
||||
is missing, a sound may still be specified however the
|
||||
|
@ -217,9 +219,15 @@ The following messages must be supported by all implementations.
|
|||
This message requires the following parameters in the exact order
|
||||
shown. For some parameters multiple types may be acceptable
|
||||
|
||||
UINT32 replaces: if non-zero this is the notification ID that
|
||||
this notification replaces. The server must atomically (ie with
|
||||
no flicker or other visual cues) replace the given notification
|
||||
with this one. This allows clients to effectively modify the
|
||||
notification while it's active.
|
||||
|
||||
BYTE urgency: The urgency level:
|
||||
0 - low urgency
|
||||
1 - medium (default)
|
||||
1 - medium
|
||||
2 - high
|
||||
3 - critical
|
||||
|
||||
|
@ -238,19 +246,13 @@ The following messages must be supported by all implementations.
|
|||
code. This code will be reported back to the client if the action
|
||||
is invoked by the user.
|
||||
|
||||
UINT32/NIL expire time: if nil the notification never times out
|
||||
|
||||
UINT32/NIL replaces: if non-nil this is the notification ID that
|
||||
this notification replaces. The server must atomically (ie with
|
||||
no flicker or other visual cues) replace the given notification
|
||||
with this one. This allows clients to effectively modify the
|
||||
notification while it's active.
|
||||
|
||||
UINT32/NIL expire time: if nil the notification never times out
|
||||
|
||||
It returns a UINT32 that will never be reused within a
|
||||
session unless more than MAXINT notifications have been generated
|
||||
(ie an acceptable implementation for this is just an incrementing
|
||||
counter).
|
||||
counter). The returned UINT32 will never be zero, as this is an invalid
|
||||
ID.
|
||||
|
||||
* CloseNotification
|
||||
|
||||
|
@ -258,7 +260,8 @@ The following messages must be supported by all implementations.
|
|||
the users view. It can be used, for instance, if the event the
|
||||
notification pertains to is no longer relevant or to cancel a
|
||||
notification with no expiration. It takes one UINT32 parameter, the ID
|
||||
of the notificaton to cancel.
|
||||
of the notificaton to cancel. The NotificationClosed signal is emitted by this
|
||||
method.
|
||||
|
||||
* GetServerInformation
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* FIXME: do we want so many arguments in the API? */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
@ -44,6 +47,8 @@ struct _NotifyHandle
|
|||
{
|
||||
guint32 id;
|
||||
|
||||
guint32 replaces;
|
||||
|
||||
gpointer user_data;
|
||||
|
||||
guint32 action_count;
|
||||
|
@ -101,6 +106,8 @@ _notify_handle_new(guint32 id)
|
|||
|
||||
handle->id = id;
|
||||
|
||||
handle->replaces = -1;
|
||||
|
||||
g_hash_table_insert(_handles, GINT_TO_POINTER(id), handle);
|
||||
|
||||
return handle;
|
||||
|
@ -571,7 +578,7 @@ notify_icon_destroy(NotifyIcon *icon)
|
|||
* Notifications API
|
||||
**************************************************************************/
|
||||
NotifyHandle *
|
||||
notify_send_notification(NotifyUrgency urgency, const char *summary,
|
||||
notify_send_notification(guint32 replaces, NotifyUrgency urgency, const char *summary,
|
||||
const char *detailed, const NotifyIcon *icon,
|
||||
gboolean expires, time_t expire_time,
|
||||
gpointer user_data, size_t action_count, ...)
|
||||
|
@ -582,7 +589,7 @@ notify_send_notification(NotifyUrgency urgency, const char *summary,
|
|||
g_return_val_if_fail(summary != NULL, 0);
|
||||
|
||||
va_start(actions, action_count);
|
||||
handle = notify_send_notification_varg(urgency, summary, detailed, icon,
|
||||
handle = notify_send_notification_varg(replaces, urgency, summary, detailed, icon,
|
||||
expires, expire_time, user_data,
|
||||
action_count, actions);
|
||||
va_end(actions);
|
||||
|
@ -591,7 +598,7 @@ notify_send_notification(NotifyUrgency urgency, const char *summary,
|
|||
}
|
||||
|
||||
NotifyHandle *
|
||||
notify_send_notification_varg(NotifyUrgency urgency, const char *summary,
|
||||
notify_send_notification_varg(guint32 replaces, NotifyUrgency urgency, const char *summary,
|
||||
const char *detailed, const NotifyIcon *icon,
|
||||
gboolean expires, time_t expire_time,
|
||||
gpointer user_data, size_t action_count,
|
||||
|
@ -612,6 +619,7 @@ notify_send_notification_varg(NotifyUrgency urgency, const char *summary,
|
|||
#if 0
|
||||
_notify_dbus_message_iter_append_app_info(&iter);
|
||||
#endif
|
||||
dbus_message_iter_append_uint32(&iter, replaces);
|
||||
dbus_message_iter_append_byte(&iter, urgency);
|
||||
dbus_message_iter_append_string(&iter, summary);
|
||||
_notify_dbus_message_iter_append_string_or_nil(&iter, detailed);
|
||||
|
|
|
@ -150,6 +150,7 @@ void notify_icon_destroy(NotifyIcon *icon);
|
|||
* void callback(NotifyHandle *handle, guint32 action_id, void *user_data);
|
||||
* @endcode
|
||||
*
|
||||
* @param replaces The ID of the notification to atomically replace
|
||||
* @param urgency The urgency level.
|
||||
* @param summary The summary of the notification.
|
||||
* @param detailed The optional detailed information.
|
||||
|
@ -164,7 +165,8 @@ void notify_icon_destroy(NotifyIcon *icon);
|
|||
*
|
||||
* @return A unique ID for the notification.
|
||||
*/
|
||||
NotifyHandle *notify_send_notification(NotifyUrgency urgency,
|
||||
NotifyHandle *notify_send_notification(guint32 replaces,
|
||||
NotifyUrgency urgency,
|
||||
const char *summary,
|
||||
const char *detailed,
|
||||
const NotifyIcon *icon,
|
||||
|
@ -181,6 +183,7 @@ NotifyHandle *notify_send_notification(NotifyUrgency urgency,
|
|||
* void callback(NotifyHandle *handle, guint32 action, void *user_data);
|
||||
* @endcode
|
||||
*
|
||||
* @param replaces The ID of the notification to atomically replace
|
||||
* @param urgency The urgency level.
|
||||
* @param summary The summary of the notification.
|
||||
* @param detailed The optional detailed information.
|
||||
|
@ -195,7 +198,8 @@ NotifyHandle *notify_send_notification(NotifyUrgency urgency,
|
|||
*
|
||||
* @return A unique ID for the notification.
|
||||
*/
|
||||
NotifyHandle *notify_send_notification_varg(NotifyUrgency urgency,
|
||||
NotifyHandle *notify_send_notification_varg(guint32 replaces,
|
||||
NotifyUrgency urgency,
|
||||
const char *summary,
|
||||
const char *detailed,
|
||||
const NotifyIcon *icon,
|
||||
|
|
|
@ -127,10 +127,10 @@ main(int argc, const char **argv)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
/* if the given time is < current time, treat it as a timeout in seconds (ie 5 seconds) */
|
||||
if (expire_time < time(NULL)) expire_time += time(NULL);
|
||||
/* if the given time is < current time, treat it as a timeout in seconds (ie 5 seconds) */
|
||||
if (expire_time < time(NULL)) expire_time += time(NULL);
|
||||
|
||||
notify_send_notification(urgency, summary, description, icon,
|
||||
notify_send_notification(0, urgency, summary, description, icon,
|
||||
TRUE, expire_time, NULL, 0);
|
||||
|
||||
if (icon != NULL)
|
||||
|
|
Loading…
Reference in New Issue