aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-reflow.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/misc/e-reflow.c')
-rw-r--r--widgets/misc/e-reflow.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c
index cd05fd017f..b4d5d03025 100644
--- a/widgets/misc/e-reflow.c
+++ b/widgets/misc/e-reflow.c
@@ -160,6 +160,37 @@ selection_row_changed (ESelectionModel *selection, int row, EReflow *reflow)
e_reflow_update_selection_row (reflow, row);
}
+static gboolean
+do_adjustment (gpointer user_data)
+{
+ int row;
+ GtkAdjustment *adj ;
+ gfloat value, min_value, max_value;
+ EReflow *reflow = user_data;
+
+ adj = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas));
+ row = reflow->cursor_row;
+ value = adj->value;
+
+ min_value = reflow->items[row]->x2 - adj->page_size;
+ max_value = reflow->items[row]->x1;
+
+ if (value < min_value)
+ value = min_value;
+
+ if (value > max_value)
+ value = max_value;
+
+ if (value != adj->value) {
+ adj->value = value;
+ gtk_adjustment_value_changed (adj);
+ }
+
+ reflow->do_adjustment_idle_id = 0;
+
+ return FALSE;
+}
+
static void
cursor_changed (ESelectionModel *selection, int row, int col, EReflow *reflow)
{
@@ -189,8 +220,13 @@ cursor_changed (ESelectionModel *selection, int row, int col, EReflow *reflow)
NULL);
}
}
+
+ if (reflow->do_adjustment_idle_id == 0)
+ reflow->do_adjustment_idle_id = g_idle_add (do_adjustment, reflow);
+
}
+
static void
incarnate (EReflow *reflow)
{
@@ -767,6 +803,10 @@ e_reflow_dispose (GObject *object)
g_source_remove (reflow->incarnate_idle_id);
reflow->incarnate_idle_id = 0;
+ if (reflow->do_adjustment_idle_id)
+ g_source_remove (reflow->do_adjustment_idle_id);
+ reflow->do_adjustment_idle_id = 0;
+
disconnect_model (reflow);
disconnect_selection (reflow);
@@ -1479,6 +1519,7 @@ e_reflow_init (EReflow *reflow)
reflow->cursor_row = -1;
reflow->incarnate_idle_id = 0;
+ reflow->do_adjustment_idle_id = 0;
reflow->set_scroll_adjustments_id = 0;
reflow->selection = E_SELECTION_MODEL (e_selection_model_simple_new());