aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorKidd Wang <kiddwang@src.gnome.org>2004-03-29 14:16:47 +0800
committerKidd Wang <kiddwang@src.gnome.org>2004-03-29 14:16:47 +0800
commitfa9c9db0a6b3281b62b2fd38c536872df4206c60 (patch)
tree7816df223d795b97416373253e6e7330fdd00d62 /calendar/gui
parentd4b41af00d2cee605499381395af3c19ba2a3081 (diff)
downloadgsoc2013-evolution-fa9c9db0a6b3281b62b2fd38c536872df4206c60.tar
gsoc2013-evolution-fa9c9db0a6b3281b62b2fd38c536872df4206c60.tar.gz
gsoc2013-evolution-fa9c9db0a6b3281b62b2fd38c536872df4206c60.tar.bz2
gsoc2013-evolution-fa9c9db0a6b3281b62b2fd38c536872df4206c60.tar.lz
gsoc2013-evolution-fa9c9db0a6b3281b62b2fd38c536872df4206c60.tar.xz
gsoc2013-evolution-fa9c9db0a6b3281b62b2fd38c536872df4206c60.tar.zst
gsoc2013-evolution-fa9c9db0a6b3281b62b2fd38c536872df4206c60.zip
remove the EVENT_MOVE signal which was binded to Alt + Arrows. ditto.
* gui/e-calendar-view.c: (e_calendar_view_class_init): remove the EVENT_MOVE signal which was binded to Alt + Arrows. * gui/e-calendar-view.h: ditto. * gui/e-day-view.c: (e_day_view_class_init), (e_day_view_do_key_press), (e_day_view_event_move): handle Alt + Arrows in the more general place e_day_view_do_key_press so that we can avoid the conflicting accessible key. When an appointment is selected, pressing Alt + Arrows causes it to be moved around. Otherwise, pressing Alt + LEFT/RIGHT will move the focus to the same day in the previous/next week. * gui/e-week-view.c: (e_week_view_class_init), (e_week_view_event_move), (e_week_view_do_key_press): ditto. svn path=/trunk/; revision=25219
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/e-calendar-view.c56
-rw-r--r--calendar/gui/e-calendar-view.h1
-rw-r--r--calendar/gui/e-day-view.c39
-rw-r--r--calendar/gui/e-week-view.c48
4 files changed, 49 insertions, 95 deletions
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 51bd3ee2cc..68bbfc88f4 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -100,7 +100,6 @@ enum {
EVENT_CHANGED,
EVENT_ADDED,
OPEN_EVENT,
- EVENT_MOVE,
LAST_SIGNAL
};
@@ -170,7 +169,6 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
klass->get_visible_time_range = NULL;
klass->update_query = NULL;
klass->open_event = e_calendar_view_open_event;
- klass->event_move = NULL;
g_object_class_install_property (gobject_class, PROP_MODEL,
g_param_spec_object ("model", NULL, NULL, E_TYPE_CAL_MODEL,
@@ -231,16 +229,6 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
G_TYPE_NONE, 1,
G_TYPE_POINTER);
- e_calendar_view_signals [EVENT_MOVE] =
- g_signal_new ("event_move",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalendarViewClass, event_move),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
-
/* clipboard atom */
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
@@ -255,49 +243,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
gtk_binding_entry_add_signal (binding_set, GDK_o,
GDK_CONTROL_MASK,
"open_event", 0);
-
- /* Alt+Arrow, move the editing event*/
- gtk_binding_entry_add_signal (binding_set, GDK_Up,
- GDK_MOD1_MASK,
- "event_move", 1,
- G_TYPE_ENUM,
- E_CAL_VIEW_MOVE_UP);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Up,
- GDK_MOD1_MASK,
- "event_move", 1,
- G_TYPE_ENUM,
- E_CAL_VIEW_MOVE_UP);
- gtk_binding_entry_add_signal (binding_set, GDK_Down,
- GDK_MOD1_MASK,
- "event_move", 1,
- G_TYPE_ENUM,
- E_CAL_VIEW_MOVE_DOWN);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Down,
- GDK_MOD1_MASK,
- "event_move", 1,
- G_TYPE_ENUM,
- E_CAL_VIEW_MOVE_DOWN);
- gtk_binding_entry_add_signal (binding_set, GDK_Left,
- GDK_MOD1_MASK,
- "event_move", 1,
- G_TYPE_ENUM,
- E_CAL_VIEW_MOVE_LEFT);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Left,
- GDK_MOD1_MASK,
- "event_move", 1,
- G_TYPE_ENUM,
- E_CAL_VIEW_MOVE_LEFT);
- gtk_binding_entry_add_signal (binding_set, GDK_Right,
- GDK_MOD1_MASK,
- "event_move", 1,
- G_TYPE_ENUM,
- E_CAL_VIEW_MOVE_RIGHT);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Right,
- GDK_MOD1_MASK,
- "event_move", 1,
- G_TYPE_ENUM,
- E_CAL_VIEW_MOVE_RIGHT);
-
+
/* init the accessibility support for e_day_view */
e_cal_view_a11y_init ();
}
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 4d72f1a0c4..9891989eea 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -95,7 +95,6 @@ struct _ECalendarViewClass {
gboolean (* get_visible_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
void (* update_query) (ECalendarView *cal_view);
void (* open_event) (ECalendarView *cal_view);
- void (* event_move) (ECalendarView *cal_view, ECalViewMoveDirection direction);
};
GType e_calendar_view_get_type (void);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index a13c059b15..f79f1d9ddd 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -344,7 +344,7 @@ static void e_day_view_stop_editing_event (EDayView *day_view);
static gboolean e_day_view_on_text_item_event (GnomeCanvasItem *item,
GdkEvent *event,
EDayView *day_view);
-static void e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction);
+static gboolean e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction);
static void e_day_view_change_event_time (EDayView *day_view, time_t start_dt,
time_t end_dt);
static void e_day_view_change_event_end_time_up (EDayView *day_view);
@@ -480,7 +480,6 @@ e_day_view_class_init (EDayViewClass *class)
view_class->get_selected_time_range = e_day_view_get_selected_time_range;
view_class->set_selected_time_range = e_day_view_set_selected_time_range;
view_class->get_visible_time_range = e_day_view_get_visible_time_range;
- view_class->event_move = e_day_view_event_move;
/* init the accessibility support for e_day_view */
e_day_view_a11y_init ();
@@ -4682,12 +4681,26 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
}
return FALSE;
}
+
+ /* Alt + Arrow Keys to move a selected event through time lines */
+ if (((event->state & GDK_SHIFT_MASK) != GDK_SHIFT_MASK)
+ &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK)
+ &&((event->state & GDK_MOD1_MASK) == GDK_MOD1_MASK)) {
+ if (keyval == GDK_Up || keyval == GDK_KP_Up)
+ return e_day_view_event_move ((ECalendarView *) day_view, E_CAL_VIEW_MOVE_UP);
+ else if (keyval == GDK_Down || keyval == GDK_KP_Down)
+ return e_day_view_event_move ((ECalendarView *) day_view, E_CAL_VIEW_MOVE_DOWN);
+ else if (keyval == GDK_Left || keyval == GDK_KP_Left)
+ return e_day_view_event_move ((ECalendarView *) day_view, E_CAL_VIEW_MOVE_LEFT);
+ else if (keyval == GDK_Right || keyval == GDK_KP_Right)
+ return e_day_view_event_move ((ECalendarView *) day_view, E_CAL_VIEW_MOVE_RIGHT);
+ }
/*Go to the start/end of a work day*/
if ((keyval == GDK_Home)
- &&((event->state & GDK_SHIFT_MASK) != GDK_SHIFT_MASK)
- &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK)
- &&((event->state & GDK_MOD1_MASK) != GDK_MOD1_MASK)) {
+ &&((event->state & GDK_SHIFT_MASK) != GDK_SHIFT_MASK)
+ &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK)
+ &&((event->state & GDK_MOD1_MASK) != GDK_MOD1_MASK)) {
e_day_view_goto_start_of_work_day (day_view);
return TRUE;
}
@@ -5689,7 +5702,7 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
return FALSE;
}
-static void
+static gboolean
e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
{
EDayViewEvent *event;
@@ -5703,7 +5716,7 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
event_num = day_view->editing_event_num;
if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
- return;
+ return FALSE;
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
@@ -5719,7 +5732,7 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
switch (direction) {
case E_CAL_VIEW_MOVE_UP:
if (resize_start_row <= 0)
- return;
+ return FALSE;
resize_start_row--;
resize_end_row--;
start_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_start_row);
@@ -5727,7 +5740,7 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
break;
case E_CAL_VIEW_MOVE_DOWN:
if (resize_end_row >= day_view->rows - 1)
- return;
+ return FALSE;
resize_start_row++;
resize_end_row++;
start_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_start_row);
@@ -5735,7 +5748,7 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
break;
case E_CAL_VIEW_MOVE_LEFT:
if (day <= 0)
- return;
+ return TRUE;
start_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_start_row);
end_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_end_row + 1);
start_time = icaltime_from_timet (start_dt, 0);
@@ -5747,7 +5760,7 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
break;
case E_CAL_VIEW_MOVE_RIGHT:
if (day + 1 >= day_view->days_shown)
- return;
+ return TRUE;
start_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_start_row);
end_dt = e_day_view_convert_grid_position_to_time (day_view, day, resize_end_row + 1);
start_time = icaltime_from_timet (start_dt, 0);
@@ -5758,11 +5771,13 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
end_dt = icaltime_as_timet (end_time);
break;
default:
- return;
+ return FALSE;
}
e_day_view_change_event_time (day_view, start_dt, end_dt);
e_day_view_ensure_rows_visible (day_view, resize_start_row, resize_end_row);
+
+ return TRUE;
}
static void
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 8ada75bbd3..ad3fac971f 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -179,7 +179,7 @@ static void e_week_view_foreach_event_with_uid (EWeekView *week_view,
static gboolean e_week_view_on_text_item_event (GnomeCanvasItem *item,
GdkEvent *event,
EWeekView *week_view);
-static void e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction);
+static gboolean e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction);
static gint e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time);
static void e_week_view_scroll_a_step (EWeekView *week_view, ECalViewMoveDirection direction);
static void e_week_view_change_event_time (EWeekView *week_view, time_t start_dt, time_t end_dt);
@@ -244,7 +244,6 @@ e_week_view_class_init (EWeekViewClass *class)
view_class->get_selected_time_range = e_week_view_get_selected_time_range;
view_class->set_selected_time_range = e_week_view_set_selected_time_range;
view_class->get_visible_time_range = e_week_view_get_visible_time_range;
- view_class->event_move = e_week_view_event_move;
/* init the accessibility support for e_week_view */
e_week_view_a11y_init ();
@@ -3171,7 +3170,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
return FALSE;
}
-static void e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
+static gboolean e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
{
EWeekViewEvent *event;
gint event_num, span_num, adjust_days, current_start_day, current_end_day;
@@ -3185,7 +3184,7 @@ static void e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirecti
/* If no item is being edited, just return. */
if (event_num == -1)
- return;
+ return FALSE;
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
start_dt = event->start;
@@ -3220,19 +3219,20 @@ static void e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirecti
current_end_day = e_week_view_get_day_offset_of_event (week_view,end_dt);
if (current_start_day < 0) {
- return;
+ return TRUE;
}
if (week_view->multi_week_view) {
if (current_end_day > week_view->weeks_shown * 7) {
- return;
+ return TRUE;
}
}else {
if (current_end_day >= 7) {
- return;
+ return TRUE;
}
}
e_week_view_change_event_time (week_view, start_dt, end_dt);
+ return TRUE;
}
static gint
@@ -3559,12 +3559,14 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
time_t dtstart, dtend;
const char *uid;
AddEventData add_event_data;
+ guint keyval;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (E_IS_WEEK_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
week_view = E_WEEK_VIEW (widget);
+ keyval = event->keyval;
/* The Escape key aborts a resize operation. */
#if 0
@@ -3577,27 +3579,19 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
#endif
/*Navigation through days with arrow keys*/
- if (!((event->state & GDK_SHIFT_MASK)
- ||(event->state & GDK_CONTROL_MASK)
- ||(event->state & GDK_MOD1_MASK))) {
- switch (event->keyval) {
- case GDK_Up:
- e_week_view_move_selection_day (week_view,E_CAL_VIEW_MOVE_UP);
- return TRUE;
- case GDK_Down:
- e_week_view_move_selection_day (week_view,E_CAL_VIEW_MOVE_DOWN);
- return TRUE;
- case GDK_Left:
- e_week_view_move_selection_day (week_view,E_CAL_VIEW_MOVE_LEFT);
- return TRUE;
- case GDK_Right:
- e_week_view_move_selection_day (week_view,E_CAL_VIEW_MOVE_RIGHT);
- return TRUE;
- default:
- break;
- }
+ if (((event->state & GDK_SHIFT_MASK) != GDK_SHIFT_MASK)
+ &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK)
+ &&((event->state & GDK_MOD1_MASK) == GDK_MOD1_MASK)) {
+ if (keyval == GDK_Up || keyval == GDK_KP_Up)
+ return e_week_view_event_move ((ECalendarView *) week_view, E_CAL_VIEW_MOVE_UP);
+ else if (keyval == GDK_Down || keyval == GDK_KP_Down)
+ return e_week_view_event_move ((ECalendarView *) week_view, E_CAL_VIEW_MOVE_DOWN);
+ else if (keyval == GDK_Left || keyval == GDK_KP_Left)
+ return e_week_view_event_move ((ECalendarView *) week_view, E_CAL_VIEW_MOVE_LEFT);
+ else if (keyval == GDK_Right || keyval == GDK_KP_Right)
+ return e_week_view_event_move ((ECalendarView *) week_view, E_CAL_VIEW_MOVE_RIGHT);
}
-
+
if (week_view->selection_start_day == -1)
return FALSE;