[gnome-builder] styling: use CSS to style the view selector buttons.



commit 80fe8989a00e6d38ce470dc84311c229c722fc5b
Author: Christian Hergert <christian hergert me>
Date:   Wed Sep 10 14:08:03 2014 -0700

    styling: use CSS to style the view selector buttons.

 src/resources/css/builder.Adwaita.css |   30 ++++++++++++++++++++++++++++++
 src/resources/ui/gb-workbench.ui      |    3 +++
 src/workbench/gb-workbench.c          |   27 ---------------------------
 3 files changed, 33 insertions(+), 27 deletions(-)
---
diff --git a/src/resources/css/builder.Adwaita.css b/src/resources/css/builder.Adwaita.css
index b0313b5..7b50d07 100644
--- a/src/resources/css/builder.Adwaita.css
+++ b/src/resources/css/builder.Adwaita.css
@@ -82,4 +82,34 @@ GbEditorTab .gb-search-slider {
     padding: 2px;
 }
 
+GtkStackSwitcher.gb-workspace-switcher > GtkRadioButton {
+    background-color: transparent;
+    background-image: none;
+    border-radius: 4px 4px 4px 4px;
+    border-width 0 0 0 0;
+    border-style: none;
+    box-shadow: none;
+    -GtkButton-image-spacing: 0;
+    -GtkButton-inner-border: 0;
+    padding: 4px 1px 4px 1px;
+}
 
+GtkStackSwitcher.gb-workspace-switcher > GtkRadioButton:checked {
+    background-color: #babdb6;
+    color: #ffffff;
+}
+
+GtkStackSwitcher.gb-workspace-switcher > GtkRadioButton:hover {
+    border-style: solid;
+    border-width: 1px 1px 1px 1px;
+    border-color: #d3d7cf;
+    transition-duration: 0ms;
+}
+
+GtkStackSwitcher.gb-workspace-switcher > GtkRadioButton:active {
+    background-color: #d3d7cf;
+    border-style: solid;
+    border-width: 1px 1px 1px 1px;
+    border-color: #d3d7cf;
+    transition-duration: 0ms;
+}
diff --git a/src/resources/ui/gb-workbench.ui b/src/resources/ui/gb-workbench.ui
index 6b6ef62..82b6811 100644
--- a/src/resources/ui/gb-workbench.ui
+++ b/src/resources/ui/gb-workbench.ui
@@ -125,6 +125,9 @@
             <property name="orientation">vertical</property>
             <property name="border_width">4</property>
             <property name="spacing">4</property>
+            <style>
+              <class name="gb-workspace-switcher"/>
+            </style>
           </object>
         </child>
         <child>
diff --git a/src/workbench/gb-workbench.c b/src/workbench/gb-workbench.c
index 18832c7..accb35c 100644
--- a/src/workbench/gb-workbench.c
+++ b/src/workbench/gb-workbench.c
@@ -143,31 +143,6 @@ 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;
@@ -192,8 +167,6 @@ 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]