summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIkey Doherty <[email protected]>2016-11-16 17:43:24 +0000
committermonsta <[email protected]>2017-02-14 17:03:17 +0400
commit124254a41b45b790866c8df8d116a7bbef47ca50 (patch)
treee4530c3f74dfe8e2e93850ada342aaa8acb51845
parenta6ff22d59d93ce06ea6752351f10873ace4a4627 (diff)
downloadmate-notification-daemon-124254a41b45b790866c8df8d116a7bbef47ca50.tar.bz2
mate-notification-daemon-124254a41b45b790866c8df8d116a7bbef47ca50.tar.xz
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 <[email protected]>
-rw-r--r--src/themes/coco/coco-theme.c12
-rw-r--r--src/themes/nodoka/nodoka-theme.c12
-rw-r--r--src/themes/slider/theme.c22
-rw-r--r--src/themes/standard/theme.c22
4 files changed, 48 insertions, 20 deletions
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 */
diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c
index b4420bd..2119f61 100644
--- a/src/themes/nodoka/nodoka-theme.c
+++ b/src/themes/nodoka/nodoka-theme.c
@@ -64,7 +64,8 @@ typedef struct
ArrowParameters arrow;
gboolean composited;
-
+ gboolean action_icons;
+
int width;
int height;
int last_width;
@@ -1084,11 +1085,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))
{
@@ -1100,6 +1102,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 */
diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c
index cc8e420..39c1977 100644
--- a/src/themes/slider/theme.c
+++ b/src/themes/slider/theme.c
@@ -42,6 +42,7 @@ typedef struct {
gboolean has_arrow;
gboolean composited;
+ gboolean action_icons;
int width;
int height;
@@ -450,27 +451,32 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
return GTK_WINDOW(win);
}
-void set_notification_hints(GtkWindow* nw, GHashTable* hints)
+void set_notification_hints(GtkWindow *nw, GHashTable *hints)
{
- WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata");
+ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
+ GValue *value = NULL, *icon_value = NULL;
g_assert(windata != NULL);
- GValue* value = (GValue*) g_hash_table_lookup(hints, "urgency");
+ 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))
{
windata->urgency = g_value_get_uchar(value);
- if (windata->urgency == URGENCY_CRITICAL)
- {
+ if (windata->urgency == URGENCY_CRITICAL) {
gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification");
- }
- else
- {
+ } else {
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);
+ }
}
void set_notification_timeout(GtkWindow *nw, glong timeout)
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index 59e07c2..2200e77 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -45,6 +45,7 @@ typedef struct {
gboolean has_arrow;
gboolean composited;
+ gboolean action_icons;
int point_x;
int point_y;
@@ -796,27 +797,32 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
return GTK_WINDOW(win);
}
-void set_notification_hints(GtkWindow* nw, GHashTable* hints)
+void set_notification_hints(GtkWindow *nw, GHashTable *hints)
{
- WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata");
+ WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
+ GValue *value = NULL, *icon_value = NULL;
g_assert(windata != NULL);
- GValue* value = (GValue*) g_hash_table_lookup(hints, "urgency");
+ 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))
{
windata->urgency = g_value_get_uchar(value);
- if (windata->urgency == URGENCY_CRITICAL)
- {
+ if (windata->urgency == URGENCY_CRITICAL) {
gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification");
- }
- else
- {
+ } else {
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);
+ }
}
void set_notification_timeout(GtkWindow* nw, glong timeout)