[gedit] Always toggle the visibility of the bottom panel stack



commit b0b87aa66db6201fd9dc895cea25aae8f8381788
Author: Paolo Borelli <pborelli gnome org>
Date:   Thu Mar 13 19:20:50 2014 +0100

    Always toggle the visibility of the bottom panel stack
    
    The surrounding box is not exposed to plugins so we do not change its
    visibility directly, instead we bind it to the visibility of the stack.

 gedit/gedit-commands-view.c |    9 ++++-----
 gedit/gedit-window.c        |   18 ++++++++++++------
 gedit/gedit-window.ui       |    4 ++--
 3 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/gedit/gedit-commands-view.c b/gedit/gedit-commands-view.c
index 0e59e6a..3654b4b 100644
--- a/gedit/gedit-commands-view.c
+++ b/gedit/gedit-commands-view.c
@@ -29,7 +29,6 @@
 #include "gedit-commands.h"
 #include "gedit-debug.h"
 #include "gedit-window.h"
-#include "gedit-window-private.h"
 #include "gedit-highlight-mode-dialog.h"
 #include "gedit-highlight-mode-selector.h"
 
@@ -63,19 +62,19 @@ _gedit_cmd_view_toggle_bottom_panel (GSimpleAction *action,
                                      gpointer       user_data)
 {
        GeditWindow *window = GEDIT_WINDOW (user_data);
-       GtkWidget *panel_box;
+       GtkWidget *panel;
        gboolean visible;
 
        gedit_debug (DEBUG_COMMANDS);
 
-       panel_box = window->priv->bottom_panel_box;
+       panel = gedit_window_get_bottom_panel (window);
 
        visible = g_variant_get_boolean (state);
-       gtk_widget_set_visible (panel_box, visible);
+       gtk_widget_set_visible (panel, visible);
 
        if (visible)
        {
-               gtk_widget_grab_focus (window->priv->bottom_panel);
+               gtk_widget_grab_focus (panel);
        }
 
        g_simple_action_set_state (action, state);
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 2301941..bf7f25b 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -944,8 +944,8 @@ clone_window (GeditWindow *origin)
 
        gtk_widget_set_visible (window->priv->side_panel,
                                gtk_widget_get_visible (origin->priv->side_panel));
-       gtk_widget_set_visible (window->priv->bottom_panel_box,
-                               gtk_widget_get_visible (origin->priv->bottom_panel_box));
+       gtk_widget_set_visible (window->priv->bottom_panel,
+                               gtk_widget_get_visible (origin->priv->bottom_panel));
 
        return window;
 }
@@ -2570,7 +2570,7 @@ bottom_panel_item_removed (GtkStack    *panel,
 
        empty = gtk_stack_get_visible_child (GTK_STACK (panel)) == NULL;
 
-       gtk_widget_set_visible (window->priv->bottom_panel_box, !empty);
+       gtk_widget_set_visible (window->priv->bottom_panel, !empty);
 
        action = g_action_map_lookup_action (G_ACTION_MAP (window), "bottom-panel");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !empty);
@@ -2599,7 +2599,7 @@ bottom_panel_item_added (GtkStack    *panel,
                                               "bottom-panel-visible");
                if (show)
                {
-                       gtk_widget_show (window->priv->bottom_panel_box);
+                       gtk_widget_show (window->priv->bottom_panel);
                }
 
                action = g_action_map_lookup_action (G_ACTION_MAP (window), "bottom-panel");
@@ -2612,7 +2612,13 @@ setup_bottom_panel (GeditWindow *window)
 {
        gedit_debug (DEBUG_WINDOW);
 
-       g_signal_connect_after (window->priv->bottom_panel_box,
+       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),
                                window);
@@ -2666,7 +2672,7 @@ init_panels_visibility (GeditWindow *window)
 
                if (bottom_panel_visible)
                {
-                       gtk_widget_show (window->priv->bottom_panel_box);
+                       gtk_widget_show (window->priv->bottom_panel);
                }
 
                g_free (panel_page);
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index d273441..607a858 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -205,7 +205,7 @@
                         </child>
                         <child>
                           <object class="GtkBox" id="bottom_panel_box">
-                            <property name="visible">False</property>
+                            <property name="visible">True</property>
                             <property name="orientation">horizontal</property>
                             <style>
                               <class name="gedit-bottom-panel"/>
@@ -216,7 +216,7 @@
                                 <property name="orientation">vertical</property>
                                 <child>
                                   <object class="GtkStack" id="bottom_panel">
-                                    <property name="visible">True</property>
+                                    <property name="visible">False</property>
                                   </object>
                                   <packing>
                                     <property name="expand">True</property>


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