diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-01-10 05:17:23 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-01-11 00:33:53 +0800 |
commit | 611fda70547f7a5258a1eaf52691cb05f8b3ec63 (patch) | |
tree | 1a274adb039e9c07c4e539b7199874b7968e76fc /modules/calendar/e-cal-shell-content.c | |
parent | c073b9c6c1e45a3e80a47eec27b58f2b2e984811 (diff) | |
download | gsoc2013-evolution-611fda70547f7a5258a1eaf52691cb05f8b3ec63.tar gsoc2013-evolution-611fda70547f7a5258a1eaf52691cb05f8b3ec63.tar.gz gsoc2013-evolution-611fda70547f7a5258a1eaf52691cb05f8b3ec63.tar.bz2 gsoc2013-evolution-611fda70547f7a5258a1eaf52691cb05f8b3ec63.tar.lz gsoc2013-evolution-611fda70547f7a5258a1eaf52691cb05f8b3ec63.tar.xz gsoc2013-evolution-611fda70547f7a5258a1eaf52691cb05f8b3ec63.tar.zst gsoc2013-evolution-611fda70547f7a5258a1eaf52691cb05f8b3ec63.zip |
Cleanup delete actions in shell views.
Diffstat (limited to 'modules/calendar/e-cal-shell-content.c')
-rw-r--r-- | modules/calendar/e-cal-shell-content.c | 133 |
1 files changed, 1 insertions, 132 deletions
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index 1ab680eec4..5213480cee 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -28,6 +28,7 @@ #include "e-util/gconf-bridge.h" #include "widgets/menus/gal-view-etable.h" #include "widgets/misc/e-paned.h" +#include "widgets/misc/e-selectable.h" #include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-view.h" @@ -139,81 +140,6 @@ cal_shell_content_notify_view_id_cb (ECalShellContent *cal_shell_content) cal_shell_content->priv->paned_binding_id = binding_id; } -static FocusLocation -cal_shell_content_get_focus_location (ECalShellContent *cal_shell_content) -{ - GnomeCalendar *calendar; - GnomeCalendarViewType view_type; - ECalendarView *calendar_view; - EMemoTable *memo_table; - ETaskTable *task_table; - ETable *table; - - /* XXX This function is silly. Certainly there are better ways - * of directing user input to the focused area than polling - * a bunch of widgets to see what's focused. */ - - calendar = GNOME_CALENDAR (cal_shell_content->priv->calendar); - view_type = gnome_calendar_get_view (calendar); - calendar_view = gnome_calendar_get_calendar_view (calendar, view_type); - - memo_table = E_MEMO_TABLE (cal_shell_content->priv->memo_table); - task_table = E_TASK_TABLE (cal_shell_content->priv->task_table); - - table = E_TABLE (memo_table); - if (gtk_widget_is_focus (GTK_WIDGET (table->table_canvas))) - return FOCUS_MEMO_TABLE; - - table = E_TABLE (task_table); - if (gtk_widget_is_focus (GTK_WIDGET (table->table_canvas))) - return FOCUS_TASK_TABLE; - - if (E_IS_DAY_VIEW (calendar_view)) { - EDayView *day_view = E_DAY_VIEW (calendar_view); - - if (gtk_widget_is_focus (day_view->top_canvas)) - return FOCUS_CALENDAR; - - if (GNOME_CANVAS (day_view->top_canvas)->focused_item != NULL) - return FOCUS_CALENDAR; - - if (gtk_widget_is_focus (day_view->main_canvas)) - return FOCUS_CALENDAR; - - if (GNOME_CANVAS (day_view->main_canvas)->focused_item != NULL) - return FOCUS_CALENDAR; - - if (gtk_widget_is_focus (GTK_WIDGET (day_view))) - return FOCUS_CALENDAR; - - } else if (E_IS_WEEK_VIEW (calendar_view)) { - EWeekView *week_view = E_WEEK_VIEW (calendar_view); - - if (gtk_widget_is_focus (week_view->main_canvas)) - return FOCUS_CALENDAR; - - if (GNOME_CANVAS (week_view->main_canvas)->focused_item != NULL) - return FOCUS_CALENDAR; - - if (gtk_widget_is_focus (GTK_WIDGET (week_view))) - return FOCUS_CALENDAR; - - } else if (E_IS_CAL_LIST_VIEW (calendar_view)) { - ECalListView *list_view = E_CAL_LIST_VIEW (calendar_view); - - if (gtk_widget_is_focus (GTK_WIDGET (list_view->table))) - return FOCUS_CALENDAR; - - if (gtk_widget_is_focus (GTK_WIDGET (list_view->table->table_canvas))) - return FOCUS_CALENDAR; - - if (gtk_widget_is_focus (GTK_WIDGET (list_view))) - return FOCUS_CALENDAR; - } - - return FOCUS_OTHER; -} - static void cal_shell_content_set_property (GObject *object, guint property_id, @@ -720,60 +646,3 @@ e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content) return cal_shell_content->priv->view_instance; } - -void -e_cal_shell_content_delete_selection (ECalShellContent *cal_shell_content) -{ - GnomeCalendar *calendar; - EMemoTable *memo_table; - ETaskTable *task_table; - GnomeCalendarViewType view_type; - ECalendarView *calendar_view; - - g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); - - calendar = e_cal_shell_content_get_calendar (cal_shell_content); - memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); - task_table = e_cal_shell_content_get_task_table (cal_shell_content); - - view_type = gnome_calendar_get_view (calendar); - calendar_view = gnome_calendar_get_calendar_view (calendar, view_type); - - switch (cal_shell_content_get_focus_location (cal_shell_content)) { - case FOCUS_CALENDAR: - e_calendar_view_delete_selected_events (calendar_view); - break; - - case FOCUS_MEMO_TABLE: - e_memo_table_delete_selected (memo_table); - break; - - case FOCUS_TASK_TABLE: - e_task_table_delete_selected (task_table); - break; - - default: - g_return_if_reached (); - } -} - -void -e_cal_shell_content_delete_selected_occurrence (ECalShellContent *cal_shell_content) -{ - GnomeCalendar *calendar; - GnomeCalendarViewType view_type; - ECalendarView *calendar_view; - FocusLocation focus; - - g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content)); - - focus = cal_shell_content_get_focus_location (cal_shell_content); - if (focus != FOCUS_CALENDAR) - return; - - calendar = e_cal_shell_content_get_calendar (cal_shell_content); - view_type = gnome_calendar_get_view (calendar); - calendar_view = gnome_calendar_get_calendar_view (calendar, view_type); - - e_calendar_view_delete_selected_occurrence (calendar_view); -} |