[Xfce4-commits] [xfce/xfce4-panel] 01/01: Add orientation-related style classes for improved theming

noreply at xfce.org noreply at xfce.org
Mon Oct 1 20:59:17 CEST 2018


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 xfce/xfce4-panel.

commit 52d4c333269452a03a0f1f8c527861b5cd21792d
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Sep 30 00:30:45 2018 +0200

    Add orientation-related style classes for improved theming
    
    This means that themes can make use of the .horizontal, .vertical and
    .deskbar classes to tweak e.g. margins or paddings.
---
 panel/panel-base-window.c | 25 +++++++++++++++++++++++++
 panel/panel-base-window.h |  4 +++-
 panel/panel-window.c      |  1 +
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index 850401e..3a6bdfc 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -673,6 +673,31 @@ panel_base_window_reset_background_css (PanelBaseWindow *window) {
 
 
 
+void
+panel_base_window_orientation_changed (PanelBaseWindow *window,
+                                       gint             mode)
+{
+  GtkStyleContext         *context = gtk_widget_get_style_context (GTK_WIDGET (window));
+
+  /* Reset all orientation-related style-classes */
+  if (gtk_style_context_has_class (context, "horizontal"))
+    gtk_style_context_remove_class (context, "horizontal");
+  if (gtk_style_context_has_class (context, "vertical"))
+    gtk_style_context_remove_class (context, "vertical");
+  if (gtk_style_context_has_class (context, "deskbar"))
+    gtk_style_context_remove_class (context, "deskbar");
+
+  /* Apply the appropriate style-class */
+  if (mode == 0)
+    gtk_style_context_add_class (context, "horizontal");
+  else if (mode == 1)
+    gtk_style_context_add_class (context, "vertical");
+  else if (mode == 2)
+    gtk_style_context_add_class (context, "deskbar");
+}
+
+
+
 static void
 panel_base_window_set_plugin_data (PanelBaseWindow *window,
                                    GtkCallback      func)
diff --git a/panel/panel-base-window.h b/panel/panel-base-window.h
index 33e9981..0e131a2 100644
--- a/panel/panel-base-window.h
+++ b/panel/panel-base-window.h
@@ -84,7 +84,9 @@ void         panel_base_window_move_resize                 (PanelBaseWindow *win
                                                             gint             width,
                                                             gint             height);
 
-void         panel_base_window_reset_background_css        (PanelBaseWindow      *window);
+void         panel_base_window_reset_background_css        (PanelBaseWindow *window);
+void         panel_base_window_orientation_changed         (PanelBaseWindow *window,
+                                                            gint             mode);
 void         panel_base_window_set_borders                 (PanelBaseWindow *window,
                                                             PanelBorders     borders);
 PanelBorders panel_base_window_get_borders                 (PanelBaseWindow *window);
diff --git a/panel/panel-window.c b/panel/panel-window.c
index 7c151af..dbf0720 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -652,6 +652,7 @@ panel_window_set_property (GObject      *object,
         {
           window->mode = val_mode;
           panel_window_screen_layout_changed (window->screen, window);
+          panel_base_window_orientation_changed (window, window->mode);
         }
 
       /* send the new orientation and screen position to the panel plugins */

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


More information about the Xfce4-commits mailing list