diff options
author | Ikey Doherty <[email protected]> | 2016-11-16 18:44:50 +0000 |
---|---|---|
committer | monsta <[email protected]> | 2017-02-14 17:03:17 +0400 |
commit | 471a3762c1b1b1515c8e5975e78ad5ebb11986d1 (patch) | |
tree | 4e24bfd75d488957c62a51a9ab1bfd015c267d84 | |
parent | 70425533f5648d00113e7bfeabe52198c6bbdad8 (diff) | |
download | mate-notification-daemon-471a3762c1b1b1515c8e5975e78ad5ebb11986d1.tar.bz2 mate-notification-daemon-471a3762c1b1b1515c8e5975e78ad5ebb11986d1.tar.xz |
themes: Implement support for action-icons buttons
Now that all of the elements are in place to support (dynamically) the
action icons, we can use the 'key' in place of the 'label' when the client
sends an hint requesting it.
Some other minor issues were corrected in this change, such as ensuring that
we always show *all* widgets inside of the notification window so that when
a live notification window is updated, the action box state is not then
hidden from view.
Signed-off-by: Ikey Doherty <[email protected]>
-rw-r--r-- | src/themes/coco/coco-theme.c | 13 | ||||
-rw-r--r-- | src/themes/nodoka/nodoka-theme.c | 13 | ||||
-rw-r--r-- | src/themes/slider/theme.c | 15 | ||||
-rw-r--r-- | src/themes/standard/theme.c | 14 |
4 files changed, 45 insertions, 10 deletions
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c index 6291354..52d542c 100644 --- a/src/themes/coco/coco-theme.c +++ b/src/themes/coco/coco-theme.c @@ -592,9 +592,12 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, } } + if (windata->action_icons) { + button = gtk_button_new_from_icon_name(key, GTK_ICON_SIZE_BUTTON); + goto add_button; + } + button = gtk_button_new(); - gtk_widget_show(button); - gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_show(hbox); @@ -630,11 +633,17 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); +add_button: + gtk_widget_show(button); + gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); + g_object_set_data(G_OBJECT(button), "_nw", nw); g_object_set_data_full(G_OBJECT(button), "_action_key", g_strdup(key), g_free); g_signal_connect(G_OBJECT(button), "button-release-event", G_CALLBACK(action_clicked_cb), cb); + + gtk_widget_show_all(windata->actions_box); } /* Clear notification actions */ diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c index 3a5cb5e..d3329b2 100644 --- a/src/themes/nodoka/nodoka-theme.c +++ b/src/themes/nodoka/nodoka-theme.c @@ -989,9 +989,12 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, } } + if (windata->action_icons) { + button = gtk_button_new_from_icon_name(key, GTK_ICON_SIZE_BUTTON); + goto add_button; + } + button = gtk_button_new(); - gtk_widget_show(button); - gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_show(hbox); @@ -1027,11 +1030,17 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); +add_button: + gtk_widget_show(button); + gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); + g_object_set_data(G_OBJECT(button), "_nw", nw); g_object_set_data_full(G_OBJECT(button), "_action_key", g_strdup(key), g_free); g_signal_connect(G_OBJECT(button), "button-release-event", G_CALLBACK(action_clicked_cb), cb); + + gtk_widget_show_all(windata->actions_box); } /* Clear notification actions */ diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c index d12b74d..46c32cd 100644 --- a/src/themes/slider/theme.c +++ b/src/themes/slider/theme.c @@ -732,11 +732,13 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A } } + if (windata->action_icons) { + button = gtk_button_new_from_icon_name(key, GTK_ICON_SIZE_BUTTON); + goto add_button; + } + button = gtk_button_new(); gtk_widget_show(button); - gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); - gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); - gtk_container_set_border_width(GTK_CONTAINER(button), 0); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_show(hbox); @@ -770,9 +772,16 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); +add_button: + gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_container_set_border_width(GTK_CONTAINER(button), 0); + g_object_set_data(G_OBJECT(button), "_nw", nw); g_object_set_data_full(G_OBJECT(button), "_action_key", g_strdup(key), g_free); g_signal_connect(G_OBJECT(button), "button-release-event", G_CALLBACK(on_action_clicked), cb); + + gtk_widget_show_all(windata->actions_box); } void clear_notification_actions(GtkWindow* nw) diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c index 5508172..c4a75d6 100644 --- a/src/themes/standard/theme.c +++ b/src/themes/standard/theme.c @@ -1036,10 +1036,12 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A } } - button = gtk_button_new(); - gtk_widget_show(button); - gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); + if (windata->action_icons) { + button = gtk_button_new_from_icon_name(key, GTK_ICON_SIZE_BUTTON); + goto add_button; + } + button = gtk_button_new(); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); gtk_widget_show(hbox); gtk_container_add(GTK_CONTAINER(button), hbox); @@ -1072,9 +1074,15 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); +add_button: + gtk_widget_show(button); + gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); + g_object_set_data(G_OBJECT(button), "_nw", nw); g_object_set_data_full(G_OBJECT(button), "_action_key", g_strdup(key), g_free); g_signal_connect(G_OBJECT(button), "button-release-event", G_CALLBACK(action_clicked_cb), cb); + + gtk_widget_show_all(windata->actions_box); } void clear_notification_actions(GtkWindow* nw) |