aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/gnome-cal.c90
-rw-r--r--calendar/gui/gnome-cal.h72
-rw-r--r--calendar/gui/goto.c4
-rw-r--r--modules/calendar/e-cal-shell-content.c38
4 files changed, 73 insertions, 131 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 10766477eb..7f2328f735 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -2319,27 +2319,6 @@ gnome_calendar_set_selected_time_range (GnomeCalendar *gcal,
}
/**
- * gnome_calendar_get_selected_time_range:
- * @gcal: A calendar view.
- * @start_time: Return value for the start of the time selection.
- * @end_time: Return value for the end of the time selection.
- *
- * Queries the time selection range on the calendar view.
- **/
-void
-gnome_calendar_get_selected_time_range (GnomeCalendar *gcal,
- time_t *start_time,
- time_t *end_time)
-{
- ECalModel *model;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- model = gnome_calendar_get_model (gcal);
- e_cal_model_get_time_range (model, start_time, end_time);
-}
-
-/**
* gnome_calendar_new_task:
* @gcal: An Evolution calendar.
* @param dtstart Start time of the task, in same timezone as model.
@@ -2493,47 +2472,6 @@ gnome_calendar_hpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gc
return FALSE;
}
-void
-gnome_calendar_cut_clipboard (GnomeCalendar *gcal)
-{
- GnomeCalendarViewType view_type;
- ECalendarView *view;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- view_type = gnome_calendar_get_view (gcal);
- view = gnome_calendar_get_calendar_view (gcal, view_type);
-
- e_calendar_view_cut_clipboard (view);
-}
-
-void
-gnome_calendar_copy_clipboard (GnomeCalendar *gcal)
-{
- GnomeCalendarViewType view_type;
- ECalendarView *view;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- view_type = gnome_calendar_get_view (gcal);
- view = gnome_calendar_get_calendar_view (gcal, view_type);
-
- e_calendar_view_copy_clipboard (view);
-}
-
-void
-gnome_calendar_paste_clipboard (GnomeCalendar *gcal)
-{
- GnomeCalendarViewType view_type;
- ECalendarView *view;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- view_type = gnome_calendar_get_view (gcal);
- view = gnome_calendar_get_calendar_view (gcal, view_type);
-
- e_calendar_view_paste_clipboard (view);
-}
void
gnome_calendar_notify_dates_shown_changed (GnomeCalendar *gcal)
@@ -2591,34 +2529,6 @@ gnome_calendar_get_num_events_selected (GnomeCalendar *gcal)
return retval;
}
-void
-gnome_calendar_delete_selection (GnomeCalendar *gcal)
-{
- GnomeCalendarViewType view_type;
- ECalendarView *view;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- view_type = gnome_calendar_get_view (gcal);
- view = gnome_calendar_get_calendar_view (gcal, view_type);
-
- e_calendar_view_delete_selected_events (view);
-}
-
-void
-gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal)
-{
- GnomeCalendarViewType view_type;
- ECalendarView *view;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- view_type = gnome_calendar_get_view (gcal);
- view = gnome_calendar_get_calendar_view (gcal, view_type);
-
- e_calendar_view_delete_selected_occurrence (view);
-}
-
static gboolean
check_instance_cb (ECalComponent *comp,
time_t instance_start,
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index a9e24921e2..a6befeaf7a 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -36,12 +36,24 @@
#include "e-calendar-table.h"
-#define GNOME_TYPE_CALENDAR (gnome_calendar_get_type ())
-#define GNOME_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CALENDAR, GnomeCalendar))
-#define GNOME_CALENDAR_CLASS(klass) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((klass), GNOME_TYPE_CALENDAR, \
- GnomeCalendarClass))
-#define GNOME_IS_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CALENDAR))
-#define GNOME_IS_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CALENDAR))
+/* Standard GObject macros */
+#define GNOME_TYPE_CALENDAR \
+ (gnome_calendar_get_type ())
+#define GNOME_CALENDAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), GNOME_TYPE_CALENDAR, GnomeCalendar))
+#define GNOME_CALENDAR_CLASS(cls) \
+ (G_TYPE_CHECK_INSTANCE_CAST_CLASS \
+ ((cls), GNOME_TYPE_CALENDAR, GnomeCalendarClass))
+#define GNOME_IS_CALENDAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), GNOME_TYPE_CALENDAR))
+#define GNOME_IS_CALENDAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), GNOME_TYPE_CALENDAR))
+#define GNOME_CALENDAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), GNOME_TYPE_CALENDAR, GnomeCalendarClass))
G_BEGIN_DECLS
@@ -75,8 +87,6 @@ typedef enum {
struct _GnomeCalendar {
GtkVBox vbox;
-
- /* Private data */
GnomeCalendarPrivate *priv;
};
@@ -109,10 +119,14 @@ void gnome_calendar_set_date_navigator
(GnomeCalendar *gcal,
ECalendar *date_navigator);
ECalModel * gnome_calendar_get_model (GnomeCalendar *gcal);
-
-gboolean gnome_calendar_remove_source (GnomeCalendar *gcal, ESource *source);
-gboolean gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, const gchar *uid);
-gboolean gnome_calendar_set_default_source (GnomeCalendar *gcal, ESource *source);
+gboolean gnome_calendar_remove_source (GnomeCalendar *gcal,
+ ESource *source);
+gboolean gnome_calendar_remove_source_by_uid
+ (GnomeCalendar *gcal,
+ const gchar *uid);
+gboolean gnome_calendar_set_default_source
+ (GnomeCalendar *gcal,
+ ESource *source);
void gnome_calendar_update_query (GnomeCalendar *gcal);
void gnome_calendar_set_search_query (GnomeCalendar *gcal,
const gchar *sexp,
@@ -120,16 +134,15 @@ void gnome_calendar_set_search_query (GnomeCalendar *gcal,
time_t start_range,
time_t end_range);
-void gnome_calendar_next (GnomeCalendar *gcal);
-void gnome_calendar_previous (GnomeCalendar *gcal);
-void gnome_calendar_goto (GnomeCalendar *gcal,
+void gnome_calendar_next (GnomeCalendar *gcal);
+void gnome_calendar_previous (GnomeCalendar *gcal);
+void gnome_calendar_goto (GnomeCalendar *gcal,
time_t new_time);
void gnome_calendar_update_view_times(GnomeCalendar *gcal,
time_t start_time);
-void gnome_calendar_dayjump (GnomeCalendar *gcal,
+void gnome_calendar_dayjump (GnomeCalendar *gcal,
time_t time);
-/* Jumps to the current day */
-void gnome_calendar_goto_today (GnomeCalendar *gcal);
+void gnome_calendar_goto_today (GnomeCalendar *gcal);
GnomeCalendarViewType
gnome_calendar_get_view (GnomeCalendar *gcal);
@@ -150,12 +163,9 @@ void gnome_calendar_set_range_selected
void gnome_calendar_set_selected_time_range
(GnomeCalendar *gcal,
time_t start_time);
-void gnome_calendar_get_selected_time_range
- (GnomeCalendar *gcal,
- time_t *start_time,
- time_t *end_time);
-
-void gnome_calendar_new_task (GnomeCalendar *gcal, time_t *dtstart, time_t *dtend);
+void gnome_calendar_new_task (GnomeCalendar *gcal,
+ time_t *dtstart,
+ time_t *dtend);
/* Returns the selected time range for the current view. Note that this may be
different from the fields in the GnomeCalendar, since the view may clip
@@ -169,20 +179,14 @@ void gnome_calendar_notify_dates_shown_changed
(GnomeCalendar *gcal);
/* Returns the number of selected events (0 or 1 at present). */
-gint gnome_calendar_get_num_events_selected (GnomeCalendar *gcal);
-
-/* Clipboard operations */
-void gnome_calendar_cut_clipboard (GnomeCalendar *gcal);
-void gnome_calendar_copy_clipboard (GnomeCalendar *gcal);
-void gnome_calendar_paste_clipboard (GnomeCalendar *gcal);
+gint gnome_calendar_get_num_events_selected
+ (GnomeCalendar *gcal);
-void gnome_calendar_delete_selection (GnomeCalendar *gcal);
-void gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal);
-void gnome_calendar_purge (GnomeCalendar *gcal,
+void gnome_calendar_purge (GnomeCalendar *gcal,
time_t older_than);
/* Direct calendar component operations */
-void gnome_calendar_edit_appointment (GnomeCalendar *gcal,
+void gnome_calendar_edit_appointment (GnomeCalendar *gcal,
const gchar * src_uid,
const gchar * comp_uid,
const gchar * comp_rid);
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index 15e8337ce1..b795ad9291 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -213,6 +213,7 @@ void
goto_dialog (GnomeCalendar *gcal)
{
#if 0 /* KILL-BONOBO */
+ ECalModel *model;
time_t start_time;
struct icaltimetype tt;
gint b;
@@ -243,7 +244,8 @@ goto_dialog (GnomeCalendar *gcal)
}
dlg->gcal = gcal;
- gnome_calendar_get_selected_time_range (dlg->gcal, &start_time, NULL);
+ model = gnome_calendar_get_model (gcal);
+ e_cal_model_get_time_range (model, &start_time, NULL);
tt = icaltime_from_timet_with_zone (start_time, FALSE, gnome_calendar_get_timezone (gcal));
dlg->year_val = tt.year;
dlg->month_val = tt.month - 1;
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index 03d79470d6..9248ea8334 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -610,6 +610,8 @@ e_cal_shell_content_copy_clipboard (ECalShellContent *cal_shell_content)
GnomeCalendar *calendar;
EMemoTable *memo_table;
ECalendarTable *task_table;
+ GnomeCalendarViewType view_type;
+ ECalendarView *calendar_view;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
@@ -617,9 +619,12 @@ e_cal_shell_content_copy_clipboard (ECalShellContent *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:
- gnome_calendar_copy_clipboard (calendar);
+ e_calendar_view_copy_clipboard (calendar_view);
break;
case FOCUS_MEMO_TABLE:
@@ -641,6 +646,8 @@ e_cal_shell_content_cut_clipboard (ECalShellContent *cal_shell_content)
GnomeCalendar *calendar;
EMemoTable *memo_table;
ECalendarTable *task_table;
+ GnomeCalendarViewType view_type;
+ ECalendarView *calendar_view;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
@@ -648,9 +655,12 @@ e_cal_shell_content_cut_clipboard (ECalShellContent *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:
- gnome_calendar_cut_clipboard (calendar);
+ e_calendar_view_cut_clipboard (calendar_view);
break;
case FOCUS_MEMO_TABLE:
@@ -672,6 +682,8 @@ e_cal_shell_content_paste_clipboard (ECalShellContent *cal_shell_content)
GnomeCalendar *calendar;
EMemoTable *memo_table;
ECalendarTable *task_table;
+ GnomeCalendarViewType view_type;
+ ECalendarView *calendar_view;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
@@ -679,9 +691,12 @@ e_cal_shell_content_paste_clipboard (ECalShellContent *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:
- gnome_calendar_paste_clipboard (calendar);
+ e_calendar_view_paste_clipboard (calendar_view);
break;
case FOCUS_MEMO_TABLE:
@@ -703,6 +718,8 @@ e_cal_shell_content_delete_selection (ECalShellContent *cal_shell_content)
GnomeCalendar *calendar;
EMemoTable *memo_table;
ECalendarTable *task_table;
+ GnomeCalendarViewType view_type;
+ ECalendarView *calendar_view;
g_return_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content));
@@ -710,9 +727,12 @@ e_cal_shell_content_delete_selection (ECalShellContent *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:
- gnome_calendar_delete_selection (calendar);
+ e_calendar_view_delete_selected_events (calendar_view);
break;
case FOCUS_MEMO_TABLE:
@@ -732,13 +752,19 @@ 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);
- if (focus == FOCUS_CALENDAR)
- gnome_calendar_delete_selected_occurrence (calendar);
+ e_calendar_view_delete_selected_occurrence (calendar_view);
}