summaryrefslogtreecommitdiff
path: root/src/themes
diff options
context:
space:
mode:
authoryetist <[email protected]>2018-05-08 13:22:49 +0800
committerraveit65 <[email protected]>2018-06-06 17:41:02 +0200
commitdccffbc0a11a130ead7fd7101d90a2d8c043bfec (patch)
treecf4cc2d8ef94f7759e9fcac5aa403a7577aa8acd /src/themes
parent960df18a456f5171a2f5e052278df64d6c663989 (diff)
downloadmate-notification-daemon-dccffbc0a11a130ead7fd7101d90a2d8c043bfec.tar.bz2
mate-notification-daemon-dccffbc0a11a130ead7fd7101d90a2d8c043bfec.tar.xz
Use GVariant
Diffstat (limited to 'src/themes')
-rw-r--r--src/themes/coco/coco-theme.c19
-rw-r--r--src/themes/nodoka/nodoka-theme.c19
-rw-r--r--src/themes/slider/theme.c18
-rw-r--r--src/themes/standard/theme.c18
4 files changed, 36 insertions, 38 deletions
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c
index 2401e6c..a08baf7 100644
--- a/src/themes/coco/coco-theme.c
+++ b/src/themes/coco/coco-theme.c
@@ -85,7 +85,7 @@ void add_notification_action(GtkWindow *nw, const char *text, const char *key,
void clear_notification_actions(GtkWindow *nw);
void move_notification(GtkWidget *nw, int x, int y);
void set_notification_timeout(GtkWindow *nw, glong timeout);
-void set_notification_hints(GtkWindow *nw, GHashTable *hints);
+void set_notification_hints(GtkWindow *nw, GVariant *hints);
void notification_tick(GtkWindow *nw, glong remaining);
#define STRIPE_WIDTH 32
@@ -677,20 +677,19 @@ set_notification_timeout(GtkWindow *nw, glong timeout)
}
/* Set notification hints */
-void
-set_notification_hints(GtkWindow *nw, GHashTable *hints)
+void set_notification_hints(GtkWindow *nw, GVariant *hints)
{
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
- GValue *value = NULL, *icon_value = NULL;
+ GVariant *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");
+ g_variant_lookup(hints, "urgency", "v", &value);
+ g_variant_lookup(hints, "action-icons", "v", &icon_value);
- if (value != NULL && G_VALUE_HOLDS_UCHAR(value))
+ if (value != NULL && g_variant_get_type(value) == G_VARIANT_TYPE_BYTE)
{
- windata->urgency = g_value_get_uchar(value);
+ windata->urgency = g_variant_get_byte(value);
if (windata->urgency == URGENCY_CRITICAL) {
gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification");
@@ -700,9 +699,9 @@ set_notification_hints(GtkWindow *nw, GHashTable *hints)
}
/* Determine if action-icons have been requested */
- if (icon_value != NULL && G_VALUE_HOLDS_BOOLEAN(icon_value))
+ if (icon_value != NULL && g_variant_get_type(icon_value) == G_VARIANT_TYPE_BOOLEAN)
{
- windata->action_icons = g_value_get_boolean(icon_value);
+ windata->action_icons = g_variant_get_boolean(icon_value);
}
}
diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c
index 6348cd6..970038e 100644
--- a/src/themes/nodoka/nodoka-theme.c
+++ b/src/themes/nodoka/nodoka-theme.c
@@ -102,7 +102,7 @@ void add_notification_action(GtkWindow *nw, const char *text, const char *key,
void clear_notification_actions(GtkWindow *nw);
void move_notification(GtkWidget *nw, int x, int y);
void set_notification_timeout(GtkWindow *nw, glong timeout);
-void set_notification_hints(GtkWindow *nw, GHashTable *hints);
+void set_notification_hints(GtkWindow *nw, GVariant *hints);
void notification_tick(GtkWindow *nw, glong remaining);
#define STRIPE_WIDTH 32
@@ -1082,20 +1082,19 @@ set_notification_timeout(GtkWindow *nw, glong timeout)
}
/* Set notification hints */
-void
-set_notification_hints(GtkWindow *nw, GHashTable *hints)
+void set_notification_hints(GtkWindow *nw, GVariant *hints)
{
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
- GValue *value = NULL, *icon_value = NULL;
+ GVariant *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");
+ g_variant_lookup(hints, "urgency", "v", &value);
+ g_variant_lookup(hints, "action-icons", "v", &icon_value);
- if (value != NULL && G_VALUE_HOLDS_UCHAR(value))
+ if (value != NULL && g_variant_get_type(value) == G_VARIANT_TYPE_BYTE)
{
- windata->urgency = g_value_get_uchar(value);
+ windata->urgency = g_variant_get_byte(value);
if (windata->urgency == URGENCY_CRITICAL) {
gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification");
@@ -1105,9 +1104,9 @@ set_notification_hints(GtkWindow *nw, GHashTable *hints)
}
/* Determine if action-icons have been requested */
- if (icon_value != NULL && G_VALUE_HOLDS_BOOLEAN(icon_value))
+ if (icon_value != NULL && g_variant_get_type(icon_value) == G_VARIANT_TYPE_BOOLEAN)
{
- windata->action_icons = g_value_get_boolean(icon_value);
+ windata->action_icons = g_variant_get_boolean(icon_value);
}
}
diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c
index d1a2826..78984d0 100644
--- a/src/themes/slider/theme.c
+++ b/src/themes/slider/theme.c
@@ -76,7 +76,7 @@ void add_notification_action(GtkWindow *nw, const char *text, const char *key,
void clear_notification_actions(GtkWindow *nw);
void move_notification(GtkWidget *nw, int x, int y);
void set_notification_timeout(GtkWindow *nw, glong timeout);
-void set_notification_hints(GtkWindow *nw, GHashTable *hints);
+void set_notification_hints(GtkWindow *nw, GVariant *hints);
void notification_tick(GtkWindow *nw, glong remaining);
gboolean get_always_stack(GtkWidget* nw);
@@ -443,19 +443,19 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
return GTK_WINDOW(win);
}
-void set_notification_hints(GtkWindow *nw, GHashTable *hints)
+void set_notification_hints(GtkWindow *nw, GVariant *hints)
{
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
- GValue *value = NULL, *icon_value = NULL;
+ GVariant *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");
+ g_variant_lookup(hints, "urgency", "v", &value);
+ g_variant_lookup(hints, "action-icons", "v", &icon_value);
- if (value != NULL && G_VALUE_HOLDS_UCHAR(value))
+ if (value != NULL && g_variant_get_type(value) == G_VARIANT_TYPE_BYTE)
{
- windata->urgency = g_value_get_uchar(value);
+ windata->urgency = g_variant_get_byte(value);
if (windata->urgency == URGENCY_CRITICAL) {
gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification");
@@ -465,9 +465,9 @@ void set_notification_hints(GtkWindow *nw, GHashTable *hints)
}
/* Determine if action-icons have been requested */
- if (icon_value != NULL && G_VALUE_HOLDS_BOOLEAN(icon_value))
+ if (icon_value != NULL && g_variant_get_type(icon_value) == G_VARIANT_TYPE_BOOLEAN)
{
- windata->action_icons = g_value_get_boolean(icon_value);
+ windata->action_icons = g_variant_get_boolean(icon_value);
}
}
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index 0048f01..91147c2 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -93,7 +93,7 @@ void add_notification_action(GtkWindow *nw, const char *text, const char *key,
void clear_notification_actions(GtkWindow *nw);
void move_notification(GtkWidget *nw, int x, int y);
void set_notification_timeout(GtkWindow *nw, glong timeout);
-void set_notification_hints(GtkWindow *nw, GHashTable *hints);
+void set_notification_hints(GtkWindow *nw, GVariant *hints);
void notification_tick(GtkWindow *nw, glong remaining);
//#define ENABLE_GRADIENT_LOOK
@@ -793,19 +793,19 @@ GtkWindow* create_notification(UrlClickedCb url_clicked)
return GTK_WINDOW(win);
}
-void set_notification_hints(GtkWindow *nw, GHashTable *hints)
+void set_notification_hints(GtkWindow *nw, GVariant *hints)
{
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
- GValue *value = NULL, *icon_value = NULL;
+ GVariant *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");
+ g_variant_lookup(hints, "urgency", "v", &value);
+ g_variant_lookup(hints, "action-icons", "v", &icon_value);
- if (value != NULL && G_VALUE_HOLDS_UCHAR(value))
+ if (value != NULL && g_variant_get_type(value) == G_VARIANT_TYPE_BYTE)
{
- windata->urgency = g_value_get_uchar(value);
+ windata->urgency = g_variant_get_byte(value);
if (windata->urgency == URGENCY_CRITICAL) {
gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification");
@@ -815,9 +815,9 @@ void set_notification_hints(GtkWindow *nw, GHashTable *hints)
}
/* Determine if action-icons have been requested */
- if (icon_value != NULL && G_VALUE_HOLDS_BOOLEAN(icon_value))
+ if (icon_value != NULL && g_variant_get_type(icon_value) == G_VARIANT_TYPE_BOOLEAN)
{
- windata->action_icons = g_value_get_boolean(icon_value);
+ windata->action_icons = g_variant_get_boolean(icon_value);
}
}