Fixed bug which manifested itself in the text import dialog
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 12 Dec 2008 07:24:57 +0000 (16:24 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 12 Dec 2008 07:24:57 +0000 (16:24 +0900)
lib/gtksheet/gtksheet.c

index ebd9321354138c61e4de591b55ed25757545d226..658061510a7b4757891a28c65b3239e72c0a4eda 100644 (file)
@@ -422,7 +422,7 @@ static void gtk_sheet_forall                         (GtkContainer *container,
                                                  GtkCallback callback,
                                                  gpointer callback_data);
 
-static void gtk_sheet_set_scroll_adjustments    (GtkSheet *sheet,
+static gboolean gtk_sheet_set_scroll_adjustments  (GtkSheet *sheet,
                                                  GtkAdjustment *hadjustment,
                                                  GtkAdjustment *vadjustment);
 
@@ -1636,7 +1636,7 @@ gtk_sheet_get_visible_range (GtkSheet *sheet, GtkSheetRange *range)
 }
 
 
-static void
+static gboolean
 gtk_sheet_set_scroll_adjustments (GtkSheet *sheet,
                                  GtkAdjustment *hadjustment,
                                  GtkAdjustment *vadjustment)
@@ -1646,24 +1646,34 @@ gtk_sheet_set_scroll_adjustments (GtkSheet *sheet,
       if (sheet->vadjustment)
        g_object_unref (sheet->vadjustment);
       sheet->vadjustment = vadjustment;
-      g_object_ref (vadjustment);
 
-      g_signal_connect (sheet->vadjustment, "value_changed",
-                       G_CALLBACK (vadjustment_value_changed),
-                       sheet);
+      if ( vadjustment)
+       {
+         g_object_ref (vadjustment);
+
+         g_signal_connect (sheet->vadjustment, "value_changed",
+                           G_CALLBACK (vadjustment_value_changed),
+                           sheet);
+       }
     }
 
   if ( sheet->hadjustment != hadjustment )
     {
       if (sheet->hadjustment)
        g_object_unref (sheet->hadjustment);
+
       sheet->hadjustment = hadjustment;
-      g_object_ref (hadjustment);
 
-      g_signal_connect (sheet->hadjustment, "value_changed",
-                       G_CALLBACK (hadjustment_value_changed),
-                       sheet);
+      if ( hadjustment)
+       {
+         g_object_ref (hadjustment);
+
+         g_signal_connect (sheet->hadjustment, "value_changed",
+                           G_CALLBACK (hadjustment_value_changed),
+                           sheet);
+       }
     }
+  return TRUE;
 }
 
 static void
@@ -1769,8 +1779,6 @@ gtk_sheet_realize (GtkWidget *widget)
 
   sheet = GTK_SHEET (widget);
 
-  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
   colormap = gtk_widget_get_colormap (widget);
   display = gtk_widget_get_display (widget);
 
@@ -1891,6 +1899,9 @@ gtk_sheet_realize (GtkWidget *widget)
   draw_column_title_buttons (sheet);
 
   gtk_sheet_update_primary_selection (sheet);
+
+
+  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 }
 
 static void