[gnome-control-center/wip/gbsneto/list-layout: 7/10] window: introduce the second headerbar



commit 000cd97242a03c6ef1164a572420811a19d47990
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun May 22 14:18:57 2016 -0300

    window: introduce the second headerbar
    
    This commit introduces the second headerbar, where the
    panel title and the panel widgets are displayed. It also
    adapts the code to use the second headerbar when needed.

 shell/cc-window.c |    7 +++----
 shell/window.ui   |   16 ++++++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/shell/cc-window.c b/shell/cc-window.c
index cbe4944..78a8f53 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -42,7 +42,6 @@
 
 #define MOUSE_BACK_BUTTON 8
 
-#define DEFAULT_WINDOW_TITLE N_("All Settings")
 #define DEFAULT_WINDOW_ICON_NAME "preferences-system"
 
 #define SEARCH_PAGE "_search"
@@ -54,6 +53,7 @@ struct _CcWindow
 
   GtkWidget  *stack;
   GtkWidget  *header;
+  GtkWidget  *header2;
   GtkWidget  *header_box;
   GtkWidget  *main_vbox;
   GtkWidget  *search_scrolled;
@@ -154,7 +154,7 @@ activate_panel (CcWindow           *self,
   icon_name = get_icon_name_from_g_icon (gicon);
 
   gtk_window_set_role (GTK_WINDOW (self), id);
-  gtk_header_bar_set_title (GTK_HEADER_BAR (self->header), name);
+  gtk_header_bar_set_title (GTK_HEADER_BAR (self->header2), name);
   gtk_window_set_default_icon_name (icon_name);
   gtk_window_set_icon_name (GTK_WINDOW (self), icon_name);
 
@@ -222,7 +222,6 @@ shell_show_overview_page (CcWindow *self)
 
   /* reset window title and icon */
   gtk_window_set_role (GTK_WINDOW (self), NULL);
-  gtk_header_bar_set_title (GTK_HEADER_BAR (self->header), _(DEFAULT_WINDOW_TITLE));
   gtk_window_set_default_icon_name (DEFAULT_WINDOW_ICON_NAME);
   gtk_window_set_icon_name (GTK_WINDOW (self), DEFAULT_WINDOW_ICON_NAME);
 
@@ -1171,6 +1170,7 @@ cc_window_class_init (CcWindowClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/ControlCenter/gtk/window.ui");
 
   gtk_widget_class_bind_template_child (widget_class, CcWindow, header);
+  gtk_widget_class_bind_template_child (widget_class, CcWindow, header2);
   gtk_widget_class_bind_template_child (widget_class, CcWindow, header_box);
   gtk_widget_class_bind_template_child (widget_class, CcWindow, header_sizegroup);
   gtk_widget_class_bind_template_child (widget_class, CcWindow, lock_button);
@@ -1288,7 +1288,6 @@ static void
 create_window (CcWindow *self)
 {
   gtk_window_set_titlebar (GTK_WINDOW (self), self->header_box);
-  gtk_header_bar_set_title (GTK_HEADER_BAR (self->header), _(DEFAULT_WINDOW_TITLE));
   gtk_widget_show_all (self->header_box);
 
   setup_model (self);
diff --git a/shell/window.ui b/shell/window.ui
index 3d566ff..0ec471a 100644
--- a/shell/window.ui
+++ b/shell/window.ui
@@ -143,6 +143,7 @@
           <object class="GtkHeaderBar" id="header">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="title" translatable="yes">Settings</property>
             <child>
               <object class="GtkToggleButton" id="search_button">
                 <property name="visible">True</property>
@@ -162,6 +163,21 @@
                 </style>
               </object>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkHeaderBar" id="header2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="show_close_button">True</property>
             <child>
               <object class="GtkBox" id="top_right_box">
                 <property name="visible">True</property>


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