[gnome-panel] panel: Add style class for orientation to PanelToplevel



commit d12e597ca627e285702b8a541a42c2c67ed5794e
Author: Peter Hurley <peter hurleysoftware com>
Date:   Wed Mar 14 12:26:53 2012 -0400

    panel: Add style class for orientation to PanelToplevel
    
      Add style class "horizontal" or "vertical" based on the orientation
      of the PanelToplevel. This allows themeing to adjust styling for
      vertical panels. An example selector would be:
    
      PanelToplevel.vertical {
        background-image: -gtk-gradient (linear, right top, left top,
                                         from (shade (@dark_bg_color, 1.15)),
                                         to (shade (@dark_bg_color, 0.95)));
      }
    
    Signed-off-by: Peter Hurley <peter hurleysoftware com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672070

 gnome-panel/panel-toplevel.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/panel-toplevel.c b/gnome-panel/panel-toplevel.c
index 5e8a966..6a11fc3 100644
--- a/gnome-panel/panel-toplevel.c
+++ b/gnome-panel/panel-toplevel.c
@@ -4252,6 +4252,8 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel)
 static void
 panel_toplevel_init (PanelToplevel *toplevel)
 {
+	GtkStyleContext *context;
+
 	toplevel->priv = PANEL_TOPLEVEL_GET_PRIVATE (toplevel);
 
 	toplevel->priv->toplevel_id      = NULL;
@@ -4353,6 +4355,9 @@ panel_toplevel_init (PanelToplevel *toplevel)
 
         /* We don't want a resize grip on the panel */
         gtk_window_set_has_resize_grip (GTK_WINDOW (toplevel), FALSE);
+
+	context = gtk_widget_get_style_context (GTK_WIDGET (toplevel));
+	gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
 }
 
 PanelWidget *
@@ -4745,6 +4750,7 @@ panel_toplevel_set_orientation (PanelToplevel    *toplevel,
 	gboolean   rotate;
 	int        monitor_width;
 	int        monitor_height;
+	GtkStyleContext *context;
 
 	g_return_if_fail (PANEL_IS_TOPLEVEL (toplevel));
 
@@ -4813,6 +4819,16 @@ panel_toplevel_set_orientation (PanelToplevel    *toplevel,
 
 	toplevel->priv->orientation = orientation;
 
+	context = gtk_widget_get_style_context (GTK_WIDGET (toplevel));
+	if (orientation & PANEL_HORIZONTAL_MASK) {
+		gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
+		gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VERTICAL);
+	} else {
+		gtk_style_context_add_class (context, GTK_STYLE_CLASS_VERTICAL);
+		gtk_style_context_remove_class (context, GTK_STYLE_CLASS_HORIZONTAL);
+	}
+	gtk_widget_reset_style (GTK_WIDGET (toplevel));
+
 	panel_toplevel_update_hide_buttons (toplevel);
 
 	panel_widget_set_orientation (	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]