From 425bde705a072effe6232cb3fa4fecdcb8849639 Mon Sep 17 00:00:00 2001 From: Jason Conti Date: Tue, 17 May 2011 16:15:41 -0400 Subject: Adding a timestamp to the messages. Currently sends a timestamp string across dbus, but ideally it will send an integer, and the indicator can decide how to display it (time ago in words, custom time format, etc). --- src/indicator-notifications.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'src/indicator-notifications.c') diff --git a/src/indicator-notifications.c b/src/indicator-notifications.c index 9178958..72e806c 100644 --- a/src/indicator-notifications.c +++ b/src/indicator-notifications.c @@ -290,23 +290,22 @@ new_notification_menuitem(DbusmenuMenuitem *new_item, DbusmenuMenuitem *parent, g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); g_return_val_if_fail(IS_INDICATOR_NOTIFICATIONS(user_data), FALSE); - const gchar *app_name = dbusmenu_menuitem_property_get(new_item, - NOTIFICATION_MENUITEM_PROP_APP_NAME); - const gchar *summary = dbusmenu_menuitem_property_get(new_item, - NOTIFICATION_MENUITEM_PROP_SUMMARY); - const gchar *body = dbusmenu_menuitem_property_get(new_item, - NOTIFICATION_MENUITEM_PROP_BODY); - - gchar *escaped_app_name = g_markup_escape_text(app_name, strlen(app_name)); - gchar *escaped_summary = g_markup_escape_text(summary, strlen(summary)); - gchar *escaped_body = g_markup_escape_text(body, strlen(body)); - - gchar *markup = g_strdup_printf("%s\n%s\n%s %s", - escaped_summary, escaped_body, _("from"), escaped_app_name); - - g_free(escaped_app_name); - g_free(escaped_summary); - g_free(escaped_body); + gchar *app_name = g_markup_escape_text(dbusmenu_menuitem_property_get(new_item, + NOTIFICATION_MENUITEM_PROP_APP_NAME), -1); + gchar *summary = g_markup_escape_text(dbusmenu_menuitem_property_get(new_item, + NOTIFICATION_MENUITEM_PROP_SUMMARY), -1); + gchar *body = g_markup_escape_text(dbusmenu_menuitem_property_get(new_item, + NOTIFICATION_MENUITEM_PROP_BODY), -1); + gchar *timestamp_string = g_markup_escape_text(dbusmenu_menuitem_property_get(new_item, + NOTIFICATION_MENUITEM_PROP_TIMESTAMP_STRING), -1); + + gchar *markup = g_strdup_printf("%s\n%s\n%s %s %s", + summary, body, timestamp_string, _("from"), app_name); + + g_free(app_name); + g_free(summary); + g_free(body); + g_free(timestamp_string); GtkWidget *hbox = gtk_hbox_new(FALSE, 0); -- cgit v1.2.3