aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2011-05-16 16:43:47 -0400
committerJason Conti <jason.conti@gmail.com>2011-05-16 16:43:47 -0400
commit4952566811da7c64fac30ceeac7adbd7f8bce3e2 (patch)
tree5d4d93adf83d1a484774798e3b030c7a9cfce04f /src
parent465d4f15b790c8f287b7139cbfa52351e990af8d (diff)
downloadayatana-indicator-notifications-4952566811da7c64fac30ceeac7adbd7f8bce3e2.tar.gz
ayatana-indicator-notifications-4952566811da7c64fac30ceeac7adbd7f8bce3e2.tar.bz2
ayatana-indicator-notifications-4952566811da7c64fac30ceeac7adbd7f8bce3e2.zip
Proof of concept complete, should probably add timestamps next.
Diffstat (limited to 'src')
-rw-r--r--src/indicator-notifications.c39
-rw-r--r--src/notifications-service.c2
2 files changed, 35 insertions, 6 deletions
diff --git a/src/indicator-notifications.c b/src/indicator-notifications.c
index 77dadf3..9178958 100644
--- a/src/indicator-notifications.c
+++ b/src/indicator-notifications.c
@@ -286,20 +286,47 @@ static gboolean
new_notification_menuitem(DbusmenuMenuitem *new_item, DbusmenuMenuitem *parent,
DbusmenuClient *client, gpointer user_data)
{
- g_debug("New notification item");
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(new_item), FALSE);
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("<b>%s</b>\n%s\n<small><i>%s <b>%s</b></i></small>",
+ escaped_summary, escaped_body, _("from"), escaped_app_name);
+
+ g_free(escaped_app_name);
+ g_free(escaped_summary);
+ g_free(escaped_body);
+
+ GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
+
+ GtkWidget *label = gtk_label_new(NULL);
+ gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
+ gtk_label_set_markup(GTK_LABEL(label), markup);
+ gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+ gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD_CHAR);
+ gtk_widget_set_size_request(label, 300, -1);
+ gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+ gtk_widget_show(label);
+
+ g_free(markup);
+
GtkWidget *item = gtk_menu_item_new();
- gtk_menu_item_set_label(GTK_MENU_ITEM(item), dbusmenu_menuitem_property_get(new_item,
- NOTIFICATION_MENUITEM_PROP_SUMMARY));
- gtk_widget_show(item);
+ gtk_container_add(GTK_CONTAINER(item), hbox);
+ gtk_widget_show(hbox);
dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), new_item, GTK_MENU_ITEM(item), parent);
- g_object_unref(item);
-
return TRUE;
}
diff --git a/src/notifications-service.c b/src/notifications-service.c
index 880b889..fa176a0 100644
--- a/src/notifications-service.c
+++ b/src/notifications-service.c
@@ -71,7 +71,9 @@ add_notification_item(gpointer user_data)
item = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_TYPE, NOTIFICATION_MENUITEM_TYPE);
+ dbusmenu_menuitem_property_set(item, NOTIFICATION_MENUITEM_PROP_APP_NAME, notification_get_app_name(note));
dbusmenu_menuitem_property_set(item, NOTIFICATION_MENUITEM_PROP_SUMMARY, notification_get_summary(note));
+ dbusmenu_menuitem_property_set(item, NOTIFICATION_MENUITEM_PROP_BODY, notification_get_body(note));
dbusmenu_menuitem_child_add_position(root, item, 1);
g_queue_push_head(notification_items, item);