[Xfce4-commits] [apps/xfce4-notifyd] 01/01: Make sure empty logs are also handled correctly

noreply at xfce.org noreply at xfce.org
Mon Feb 13 08:08: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 c12f7eb846976eee32742d292f6bb9b13f387ac8
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Mon Feb 13 08:08:30 2017 +0100

    Make sure empty logs are also handled correctly
---
 xfce4-notifyd-config/main.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index 6c483aa..4cc33f5 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -498,11 +498,15 @@ xfce4_notifyd_log_populate (GtkWidget *log_listbox)
         gchar **groups;
         gboolean yesterday = FALSE;
         gsize num_groups;
+        int log_length;
 
         groups = g_key_file_get_groups (notify_log, &num_groups);
+        log_length = GPOINTER_TO_UINT(num_groups) - LOG_DISPLAY_LIMIT;
+        if (log_length < 0)
+            log_length = 0;
 
         /* Notifications are only shown until LOG_DISPLAY_LIMIT is hit */
-        for (i = GPOINTER_TO_UINT(num_groups) - LOG_DISPLAY_LIMIT; groups && groups[i]; i += 1) {
+        for (i = log_length; groups && groups[i]; i += 1) {
             GtkWidget *grid;
             GtkWidget *summary, *body, *app_icon, *expire_timeout;
             const gchar *group = groups[i];
@@ -568,15 +572,17 @@ xfce4_notifyd_log_populate (GtkWidget *log_listbox)
 
             gtk_list_box_insert (GTK_LIST_BOX (log_listbox), grid, 0);
         }
-        limit_label = g_strdup_printf("Showing %d of %d notifications. Click to open full log.",
-                                      LOG_DISPLAY_LIMIT, GPOINTER_TO_UINT(num_groups));
-        limit_button = gtk_button_new_with_label (limit_label);
-        gtk_widget_set_margin_bottom (limit_button, 3);
-        gtk_widget_set_margin_top (limit_button, 3);
-        gtk_button_set_relief (GTK_BUTTON (limit_button), GTK_RELIEF_NONE);
-        g_signal_connect (G_OBJECT (limit_button), "clicked",
-                          G_CALLBACK (xfce4_notifyd_log_open), log_listbox);
-        gtk_list_box_insert (GTK_LIST_BOX (log_listbox), limit_button, LOG_DISPLAY_LIMIT + 1);
+        if (log_length > 0) {
+            limit_label = g_strdup_printf("Showing %d of %d notifications. Click to open full log.",
+                                          LOG_DISPLAY_LIMIT, GPOINTER_TO_UINT(num_groups));
+            limit_button = gtk_button_new_with_label (limit_label);
+            gtk_widget_set_margin_bottom (limit_button, 3);
+            gtk_widget_set_margin_top (limit_button, 3);
+            gtk_button_set_relief (GTK_BUTTON (limit_button), GTK_RELIEF_NONE);
+            g_signal_connect (G_OBJECT (limit_button), "clicked",
+                              G_CALLBACK (xfce4_notifyd_log_open), log_listbox);
+            gtk_list_box_insert (GTK_LIST_BOX (log_listbox), limit_button, LOG_DISPLAY_LIMIT + 1);
+        }
         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