[gedit/wip/redesign2: 42/46] Integrate sidebar insto titlebar



commit 4fd462d071c97eeff4996112723b51995aecd6f2
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Nov 6 09:10:42 2013 +0100

    Integrate sidebar insto titlebar

 gedit/gedit-window-private.h |    2 +
 gedit/gedit-window.c         |   13 ++++
 gedit/gedit-window.ui        |  155 ++++++++++++++++++++++-------------------
 3 files changed, 98 insertions(+), 72 deletions(-)
---
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index 1cb32b5..e61974b 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -87,6 +87,8 @@ struct _GeditWindowPrivate
        GtkActionGroup *documents_list_action_group;
        guint           documents_list_menu_ui_id;
 
+       GtkWidget      *titlebar_paned;
+       GtkWidget      *side_headerbar;
        GtkWidget      *headerbar;
        GtkWidget      *open_button;
        GtkWidget      *open_menu;
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index fbb05ab..176572f 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -428,6 +428,8 @@ gedit_window_class_init (GeditWindowClass *klass)
        /* Bind class to template */
        gtk_widget_class_set_template_from_resource (widget_class,
                                                     "/org/gnome/gedit/ui/gedit-window.ui");
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, titlebar_paned);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, side_headerbar);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, headerbar);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, open_menu);
        gtk_widget_class_bind_template_child_private (widget_class, GeditWindow, hpaned);
@@ -3219,6 +3221,17 @@ gedit_window_init (GeditWindow *window)
        // FIXME: kill this, right now it is just not added to the window
        create_menu_bar_and_toolbar (window);
 
+       g_object_bind_property (window->priv->side_panel,
+                               "visible",
+                               window->priv->side_headerbar,
+                               "visible",
+                               G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+       g_object_bind_property (window->priv->titlebar_paned,
+                               "position",
+                               window->priv->hpaned,
+                               "position",
+                               G_BINDING_DEFAULT | G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+
        setup_headerbar_open_button (window);
 
        /* Setup status bar */
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index df8d0e1..dc0e93e 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -68,103 +68,114 @@
     <property name="has_focus">False</property>
     <property name="is_focus">False</property>
     <child type="titlebar">
-      <object class="GtkHeaderBar" id="headerbar">
+      <object class="GtkPaned" id="titlebar_paned">
         <property name="visible">True</property>
-        <property name="show_close_button">True</property>
         <child>
-          <object class="GtkBox" id="open_box">
+          <object class="GtkHeaderBar" id="side_headerbar">
             <property name="visible">True</property>
-            <property name="orientation">horizontal</property>
-            <property name="valign">center</property>
-            <style>
-              <class name="linked"/>
-            </style>
+            <property name="title">Documents</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkHeaderBar" id="headerbar">
+            <property name="visible">True</property>
+            <property name="show_close_button">True</property>
             <child>
-              <object class="GtkButton" id="open_button">
+              <object class="GtkBox" id="open_box">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">Open</property>
-                <property name="tooltip_text" translatable="yes">Open a file</property>
-                <property name="action_name">win.open</property>
+                <property name="orientation">horizontal</property>
+                <property name="valign">center</property>
                 <style>
-                  <class name="text-button"/>
+                  <class name="linked"/>
                 </style>
+                <child>
+                  <object class="GtkButton" id="open_button">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Open</property>
+                    <property name="tooltip_text" translatable="yes">Open a file</property>
+                    <property name="action_name">win.open</property>
+                    <style>
+                      <class name="text-button"/>
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="GeditOpenMenuButton" id="open_menu">
+                    <property name="visible">True</property>
+                    <property name="tooltip_text" translatable="yes">Open a recently used file</property>
+                    <style>
+                      <class name="image-button"/>
+                    </style>
+                  </object>
+                </child>
               </object>
+              <packing>
+                <property name="pack_type">start</property>
+              </packing>
             </child>
             <child>
-              <object class="GeditOpenMenuButton" id="open_menu">
+              <object class="GtkButton" id="new_tab_button">
                 <property name="visible">True</property>
-                <property name="tooltip_text" translatable="yes">Open a recently used file</property>
+                <property name="valign">center</property>
+                <property name="tooltip_text" translatable="yes">Create a new document</property>
+                <property name="action_name">win.new_tab</property>
                 <style>
                   <class name="image-button"/>
                 </style>
+                <child>
+                  <object class="GtkImage" id="new_tab_image">
+                    <property name="visible">True</property>
+                    <property name="icon_size">1</property>
+                    <property name="icon_name">tab-new-symbolic</property>
+                  </object>
+                </child>
               </object>
+              <packing>
+                <property name="pack_type">start</property>
+              </packing>
             </child>
-          </object>
-          <packing>
-            <property name="pack_type">start</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButton" id="new_tab_button">
-            <property name="visible">True</property>
-            <property name="valign">center</property>
-            <property name="tooltip_text" translatable="yes">Create a new document</property>
-            <property name="action_name">win.new_tab</property>
-            <style>
-              <class name="image-button"/>
-            </style>
             <child>
-              <object class="GtkImage" id="new_tab_image">
+              <object class="GtkButton" id="save_button">
                 <property name="visible">True</property>
-                <property name="icon_size">1</property>
-                <property name="icon_name">tab-new-symbolic</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack_type">start</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButton" id="save_button">
-            <property name="visible">True</property>
-            <property name="valign">center</property>
-            <property name="tooltip_text" translatable="yes">Save the current file</property>
-            <property name="action_name">win.save</property>
-            <style>
-              <class name="image-button"/>
-            </style>
-            <child>
-              <object class="GtkImage" id="save_image">
-                <property name="visible">True</property>
-                <property name="icon_size">1</property>
-                <property name="icon_name">document-save-symbolic</property>
+                <property name="valign">center</property>
+                <property name="tooltip_text" translatable="yes">Save the current file</property>
+                <property name="action_name">win.save</property>
+                <style>
+                  <class name="image-button"/>
+                </style>
+                <child>
+                  <object class="GtkImage" id="save_image">
+                    <property name="visible">True</property>
+                    <property name="icon_size">1</property>
+                    <property name="icon_name">document-save-symbolic</property>
+                  </object>
+                </child>
               </object>
+              <packing>
+                <property name="pack_type">start</property>
+              </packing>
             </child>
-          </object>
-          <packing>
-            <property name="pack_type">start</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkMenuButton" id="gear_button">
-            <property name="visible">True</property>
-            <property name="valign">center</property>
-            <property name="menu_model">gear-menu</property>
-            <style>
-              <class name="image-button"/>
-            </style>
             <child>
-              <object class="GtkImage" id="gear_image">
+              <object class="GtkMenuButton" id="gear_button">
                 <property name="visible">True</property>
-                <property name="icon_size">1</property>
-                <property name="icon_name">emblem-system-symbolic</property>
+                <property name="valign">center</property>
+                <property name="menu_model">gear-menu</property>
+                <style>
+                  <class name="image-button"/>
+                </style>
+                <child>
+                  <object class="GtkImage" id="gear_image">
+                    <property name="visible">True</property>
+                    <property name="icon_size">1</property>
+                    <property name="icon_name">emblem-system-symbolic</property>
+                  </object>
+                </child>
               </object>
+              <packing>
+                <property name="pack_type">end</property>
+              </packing>
             </child>
           </object>
-          <packing>
-            <property name="pack_type">end</property>
-          </packing>
         </child>
       </object>
     </child>


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