[Xfce4-commits] [apps/xfce4-notifyd] 06/29: Add application name to log and tooltip

noreply at xfce.org noreply at xfce.org
Sun Jan 29 20:51:56 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 198e5dcfcb7821c21ed4813a81f2d6fc5a67dc18
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sat Oct 22 23:46:14 2016 +0200

    Add application name to log and tooltip
---
 xfce4-notifyd-config/main.c        | 12 +++++++-----
 xfce4-notifyd/xfce-notify-daemon.c |  6 +++---
 xfce4-notifyd/xfce-notify-log.c    |  4 +++-
 xfce4-notifyd/xfce-notify-log.h    | 11 ++++++-----
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index e092d22..b70720b 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -468,8 +468,9 @@ xfce4_notifyd_log_populate (GtkWidget *log_listbox)
             GtkWidget *summary, *body, *app_icon, *expire_timeout;
             const gchar *group = groups[i];
             const char *format = "<b>\%s</b>";
-            const char *tooltip_format = "<b>\%s</b>: \%s";
+            const char *tooltip_format = "<b>\%s</b> - \%s\n\%s";
             char *markup;
+            gchar *app_name;
 
             if (g_str_match_string(timestamp, group, FALSE) == TRUE && yesterday == FALSE) {
                 GtkWidget *header;
@@ -481,6 +482,7 @@ xfce4_notifyd_log_populate (GtkWidget *log_listbox)
                 yesterday = TRUE;
             }
 
+            app_name = g_key_file_get_string (notify_log, group, "app_name", NULL);
             markup = g_markup_printf_escaped (format, g_key_file_get_string (notify_log, group, "summary", NULL));
             summary = gtk_label_new (NULL);
             gtk_label_set_markup (GTK_LABEL (summary), markup);
@@ -490,6 +492,7 @@ xfce4_notifyd_log_populate (GtkWidget *log_listbox)
             gtk_label_set_xalign (GTK_LABEL (body), 0);
             gtk_label_set_ellipsize (GTK_LABEL (body), PANGO_ELLIPSIZE_END);
             app_icon = gtk_image_new_from_icon_name (g_key_file_get_string (notify_log, group, "app_icon", NULL), GTK_ICON_SIZE_LARGE_TOOLBAR);
+            gtk_image_set_pixel_size (GTK_IMAGE (app_icon), 24);
             gtk_widget_set_margin_start (app_icon, 3);
             expire_timeout = gtk_label_new (g_key_file_get_string (notify_log, group, "expire-timeout", NULL));
             // TODO: actions and timeout are missing (timeout is only interesting for urgent messages) - do we need that?
@@ -500,15 +503,14 @@ xfce4_notifyd_log_populate (GtkWidget *log_listbox)
             /* Handle icon-only notifications */
             if (g_strcmp0 (g_key_file_get_string (notify_log, group, "body", NULL), "") == 0) {
                 gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (summary), 1, 0, 1, 2);
-                gtk_widget_set_tooltip_text (grid, group);
             }
             else {
                 gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (summary), 1, 0, 1, 1);
                 gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (body), 1, 1, 1, 1);
-                markup = g_strdup_printf (tooltip_format, group, g_key_file_get_string (notify_log, group, "body", NULL));
-                gtk_widget_set_tooltip_markup (grid, markup);
-                g_free (markup);
             }
+            markup = g_strdup_printf (tooltip_format, app_name, group, g_key_file_get_string (notify_log, group, "body", NULL));
+            gtk_widget_set_tooltip_markup (grid, markup);
+            g_free (markup);
             /* Only show the first 100 notifications from the log */
             if (i <= 100)
                 gtk_list_box_insert (GTK_LIST_BOX (log_listbox), grid, 0);
diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index b0e4de9..6f1b3b2 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -1222,7 +1222,7 @@ notify_notify (XfceNotifyGBus *skeleton,
 
 
             if (xndaemon->notification_log == TRUE)
-                xfce_notify_log_insert (summary, body, app_icon, expire_timeout, actions);
+                xfce_notify_log_insert (new_app_name, summary, body, app_icon, expire_timeout, actions);
 
             xfce_notify_gbus_complete_notify(skeleton, invocation, OUT_id);
             return TRUE;
@@ -1318,10 +1318,10 @@ notify_notify (XfceNotifyGBus *skeleton,
     }
 
     // for a complete notification we need:
-    // summary, body, app_icon, expire_timeout, actions
+    // app_name, summary, body, app_icon, expire_timeout, actions
     // TODO: icons need to be handled, app_icon is bad - what shall be done with image_data??
     if (xndaemon->notification_log == TRUE)
-        xfce_notify_log_insert (summary, body, app_icon, expire_timeout, actions);
+        xfce_notify_log_insert (new_app_name, summary, body, app_icon, expire_timeout, actions);
 
     xfce_notify_window_set_icon_only(window, x_canonical);
 
diff --git a/xfce4-notifyd/xfce-notify-log.c b/xfce4-notifyd/xfce-notify-log.c
index 2ef3eac..92d50ed 100644
--- a/xfce4-notifyd/xfce-notify-log.c
+++ b/xfce4-notifyd/xfce-notify-log.c
@@ -56,7 +56,8 @@ xfce_notify_log_get (void)
     return notify_log;
 }
 
-void xfce_notify_log_insert (const gchar *summary,
+void xfce_notify_log_insert (const gchar *app_name,
+                             const gchar *summary,
                              const gchar *body,
                              const gchar *app_icon,
                              gint expire_timeout,
@@ -87,6 +88,7 @@ void xfce_notify_log_insert (const gchar *summary,
         timestamp = g_date_time_format (now, "%FT%T");
         group = g_strdup_printf ("%s", timestamp);
 
+        g_key_file_set_value (notify_log, group, "app_name", app_name);
         g_key_file_set_value (notify_log, group, "summary", summary);
         g_key_file_set_value (notify_log, group, "body", body);
         g_key_file_set_value (notify_log, group, "app_icon", app_icon);
diff --git a/xfce4-notifyd/xfce-notify-log.h b/xfce4-notifyd/xfce-notify-log.h
index d722106..3f9729e 100644
--- a/xfce4-notifyd/xfce-notify-log.h
+++ b/xfce4-notifyd/xfce-notify-log.h
@@ -24,11 +24,12 @@
 #define XFCE_NOTIFY_LOG_FILE "xfce4/notifyd/log"
 
 GKeyFile   *xfce_notify_log_get (void);
-void    xfce_notify_log_insert (const gchar *summary,
-                             const gchar *body,
-                             const gchar *app_icon,
-                             gint expire_timeout,
-                             const gchar **actions);
+void    xfce_notify_log_insert (const gchar *app_name,
+                                const gchar *summary,
+                                const gchar *body,
+                                const gchar *app_icon,
+                                gint expire_timeout,
+                                const gchar **actions);
 void    xfce_notify_log_clear (void);
 
 #endif /* __XFCE_NOTIFY_LOG_H_ */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list