diff options
author | Nuno Araujo <nuno.araujo@russo79.com> | 2013-02-14 01:08:56 +0100 |
---|---|---|
committer | Arx Cruz <arxcruz@gnome.org> | 2013-02-25 20:12:53 -0300 |
commit | 74d867c2aa9dde9dc21297c67af9e6432124b054 (patch) | |
tree | e78a87385fbcb07e698322c6ae2898f3111ac376 /src/option.c | |
parent | Updated Polish translation (diff) | |
download | zenity-74d867c2aa9dde9dc21297c67af9e6432124b054.tar.gz zenity-74d867c2aa9dde9dc21297c67af9e6432124b054.tar.bz2 zenity-74d867c2aa9dde9dc21297c67af9e6432124b054.zip |
Allow to specify notification's hints
Desktop Notifications Specification [1] specifies that hints can be
used to provide extra data to a notification server.
A new command line option --hint allows to add a hint to the
notification to display.
This option can be used multiple times, one for each hint to add.
--hint option format is name:value.
The new 'hints' command allow to specify hints in 'listen' mode.
Same format that in the command line option is used.
Several hints can be passed by separating them by '\n'.
Hints of value type '(iiibiiay)' are not supported.
This value type is used to pass a raw data image as a hint value.
This new change is useful for implementing the NotificationSource [2]
GNOME Goal.
A application using zenity and having a desktop file, can now specify
that it is a notification emitter and it's notifications can be
filtered in the new Notifications GNOME control panel pane.
[1] http://people.gnome.org/~mccann/docs/notification-spec/notification-spec-latest.html#hints
[2] https://live.gnome.org/GnomeGoals/NotificationSource
https://bugzilla.gnome.org/show_bug.cgi?id=693751
Diffstat (limited to 'src/option.c')
-rw-r--r-- | src/option.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/option.c b/src/option.c index 13275d1c..2ca9f1d7 100644 --- a/src/option.c +++ b/src/option.c @@ -86,6 +86,7 @@ static gboolean zenity_list_imagelist; /* Notification Dialog Options */ static gboolean zenity_notification_active; static gboolean zenity_notification_listen; +static gchar **zenity_notification_hints; #endif /* Progress Dialog Options */ @@ -652,6 +653,15 @@ static GOptionEntry notification_options[] = { N_("Listen for commands on stdin"), NULL }, + { + "hint", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING_ARRAY, + &zenity_notification_hints, + N_("Set the notification hints"), + N_("TEXT") + }, { NULL } @@ -1243,6 +1253,11 @@ zenity_option_free (void) { if (zenity_list_hide_column) g_free (zenity_list_hide_column); +#ifdef HAVE_LIBNOTIFY + if (zenity_notification_hints) + g_strfreev (zenity_notification_hints); +#endif + if (zenity_text_font) g_free (zenity_text_font); if (zenity_text_checkbox) @@ -1801,6 +1816,7 @@ zenity_notification_post_callback (GOptionContext *context, if (results->mode == MODE_NOTIFICATION) { results->notification_data->notification_text = zenity_general_dialog_text; results->notification_data->listen = zenity_notification_listen; + results->notification_data->notification_hints = zenity_notification_hints; } else { if (zenity_notification_listen) zenity_option_error (zenity_option_get_name (notification_options, &zenity_notification_listen), |