diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-01-14 06:16:57 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:19 +0800 |
commit | 80bc7035be2d07d14e60b09a624147f6e92d1dc6 (patch) | |
tree | 6a6dbd40ed7efffa7f42c0f2ff940474b80f7191 /widgets/table | |
parent | 2485ba3936c9fdd4e185393d49c34dae7ba1f49d (diff) | |
download | gsoc2013-evolution-80bc7035be2d07d14e60b09a624147f6e92d1dc6.tar gsoc2013-evolution-80bc7035be2d07d14e60b09a624147f6e92d1dc6.tar.gz gsoc2013-evolution-80bc7035be2d07d14e60b09a624147f6e92d1dc6.tar.bz2 gsoc2013-evolution-80bc7035be2d07d14e60b09a624147f6e92d1dc6.tar.lz gsoc2013-evolution-80bc7035be2d07d14e60b09a624147f6e92d1dc6.tar.xz gsoc2013-evolution-80bc7035be2d07d14e60b09a624147f6e92d1dc6.tar.zst gsoc2013-evolution-80bc7035be2d07d14e60b09a624147f6e92d1dc6.zip |
Fudge GtkScrollable for gtk2.
Yes, the GtkScrollable interface is implemented by more than just
GtkLayout, but it turns out GtkLayout is the only thing Evolution
uses the GtkScrollable API for on the gtk3 branch.
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-cell-combo.c | 4 | ||||
-rw-r--r-- | widgets/table/e-cell-date-edit.c | 6 | ||||
-rw-r--r-- | widgets/table/e-table-field-chooser.c | 7 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 18 | ||||
-rw-r--r-- | widgets/table/e-table.c | 64 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 73 |
6 files changed, 87 insertions, 85 deletions
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c index 6e1eb5ca80..c06e5450e8 100644 --- a/widgets/table/e-cell-combo.c +++ b/widgets/table/e-cell-combo.c @@ -426,8 +426,8 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, /* The ETable positions don't include the grid lines, I think, so we add 1. */ *y += y1 + 1 - (gint)gtk_adjustment_get_value ( - gtk_layout_get_vadjustment ( - &((GnomeCanvas *)canvas)->layout)) + gtk_scrollable_get_vadjustment ( + GTK_SCROLLABLE (&((GnomeCanvas *)canvas)->layout))) + ((GnomeCanvas *)canvas)->zoom_yofs; widget = gtk_scrolled_window_get_vscrollbar (popup); diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c index 005f7a63e4..31d63d97cf 100644 --- a/widgets/table/e-cell-date-edit.c +++ b/widgets/table/e-cell-date-edit.c @@ -648,7 +648,7 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde, GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas); GtkRequisition popup_requisition; GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; GdkWindow *window; gint avail_height, screen_width, column_width, row_height; gdouble x1, y1, wx, wy; @@ -677,8 +677,8 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde, *x += x1; /* The ETable positions don't include the grid lines, I think, so we add 1. */ - layout = &GNOME_CANVAS (canvas)->layout; - adjustment = gtk_layout_get_vadjustment (layout); + scrollable = GTK_SCROLLABLE (&GNOME_CANVAS (canvas)->layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); value = (gint) gtk_adjustment_get_value (adjustment); *y += y1 + 1 - value + ((GnomeCanvas *)canvas)->zoom_yofs; diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c index f0e3ece84c..374507e1ee 100644 --- a/widgets/table/e-table-field-chooser.c +++ b/widgets/table/e-table-field-chooser.c @@ -34,6 +34,9 @@ #include "e-table-field-chooser.h" #include "e-table-field-chooser-item.h" +/* backward-compatibility cruft */ +#include "e-util/gtk-compat.h" + static void e_table_field_chooser_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void e_table_field_chooser_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void e_table_field_chooser_dispose (GObject *object); @@ -86,8 +89,8 @@ ensure_nonzero_step_increments (ETableFieldChooser *etfc) { GtkAdjustment *va, *ha; - va = gtk_layout_get_vadjustment (GTK_LAYOUT (etfc->canvas)); - ha = gtk_layout_get_hadjustment (GTK_LAYOUT (etfc->canvas)); + va = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (etfc->canvas)); + ha = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (etfc->canvas)); /* it looks pretty complicated to get height of column header diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 7fda0066af..1c97826ef2 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -506,10 +506,10 @@ ethi_add_drop_marker (ETableHeaderItem *ethi, gint col, gboolean recreate) window = gtk_widget_get_window (GTK_WIDGET (canvas)); gdk_window_get_origin (window, &rx, &ry); - adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (canvas)); + adjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas)); rx -= gtk_adjustment_get_value (adjustment); - adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (canvas)); + adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas)); ry -= gtk_adjustment_get_value (adjustment); gtk_window_move ( @@ -625,8 +625,8 @@ scroll_timeout (gpointer data) { ETableHeaderItem *ethi = data; gint dx = 0; - GtkLayout *layout; GtkAdjustment *adjustment; + GtkScrollable *scrollable; gdouble hadjustment_value; gdouble vadjustment_value; gdouble page_size; @@ -639,17 +639,17 @@ scroll_timeout (gpointer data) if (ethi->scroll_direction & ET_SCROLL_LEFT) dx -= 20; - layout = GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas); + scrollable = GTK_SCROLLABLE (GNOME_CANVAS_ITEM (ethi)->canvas); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); hadjustment_value = gtk_adjustment_get_value (adjustment); - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); vadjustment_value = gtk_adjustment_get_value (adjustment); value = hadjustment_value; - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); page_size = gtk_adjustment_get_page_size (adjustment); lower = gtk_adjustment_get_lower (adjustment); upper = gtk_adjustment_get_upper (adjustment); @@ -759,10 +759,10 @@ ethi_drag_motion (GtkWidget *widget, ethi->last_drop_context = context; context_connect (ethi, context); - adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (widget)); + adjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (widget)); hadjustment_value = gtk_adjustment_get_value (adjustment); - adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (widget)); + adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (widget)); vadjustment_value = gtk_adjustment_get_value (adjustment); do_drag_motion ( diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 4dc13bfb1a..952bf900b8 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -838,13 +838,13 @@ group_key_press (ETableGroup *etg, gint row, gint col, GdkEvent *event, ETable * GdkEventKey *key = (GdkEventKey *) event; gint y, row_local, col_local; GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; gdouble page_size; gdouble upper; gdouble value; - layout = GTK_LAYOUT (et->table_canvas); - adjustment = gtk_layout_get_vadjustment (layout); + scrollable = GTK_SCROLLABLE (et->table_canvas); + adjustment = gtk_scrollable_get_vadjustment (scrollable); switch (key->keyval) { case GDK_KEY_Page_Down: @@ -1607,8 +1607,8 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, gint row = 0; gint col_count, i; GValue *val; - GtkLayout *layout; GtkAdjustment *adjustment; + GtkScrollable *scrollable; val = g_new0 (GValue, 1); g_value_init (val, G_TYPE_OBJECT); @@ -1689,12 +1689,12 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table_setup_table (e_table, e_table->full_header, e_table->header, etm); e_table_fill_table (e_table, etm); - layout = GTK_LAYOUT (e_table->table_canvas); + scrollable = GTK_SCROLLABLE (e_table->table_canvas); - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); gtk_adjustment_set_step_increment (adjustment, 20); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); gtk_adjustment_set_step_increment (adjustment, 20); if (!specification->no_headers) { @@ -2331,15 +2331,15 @@ set_scroll_adjustments (ETable *table, gtk_adjustment_set_step_increment (hadjustment, 20); if (table->table_canvas != NULL) { - gtk_layout_set_hadjustment ( - GTK_LAYOUT (table->table_canvas), hadjustment); - gtk_layout_set_vadjustment ( - GTK_LAYOUT (table->table_canvas), vadjustment); + gtk_scrollable_set_hadjustment ( + GTK_SCROLLABLE (table->table_canvas), hadjustment); + gtk_scrollable_set_vadjustment ( + GTK_SCROLLABLE (table->table_canvas), vadjustment); } if (table->header_canvas != NULL) - gtk_layout_set_hadjustment ( - GTK_LAYOUT (table->header_canvas), hadjustment); + gtk_scrollable_set_hadjustment ( + GTK_SCROLLABLE (table->header_canvas), hadjustment); } /** @@ -2469,7 +2469,7 @@ e_table_get_cell_at (ETable *table, gint *row_return, gint *col_return) { GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; g_return_if_fail (E_IS_TABLE (table)); g_return_if_fail (row_return != NULL); @@ -2478,12 +2478,12 @@ e_table_get_cell_at (ETable *table, /* FIXME it would be nice if it could handle a NULL row_return or * col_return gracefully. */ - layout = GTK_LAYOUT (table->table_canvas); + scrollable = GTK_SCROLLABLE (table->table_canvas); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); x += gtk_adjustment_get_value (adjustment); - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); y += gtk_adjustment_get_value (adjustment); e_table_group_compute_location ( @@ -2511,26 +2511,26 @@ e_table_get_cell_geometry (ETable *table, gint *x_return, gint *y_return, gint *width_return, gint *height_return) { - GtkAdjustment *adjustment; GtkAllocation allocation; - GtkLayout *layout; + GtkAdjustment *adjustment; + GtkScrollable *scrollable; g_return_if_fail (E_IS_TABLE (table)); - layout = GTK_LAYOUT (table->table_canvas); + scrollable = GTK_SCROLLABLE (table->table_canvas); e_table_group_get_cell_geometry ( table->group, &row, &col, x_return, y_return, width_return, height_return); if (x_return && table->table_canvas) { - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); (*x_return) -= gtk_adjustment_get_value (adjustment); } if (y_return) { if (table->table_canvas) { - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); (*y_return) -= gtk_adjustment_get_value (adjustment); } @@ -2692,16 +2692,16 @@ e_table_drag_highlight (ETable *table, gint row, gint col) { - GtkAdjustment *adjustment; GtkAllocation allocation; - GtkLayout *layout; + GtkAdjustment *adjustment; + GtkScrollable *scrollable; GtkStyle *style; g_return_if_fail (E_IS_TABLE (table)); - layout = GTK_LAYOUT (table->table_canvas); + scrollable = GTK_SCROLLABLE (table->table_canvas); style = gtk_widget_get_style (GTK_WIDGET (table)); - gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation); + gtk_widget_get_allocation (GTK_WIDGET (scrollable), &allocation); if (row != -1) { gint x, y, width, height; @@ -2711,11 +2711,11 @@ e_table_drag_highlight (ETable *table, width = allocation.width; } else { e_table_get_cell_geometry (table, row, col, &x, &y, &width, &height); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); x += gtk_adjustment_get_value (adjustment); } - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); y += gtk_adjustment_get_value (adjustment); if (table->drop_highlight == NULL) { @@ -3025,7 +3025,7 @@ scroll_timeout (gpointer data) ETable *et = data; gint dx = 0, dy = 0; GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; gdouble old_h_value; gdouble new_h_value; gdouble old_v_value; @@ -3044,9 +3044,9 @@ scroll_timeout (gpointer data) if (et->scroll_direction & ET_SCROLL_LEFT) dx -= 20; - layout = GTK_LAYOUT (et->table_canvas); + scrollable = GTK_SCROLLABLE (et->table_canvas); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); lower = gtk_adjustment_get_lower (adjustment); upper = gtk_adjustment_get_upper (adjustment); @@ -3057,7 +3057,7 @@ scroll_timeout (gpointer data) gtk_adjustment_set_value (adjustment, new_h_value); - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); lower = gtk_adjustment_get_lower (adjustment); upper = gtk_adjustment_get_upper (adjustment); diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 8d718b0235..f19a9a7cfc 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -759,7 +759,7 @@ scroll_to_cursor (ETree *e_tree) { ETreePath path; GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; gint x, y, w, h; gdouble page_size; gdouble lower; @@ -779,8 +779,8 @@ scroll_to_cursor (ETree *e_tree) &row, &col, &x, &y, &w, &h); } - layout = GTK_LAYOUT (e_tree->priv->table_canvas); - adjustment = gtk_layout_get_vadjustment (layout); + scrollable = GTK_SCROLLABLE (e_tree->priv->table_canvas); + adjustment = gtk_scrollable_get_vadjustment (scrollable); page_size = gtk_adjustment_get_page_size (adjustment); lower = gtk_adjustment_get_lower (adjustment); @@ -928,13 +928,13 @@ item_key_press (ETableItem *eti, gint row, gint col, GdkEvent *event, ETree *et) ETreePath path; gint y, row_local, col_local; GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; gdouble page_size; gdouble upper; gdouble value; - layout = GTK_LAYOUT (et->priv->table_canvas); - adjustment = gtk_layout_get_vadjustment (layout); + scrollable = GTK_SCROLLABLE (et->priv->table_canvas); + adjustment = gtk_scrollable_get_vadjustment (scrollable); page_size = gtk_adjustment_get_page_size (adjustment); upper = gtk_adjustment_get_upper (adjustment); @@ -1514,7 +1514,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, ETableSpecification *specification, ETableState *state) { GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; gint row = 0; if (ete) @@ -1566,12 +1566,12 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, } e_tree_setup_table (e_tree); - layout = GTK_LAYOUT (e_tree->priv->table_canvas); + scrollable = GTK_SCROLLABLE (e_tree->priv->table_canvas); - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); gtk_adjustment_set_step_increment (adjustment, 20); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); gtk_adjustment_set_step_increment (adjustment, 20); if (!specification->no_headers) { @@ -2036,17 +2036,16 @@ set_scroll_adjustments (ETree *tree, gtk_adjustment_set_step_increment (hadjustment, 20); if (tree->priv) { - GtkLayout *layout; + GtkScrollable *scrollable; - layout = GTK_LAYOUT (tree->priv->table_canvas); + scrollable = GTK_SCROLLABLE (tree->priv->table_canvas); + gtk_scrollable_set_hadjustment (scrollable, hadjustment); + gtk_scrollable_set_vadjustment (scrollable, vadjustment); - gtk_layout_set_hadjustment (layout, hadjustment); - gtk_layout_set_vadjustment (layout, vadjustment); - - if (tree->priv->header_canvas != NULL) - gtk_layout_set_hadjustment ( - GTK_LAYOUT (tree->priv->header_canvas), - hadjustment); + if (tree->priv->header_canvas != NULL) { + scrollable = GTK_SCROLLABLE (tree->priv->header_canvas); + gtk_scrollable_set_hadjustment (scrollable, hadjustment); + } } } @@ -2485,16 +2484,16 @@ e_tree_drag_highlight (ETree *tree, gint row, gint col) { - GtkAdjustment *adjustment; GtkAllocation allocation; - GtkLayout *layout; + GtkAdjustment *adjustment; + GtkScrollable *scrollable; GtkStyle *style; g_return_if_fail (E_IS_TREE (tree)); - layout = GTK_LAYOUT (tree->priv->table_canvas); + scrollable = GTK_SCROLLABLE (tree->priv->table_canvas); style = gtk_widget_get_style (GTK_WIDGET (tree)); - gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation); + gtk_widget_get_allocation (GTK_WIDGET (scrollable), &allocation); if (row != -1) { gint x, y, width, height; @@ -2504,11 +2503,11 @@ e_tree_drag_highlight (ETree *tree, width = allocation.width; } else { e_tree_get_cell_geometry (tree, row, col, &x, &y, &width, &height); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); x += gtk_adjustment_get_value (adjustment); } - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); y += gtk_adjustment_get_value (adjustment); if (tree->priv->drop_highlight == NULL) { @@ -2731,7 +2730,7 @@ e_tree_get_cell_at (ETree *tree, gint *row_return, gint *col_return) { GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; g_return_if_fail (E_IS_TREE (tree)); g_return_if_fail (row_return != NULL); @@ -2745,12 +2744,12 @@ e_tree_get_cell_at (ETree *tree, if (col_return) *col_return = -1; - layout = GTK_LAYOUT (tree->priv->table_canvas); + scrollable = GTK_SCROLLABLE (tree->priv->table_canvas); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); x += gtk_adjustment_get_value (adjustment); - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); y += gtk_adjustment_get_value (adjustment); e_table_item_compute_location ( @@ -2779,7 +2778,7 @@ e_tree_get_cell_geometry (ETree *tree, gint *width_return, gint *height_return) { GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; g_return_if_fail (E_IS_TREE (tree)); g_return_if_fail (row >= 0); @@ -2793,15 +2792,15 @@ e_tree_get_cell_geometry (ETree *tree, &row, &col, x_return, y_return, width_return, height_return); - layout = GTK_LAYOUT (tree->priv->table_canvas); + scrollable = GTK_SCROLLABLE (tree->priv->table_canvas); if (x_return) { - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); (*x_return) -= gtk_adjustment_get_value (adjustment); } if (y_return) { - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); (*y_return) -= gtk_adjustment_get_value (adjustment); } } @@ -2915,7 +2914,7 @@ scroll_timeout (gpointer data) ETree *et = data; gint dx = 0, dy = 0; GtkAdjustment *adjustment; - GtkLayout *layout; + GtkScrollable *scrollable; gdouble old_h_value; gdouble new_h_value; gdouble old_v_value; @@ -2934,9 +2933,9 @@ scroll_timeout (gpointer data) if (et->priv->scroll_direction & ET_SCROLL_LEFT) dx -= 20; - layout = GTK_LAYOUT (et->priv->table_canvas); + scrollable = GTK_SCROLLABLE (et->priv->table_canvas); - adjustment = gtk_layout_get_hadjustment (layout); + adjustment = gtk_scrollable_get_hadjustment (scrollable); page_size = gtk_adjustment_get_page_size (adjustment); lower = gtk_adjustment_get_lower (adjustment); @@ -2947,7 +2946,7 @@ scroll_timeout (gpointer data) gtk_adjustment_set_value (adjustment, new_h_value); - adjustment = gtk_layout_get_vadjustment (layout); + adjustment = gtk_scrollable_get_vadjustment (scrollable); page_size = gtk_adjustment_get_page_size (adjustment); lower = gtk_adjustment_get_lower (adjustment); |