- Changed timeouts to expire times.

- Install notify-send.
This commit is contained in:
Christian Hammond 2004-07-04 21:09:58 +00:00
parent 216d1eaf74
commit db56d94133
6 changed files with 40 additions and 30 deletions

View File

@ -1,3 +1,12 @@
Sun Jul 04 14:08:59 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* libnotify/notify.c:
* libnotify/notify.h:
* tools/notify-send.c:
* SPECIFICATION:
- Changed timeouts to expire times.
- Install notify-send.
Sun Jul 04 13:46:32 PDT 2004 Christian Hammond <chipx86@gnupdate.org>
* tools/notify-send.c:

View File

@ -79,20 +79,21 @@ A notification has the following components:
requested by the client. As an example one possible rendering of
actions would be as buttons in the notification popup.
- A timeout: the time in milliseconds after which the notification
should be hidden (FIXME: should this be a function of text length
to accommodate different reading speeds?). If zero, the notification's
timeout is dependent on the notification server's settings, and may vary
for the type of notification.
- An expiration time: the timestamp in seconds since the epoch that the
notification should close. If one wishes to have an expiration of 5 seconds
from now, they must grab the current timestamp and add 5 seconds to it.
The timeout should be respected by implementations, but this is not
required (this is for compatibility with KNotify).
If zero, the notification's expiration time is dependent on the notification
server's settings, and may vary for the type of notification.
The expiration time should be respected by implementations, but this is
not required (this is for compatibility with KNotify).
Each notification displayed is allocated a unique ID by the server
(FIXME: should this be unique within a session, or just unique while
the notification is active?). This can be used to hide the
notification before the timeout is over. It can also be used to
notification before the expiration time is reached. It can also be used to
atomically replace the notification with another: this allows you to
(for instance) modify the contents of a notification while it's
on-screen.
@ -227,7 +228,7 @@ 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 timeout: if nil the notification never times out
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
@ -239,7 +240,7 @@ The following messages must be supported by all implementations.
This message indicates that the notification should be removed from
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 timeout. It takes one UINT32 parameter, the ID
notification with no expiration. It takes one UINT32 parameter, the ID
of the notificaton to cancel.
* GetServerInformation
@ -261,7 +262,7 @@ All implementations must emit the following signals:
* UINT32 id: containing the ID of the notification that was
completed.
* UINT32 reason: 1 for timeout, 2 for being dismissed by the user,
* UINT32 reason: 1 for expires, 2 for being dismissed by the user,
3 for "other".
The ID specified in the signal is invalidated *before* the signal

View File

@ -576,7 +576,7 @@ notify_icon_destroy(NotifyIcon *icon)
NotifyHandle *
notify_send_notification(NotifyUrgency urgency, const char *summary,
const char *detailed, const NotifyIcon *icon,
gboolean timeout, time_t timeout_time,
gboolean expires, time_t expire_time,
gpointer user_data, size_t action_count, ...)
{
va_list actions;
@ -586,7 +586,7 @@ notify_send_notification(NotifyUrgency urgency, const char *summary,
va_start(actions, action_count);
handle = notify_send_notification_varg(urgency, summary, detailed, icon,
timeout, timeout_time, user_data,
expires, expire_time, user_data,
action_count, actions);
va_end(actions);
@ -596,7 +596,7 @@ notify_send_notification(NotifyUrgency urgency, const char *summary,
NotifyHandle *
notify_send_notification_varg(NotifyUrgency urgency, const char *summary,
const char *detailed, const NotifyIcon *icon,
gboolean timeout, time_t timeout_time,
gboolean expires, time_t expire_time,
gpointer user_data, size_t action_count,
va_list actions)
{
@ -661,8 +661,8 @@ notify_send_notification_varg(NotifyUrgency urgency, const char *summary,
g_hash_table_insert(table, GINT_TO_POINTER(action->id), action);
}
if (timeout)
dbus_message_iter_append_uint32(&iter, timeout_time);
if (expires)
dbus_message_iter_append_uint32(&iter, expire_time);
else
dbus_message_iter_append_nil(&iter);
@ -675,7 +675,7 @@ notify_send_notification_varg(NotifyUrgency urgency, const char *summary,
if (dbus_error_is_set(&error))
{
print_error("Error sending SendNotification: %s\n", error.message);
print_error("Error sending Notify: %s\n", error.message);
dbus_error_free(&error);

View File

@ -154,9 +154,9 @@ void notify_icon_destroy(NotifyIcon *icon);
* @param summary The summary of the notification.
* @param detailed The optional detailed information.
* @param icon The optional icon.
* @param timeout TRUE if the notification should automatically timeout,
* @param expires TRUE if the notification should automatically expire,,
* or FALSE to keep it open until manually closed.
* @param timeout_time The optional time to automatically close the
* @param expire_time The optional time to automatically close the
* notification, or 0 for the daemon's default.
* @param user_data User-specified data to send to a callback.
* @param action_count The number of actions.
@ -168,7 +168,7 @@ NotifyHandle *notify_send_notification(NotifyUrgency urgency,
const char *summary,
const char *detailed,
const NotifyIcon *icon,
gboolean timeout, time_t timeout_time,
gboolean expires, time_t expire_time,
gpointer user_data,
size_t action_count, ...);
@ -185,9 +185,9 @@ NotifyHandle *notify_send_notification(NotifyUrgency urgency,
* @param summary The summary of the notification.
* @param detailed The optional detailed information.
* @param icon The optional icon.
* @param timeout TRUE if the notification should automatically timeout,
* @param expires TRUE if the notification should automatically expire,
* or FALSE to keep it open until manually closed.
* @param timeout_time The optional time to automatically close the
* @param expire_time The optional time to automatically close the
* notification, or 0 for the daemon's default.
* @param user_data User-specified data to send to a callback.
* @param action_count The number of actions.
@ -199,8 +199,8 @@ NotifyHandle *notify_send_notification_varg(NotifyUrgency urgency,
const char *summary,
const char *detailed,
const NotifyIcon *icon,
gboolean timeout,
time_t timeout_time,
gboolean expires,
time_t expire_time,
gpointer user_data,
size_t action_count,
va_list actions);

View File

@ -1,4 +1,4 @@
noinst_PROGRAMS = notify-send
bin_PROGRAMS = notify-send
common_ldflags = \
$(top_builddir)/libnotify/libnotify.la \

View File

@ -38,8 +38,7 @@ main(int argc, const char **argv)
gchar *icon_str = NULL;
NotifyIcon *icon = NULL;
NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL;
gboolean timeout = TRUE;
time_t timeout_time;
time_t expire_time;
char ch;
poptContext opt_ctx;
const char **args;
@ -48,8 +47,9 @@ main(int argc, const char **argv)
{ "urgency", 'u', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &urgency_str,
0, N_("Specifies the urgency level (low, normal, high, critical)"),
NULL },
{ "timeout", 't', POPT_ARG_INT | POPT_ARGFLAG_STRIP, &timeout_time, 0,
N_("Specifies the timeout time in seconds."), NULL },
{ "expire-time", 't', POPT_ARG_INT | POPT_ARGFLAG_STRIP, &expire_time,
0, N_("Specifies the timestamp at which to expire the notification"),
NULL },
{ "sound", 's', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &sound, 0,
N_("Specifies a sound file to play on notification."), NULL },
{ "icon", 'i', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &icons, 0,
@ -128,7 +128,7 @@ main(int argc, const char **argv)
}
notify_send_notification(urgency, summary, description, icon,
time(NULL) + timeout, timeout_time, NULL, 0);
TRUE, expire_time, NULL, 0);
if (icon != NULL)
notify_icon_destroy(icon);