[gnome-builder/wip/chergert/layout: 75/118] editor: fix initial state of overview map



commit 4214be4473b039cab1d29be41c6b6200004eb945
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 2 19:53:16 2017 -0700

    editor: fix initial state of overview map

 libide/editor/ide-editor-view.c  |   62 +++++++++++++++++++-------------------
 libide/editor/ide-editor-view.ui |    4 ++-
 2 files changed, 34 insertions(+), 32 deletions(-)
---
diff --git a/libide/editor/ide-editor-view.c b/libide/editor/ide-editor-view.c
index b7620c4..720e268 100644
--- a/libide/editor/ide-editor-view.c
+++ b/libide/editor/ide-editor-view.c
@@ -367,6 +367,33 @@ ide_editor_view_hierarchy_changed (GtkWidget *widget,
 }
 
 static void
+ide_editor_view_update_map (IdeEditorView *self)
+{
+  GtkWidget *parent;
+
+  g_assert (IDE_IS_EDITOR_VIEW (self));
+
+  parent = gtk_widget_get_parent (GTK_WIDGET (self->map));
+
+  g_object_ref (self->map);
+
+  gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (self->map));
+
+  if (self->auto_hide_map)
+    gtk_container_add (GTK_CONTAINER (self->map_revealer), GTK_WIDGET (self->map));
+  else
+    gtk_container_add (GTK_CONTAINER (self->scroller_box), GTK_WIDGET (self->map));
+
+  gtk_widget_set_visible (GTK_WIDGET (self->map_revealer), self->show_map && self->auto_hide_map);
+  gtk_widget_set_visible (GTK_WIDGET (self->map), self->show_map);
+  gtk_revealer_set_reveal_child (self->map_revealer, self->show_map);
+
+  ide_editor_view_update_reveal_timer (self);
+
+  g_object_unref (self->map);
+}
+
+static void
 ide_editor_view_constructed (GObject *object)
 {
   IdeEditorView *self = (IdeEditorView *)object;
@@ -405,6 +432,7 @@ ide_editor_view_constructed (GObject *object)
                             self);
 
   ide_editor_view_load_fonts (self);
+  ide_editor_view_update_map (self);
 }
 
 static void
@@ -740,37 +768,6 @@ ide_editor_view_update_reveal_timer (IdeEditorView *self)
     }
 }
 
-static void
-ide_editor_view_update_map (IdeEditorView *self)
-{
-  GtkWidget *parent;
-
-  g_assert (IDE_IS_EDITOR_VIEW (self));
-
-  parent = gtk_widget_get_parent (GTK_WIDGET (self->map));
-
-  g_object_ref (self->map);
-
-  gtk_container_remove (GTK_CONTAINER (parent), GTK_WIDGET (self->map));
-
-  if (self->auto_hide_map)
-    gtk_container_add (GTK_CONTAINER (self->map_revealer), GTK_WIDGET (self->map));
-  else
-    gtk_container_add (GTK_CONTAINER (self->scroller_box), GTK_WIDGET (self->map));
-
-  gtk_widget_set_visible (GTK_WIDGET (self->map_revealer), self->show_map);
-  gtk_widget_set_visible (GTK_WIDGET (self->map), self->show_map);
-  gtk_revealer_set_reveal_child (self->map_revealer, self->show_map);
-
-  g_object_set (self->scroller,
-                "vscrollbar-policy", self->show_map ? GTK_POLICY_EXTERNAL : GTK_POLICY_AUTOMATIC,
-                NULL);
-
-  ide_editor_view_update_reveal_timer (self);
-
-  g_object_unref (self->map);
-}
-
 void
 ide_editor_view_set_auto_hide_map (IdeEditorView *self,
                                    gboolean       auto_hide_map)
@@ -806,6 +803,9 @@ ide_editor_view_set_show_map (IdeEditorView *self,
   if (show_map != self->show_map)
     {
       self->show_map = show_map;
+      g_object_set (self->scroller,
+                    "vscrollbar-policy", show_map ? GTK_POLICY_EXTERNAL : GTK_POLICY_AUTOMATIC,
+                    NULL);
       ide_editor_view_update_map (self);
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_AUTO_HIDE_MAP]);
     }
diff --git a/libide/editor/ide-editor-view.ui b/libide/editor/ide-editor-view.ui
index eed95cb..01f0cc3 100644
--- a/libide/editor/ide-editor-view.ui
+++ b/libide/editor/ide-editor-view.ui
@@ -52,7 +52,9 @@
               </object>
             </child>
             <child>
-              <object class="GtkSourceMap" id="map"/>
+              <object class="GtkSourceMap" id="map">
+                <property name="visible">false</property>
+              </object>
             </child>
           </object>
         </child>


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