[Xfce4-commits] [apps/xfce4-notifyd] 11/29: Display icons for applications
noreply at xfce.org
noreply at xfce.org
Sun Jan 29 20:52:01 CET 2017
This is an automated email from the git hooks/post-receive script.
ochosi pushed a commit to branch master
in repository apps/xfce4-notifyd.
commit 83312db2f5a421210439e8d27f003ddccdb3d79f
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Fri Jan 6 12:18:26 2017 +0100
Display icons for applications
This is a first implementation, by far not ideal, but it will display
icons for at least some of the applications, making it easier for users
to browse the list.
---
xfce4-notifyd-config/main.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index 14d359a..d32d580 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -373,12 +373,14 @@ xfce4_notifyd_known_applications_changed (XfconfChannel *channel,
GtkWidget *known_applications_listbox = user_data;
GtkWidget *hbox;
GtkWidget *label;
+ GtkWidget *icon;
GtkWidget *mute_switch;
GtkCallback func = listbox_remove_all;
GPtrArray *known_applications;
GPtrArray *muted_applications;
GValue *known_application;
guint i, j;
+ gchar *icon_name;
known_applications = xfconf_channel_get_arrayv (channel, KNOWN_APPLICATIONS_PROP);
muted_applications = xfconf_channel_get_arrayv (channel, MUTED_APPLICATIONS_PROP);
@@ -393,6 +395,16 @@ xfce4_notifyd_known_applications_changed (XfconfChannel *channel,
known_application = g_ptr_array_index (known_applications, i);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
label = gtk_label_new (g_value_get_string (known_application));
+ icon_name = g_value_get_string (known_application);
+ if (gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), icon_name, 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK))
+ icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
+ else if (gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), g_ascii_strdown(icon_name, -1), 16, GTK_ICON_LOOKUP_GENERIC_FALLBACK))
+ icon = gtk_image_new_from_icon_name (g_ascii_strdown(icon_name, -1), GTK_ICON_SIZE_MENU);
+ else {
+ icon = gtk_image_new ();
+ gtk_image_set_pixel_size (GTK_IMAGE(icon), 16);
+ }
+
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (label), 0);
#else
@@ -400,6 +412,7 @@ xfce4_notifyd_known_applications_changed (XfconfChannel *channel,
#endif
mute_switch = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (mute_switch), TRUE);
+ gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, TRUE, 3);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 3);
gtk_box_pack_end (GTK_BOX (hbox), mute_switch, FALSE, TRUE, 3);
gtk_list_box_insert (GTK_LIST_BOX (known_applications_listbox), hbox, -1);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list