[gnome-builder/wip/minimap2] minimap: handle creation of widget outside of .ui



commit a1f217fc0962703f33f6152f6fc2eac46efa2d30
Author: Christian Hergert <christian hergert me>
Date:   Tue Apr 21 17:37:04 2015 -0700

    minimap: handle creation of widget outside of .ui
    
    Whe this widget is created manually and packed into the widget tree, we
    hit a couple of corner cases. This fixes those up.

 libide/ide-source-map.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-source-map.c b/libide/ide-source-map.c
index 52ef6f6..9ff9b8b 100644
--- a/libide/ide-source-map.c
+++ b/libide/ide-source-map.c
@@ -389,7 +389,8 @@ ide_source_map__child_view_state_flags_changed (GtkWidget     *widget,
   g_assert (GTK_SOURCE_IS_VIEW (child_view));
 
   window = gtk_text_view_get_window (GTK_TEXT_VIEW (child_view), GTK_TEXT_WINDOW_TEXT);
-  gdk_window_set_cursor (window, NULL);
+  if (window != NULL)
+    gdk_window_set_cursor (window, NULL);
 }
 
 static void
@@ -508,6 +509,17 @@ ide_source_map__overlay_box_motion_notify_event (IdeSourceMap   *self,
 }
 
 static void
+ide_source_map_size_allocate (GtkWidget     *widget,
+                              GtkAllocation *alloc)
+{
+  IdeSourceMap *self = (IdeSourceMap *)widget;
+
+  GTK_WIDGET_CLASS (ide_source_map_parent_class)->size_allocate (widget, alloc);
+
+  update_scrubber_height (self);
+}
+
+static void
 ide_source_map_finalize (GObject *object)
 {
   IdeSourceMap *self = (IdeSourceMap *)object;
@@ -570,6 +582,7 @@ ide_source_map_class_init (IdeSourceMapClass *klass)
 
   widget_class->get_preferred_height = ide_source_map_get_preferred_height;
   widget_class->get_preferred_width = ide_source_map_get_preferred_width;
+  widget_class->size_allocate = ide_source_map_size_allocate;
 
   overlay_class->get_child_position = ide_source_map_get_child_position;
 


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