diff options
author | Milan Crha <mcrha@redhat.com> | 2009-02-16 19:00:23 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2009-02-16 19:00:23 +0800 |
commit | 5f0a7fea0d679915459fb28a98c82d61cb79b673 (patch) | |
tree | 8d882acdc94652af6a459b8acbf6ca7b4806aba5 | |
parent | 5a7c58ddeb7d9fc5749f0bdf3c4c2f50d0245a58 (diff) | |
download | gsoc2013-evolution-5f0a7fea0d679915459fb28a98c82d61cb79b673.tar.gz gsoc2013-evolution-5f0a7fea0d679915459fb28a98c82d61cb79b673.tar.zst gsoc2013-evolution-5f0a7fea0d679915459fb28a98c82d61cb79b673.zip |
** Fix for bug #550114
2009-02-16 Milan Crha <mcrha@redhat.com>
** Fix for bug #550114
* widgets/table/e-table-group.h:
* widgets/table/e-table-group.c:
* widgets/table/e-table-group-container.c:
* widgets/table/e-table-group-leaf.c:
Replaced 'compute_mouse_over' with 'get_mouse_over', now works
with cached values 'motion_row', 'motion_col'.
* widgets/table/e-table.c: (e_table_get_mouse_over_cell):
Mouse position not required anymore, remove it too then.
* calendar/gui/e-calendar-table.h: (ec_query_tooltip):
* calendar/gui/e-calendar-table.c: (ec_query_tooltip): Offer it to others too.
* calendar/gui/e-calendar-table.c: (query_tooltip_cb): Use above funtion.
Show proper tooltip in table with grouping columns.
* calendar/gui/e-memo-table.c: (query_tooltip_cb), (e_memo_table_init):
Show tooltips in memo view too.
svn path=/trunk/; revision=37275
-rw-r--r-- | calendar/ChangeLog | 11 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 29 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-memo-table.c | 15 | ||||
-rw-r--r-- | widgets/table/ChangeLog | 13 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.c | 21 | ||||
-rw-r--r-- | widgets/table/e-table-group-leaf.c | 11 | ||||
-rw-r--r-- | widgets/table/e-table-group.c | 8 | ||||
-rw-r--r-- | widgets/table/e-table-group.h | 6 | ||||
-rw-r--r-- | widgets/table/e-table.c | 12 | ||||
-rw-r--r-- | widgets/table/e-table.h | 2 |
11 files changed, 94 insertions, 36 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index f7d47c8ce9..96b08efbba 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,14 @@ +2009-02-16 Milan Crha <mcrha@redhat.com> + + ** Fix for bug #550114 + + * gui/e-calendar-table.h: (ec_query_tooltip): + * gui/e-calendar-table.c: (ec_query_tooltip): Offer it to others too. + * gui/e-calendar-table.c: (query_tooltip_cb): Use above funtion. + Show proper tooltip in table with grouping columns. + * gui/e-memo-table.c: (query_tooltip_cb), (e_memo_table_init): + Show tooltips in memo view too. + 2009-02-13 Chow Loong Jin <hyperair@gmail.com> ** Fixes bug #571625 diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 4c5836f1d9..3f5e708e9d 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -276,10 +276,9 @@ get_time_as_text (struct icaltimetype *tt, icaltimezone *f_zone, icaltimezone *t buff, buff_len); } -static gboolean -query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data) +gboolean +ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, GtkWidget *etable_wgt, ECalModel *model) { - ECalendarTable *cal_table; ECalModelComponent *comp; int row = -1, col = -1; GtkWidget *box, *l, *w; @@ -302,13 +301,13 @@ query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk return FALSE; g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (E_IS_CALENDAR_TABLE (user_data), FALSE); g_return_val_if_fail (tooltip != NULL, FALSE); + g_return_val_if_fail (E_IS_TABLE (etable_wgt), FALSE); + g_return_val_if_fail (E_IS_CAL_MODEL (model), FALSE); - cal_table = E_CALENDAR_TABLE (user_data); + etable = E_TABLE (etable_wgt); - etable = e_calendar_table_get_table (cal_table); - e_table_get_mouse_over_cell (etable, x, y, &row, &col); + e_table_get_mouse_over_cell (etable, &row, &col); if (row == -1 || !etable) return FALSE; @@ -317,7 +316,7 @@ query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk if (esm && esm->sorter && e_sorter_needs_sorting (esm->sorter)) row = e_sorter_sorted_to_model (esm->sorter, row); - comp = e_cal_model_get_component_at (cal_table->model, row); + comp = e_cal_model_get_component_at (model, row); if (!comp || !comp->icalcomp) return FALSE; @@ -386,7 +385,7 @@ query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk e_cal_component_get_dtstart (new_comp, &dtstart); e_cal_component_get_due (new_comp, &dtdue); - default_zone = e_cal_model_get_timezone (cal_table->model); + default_zone = e_cal_model_get_timezone (model); if (dtstart.tzid) { zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (new_comp), dtstart.tzid); @@ -476,6 +475,18 @@ query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, Gtk return TRUE; } +static gboolean +query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data) +{ + ECalendarTable *cal_table; + + g_return_val_if_fail (E_IS_CALENDAR_TABLE (user_data), FALSE); + + cal_table = E_CALENDAR_TABLE (user_data); + + return ec_query_tooltip (widget, x, y, keyboard_mode, tooltip, GTK_WIDGET (e_calendar_table_get_table (cal_table)), cal_table->model); +} + static void e_calendar_table_init (ECalendarTable *cal_table) { diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h index 3e11716e21..e9906ad59b 100644 --- a/calendar/gui/e-calendar-table.h +++ b/calendar/gui/e-calendar-table.h @@ -116,6 +116,8 @@ void e_calendar_table_hide_completed_tasks (ECalendarTable *table, GList *client void e_calendar_table_process_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed); +gboolean ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, GtkWidget *etable_wgt, ECalModel *model); + G_END_DECLS #endif /* _E_CALENDAR_TABLE_H_ */ diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c index 8e312c7b0b..260103ada0 100644 --- a/calendar/gui/e-memo-table.c +++ b/calendar/gui/e-memo-table.c @@ -57,6 +57,7 @@ #include <e-util/e-icon-factory.h> #include <e-util/e-util-private.h> #include "e-cal-popup.h" +#include "e-calendar-table.h" enum TargetType{ TARGET_TYPE_VCALENDAR @@ -181,6 +182,18 @@ row_appended_cb (ECalModel *model, EMemoTable *memo_table) g_signal_emit (memo_table, signals[USER_CREATED], 0); } +static gboolean +query_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data) +{ + EMemoTable *memo_table; + + g_return_val_if_fail (E_IS_MEMO_TABLE (user_data), FALSE); + + memo_table = E_MEMO_TABLE (user_data); + + return ec_query_tooltip (widget, x, y, keyboard_mode, tooltip, GTK_WIDGET (e_memo_table_get_table (memo_table)), memo_table->model); +} + static void e_memo_table_init (EMemoTable *memo_table) { @@ -272,6 +285,8 @@ e_memo_table_init (EMemoTable *memo_table) g_signal_connect (e_table, "right_click", G_CALLBACK (e_memo_table_on_right_click), memo_table); g_signal_connect (e_table, "key_press", G_CALLBACK (e_memo_table_on_key_press), memo_table); g_signal_connect (e_table, "popup_menu", G_CALLBACK (e_memo_table_on_popup_menu), memo_table); + g_signal_connect (e_table, "query-tooltip", G_CALLBACK (query_tooltip_cb), memo_table); + gtk_widget_set_has_tooltip (GTK_WIDGET (e_table), TRUE); a11y = gtk_widget_get_accessible (GTK_WIDGET(e_table)); if (a11y) diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog index d2de4354a2..c33ff9eba7 100644 --- a/widgets/table/ChangeLog +++ b/widgets/table/ChangeLog @@ -1,3 +1,16 @@ +2009-02-16 Milan Crha <mcrha@redhat.com> + + ** Part of fix for bug #550114 + + * e-table-group.h: + * e-table-group.c: + * e-table-group-container.c: + * e-table-group-leaf.c: + Replaced 'compute_mouse_over' with 'get_mouse_over', now works + with cached values 'motion_row', 'motion_col'. + * e-table.c: (e_table_get_mouse_over_cell): + Mouse position not required anymore, remove it too then. + 2008-12-15 Milan Crha <mcrha@redhat.com> ** Fix for bug #557176 diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 0066b8b482..592cd1eee5 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -688,7 +688,7 @@ etgc_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col) } static void -etgc_compute_mouse_over (ETableGroup *etg, int x, int y, int *row, int *col) +etgc_get_mouse_over (ETableGroup *etg, int *row, int *col) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); @@ -697,18 +697,23 @@ etgc_compute_mouse_over (ETableGroup *etg, int x, int y, int *row, int *col) if (col) *col = -1; - x -= GROUP_INDENT; - y -= TITLE_HEIGHT; - - if (x >= 0 && y >= 0 && etgc->children) { + if (etgc->children) { + int row_plus = 0; GList *list; + for (list = etgc->children; list; list = list->next) { ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; ETableGroup *child = child_node->child; - e_table_group_compute_mouse_over (child, x, y, row, col); - if ((*row != -1) && (*col != -1)) + e_table_group_get_mouse_over (child, row, col); + + if ((!row || *row != -1) && (!col || *col != -1)) { + if (row) + *row += row_plus; return; + } + + row_plus += e_table_group_row_count (child); } } } @@ -914,7 +919,7 @@ etgc_class_init (ETableGroupContainerClass *klass) e_group_class->get_focus_column = etgc_get_focus_column; e_group_class->get_printable = etgc_get_printable; e_group_class->compute_location = etgc_compute_location; - e_group_class->compute_mouse_over = etgc_compute_mouse_over; + e_group_class->get_mouse_over = etgc_get_mouse_over; e_group_class->get_cell_geometry = etgc_get_cell_geometry; g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS, diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index 95dc312b0a..dc4c8ba11e 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -408,11 +408,16 @@ etgl_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col) } static void -etgl_compute_mouse_over (ETableGroup *etg, int x, int y, int *row, int *col) +etgl_get_mouse_over (ETableGroup *etg, int *row, int *col) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - e_table_item_compute_mouse_over (etgl->item, x, y, row, col); + if (etgl->item && etgl->item->motion_row > -1 && etgl->item->motion_col > -1) { + if (row) + *row = etgl->item->motion_row; + if (col) + *col = etgl->item->motion_col; + } } static void @@ -573,7 +578,7 @@ etgl_class_init (ETableGroupLeafClass *klass) e_group_class->get_focus_column = etgl_get_focus_column; e_group_class->get_printable = etgl_get_printable; e_group_class->compute_location = etgl_compute_location; - e_group_class->compute_mouse_over = etgl_compute_mouse_over; + e_group_class->get_mouse_over = etgl_get_mouse_over; e_group_class->get_cell_geometry = etgl_get_cell_geometry; g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS, diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index cbbd02c839..9e558bcb3f 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -382,13 +382,13 @@ e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int } void -e_table_group_compute_mouse_over (ETableGroup *etg, int x, int y, int *row, int *col) +e_table_group_get_mouse_over (ETableGroup *etg, int *row, int *col) { g_return_if_fail (etg != NULL); g_return_if_fail (E_IS_TABLE_GROUP (etg)); - g_return_if_fail (ETG_CLASS (etg)->compute_mouse_over != NULL); - ETG_CLASS (etg)->compute_mouse_over (etg, x, y, row, col); + g_return_if_fail (ETG_CLASS (etg)->get_mouse_over != NULL); + ETG_CLASS (etg)->get_mouse_over (etg, row, col); } /** @@ -648,7 +648,7 @@ etg_class_init (ETableGroupClass *klass) klass->get_focus = etg_get_focus; klass->get_printable = NULL; klass->compute_location = NULL; - klass->compute_mouse_over = NULL; + klass->get_mouse_over = NULL; klass->get_cell_geometry = NULL; etg_signals [CURSOR_CHANGE] = diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index 10591e4113..ee225c2471 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -90,7 +90,7 @@ typedef struct { gint (*get_focus_column) (ETableGroup *etg); EPrintable *(*get_printable) (ETableGroup *etg); void (*compute_location) (ETableGroup *etg, int *x, int *y, int *row, int *col); - void (*compute_mouse_over) (ETableGroup *etg, int x, int y, int *row, int *col); + void (*get_mouse_over) (ETableGroup *etg, int *row, int *col); void (*get_cell_geometry) (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height); } ETableGroupClass; @@ -123,9 +123,7 @@ void e_table_group_compute_location (ETableGroup *etg, int *y, int *row, int *col); -void e_table_group_compute_mouse_over(ETableGroup *etg, - int x, - int y, +void e_table_group_get_mouse_over(ETableGroup *etg, int *row, int *col); void e_table_group_get_cell_geometry (ETableGroup *etg, diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index bd2926c682..b2e6b0ecaf 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -2416,20 +2416,18 @@ e_table_get_cell_geometry (ETable *table, /** * e_table_get_mouse_over_cell: - * Similar to e_table_get_cell_at, only here we recalculate x,y relatively to each item. + * Similar to e_table_get_cell_at, only here we check based on the mouse motion information in the group. **/ void -e_table_get_mouse_over_cell (ETable *table, int x, int y, int *row, int *col) +e_table_get_mouse_over_cell (ETable *table, int *row, int *col) { g_return_if_fail (table != NULL); g_return_if_fail (E_IS_TABLE (table)); - x += GTK_LAYOUT (table->table_canvas)->hadjustment->value; - y += GTK_LAYOUT (table->table_canvas)->vadjustment->value; - - y -= E_TABLE_HEADER_ITEM (table->header_item)->height; + if (!table->group) + return; - e_table_group_compute_mouse_over (table->group, x, y, row, col); + e_table_group_get_mouse_over (table->group, row, col); } /** diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 1a681e9eca..6b2a698d5c 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -282,7 +282,7 @@ void e_table_get_cell_at (ETable *table, int y, int *row_return, int *col_return); -void e_table_get_mouse_over_cell (ETable *table, int x, int y, int *row, int *col); +void e_table_get_mouse_over_cell (ETable *table, int *row, int *col); void e_table_get_cell_geometry (ETable *table, int row, int col, |