aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-selection-model.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2001-01-25 22:48:39 +0800
committerChris Lahey <clahey@src.gnome.org>2001-01-25 22:48:39 +0800
commit9c73622d3869ef66c795f8fa583e726ef8798563 (patch)
treeb3e64bf3a408385876d6bfa4d8f92ea1a2f20e25 /widgets/table/e-table-selection-model.c
parent735020a97601de2799e6107c45b35047fedb7efa (diff)
downloadgsoc2013-evolution-9c73622d3869ef66c795f8fa583e726ef8798563.tar
gsoc2013-evolution-9c73622d3869ef66c795f8fa583e726ef8798563.tar.gz
gsoc2013-evolution-9c73622d3869ef66c795f8fa583e726ef8798563.tar.bz2
gsoc2013-evolution-9c73622d3869ef66c795f8fa583e726ef8798563.tar.lz
gsoc2013-evolution-9c73622d3869ef66c795f8fa583e726ef8798563.tar.xz
gsoc2013-evolution-9c73622d3869ef66c795f8fa583e726ef8798563.tar.zst
gsoc2013-evolution-9c73622d3869ef66c795f8fa583e726ef8798563.zip
Documented. Added a "cursor_activated" signal. Removed some unused
2001-01-25 Christopher James Lahey <clahey@helixcode.com> * e-table-group-container.c, e-table-group-leaf.c, e-table-group.c, e-table-group.h, e-table-item.c, e-table-item.h: Documented. Added a "cursor_activated" signal. Removed some unused functions (e_table_group_get_count and e_table_group_get_ecol). * e-table-selection-model.c, e-table-selection-model.h: Added a "cursor_activated" signal. Call it when the user changes the selection to match the cursor. * e-table.c, e-table.h: Added a "cursor_activated" signal. Fixed the e_table_compute_location function to take into account the scrolled position. svn path=/trunk/; revision=7808
Diffstat (limited to 'widgets/table/e-table-selection-model.c')
-rw-r--r--widgets/table/e-table-selection-model.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index 85a22fd638..57869602a4 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -31,6 +31,7 @@ static void etsm_select_single_row (ETableSelectionModel *selection, int row);
enum {
CURSOR_CHANGED,
+ CURSOR_ACTIVATED,
SELECTION_CHANGED,
LAST_SIGNAL
};
@@ -290,6 +291,14 @@ e_table_selection_model_class_init (ETableSelectionModelClass *klass)
gtk_marshal_NONE__INT_INT,
GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
+ e_table_selection_model_signals [CURSOR_ACTIVATED] =
+ gtk_signal_new ("cursor_activated",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (ETableSelectionModelClass, cursor_activated),
+ gtk_marshal_NONE__INT_INT,
+ GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
+
e_table_selection_model_signals [SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
GTK_RUN_LAST,
@@ -298,7 +307,8 @@ e_table_selection_model_class_init (ETableSelectionModelClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
- klass->cursor_changed = NULL;
+ klass->cursor_changed = NULL;
+ klass->cursor_activated = NULL;
klass->selection_changed = NULL;
gtk_object_class_add_signals (object_class, e_table_selection_model_signals, LAST_SIGNAL);
@@ -545,6 +555,8 @@ e_table_selection_model_do_something (ETableSelectionModel *selection,
selection->cursor_col = col;
gtk_signal_emit(GTK_OBJECT(selection),
e_table_selection_model_signals[CURSOR_CHANGED], row, col);
+ gtk_signal_emit(GTK_OBJECT(selection),
+ e_table_selection_model_signals[CURSOR_ACTIVATED], row, col);
}
}
}
@@ -583,6 +595,7 @@ move_selection (ETableSelectionModel *selection,
{
int row = selection->cursor_row;
int col = selection->cursor_col;
+ int cursor_activated = TRUE;
gint shift_p = state & GDK_SHIFT_MASK;
gint ctrl_p = state & GDK_CONTROL_MASK;
@@ -602,7 +615,8 @@ move_selection (ETableSelectionModel *selection,
etsm_set_selection_end (selection, row);
} else if (!ctrl_p) {
etsm_select_single_row (selection, row);
- }
+ } else
+ cursor_activated = FALSE;
break;
case GTK_SELECTION_SINGLE:
case GTK_SELECTION_MULTIPLE:
@@ -614,6 +628,9 @@ move_selection (ETableSelectionModel *selection,
selection->cursor_row = row;
gtk_signal_emit(GTK_OBJECT(selection),
e_table_selection_model_signals[CURSOR_CHANGED], row, col);
+ if (cursor_activated)
+ gtk_signal_emit(GTK_OBJECT(selection),
+ e_table_selection_model_signals[CURSOR_ACTIVATED], row, col);
}
return TRUE;
}
@@ -640,8 +657,20 @@ e_table_selection_model_key_press (ETableSelectionModel *selection,
return move_selection(selection, FALSE, key->state);
break;
case GDK_space:
+ case GDK_KP_Space:
if (selection->mode != GTK_SELECTION_SINGLE) {
etsm_toggle_single_row (selection, selection->cursor_row);
+ gtk_signal_emit(GTK_OBJECT(selection),
+ e_table_selection_model_signals[CURSOR_ACTIVATED], selection->cursor_row, selection->cursor_col);
+ return TRUE;
+ }
+ break;
+ case GDK_Return:
+ case GDK_KP_Enter:
+ if (selection->mode != GTK_SELECTION_SINGLE) {
+ etsm_select_single_row (selection, selection->cursor_row);
+ gtk_signal_emit(GTK_OBJECT(selection),
+ e_table_selection_model_signals[CURSOR_ACTIVATED], selection->cursor_row, selection->cursor_col);
return TRUE;
}
break;