[gnome-panel] panel: Add style class for orientation to PanelAppletFrame
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel: Add style class for orientation to PanelAppletFrame
- Date: Wed, 14 Mar 2012 17:12:00 +0000 (UTC)
commit 5990d903635adf513ce4bd655ad48c5d7ab7f749
Author: Peter Hurley <peter hurleysoftware com>
Date: Mon Mar 5 13:14:44 2012 -0500
panel: Add style class for orientation to PanelAppletFrame
Add style class "horizontal" or "vertical" based on the orientation
of the PanelAppletFrame. This allows themeing to adjust styling for
vertical panels. An example selector would be:
PanelAppletFrame.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-applet-frame.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
index c6c6db4..b1e4f60 100644
--- a/gnome-panel/panel-applet-frame.c
+++ b/gnome-panel/panel-applet-frame.c
@@ -464,12 +464,17 @@ panel_applet_frame_class_init (PanelAppletFrameClass *klass)
static void
panel_applet_frame_init (PanelAppletFrame *frame)
{
+ GtkStyleContext *context;
+
frame->priv = PANEL_APPLET_FRAME_GET_PRIVATE (frame);
frame->priv->panel = NULL;
frame->priv->orientation = PANEL_ORIENTATION_TOP;
frame->priv->applet_info = NULL;
frame->priv->has_handle = FALSE;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (frame));
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
}
static void
@@ -498,10 +503,23 @@ void
panel_applet_frame_change_orientation (PanelAppletFrame *frame,
PanelOrientation orientation)
{
+ GtkStyleContext *context;
+
if (orientation == frame->priv->orientation)
return;
frame->priv->orientation = orientation;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (frame));
+ 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 (frame));
+
PANEL_APPLET_FRAME_GET_CLASS (frame)->change_orientation (frame, orientation);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]