[Xfce4-commits] [apps/xfce4-notifyd] 08/29: Show the notification timestamp in the tooltip in current locale

noreply at xfce.org noreply at xfce.org
Sun Jan 29 20:51:58 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 7c35eba03c7e23ee8a97b33523e704199b83d12d
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Mon Oct 24 00:32:24 2016 +0200

    Show the notification timestamp in the tooltip in current locale
---
 xfce4-notifyd-config/main.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index b70720b..275e6dc 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -469,8 +469,19 @@ xfce4_notifyd_log_populate (GtkWidget *log_listbox)
             const gchar *group = groups[i];
             const char *format = "<b>\%s</b>";
             const char *tooltip_format = "<b>\%s</b> - \%s\n\%s";
+            const char *tooltip_format_simple = "<b>\%s</b> - \%s";
             char *markup;
             gchar *app_name;
+            gchar *tooltip_timestamp;
+            GTimeVal tv;
+            GDateTime *log_timestamp;
+
+            if (g_time_val_from_iso8601 (group, &tv) == TRUE) {
+                if (log_timestamp = g_date_time_new_from_timeval_local (&tv)) {
+                    tooltip_timestamp = g_date_time_format (log_timestamp, "%c");
+                    g_date_time_unref(log_timestamp);
+                }
+            }
 
             if (g_str_match_string(timestamp, group, FALSE) == TRUE && yesterday == FALSE) {
                 GtkWidget *header;
@@ -503,18 +514,21 @@ 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);
+                markup = g_strdup_printf (tooltip_format_simple, app_name, tooltip_timestamp);
             }
             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, app_name, tooltip_timestamp, g_key_file_get_string (notify_log, group, "body", NULL));
             }
-            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);
             else
+            /* TODO: Show a warning in the UI that only the first 100 are shown */
                 return;
         }
         g_key_file_free (notify_log);

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


More information about the Xfce4-commits mailing list