aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gnome-cal.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-09-04 08:36:49 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-09-04 08:36:49 +0800
commitb5660966bdf769a48a01efb003a9958d62b23140 (patch)
tree5c719303c3bffca8175259ca90ef361e9af85726 /calendar/gui/gnome-cal.c
parent154129242bc071ca620311184fa94b62e2e6684d (diff)
downloadgsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.tar
gsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.tar.gz
gsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.tar.bz2
gsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.tar.lz
gsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.tar.xz
gsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.tar.zst
gsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.zip
don't call calendar_config_check_timezone_set() now, since the startup
2001-09-03 Damon Chaplin <damon@ximian.com> * gui/calendar-commands.c (calendar_control_activate): * gui/tasks-control.c (tasks_control_activate): don't call calendar_config_check_timezone_set() now, since the startup wizard handles that. * gui/e-tasks.c (e_tasks_class_init): changed selection_changed signal to GTK_RUN_LAST. It has no reason to be GTK_RUN_FIRST. * gui/gnome-cal.c: * gui/e-week-view.c: * gui/e-day-view.c: added "selection_changed" signal, XX_delete_event() and XX_get_num_events_selected(). * gui/e-day-view-top-item.c (e_day_view_top_item_draw): fix the shadow around the dates at the top - it was 1 pixel off. * gui/calendar-commands.c: added sensitize_commands(), similar to in tasks-control.c, so we only make Cut/Copy/Delete sensitive when an event is selected. Also added delete_event_cmd(). * gui/dialogs/task-page.c (task_page_set_summary): * gui/dialogs/event-page.c (event_page_set_summary): do nothing, since the summary only gets changed on the main event/task page now. Fixes bug #6939. * gui/e-day-view.c (e_day_view_on_main_canvas_drag_data_received): (e_day_view_on_top_canvas_drag_data_received): check that we are dragging an event from the same EDayView. We currently don't support DnD from other widgets. (e_day_view_update_top_canvas_drag): only get the summary if we actually have an event. Fixes bug #5162. * gui/e-day-view.c (e_day_view_on_editing_stopped): if the text hasn't changed we need to call e_day_view_update_event_label() to show the times again if necessary. Fixes bug #1813. * gui/dialogs/comp-editor.c (comp_editor_destroy): destroy the CompEditorPage objects here rather than in close_dialog(), after the widgets have been destroyed. We do this because the widgets have lots of signal handlers connected with the CompEditorPage objects as the signal data, so we want to ensure that the data pointer is always valid. (Alternatively we could disconnect all the handlers when the CompEditorPage objects are destroyed, or use connect_while_alive()). Fixes bug #7543. Note: there is still a small bug in that if you type in a time and then hit 'Save and Close', the time won't be saved. I'm not sure where this should be fixed - should the actions which close the dialog grab the focus to the toplevel, so any widgets currently being edited finish the edit and emit 'changed'? * gui/dialogs/recurrence-page.c (append_exception): use gtk_clist_set_row_data_full() so freeing is handled automatically by the GtkClist. This helps avoid problems at destroy-time. (exception_delete_cb): just call gtk_clist_remove() now. No need to free the row data as GtkCList now handles it. (recurrence_page_destroy): no need to free the data in the clist. * gui/dialogs/alarm-page.c: ditto. * gui/dialogs/meeting-page.c: ditto. (etable_destroy_cb): save the ETable state in this new handler cb rather than in the destroy method, since the widget will already be destroyed by then. svn path=/trunk/; revision=12575
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r--calendar/gui/gnome-cal.c96
1 files changed, 96 insertions, 0 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 01714db44b..a2282ba2f1 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -154,6 +154,7 @@ struct _GnomeCalendarPrivate {
enum {
DATES_SHOWN_CHANGED,
+ SELECTION_CHANGED,
LAST_SIGNAL
};
@@ -233,6 +234,15 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ gnome_calendar_signals[SELECTION_CHANGED] =
+ gtk_signal_new ("selection_changed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GnomeCalendarClass,
+ selection_changed),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
gtk_object_class_add_signals (object_class,
gnome_calendar_signals,
LAST_SIGNAL);
@@ -240,6 +250,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
object_class->destroy = gnome_calendar_destroy;
class->dates_shown_changed = NULL;
+ class->selection_changed = NULL;
}
/* Callback used when the calendar query reports of an updated object */
@@ -320,6 +331,35 @@ dn_query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
fprintf (stderr, "eval error: %s\n", error_str);
}
+/* Returns the current view widget, a EDayView or EWeekView. */
+static GtkWidget*
+gnome_calendar_get_current_view_widget (GnomeCalendar *gcal)
+{
+ GnomeCalendarPrivate *priv;
+ GtkWidget *retval = NULL;
+
+ priv = gcal->priv;
+
+ switch (priv->current_view_type) {
+ case GNOME_CAL_DAY_VIEW:
+ retval = priv->day_view;
+ break;
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ retval = priv->work_week_view;
+ break;
+ case GNOME_CAL_WEEK_VIEW:
+ retval = priv->week_view;
+ break;
+ case GNOME_CAL_MONTH_VIEW:
+ retval = priv->month_view;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ return retval;
+}
+
/* Computes the range of time that the date navigator is showing */
static void
get_date_navigator_range (GnomeCalendar *gcal, time_t *start_time, time_t *end_time)
@@ -548,6 +588,16 @@ search_bar_category_changed_cb (CalSearchBar *cal_search, const char *category,
}
static void
+view_selection_changed_cb (GtkWidget *view, GnomeCalendar *gcal)
+{
+ g_print ("In view_selection_changed_cb\n");
+
+ gtk_signal_emit (GTK_OBJECT (gcal),
+ gnome_calendar_signals[SELECTION_CHANGED]);
+}
+
+
+static void
setup_widgets (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
@@ -630,6 +680,8 @@ setup_widgets (GnomeCalendar *gcal)
gtk_widget_show (priv->day_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->day_view, gtk_label_new (""));
+ gtk_signal_connect (GTK_OBJECT (priv->day_view), "selection_changed",
+ GTK_SIGNAL_FUNC (view_selection_changed_cb), gcal);
/* The Work Week View. */
priv->work_week_view = e_day_view_new ();
@@ -640,6 +692,8 @@ setup_widgets (GnomeCalendar *gcal)
gtk_widget_show (priv->work_week_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->work_week_view, gtk_label_new (""));
+ gtk_signal_connect (GTK_OBJECT (priv->work_week_view), "selection_changed",
+ GTK_SIGNAL_FUNC (view_selection_changed_cb), gcal);
/* The Week View. */
priv->week_view = e_week_view_new ();
@@ -647,6 +701,8 @@ setup_widgets (GnomeCalendar *gcal)
gtk_widget_show (priv->week_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->week_view, gtk_label_new (""));
+ gtk_signal_connect (GTK_OBJECT (priv->week_view), "selection_changed",
+ GTK_SIGNAL_FUNC (view_selection_changed_cb), gcal);
/* The Month View. */
priv->month_view = e_week_view_new ();
@@ -655,6 +711,8 @@ setup_widgets (GnomeCalendar *gcal)
gtk_widget_show (priv->month_view);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->month_view, gtk_label_new (""));
+ gtk_signal_connect (GTK_OBJECT (priv->month_view), "selection_changed",
+ GTK_SIGNAL_FUNC (view_selection_changed_cb), gcal);
gnome_calendar_update_config_settings (gcal, TRUE);
}
@@ -2077,6 +2135,8 @@ gnome_calendar_get_visible_time_range (GnomeCalendar *gcal,
GnomeCalendarPrivate *priv;
gboolean retval = FALSE;
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
+
priv = gcal->priv;
switch (priv->current_view_type) {
@@ -2477,3 +2537,39 @@ gnome_calendar_notify_dates_shown_changed (GnomeCalendar *gcal)
gnome_calendar_signals[DATES_SHOWN_CHANGED]);
}
}
+
+
+/* Returns the number of selected events (0 or 1 at present). */
+gint
+gnome_calendar_get_num_events_selected (GnomeCalendar *gcal)
+{
+ GtkWidget *view;
+ gint retval = 0;
+
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0);
+
+ view = gnome_calendar_get_current_view_widget (gcal);
+ if (E_IS_DAY_VIEW (view))
+ retval = e_day_view_get_num_events_selected (E_DAY_VIEW (view));
+ else
+ retval = e_week_view_get_num_events_selected (E_WEEK_VIEW (view));
+
+ return retval;
+}
+
+
+void
+gnome_calendar_delete_event (GnomeCalendar *gcal)
+{
+ GtkWidget *view;
+
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+
+ view = gnome_calendar_get_current_view_widget (gcal);
+ if (E_IS_DAY_VIEW (view))
+ e_day_view_delete_event (E_DAY_VIEW (view));
+ else
+ e_week_view_delete_event (E_WEEK_VIEW (view));
+}
+
+