From 124254a41b45b790866c8df8d116a7bbef47ca50 Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Wed, 16 Nov 2016 17:43:24 +0000 Subject: themes: Add functionality to test for presence of action-icons Each of the themes will have to detect the 'action-icons' hint passed to them in 'set_notification_hints' to make a determination on whether or not to use image based buttons, instead of textual buttons, in their actions boxes. This factory behaviour simply extends the existing checks for urgency-hint, as well as unifying the code style between the various in-tree theme implementations. Signed-off-by: Ikey Doherty --- src/themes/coco/coco-theme.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/themes/coco/coco-theme.c') diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c index ae4037b..b72c743 100644 --- a/src/themes/coco/coco-theme.c +++ b/src/themes/coco/coco-theme.c @@ -47,7 +47,8 @@ typedef struct GtkWidget *pie_countdown; gboolean composited; - + gboolean action_icons; + int width; int height; int last_width; @@ -680,11 +681,12 @@ void set_notification_hints(GtkWindow *nw, GHashTable *hints) { WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); - GValue *value; + GValue *value = NULL, *icon_value = NULL; g_assert(windata != NULL); value = (GValue *)g_hash_table_lookup(hints, "urgency"); + icon_value = (GValue *)g_hash_table_lookup(hints, "action-icons"); if (value != NULL && G_VALUE_HOLDS_UCHAR(value)) { @@ -696,6 +698,12 @@ set_notification_hints(GtkWindow *nw, GHashTable *hints) gtk_window_set_title(GTK_WINDOW(nw), "Notification"); } } + + /* Determine if action-icons have been requested */ + if (icon_value != NULL && G_VALUE_HOLDS_BOOLEAN(icon_value)) + { + windata->action_icons = g_value_get_boolean(icon_value); + } } /* Notification tick */ -- cgit v1.2.1