[Xfce4-commits] [apps/xfce4-notifyd] 19/24: panel-plugin: Add support for pixbufs in the log
noreply at xfce.org
noreply at xfce.org
Fri Sep 8 23:27:50 CEST 2017
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfce4-notifyd.
commit 79e3dbb6cff979aa1f4e55ad2a0c71dd00fe4433
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Sun Aug 27 00:53:30 2017 +0200
panel-plugin: Add support for pixbufs in the log
---
panel-plugin/notification-plugin-log.c | 19 +++++++++++++++++--
panel-plugin/notification-plugin.h | 1 +
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/panel-plugin/notification-plugin-log.c b/panel-plugin/notification-plugin-log.c
index 4f65b34..8719b1c 100644
--- a/panel-plugin/notification-plugin-log.c
+++ b/panel-plugin/notification-plugin-log.c
@@ -102,6 +102,9 @@ notification_plugin_menu_populate (NotificationPlugin *notification_plugin)
gchar *timestamp;
gsize num_groups = 0;
GtkCallback func = notification_plugin_menu_clear;
+ GdkPixbuf *pixbuf = NULL;
+ gchar *notify_log_icon_folder;
+ gchar *notify_log_icon_path;
today = g_date_time_new_now_local ();
timestamp = g_date_time_format (today, "%F");
@@ -110,6 +113,8 @@ notification_plugin_menu_populate (NotificationPlugin *notification_plugin)
gtk_container_foreach (GTK_CONTAINER (menu), func, menu);
notify_log = xfce_notify_log_get();
+ notify_log_icon_folder = xfce_resource_save_location (XFCE_RESOURCE_CACHE,
+ XFCE_NOTIFY_ICON_PATH, TRUE);
if (notify_log) {
gchar **groups;
@@ -180,9 +185,19 @@ G_GNUC_END_IGNORE_DEPRECATIONS
gtk_label_set_max_width_chars (GTK_LABEL (body), 40);
tmp = g_key_file_get_string (notify_log, group, "app_icon", NULL);
- app_icon = gtk_image_new_from_icon_name (tmp, GTK_ICON_SIZE_MENU);
+ notify_log_icon_path = g_strconcat (notify_log_icon_folder , tmp, ".png", NULL);
+ if (g_file_test (notify_log_icon_path, G_FILE_TEST_EXISTS))
+ {
+ pixbuf = gdk_pixbuf_new_from_file_at_scale (notify_log_icon_path,
+ 16, 16, FALSE, NULL);
+ app_icon = gtk_image_new_from_pixbuf (pixbuf);
+ }
+ else
+ {
+ app_icon = gtk_image_new_from_icon_name (tmp, GTK_ICON_SIZE_LARGE_TOOLBAR);
+ gtk_image_set_pixel_size (GTK_IMAGE (app_icon), 16);
+ }
g_free (tmp);
- gtk_image_set_pixel_size (GTK_IMAGE (app_icon), 16);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), app_icon);
G_GNUC_END_IGNORE_DEPRECATIONS
diff --git a/panel-plugin/notification-plugin.h b/panel-plugin/notification-plugin.h
index 8e9e549..a317b7b 100644
--- a/panel-plugin/notification-plugin.h
+++ b/panel-plugin/notification-plugin.h
@@ -26,6 +26,7 @@ G_BEGIN_DECLS
#define ICON_NAME "xfce4-notifyd"
#define XFCE_NOTIFY_LOG_FILE "xfce4/notifyd/log"
+#define XFCE_NOTIFY_ICON_PATH "xfce4/notifyd/icons/"
#define SETTING_LOG_DISPLAY_LIMIT "/plugin/log-display-limit"
#define DEFAULT_LOG_DISPLAY_LIMIT 10
#define SETTING_LOG_ONLY_TODAY "/plugin/log-only-today"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list