diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-26 05:24:22 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-26 05:24:22 +0800 |
commit | 650c4690b2040f83c032b67a271b996f876fdc50 (patch) | |
tree | 0261f48453ee539fca02031f81d67943d4608960 /widgets/misc/e-selection-model.c | |
parent | a413337c28972fc703e73b90dd23b076f4857560 (diff) | |
download | gsoc2013-evolution-650c4690b2040f83c032b67a271b996f876fdc50.tar.gz gsoc2013-evolution-650c4690b2040f83c032b67a271b996f876fdc50.tar.zst gsoc2013-evolution-650c4690b2040f83c032b67a271b996f876fdc50.zip |
Commit patch from Chris to implement e_tree_right_click_up() for
correct right-click behavior in single selection mode.
svn path=/trunk/; revision=13123
Diffstat (limited to 'widgets/misc/e-selection-model.c')
-rw-r--r-- | widgets/misc/e-selection-model.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c index 3fd28a7db2..e8b19fc618 100644 --- a/widgets/misc/e-selection-model.c +++ b/widgets/misc/e-selection-model.c @@ -117,6 +117,7 @@ e_selection_model_init (ESelectionModel *selection) { selection->mode = GTK_SELECTION_MULTIPLE; selection->cursor_mode = E_CURSOR_SIMPLE; + selection->old_selection = -1; } static void @@ -376,6 +377,8 @@ e_selection_model_do_something (ESelectionModel *selection, gint ctrl_p = state & GDK_CONTROL_MASK; int row_count; + selection->old_selection = -1; + if (row == -1 && col != -1) row = 0; if (col == -1 && row != -1) @@ -428,6 +431,8 @@ e_selection_model_maybe_do_something (ESelectionModel *selection, guint col, GdkModifierType state) { + selection->old_selection = -1; + if (e_selection_model_is_row_selected(selection, row)) { e_selection_model_change_cursor(selection, row, col); gtk_signal_emit(GTK_OBJECT(selection), @@ -440,6 +445,28 @@ e_selection_model_maybe_do_something (ESelectionModel *selection, } void +e_selection_model_right_click_down (ESelectionModel *selection, + guint row, + guint col, + GdkModifierType state) +{ + if (selection->mode == GTK_SELECTION_SINGLE) { + selection->old_selection = e_selection_model_cursor_row (selection); + e_selection_model_select_single_row (selection, row); + } else { + e_selection_model_maybe_do_something (selection, row, col, state); + } +} + +void +e_selection_model_right_click_up (ESelectionModel *selection) +{ + if (selection->mode == GTK_SELECTION_SINGLE && selection->old_selection != -1) { + e_selection_model_select_single_row (selection, selection->old_selection); + } +} + +void e_selection_model_select_as_key_press (ESelectionModel *selection, guint row, guint col, @@ -450,6 +477,8 @@ e_selection_model_select_as_key_press (ESelectionModel *selection, gint shift_p = state & GDK_SHIFT_MASK; gint ctrl_p = state & GDK_CONTROL_MASK; + selection->old_selection = -1; + switch (selection->mode) { case GTK_SELECTION_BROWSE: if (shift_p) { @@ -514,6 +543,8 @@ gint e_selection_model_key_press (ESelectionModel *selection, GdkEventKey *key) { + selection->old_selection = -1; + switch (key->keyval) { case GDK_Up: case GDK_KP_Up: |