[gucharmap] Set the adjustment value last



commit b315642bfbc00331d627063e92337d45c2e8c2f6
Author: Christian Persch <chpe gnome org>
Date:   Sun Apr 18 11:42:11 2010 +0200

    Set the adjustment value last
    
    ... after setting the bounds. Also freeze the notifications around
    setting these values.

 gucharmap/gucharmap-chartable.c |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/gucharmap/gucharmap-chartable.c b/gucharmap/gucharmap-chartable.c
index cc2061c..a0d6d20 100644
--- a/gucharmap/gucharmap-chartable.c
+++ b/gucharmap/gucharmap-chartable.c
@@ -1283,33 +1283,23 @@ update_scrollbar_adjustment (GucharmapChartable *chartable)
 {
   GucharmapChartablePrivate *priv = chartable->priv;
   GtkAdjustment *vadjustment = priv->vadjustment;
-#if 0
   GObject *vadjustment_object = G_OBJECT (vadjustment);
-#endif
 
   if (!vadjustment)
     return;
 
-  vadjustment->value = 1.0 * priv->page_first_cell / priv->cols;
-  vadjustment->lower = 0.0;
-  vadjustment->upper = 1.0 * ( priv->last_cell / priv->cols + 1 );
-  vadjustment->step_increment = 3.0;
-  vadjustment->page_increment = 1.0 * priv->rows;
-  vadjustment->page_size = priv->rows; /* FIXMEchpe + 1 maybe? so scroll-wheel up/down scroll exactly half a page? */
-
-#if 0
   g_object_freeze_notify (vadjustment_object);
-  gtk_adjustment_set_value (vadjustment, 1.0 * priv->page_first_cell / priv->cols);
+
   gtk_adjustment_set_lower (vadjustment, 0.0);
   gtk_adjustment_set_upper (vadjustment, 1.0 * ( priv->last_cell / priv->cols + 1 ));
   gtk_adjustment_set_step_increment (vadjustment, 3.0);
   gtk_adjustment_set_page_increment (vadjustment, 1.0 * priv->rows);
   /* FIXMEchpe: shouldn't set page size at all! */
   gtk_adjustment_set_page_size (vadjustment, priv->rows); /* FIXMEchpe + 1 maybe? so scroll-wheel up/down scroll exactly half a page? */
-  g_object_thaw_notify (vadjustment_object);
-#endif
 
-  gtk_adjustment_changed (vadjustment);
+  gtk_adjustment_set_value (vadjustment, 1.0 * priv->page_first_cell / priv->cols);
+
+  g_object_thaw_notify (vadjustment_object);
 }
 
 static void



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