diff options
author | Aurélio A. Heckert <aurium@gmail.com> | 2009-08-10 00:08:14 +0100 |
---|---|---|
committer | Lucas Rocha <lucasr@gnome.org> | 2009-08-10 02:38:41 +0100 |
commit | 533edc70443741edd36fe7b332ce47c2f2701167 (patch) | |
tree | 453e7cb33a2760e5c4ee0e9b39e51c17aabe3cee | |
parent | Updated Spanish translation (diff) | |
download | zenity-533edc70443741edd36fe7b332ce47c2f2701167.tar.gz zenity-533edc70443741edd36fe7b332ce47c2f2701167.tar.bz2 zenity-533edc70443741edd36fe7b332ce47c2f2701167.zip |
Bug 573802 - Support notification summary
You can now define title and summary on notifications. The first line
of the provided text will be considered the title and the following
lines are the summary.
-rw-r--r-- | src/notification.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/notification.c b/src/notification.c index 1d80fa15..674eaec9 100644 --- a/src/notification.c +++ b/src/notification.c @@ -165,10 +165,18 @@ zenity_notification_handle_stdin (GIOChannel *channel, NotifyNotification *notif; const gchar *icon = NULL; gchar *freeme = NULL; - gchar *message; + gchar **message; error = NULL; - message = g_strcompress (value); + /* message[1] (the summary) will be NULL in case there's + * no \n in the string. In which case only the title is + * defined */ + message = g_strsplit (g_strcompress (value), "\n", 2); + + if (*message == NULL) { + g_printerr (_("Could not parse message from stdin\n")); + continue; + } if (icon_stock) { icon = icon_stock; @@ -176,9 +184,12 @@ zenity_notification_handle_stdin (GIOChannel *channel, icon = freeme = g_filename_to_uri (icon_file, NULL, NULL); } - notif = notify_notification_new_with_status_icon (message, NULL /* summary */, - icon, status_icon); - g_free (message); + notif = notify_notification_new_with_status_icon ( + message[0] /* title */, + message[1] /* summary */, + icon, status_icon); + + g_strfreev (message); g_free (freeme); notify_notification_show (notif, &error); |