[gnome-builder] styling: override stackswitcher styling to remove linked and raised buttons
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] styling: override stackswitcher styling to remove linked and raised buttons
- Date: Wed, 10 Sep 2014 10:33:43 +0000 (UTC)
commit 84cfdf3769c3d8ab714731f0fc7ca5eed427e56a
Author: Christian Hergert <christian hergert me>
Date: Wed Sep 10 03:33:21 2014 -0700
styling: override stackswitcher styling to remove linked and raised buttons
To match the mockups, these need to be flat and not linked. Sort of
painful to do this in code, but seems to be the only way at the
moment since we:
* cant remove style classes from GtkBuilder
* cant access the button children of a GtkStackSwitcher
src/resources/ui/gb-workbench.ui | 1 +
src/workbench/gb-workbench.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/resources/ui/gb-workbench.ui b/src/resources/ui/gb-workbench.ui
index fcd8b7c..5250b48 100644
--- a/src/resources/ui/gb-workbench.ui
+++ b/src/resources/ui/gb-workbench.ui
@@ -124,6 +124,7 @@
<property name="stack">stack</property>
<property name="orientation">vertical</property>
<property name="border_width">3</property>
+ <property name="spacing">4</property>
</object>
</child>
<child>
diff --git a/src/workbench/gb-workbench.c b/src/workbench/gb-workbench.c
index accb35c..18832c7 100644
--- a/src/workbench/gb-workbench.c
+++ b/src/workbench/gb-workbench.c
@@ -143,6 +143,31 @@ load_actions (GbWorkbench *workbench,
}
static void
+fixup_stack_switcher_buttons_func (GtkWidget *widget,
+ gpointer user_data)
+{
+ GtkStyleContext *context;
+
+ g_assert (GTK_IS_RADIO_BUTTON (widget));
+
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_FLAT);
+}
+
+static void
+fixup_stack_switcher_buttons (GtkStackSwitcher *switcher)
+{
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (switcher));
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LINKED);
+
+ gtk_container_forall (GTK_CONTAINER (switcher),
+ (GtkCallback)fixup_stack_switcher_buttons_func,
+ NULL);
+}
+
+static void
gb_workbench_realize (GtkWidget *widget)
{
GbWorkbench *workbench = (GbWorkbench *)widget;
@@ -167,6 +192,8 @@ gb_workbench_constructed (GObject *object)
priv = workbench->priv;
+ fixup_stack_switcher_buttons (priv->switcher);
+
load_actions (workbench, GB_WORKSPACE (priv->editor));
load_actions (workbench, GB_WORKSPACE (priv->devhelp));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]