summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArx Cruz <arxcruz@gnome.org>2015-06-03 11:54:52 +0200
committerArx Cruz <arxcruz@gnome.org>2015-06-03 11:57:27 +0200
commitd44ca5978053bb79a406acb4c824f79068f329b8 (patch)
tree9e80e47640390aed6a4bf9451c1b1c93df92ff7c /src
parent99a34fe7e6321b708d0ef26784ae37cf92020a94 (diff)
downloadzenity-d44ca5978053bb79a406acb4c824f79068f329b8.tar.gz
Add the possibility to pass title and the summary to zenity notification
Now you can use zenity --notification --text="Title\nSummary" and it will use the first string before the first escape \n as the title, and the rest of the string as summary text.
Diffstat (limited to 'src')
-rw-r--r--src/notification.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/notification.c b/src/notification.c
index 3169a99..8086be6 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -315,6 +315,7 @@ zenity_notification (ZenityData *data, ZenityNotificationData *notification_data
GError *error;
NotifyNotification *notification;
GHashTable *notification_hints;
+ gchar **message;
/* create the notification widget */
if (!notify_is_initted ()) {
@@ -328,8 +329,16 @@ zenity_notification (ZenityData *data, ZenityNotificationData *notification_data
if (notification_data->notification_text == NULL) {
exit (1);
}
+
+ message = g_strsplit (g_strcompress (notification_data->notification_text), "\n", 2);
+ if (*message == NULL) {
+ g_printerr (_("Could not parse message\n"));
+ exit (1);
+ }
- notification = notify_notification_new (notification_data->notification_text, NULL, data->window_icon);
+ notification = notify_notification_new (message[0], /* title */
+ message[1], /* summary */
+ data->window_icon);
if (notification == NULL) {
exit (1);
}