[Xfce4-commits] [panel-plugins/xfce4-weather-plugin] 23/25: Add small padding between label and icon

noreply at xfce.org noreply at xfce.org
Mon Sep 17 00:14:20 CEST 2018


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       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 panel-plugins/xfce4-weather-plugin.

commit 75aa63be4dcac8352f429af7aca63d56113982f0
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Sep 15 11:30:51 2018 -0400

    Add small padding between label and icon
---
 panel-plugin/weather-scrollbox.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c
index 25e79dd..1c5afb9 100644
--- a/panel-plugin/weather-scrollbox.c
+++ b/panel-plugin/weather-scrollbox.c
@@ -31,6 +31,7 @@
 #define LABEL_SLEEP (3)       /* sleep time in seconds */
 #define LABEL_SLEEP_LONG (6)  /* sleep time in seconds for FADE_NONE */
 #define LABEL_SPEED (25)      /* animation speed, delay in ms */
+#define LABEL_PADDING (3)     /* padding to left/right or top/bottom of label */
 
 
 static void gtk_scrollbox_finalize(GObject *object);
@@ -181,11 +182,15 @@ gtk_scrollbox_get_preferred_height (GtkWidget *widget,
                                     gint      *minimal_height,
                                     gint      *natural_height)
 {
+    GtkScrollbox *self = GTK_SCROLLBOX(widget);
     GtkRequisition requisition;
 
     gtk_scrollbox_size_request (widget, &requisition);
 
-    *minimal_height = *natural_height = requisition.height;
+    if (self->orientation == GTK_ORIENTATION_VERTICAL)
+        *minimal_height = *natural_height = requisition.height + (LABEL_PADDING * 2);
+    else
+        *minimal_height = *natural_height = requisition.height;
 }
 
 
@@ -194,11 +199,15 @@ gtk_scrollbox_get_preferred_width (GtkWidget *widget,
                                    gint      *minimal_width,
                                    gint      *natural_width)
 {
-  GtkRequisition requisition;
+    GtkScrollbox *self = GTK_SCROLLBOX(widget);
+    GtkRequisition requisition;
 
-  gtk_scrollbox_size_request (widget, &requisition);
+    gtk_scrollbox_size_request (widget, &requisition);
 
-  *minimal_width = *natural_width = requisition.width + 12;
+    if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
+        *minimal_width = *natural_width = requisition.width + (LABEL_PADDING * 2);
+    else
+        *minimal_width = *natural_width = requisition.width;
 }
 
 
@@ -229,12 +238,12 @@ gtk_scrollbox_draw_event(GtkWidget *widget,
         gtk_widget_get_allocation (GTK_WIDGET (widget), &allocation);
 
         if (self->orientation == GTK_ORIENTATION_HORIZONTAL) {
-            width = 0;
+            width = LABEL_PADDING;
             height = (allocation.height - PANGO_PIXELS(logical_rect.height)) / 2
                 + (self->fade == FADE_IN || self->fade == FADE_OUT
                    ? self->offset : 0);
         } else {
-            height = 0;
+            height = LABEL_PADDING;
             width = (allocation.width + PANGO_PIXELS(logical_rect.height)) / 2
                 + (self->fade == FADE_IN || self->fade == FADE_OUT
                    ? self->offset : 0);

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


More information about the Xfce4-commits mailing list