aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r--calendar/gui/e-week-view.c324
1 files changed, 112 insertions, 212 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 2d5c80996b..bfa2ad780f 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -30,7 +30,7 @@
#endif
#include "e-week-view.h"
-#include "ea-calendar.h"
+/*#include "a11y/ea-calendar.h"*/ /* KILL-BONOBO */
#include <math.h>
#include <gdk/gdkkeysyms.h>
@@ -39,7 +39,7 @@
#include <text/e-text.h>
#include <misc/e-canvas-utils.h>
#include <misc/e-gui-utils.h>
-#include <misc/e-unicode.h>
+#include <e-util/e-unicode.h>
#include <e-util/e-categories-config.h>
#include <e-util/e-dialog-utils.h>
#include <e-util/e-util.h>
@@ -51,7 +51,6 @@
#include "comp-util.h"
#include "itip-utils.h"
#include <libecal/e-cal-time-util.h>
-#include "calendar-commands.h"
#include "calendar-config.h"
#include "print.h"
#include "goto.h"
@@ -169,7 +168,6 @@ static gboolean e_week_view_on_text_item_event (GnomeCanvasItem *item,
EWeekView *week_view);
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, gboolean is_all_day);
static gboolean e_week_view_on_jump_button_event (GnomeCanvasItem *item,
GdkEvent *event,
@@ -195,6 +193,69 @@ static gboolean e_week_view_layout_timeout_cb (gpointer data);
G_DEFINE_TYPE (EWeekView, e_week_view, E_TYPE_CALENDAR_VIEW)
+static gint map_left[] = {0, 1, 2, 0, 1, 2, 2};
+static gint map_right[] = {3, 4, 5, 3, 4, 5, 6};
+
+static void
+week_view_cursor_key_up (EWeekView *week_view)
+{
+ if (week_view->selection_start_day == -1)
+ return;
+
+ week_view->selection_start_day--;
+
+ if (week_view->selection_start_day < 0) {
+ e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_UP);
+ week_view->selection_start_day = 6;
+ }
+
+ week_view->selection_end_day = week_view->selection_start_day;
+ g_signal_emit_by_name (week_view, "selected_time_changed");
+ gtk_widget_queue_draw (week_view->main_canvas);
+}
+
+static void
+week_view_cursor_key_down (EWeekView *week_view)
+{
+ if (week_view->selection_start_day == -1)
+ return;
+
+ week_view->selection_start_day++;
+
+ if (week_view->selection_start_day > 6) {
+ e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_DOWN);
+ week_view->selection_start_day = 0;
+ }
+
+ week_view->selection_end_day = week_view->selection_start_day;
+ g_signal_emit_by_name (week_view, "selected_time_changed");
+ gtk_widget_queue_draw (week_view->main_canvas);
+}
+
+static void
+week_view_cursor_key_left (EWeekView *week_view)
+{
+ if (week_view->selection_start_day == -1)
+ return;
+
+ week_view->selection_start_day = map_left[week_view->selection_start_day];
+ week_view->selection_end_day = week_view->selection_start_day;
+ g_signal_emit_by_name (week_view, "selected_time_changed");
+ gtk_widget_queue_draw (week_view->main_canvas);
+}
+
+static void
+week_view_cursor_key_right (EWeekView *week_view)
+{
+ if (week_view->selection_start_day == -1)
+ return;
+
+ week_view->selection_start_day = map_right[week_view->selection_start_day];
+ week_view->selection_end_day = week_view->selection_start_day;
+ g_signal_emit_by_name (week_view, "selected_time_changed");
+ gtk_widget_queue_draw (week_view->main_canvas);
+}
+
static void
e_week_view_class_init (EWeekViewClass *class)
{
@@ -226,8 +287,15 @@ e_week_view_class_init (EWeekViewClass *class)
view_class->get_visible_time_range = e_week_view_get_visible_time_range;
view_class->paste_text = e_week_view_paste_text;
+ class->cursor_key_up = week_view_cursor_key_up;
+ class->cursor_key_down = week_view_cursor_key_down;
+ class->cursor_key_left = week_view_cursor_key_left;
+ class->cursor_key_right = week_view_cursor_key_right;
+
+#if 0 /* KILL-BONOBO */
/* init the accessibility support for e_week_view */
e_week_view_a11y_init ();
+#endif
}
static void
@@ -655,7 +723,7 @@ e_week_view_new (ECalModel *model)
{
GtkWidget *week_view;
- week_view = GTK_WIDGET (g_object_new (e_week_view_get_type (), NULL));
+ week_view = GTK_WIDGET (g_object_new (E_TYPE_WEEK_VIEW, NULL));
e_calendar_view_set_model ((ECalendarView *) week_view, model);
init_model ((EWeekView *) week_view, model);
@@ -1937,6 +2005,9 @@ set_text_as_bold (EWeekViewEvent *event, EWeekViewEventSpan *span)
break;
}
}
+ e_cal_component_free_attendee_list (attendees);
+ g_free (address);
+ g_object_unref (comp);
/* The attendee has not yet accepted the meeting, display the summary as bolded.
If the attendee is not present, it might have come through a mailing list.
@@ -3391,7 +3462,7 @@ e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time)
return (event_time - first_day) / (24 * 60 * 60);
}
-static void
+void
e_week_view_scroll_a_step (EWeekView *week_view, ECalViewMoveDirection direction)
{
GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment;
@@ -3592,7 +3663,8 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
else
- gnome_calendar_emit_user_created_signal (week_view, e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)), client);
+ e_calendar_view_emit_user_created (
+ E_CALENDAR_VIEW (week_view));
/* we remove the object since we either got the update from the server or failed */
e_week_view_remove_event_cb (week_view, event_num, NULL);
@@ -3782,232 +3854,55 @@ e_week_view_is_one_day_event (EWeekView *week_view,
return FALSE;
}
-static gint map_left[] = {0, 1, 2, 0, 1, 2, 2};
-static gint map_right[] = {3, 4, 5, 3, 4, 5, 6};
-
-static void
-e_week_view_do_cursor_key_up (EWeekView *week_view)
-{
- if (week_view->selection_start_day == -1)
- return;
-
- week_view->selection_start_day--;
-
- if (week_view->selection_start_day < 0) {
- e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_UP);
- week_view->selection_start_day = 6;
- }
-
- week_view->selection_end_day = week_view->selection_start_day;
- g_signal_emit_by_name (week_view, "selected_time_changed");
- gtk_widget_queue_draw (week_view->main_canvas);
-}
-
-static void
-e_week_view_do_cursor_key_down (EWeekView *week_view)
-{
- if (week_view->selection_start_day == -1)
- return;
-
- week_view->selection_start_day++;
-
- if (week_view->selection_start_day > 6) {
- e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_DOWN);
- week_view->selection_start_day = 0;
- }
-
- week_view->selection_end_day = week_view->selection_start_day;
- g_signal_emit_by_name (week_view, "selected_time_changed");
- gtk_widget_queue_draw (week_view->main_canvas);
-}
-
static void
-e_week_view_do_cursor_key_left (EWeekView *week_view)
+e_week_view_cursor_key_up (EWeekView *week_view)
{
- if (week_view->selection_start_day == -1)
- return;
+ EWeekViewClass *week_view_class;
- week_view->selection_start_day = map_left[week_view->selection_start_day];
- week_view->selection_end_day = week_view->selection_start_day;
- g_signal_emit_by_name (week_view, "selected_time_changed");
- gtk_widget_queue_draw (week_view->main_canvas);
-}
+ week_view_class = E_WEEK_VIEW_GET_CLASS (week_view);
+ g_return_if_fail (week_view_class->cursor_key_up != NULL);
-static void
-e_week_view_do_cursor_key_right (EWeekView *week_view)
-{
- if (week_view->selection_start_day == -1)
- return;
-
- week_view->selection_start_day = map_right[week_view->selection_start_day];
- week_view->selection_end_day = week_view->selection_start_day;
- g_signal_emit_by_name (week_view, "selected_time_changed");
- gtk_widget_queue_draw (week_view->main_canvas);
-}
-
-static void
-e_month_view_do_cursor_key_up (EWeekView *week_view)
-{
- if (week_view->selection_start_day == -1)
- return;
-
- if (week_view->selection_start_day < 7) {
- /* no easy way to calculate new selection_start_day, therefore
- * calculate a time_t value and set_selected_time_range */
- time_t current;
- if (e_calendar_view_get_selected_time_range(&week_view->cal_view, &current, NULL)) {
- current = time_add_week(current,-1);
- e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_UP);
- e_week_view_set_selected_time_range_visible(week_view,current,current);
- }
- } else {
- week_view->selection_start_day -= 7;
- week_view->selection_end_day = week_view->selection_start_day;
- }
-
- g_signal_emit_by_name (week_view, "selected_time_changed");
- gtk_widget_queue_draw (week_view->main_canvas);
-}
-
-static void
-e_month_view_do_cursor_key_down (EWeekView *week_view)
-{
- gint weeks_shown = e_week_view_get_weeks_shown (week_view);
-
- if (week_view->selection_start_day == -1)
- return;
-
- if (week_view->selection_start_day >= (weeks_shown - 1) * 7) {
- /* no easy way to calculate new selection_start_day, therefore
- * calculate a time_t value and set_selected_time_range */
- time_t current;
- if (e_calendar_view_get_selected_time_range(&week_view->cal_view, &current, NULL)) {
- current = time_add_week(current,1);
- e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_DOWN);
- e_week_view_set_selected_time_range_visible(week_view,current,current);
- }
- } else {
- week_view->selection_start_day += 7;
- week_view->selection_end_day = week_view->selection_start_day;
- }
-
- g_signal_emit_by_name (week_view, "selected_time_changed");
- gtk_widget_queue_draw (week_view->main_canvas);
+ week_view_class->cursor_key_up (week_view);
}
static void
-e_month_view_do_cursor_key_left (EWeekView *week_view)
+e_week_view_cursor_key_down (EWeekView *week_view)
{
- if (week_view->selection_start_day == -1)
- return;
+ EWeekViewClass *week_view_class;
- if (week_view->selection_start_day == 0) {
- /* no easy way to calculate new selection_start_day, therefore
- * calculate a time_t value and set_selected_time_range */
- time_t current;
- if (e_calendar_view_get_selected_time_range(&week_view->cal_view, &current, NULL)) {
- current = time_add_day(current,-1);
- e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_UP);
- e_week_view_set_selected_time_range_visible(week_view,current,current);
- }
- } else {
- week_view->selection_start_day--;
- week_view->selection_end_day = week_view->selection_start_day;
- }
+ week_view_class = E_WEEK_VIEW_GET_CLASS (week_view);
+ g_return_if_fail (week_view_class->cursor_key_down != NULL);
- g_signal_emit_by_name (week_view, "selected_time_changed");
- gtk_widget_queue_draw (week_view->main_canvas);
+ week_view_class->cursor_key_down (week_view);
}
static void
-e_month_view_do_cursor_key_right (EWeekView *week_view)
+e_week_view_cursor_key_left (EWeekView *week_view)
{
- gint weeks_shown = e_week_view_get_weeks_shown (week_view);
+ EWeekViewClass *week_view_class;
- if (week_view->selection_start_day == -1)
- return;
+ week_view_class = E_WEEK_VIEW_GET_CLASS (week_view);
+ g_return_if_fail (week_view_class->cursor_key_left != NULL);
- if (week_view->selection_start_day == weeks_shown * 7 - 1) {
- /* no easy way to calculate new selection_start_day, therefore
- * calculate a time_t value and set_selected_time_range */
- time_t current;
- if (e_calendar_view_get_selected_time_range(&week_view->cal_view, &current, NULL)) {
- current = time_add_day(current,1);
- e_week_view_scroll_a_step(week_view, E_CAL_VIEW_MOVE_PAGE_DOWN);
- e_week_view_set_selected_time_range_visible(week_view,current,current);
- }
- } else {
- week_view->selection_start_day++;
- week_view->selection_end_day = week_view->selection_start_day;
- }
-
- g_signal_emit_by_name (week_view, "selected_time_changed");
- gtk_widget_queue_draw (week_view->main_canvas);
+ week_view_class->cursor_key_left (week_view);
}
static void
-e_week_view_cursor_key_up (EWeekView *week_view, GnomeCalendarViewType view_type)
+e_week_view_cursor_key_right (EWeekView *week_view)
{
- switch (view_type) {
- case GNOME_CAL_WEEK_VIEW:
- e_week_view_do_cursor_key_up (week_view);
- break;
- case GNOME_CAL_MONTH_VIEW:
- e_month_view_do_cursor_key_up (week_view);
- break;
- default:
- g_return_if_reached ();
- }
-}
+ EWeekViewClass *week_view_class;
-static void
-e_week_view_cursor_key_down (EWeekView *week_view, GnomeCalendarViewType view_type)
-{
- switch (view_type) {
- case GNOME_CAL_WEEK_VIEW:
- e_week_view_do_cursor_key_down (week_view);
- break;
- case GNOME_CAL_MONTH_VIEW:
- e_month_view_do_cursor_key_down (week_view);
- break;
- default:
- g_return_if_reached ();
- }
-}
-
-static void
-e_week_view_cursor_key_left (EWeekView *week_view, GnomeCalendarViewType view_type)
-{
- switch (view_type) {
- case GNOME_CAL_WEEK_VIEW:
- e_week_view_do_cursor_key_left (week_view);
- break;
- case GNOME_CAL_MONTH_VIEW:
- e_month_view_do_cursor_key_left (week_view);
- break;
- default:
- g_return_if_reached ();
- }
-}
+ week_view_class = E_WEEK_VIEW_GET_CLASS (week_view);
+ g_return_if_fail (week_view_class->cursor_key_right != NULL);
-static void
-e_week_view_cursor_key_right (EWeekView *week_view, GnomeCalendarViewType view_type)
-{
- switch (view_type) {
- case GNOME_CAL_WEEK_VIEW:
- e_week_view_do_cursor_key_right (week_view);
- break;
- case GNOME_CAL_MONTH_VIEW:
- e_month_view_do_cursor_key_right (week_view);
- break;
- default:
- g_return_if_reached ();
- }
+ week_view_class->cursor_key_right (week_view);
}
static gboolean
e_week_view_add_new_event_in_selected_range (EWeekView *week_view, const gchar *initial_text)
{
+#if 0 /* KILL-BONOBO */
+ EWeekView *week_view;
ECal *ecal;
ECalModel *model;
ECalComponent *comp;
@@ -4103,7 +3998,6 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
guint keyval;
gboolean stop_emission;
gboolean ret_val;
- GnomeCalendarViewType view_type;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (E_IS_WEEK_VIEW (widget), FALSE);
@@ -4123,7 +4017,6 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
#endif
/* Handle the cursor keys for moving the selection */
- view_type = gnome_calendar_get_view (e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)));
stop_emission = FALSE;
if (!(event->state & GDK_SHIFT_MASK)
&& !(event->state & GDK_MOD1_MASK)) {
@@ -4142,16 +4035,16 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
e_week_view_scroll_a_step (week_view, E_CAL_VIEW_MOVE_PAGE_DOWN);
break;
case GDK_Up:
- e_week_view_cursor_key_up (week_view, view_type);
+ e_week_view_cursor_key_up (week_view);
break;
case GDK_Down:
- e_week_view_cursor_key_down (week_view, view_type);
+ e_week_view_cursor_key_down (week_view);
break;
case GDK_Left:
- e_week_view_cursor_key_left (week_view, view_type);
+ e_week_view_cursor_key_left (week_view);
break;
case GDK_Right:
- e_week_view_cursor_key_right (week_view, view_type);
+ e_week_view_cursor_key_right (week_view);
break;
default:
stop_emission = FALSE;
@@ -4196,6 +4089,7 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
g_free (initial_text);
return ret_val;
+#endif
}
static gint
@@ -4231,6 +4125,7 @@ e_week_view_get_adjust_days_for_move_right (EWeekView *week_view,gint current_da
static gboolean
e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
{
+#if 0 /* KILL-BONOBO */
gboolean handled = FALSE;
handled = e_week_view_do_key_press (widget, event);
@@ -4238,6 +4133,7 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
if (!handled)
handled = GTK_WIDGET_CLASS (e_week_view_parent_class)->key_press_event (widget, event);
return handled;
+#endif
}
static void
@@ -4257,9 +4153,11 @@ e_week_view_show_popup_menu (EWeekView *week_view,
week_view->popup_event_num = event_num;
+#if 0 /* KILL-BONOBO */
popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (week_view));
g_object_weak_ref (G_OBJECT (popup), popup_destroyed_cb, week_view);
gtk_menu_popup (popup, NULL, NULL, NULL, NULL, bevent?bevent->button:0, bevent?bevent->time:gtk_get_current_event_time());
+#endif
}
static gboolean
@@ -4274,6 +4172,7 @@ e_week_view_popup_menu (GtkWidget *widget)
void
e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item)
{
+#if 0 /* KILL-BONOBO */
gint day;
GnomeCalendar *calendar;
@@ -4289,6 +4188,7 @@ e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item)
return;
}
}
+#endif
}
static gboolean