[gedit/wip/redesign2] window: Fix the location of the buttons in the headerbar when is split



commit 4e8adca582cbb4448e1720c20b6a436ca72eda46
Author: Yosef Or Boczko <yoseforb gmail com>
Date:   Mon Jan 6 15:12:23 2014 +0200

    window: Fix the location of the buttons in the headerbar when is split

 gedit/gedit-window.c  |   29 +++++++++++++++++++++++++++++
 gedit/gedit-window.ui |    1 +
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 9f0ad5f..c9061c1 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2609,6 +2609,7 @@ side_panel_visibility_changed (GtkWidget   *panel,
        gboolean visible;
        GAction *action;
        GtkStyleContext *context;
+       gchar *layout_desc;
 
        visible = gtk_widget_get_visible (panel);
 
@@ -2632,6 +2633,34 @@ side_panel_visibility_changed (GtkWidget   *panel,
                gtk_style_context_remove_class (context, "gedit-titlebar-right");
                gtk_widget_grab_focus (GTK_WIDGET (window->priv->multi_notebook));
        }
+
+       g_object_get (gtk_settings_get_default (),
+                     "gtk-decoration-layout", &layout_desc,
+                     NULL);
+       if (visible)
+       {
+               gchar **tokens;
+
+               tokens = g_strsplit (layout_desc, ":", 2);
+               if (tokens)
+               {
+                       gchar *layout_headerbar;
+
+                       layout_headerbar = g_strdup_printf ("%c%s", ':', tokens[1]);
+                       gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (window->priv->headerbar), 
layout_headerbar);
+                       gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (window->priv->side_headerbar), 
tokens[0]);
+
+                       g_free (layout_headerbar);
+                       g_strfreev (tokens);
+               }
+       }
+       else
+       {
+               gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (window->priv->headerbar), layout_desc);
+               gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (window->priv->side_headerbar), NULL);
+       }
+
+       g_free (layout_desc);
 }
 
 static void
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index 643881a..2c79087 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -121,6 +121,7 @@
           <object class="GtkHeaderBar" id="side_headerbar">
             <property name="visible">True</property>
             <property name="title">Documents</property>
+            <property name="show_close_button">True</property>
             <style>
               <class name="gedit-titlebar-left"/>
               <class name="titlebar"/>


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