[gnome-panel] panel: Add style class for orientation to PanelWidget
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel: Add style class for orientation to PanelWidget
- Date: Wed, 14 Mar 2012 17:12:05 +0000 (UTC)
commit c066f71550f699a3958aca392f1dcd78f36bc4d8
Author: Peter Hurley <peter hurleysoftware com>
Date: Wed Mar 14 12:17:57 2012 -0400
panel: Add style class for orientation to PanelWidget
Add style class "horizontal" or "vertical" based on the orientation
of the PanelWidget. This allows themeing to adjust styling for vertical
panels. An example selector would be:
PanelWidget.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-widget.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gnome-panel/panel-widget.c b/gnome-panel/panel-widget.c
index a18fed0..d640c27 100644
--- a/gnome-panel/panel-widget.c
+++ b/gnome-panel/panel-widget.c
@@ -1692,6 +1692,7 @@ panel_widget_dispose (GObject *obj)
static void
panel_widget_init (PanelWidget *panel)
{
+ GtkStyleContext *context;
GtkWidget *widget = (GtkWidget *) panel;
gtk_widget_set_events (
@@ -1710,6 +1711,9 @@ panel_widget_init (PanelWidget *panel)
panel->applets_hints = NULL;
panel->applets_using_hint = NULL;
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_HORIZONTAL);
+
panel_background_init (&panel->background,
(PanelBackgroundChangedNotify) panel_widget_background_changed,
panel);
@@ -2533,8 +2537,20 @@ void
panel_widget_set_orientation (PanelWidget *panel_widget,
GtkOrientation orientation)
{
+ GtkStyleContext *context;
+
panel_widget->orient = orientation;
+ context = gtk_widget_get_style_context (GTK_WIDGET (panel_widget));
+ if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+ 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);
+ }
+ panel_widget_style_updated (GTK_WIDGET (panel_widget));
+
gtk_widget_queue_resize (GTK_WIDGET (panel_widget));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]