[gedit] window: bind properties in the ui file



commit acd7e307db4dab7d42d527f8ec7d68f82e373930
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Aug 9 16:16:50 2015 +0200

    window: bind properties in the ui file

 gedit/gedit-window.c               |   23 -----------------------
 gedit/resources/ui/gedit-window.ui |    7 ++++---
 2 files changed, 4 insertions(+), 26 deletions(-)
---
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 44bd5e6..7d9d85f 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2434,12 +2434,6 @@ setup_side_panel (GeditWindow *window)
 
        gedit_debug (DEBUG_WINDOW);
 
-       g_object_bind_property (window->priv->side_panel,
-                               "visible",
-                               window->priv->side_panel_box,
-                               "visible",
-                               G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
-
        g_signal_connect_after (priv->side_panel,
                                "notify::visible",
                                G_CALLBACK (side_panel_visibility_changed),
@@ -2551,12 +2545,6 @@ setup_bottom_panel (GeditWindow *window)
 {
        gedit_debug (DEBUG_WINDOW);
 
-       g_object_bind_property (window->priv->bottom_panel,
-                               "visible",
-                               window->priv->bottom_panel_box,
-                               "visible",
-                               G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
-
        g_signal_connect_after (window->priv->bottom_panel,
                                "notify::visible",
                                G_CALLBACK (bottom_panel_visibility_changed),
@@ -2799,17 +2787,6 @@ gedit_window_init (GeditWindow *window)
        window->priv->window_group = gtk_window_group_new ();
        gtk_window_group_add_window (window->priv->window_group, GTK_WINDOW (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 file popover and file dialog */
        window->priv->open_document_popover = gtk_popover_new (window->priv->open_button);
        gtk_menu_button_set_popover (GTK_MENU_BUTTON (window->priv->open_button),
diff --git a/gedit/resources/ui/gedit-window.ui b/gedit/resources/ui/gedit-window.ui
index c254ec7..cac2005 100644
--- a/gedit/resources/ui/gedit-window.ui
+++ b/gedit/resources/ui/gedit-window.ui
@@ -8,12 +8,13 @@
     <child type="titlebar">
       <object class="GtkPaned" id="titlebar_paned">
         <property name="visible">True</property>
+        <property name="position" bind-source="hpaned" bind-property="position" 
bind-flags="bidirectional|sync-create"/>
         <style>
           <class name="gedit-headerbar-paned"/>
         </style>
         <child>
           <object class="GtkHeaderBar" id="side_headerbar">
-            <property name="visible">True</property>
+            <property name="visible" bind-source="side_panel" bind-property="visible" 
bind-flags="sync-create"/>
             <property name="show_close_button">False</property>
             <property name="title" translatable="yes">Documents</property>
             <style>
@@ -154,7 +155,7 @@
                 </style>
                 <child>
                   <object class="GtkBox" id="side_panel_box">
-                    <property name="visible">True</property>
+                    <property name="visible" bind-source="side_panel" bind-property="visible" 
bind-flags="sync-create"/>
                     <property name="orientation">vertical</property>
                     <child>
                       <object class="GeditMenuStackSwitcher" id="side_panel_inline_stack_switcher">
@@ -211,7 +212,7 @@
                         </child>
                         <child>
                           <object class="GtkBox" id="bottom_panel_box">
-                            <property name="visible">True</property>
+                            <property name="visible" bind-source="bottom_panel" bind-property="visible" 
bind-flags="sync-create"/>
                             <property name="orientation">horizontal</property>
                             <style>
                               <class name="gedit-bottom-panel"/>


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