aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMengjie Yu <meng-jie.yu@sun.com>2005-04-22 16:04:03 +0800
committerHarry Lu <haip@src.gnome.org>2005-04-22 16:04:03 +0800
commit4ef011fee458a41efea4dd5023fbb38a505127bb (patch)
tree0d692870b4e0d627129fe1019c600c7de55035b3 /widgets
parentf45242150b280b91ae59aef5ad6c812ad1ced88a (diff)
downloadgsoc2013-evolution-4ef011fee458a41efea4dd5023fbb38a505127bb.tar
gsoc2013-evolution-4ef011fee458a41efea4dd5023fbb38a505127bb.tar.gz
gsoc2013-evolution-4ef011fee458a41efea4dd5023fbb38a505127bb.tar.bz2
gsoc2013-evolution-4ef011fee458a41efea4dd5023fbb38a505127bb.tar.lz
gsoc2013-evolution-4ef011fee458a41efea4dd5023fbb38a505127bb.tar.xz
gsoc2013-evolution-4ef011fee458a41efea4dd5023fbb38a505127bb.tar.zst
gsoc2013-evolution-4ef011fee458a41efea4dd5023fbb38a505127bb.zip
use idle callback to adjust scrollbar when focus has been changed. add
2005-04-21 Mengjie Yu <meng-jie.yu@sun.com> * gal/widgets/e-reflow.c: (do_adjustment), (cursor_changed), (e_reflow_dispose), (e_reflow_init): use idle callback to adjust scrollbar when focus has been changed. * gal/widgets/e-reflow.h: add source ID field for idle callback Fixes #300954 svn path=/trunk/; revision=29223
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-reflow.c41
-rw-r--r--widgets/misc/e-reflow.h1
2 files changed, 42 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());
diff --git a/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h
index b92643a935..b37e028340 100644
--- a/widgets/misc/e-reflow.h
+++ b/widgets/misc/e-reflow.h
@@ -98,6 +98,7 @@ struct _EReflow
double column_width;
int incarnate_idle_id;
+ int do_adjustment_idle_id;
/* These are all for when the column is being dragged. */
gdouble start_x;