[gnome-builder/wip/chergert/perspective] tabbar: use dummy expander label instead of opacity:0 on tab



commit 44d0a2c7e1a8ef0ea0e54f6eefcd6dcc62c34be6
Author: Christian Hergert <chergert redhat com>
Date:   Fri Dec 11 01:41:05 2015 -0800

    tabbar: use dummy expander label instead of opacity:0 on tab
    
    The opacity was very hacky and didn't work very correctly. Instead use a
    dummy label to fill up the space by the hidden tab.

 data/theme/Adwaita-dark.css   |    7 -------
 data/theme/Adwaita.css        |    7 -------
 data/ui/ide-layout-tab-bar.ui |    5 +++++
 libide/ide-layout-tab-bar.c   |   13 +++++++++++++
 4 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/data/theme/Adwaita-dark.css b/data/theme/Adwaita-dark.css
index 7bc04dc..c058cb2 100644
--- a/data/theme/Adwaita-dark.css
+++ b/data/theme/Adwaita-dark.css
@@ -181,13 +181,6 @@ layouttabbar:backdrop {
   box-shadow: none;
 }
 
-layoutstack.empty layouttab,
-layoutstack.empty layouttab button,
-layoutstack.empty layouttab separator {
-  color: transparent;
-  background-color: transparent;
-}
-
 layoutstack layouttab button.close {
   border-style: solid;
   border-radius: 5px;
diff --git a/data/theme/Adwaita.css b/data/theme/Adwaita.css
index 3afa7ac..803cefb 100644
--- a/data/theme/Adwaita.css
+++ b/data/theme/Adwaita.css
@@ -167,13 +167,6 @@ layouttabbar:backdrop {
   box-shadow: none;
 }
 
-layoutstack.empty layouttab,
-layoutstack.empty layouttab button,
-layoutstack.empty layouttab separator {
-  color: transparent;
-  background-color: transparent;
-}
-
 layoutstack layouttab button.close {
   border-style: solid;
   border-radius: 5px;
diff --git a/data/ui/ide-layout-tab-bar.ui b/data/ui/ide-layout-tab-bar.ui
index fb75e3b..d171369 100644
--- a/data/ui/ide-layout-tab-bar.ui
+++ b/data/ui/ide-layout-tab-bar.ui
@@ -9,6 +9,11 @@
         <child>
           <object class="IdeLayoutTab" id="tab">
             <property name="margin-left">4</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="tab_expander">
+            <property name="hexpand">true</property>
             <property name="visible">true</property>
           </object>
         </child>
diff --git a/libide/ide-layout-tab-bar.c b/libide/ide-layout-tab-bar.c
index f4cb33c..e365f79 100644
--- a/libide/ide-layout-tab-bar.c
+++ b/libide/ide-layout-tab-bar.c
@@ -23,6 +23,8 @@
 #include "ide-layout-tab.h"
 #include "ide-layout-tab-bar.h"
 #include "ide-layout-view.h"
+#include "ide-workbench.h"
+#include "ide-workbench-private.h"
 
 struct _IdeLayoutTabBar
 {
@@ -33,6 +35,7 @@ struct _IdeLayoutTabBar
   guint          child_count;
 
   IdeLayoutTab  *tab;
+  GtkWidget     *tab_expander;
   GtkMenuButton *views_list_button;
   GtkButton     *views_add_button;
   GtkStack      *stack;
@@ -153,6 +156,9 @@ ide_layout_tab_bar_add (IdeLayoutTabBar *self,
 
   if (self->child_count > 1)
     gtk_widget_show (GTK_WIDGET (self->views_list_button));
+
+  gtk_widget_hide (GTK_WIDGET (self->tab_expander));
+  gtk_widget_show (GTK_WIDGET (self->tab));
 }
 
 static void
@@ -213,6 +219,12 @@ ide_layout_tab_bar_remove (IdeLayoutTabBar *self,
 
       if (self->child_count <= 1)
         gtk_widget_hide (GTK_WIDGET (self->views_list_button));
+
+      if (self->child_count == 0)
+        {
+          gtk_widget_hide (GTK_WIDGET (self->tab));
+          gtk_widget_show (GTK_WIDGET (self->tab_expander));
+        }
     }
 }
 
@@ -379,6 +391,7 @@ ide_tab_layout_bar_class_init (IdeLayoutTabBarClass *klass)
   gtk_widget_class_set_css_name (widget_class, "layouttabbar");
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-layout-tab-bar.ui");
   gtk_widget_class_bind_template_child (widget_class, IdeLayoutTabBar, tab);
+  gtk_widget_class_bind_template_child (widget_class, IdeLayoutTabBar, tab_expander);
   gtk_widget_class_bind_template_child (widget_class, IdeLayoutTabBar, views_add_button);
   gtk_widget_class_bind_template_child (widget_class, IdeLayoutTabBar, views_list_button);
   gtk_widget_class_bind_template_child (widget_class, IdeLayoutTabBar, views_list_box);


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