From 936611683a969d2a93bde1c41d048881e860edea Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 30 May 2000 17:06:11 +0000 Subject: Added alphabet.glade and alphabet.glade.h. 2000-05-30 Christopher James Lahey * gui/component/Makefile.am: Added alphabet.glade and alphabet.glade.h. * gui/component/addressbook.c, gui/component/alphabet.glade, gui/component/alphabet.glade.h: Added an alphabet bar. * gui/minicard/e-minicard-view.c, gui/minicard/e-minicard-view.h, gui/minicard/e-reflow-sorted.c, gui/minicard/e-reflow-sorted.h: Added the ability to just to a particular spot in the reflow. svn path=/trunk/; revision=3283 --- widgets/e-reflow/e-reflow-sorted.c | 33 +++++++++++++++++++++++++++++++++ widgets/e-reflow/e-reflow-sorted.h | 1 + 2 files changed, 34 insertions(+) (limited to 'widgets/e-reflow') diff --git a/widgets/e-reflow/e-reflow-sorted.c b/widgets/e-reflow/e-reflow-sorted.c index 7205785c6c..c899ccb9a7 100644 --- a/widgets/e-reflow/e-reflow-sorted.c +++ b/widgets/e-reflow/e-reflow-sorted.c @@ -34,6 +34,10 @@ static void e_reflow_sorted_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); static void e_reflow_sorted_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); static void e_reflow_sorted_add_item(EReflow *e_reflow, GnomeCanvasItem *item); +#define E_REFLOW_DIVIDER_WIDTH 2 +#define E_REFLOW_BORDER_WIDTH 7 +#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) + static EReflowClass *parent_class = NULL; /* The arguments we take */ @@ -234,3 +238,32 @@ e_reflow_sorted_add_item(EReflow *reflow, GnomeCanvasItem *item) } e_reflow_post_add_item(reflow, item); } + +void e_reflow_sorted_jump (EReflowSorted *sorted, + GCompareFunc compare_func, + void *value) +{ + int columns = 0; + EReflow *reflow = E_REFLOW(sorted); + GList *list; + + for (list = reflow->columns; list; list = g_list_next(list)) { + if (compare_func(((GList *)list->data)->data, value) >= 0) { + GList *last = list->prev; + GtkAdjustment *adjustment; + if (last) { + GList *walk; + for (walk = last->data; walk != list->data; walk = g_list_next(walk)) { + if (compare_func(walk->data, value) >= 0) { + columns --; + break; + } + } + } + adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(sorted)->canvas)); + gtk_adjustment_set_value(adjustment, (reflow->column_width + E_REFLOW_FULL_GUTTER) * columns); + return; + } + columns ++; + } +} diff --git a/widgets/e-reflow/e-reflow-sorted.h b/widgets/e-reflow/e-reflow-sorted.h index d9b4acc747..7adfa2c045 100644 --- a/widgets/e-reflow/e-reflow-sorted.h +++ b/widgets/e-reflow/e-reflow-sorted.h @@ -81,6 +81,7 @@ void e_reflow_sorted_replace_item (EReflowSorted *sorted, GnomeCanvasI void e_reflow_sorted_reorder_item (EReflowSorted *e_reflow_sorted, const gchar *id); GnomeCanvasItem *e_reflow_sorted_get_item (EReflowSorted *e_reflow_sorted, const gchar *id); GtkType e_reflow_sorted_get_type (void); +void e_reflow_sorted_jump (EReflowSorted *sorted, GCompareFunc compare_func, void *value); #ifdef __cplusplus } -- cgit v1.2.3