[gnome-software] Replace the last notebook by a stack



commit 0b02d38c48354d1217fb2b0301014cb512f75ed6
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Sep 20 20:53:27 2013 -0400

    Replace the last notebook by a stack
    
    The hidden tabs were causing accessibility heartburn.

 src/gnome-software.ui |   64 +++++++++++++------------------------------------
 src/gs-shell.c        |   15 +++++++++--
 2 files changed, 29 insertions(+), 50 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index bee48f0..a6ba960 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -256,11 +256,8 @@
           </packing>
         </child>
         <child>
-          <object class="GtkNotebook" id="notebook_main">
+          <object class="GtkStack" id="stack_main">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="show_border">False</property>
-            <property name="show_tabs">False</property>
             <child>
               <object class="GtkStack" id="stack_overview">
                 <property name="visible">True</property>
@@ -462,15 +459,8 @@
                   </packing>
                 </child>
               </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label2">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">All</property>
-              </object>
               <packing>
-                <property name="tab_fill">False</property>
+                <property name="name">overview</property>
               </packing>
             </child>
             <child>
@@ -513,13 +503,9 @@
                   </packing>
                 </child>
               </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label3">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">Installed</property>
-              </object>
+              <packing>
+                <property name="name">installed</property>
+              </packing>
             </child>
             <child>
               <object class="GtkStack" id="stack_search">
@@ -603,13 +589,9 @@
                   </packing>
                 </child>
               </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label_tab_search">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">Search</property>
-              </object>
+              <packing>
+                <property name="name">search</property>
+              </packing>
             </child>
             <child>
               <object class="GtkStack" id="stack_updates">
@@ -687,13 +669,9 @@
                   </packing>
                 </child>
               </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label4">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label">Updates</property>
-              </object>
+              <packing>
+                <property name="name">updates</property>
+              </packing>
             </child>
             <child>
               <object class="GtkScrolledWindow" id="scrolledwindow_details">
@@ -834,13 +812,9 @@
                   </object>
                 </child>
               </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label7">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Application</property>
-              </object>
+              <packing>
+                <property name="name">details</property>
+              </packing>
             </child>
             <child>
               <object class="GsBox" id="box_category">
@@ -919,13 +893,9 @@
                   </packing>
                 </child>
               </object>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label11">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Category</property>
-              </object>
+              <packing>
+                <property name="name">category</property>
+              </packing>
             </child>
           </object>
           <packing>
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 9badc26..287985e 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -33,6 +33,16 @@
 #include "gs-shell-updates.h"
 #include "gs-shell-category.h"
 
+static const gchar *page_name[] = {
+       "overview",
+       "installed",
+       "search",
+       "updates",
+       "details",
+       "category",
+       "updates"
+};
+
 static void    gs_shell_finalize       (GObject        *object);
 
 #define GS_SHELL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GS_TYPE_SHELL, GsShellPrivate))
@@ -130,9 +140,8 @@ gs_shell_change_mode (GsShell *shell, GsShellMode mode, GsApp *app, GsCategory *
        priv->ignore_primary_buttons = FALSE;
 
        /* switch page */
-       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "notebook_main"));
-       gtk_notebook_set_current_page (GTK_NOTEBOOK (widget),
-                                      mode == GS_SHELL_MODE_UPDATED ? GS_SHELL_MODE_UPDATES : mode);
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "stack_main"));
+       gtk_stack_set_visible_child_name (GTK_STACK (widget), page_name[mode]);
 
        /* do action for mode */
        priv->mode = mode;


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