From abf34a4520db2714e688fcdc01f3e5cbb890bc73 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 5 Nov 2007 10:03:02 +0000 Subject: ** Fix for bug #318604 2007-11-05 Milan Crha ** Fix for bug #318604 * Enable source when adding event to disabled source. * gui/gnome-cal.h: (gnome_calendar_emit_user_created_signal): New helper function which will store used calendar before emitting signal "user_created" on the instance to GnomeCalendar for later use and unset it right after the emit. * gui/gnome-cal.c: (struct _GnomeCalendarPrivate): New member to store used ECal before emitting "user_created" signal. * gui/gnome-cal.c: (gnome_calendar_emit_user_created_signal), (user_created_cb): Implementation of new helper function and enabling last used source instead of default one on "user_created" signal. * gui/e-day-view.c: (e_day_view_on_editing_stopped): * gui/e-week-view.c: (e_week_view_on_editing_stopped): * gui/e-calendar-view.c: (object_created_cb): Use our new helper function to emit "user_created" signal with proper ECal. * gui/e-calendar-table.h: (struct _ECalendarTable): * gui/e-memo-table.h: (struct _EMemoTable): New member added. * gui/e-calendar-table.c: (e_calendar_table_init): * gui/e-memo-table.c: (e_memo_table_init): Initialize member to NULL. * gui/tasks-component.c: (object_created_cb), (create_new_todo): * gui/memos-component.c: (object_created_cb), (create_new_memo): Add new callback function to notice new object created and emit "user_created" signal with proper ECal stored in ECalendarTable. * gui/e-tasks.c: (user_created_cb): * gui/e-memos.c: (user_created_cb): Use previously stored ECal, which has been used to create event, instead of using default ECal. svn path=/trunk/; revision=34495 --- calendar/gui/memos-component.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'calendar/gui/memos-component.c') diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c index 2023306e84..5024a5f2e7 100644 --- a/calendar/gui/memos-component.c +++ b/calendar/gui/memos-component.c @@ -925,6 +925,17 @@ setup_create_ecal (MemosComponent *component, MemosComponentView *component_view return priv->create_ecal ; } +/* Ensures the calendar is selected */ +static void +object_created_cb (CompEditor *ce, EMemoTable *memo_table) +{ + g_return_if_fail (memo_table != NULL); + + memo_table->user_created_cal = comp_editor_get_e_cal (ce); + g_signal_emit_by_name (memo_table, "user_created"); + memo_table->user_created_cal = NULL; +} + static gboolean create_new_memo (MemosComponent *memo_component, gboolean is_assigned, MemosComponentView *component_view) { @@ -946,6 +957,8 @@ create_new_memo (MemosComponent *memo_component, gboolean is_assigned, MemosComp editor = memo_editor_new (ecal, flags); comp = cal_comp_memo_new_with_defaults (ecal); + g_signal_connect (editor, "object_created", G_CALLBACK (object_created_cb), e_memos_get_calendar_table (component_view->memos)); + comp_editor_edit_comp (COMP_EDITOR (editor), comp); comp_editor_focus (COMP_EDITOR (editor)); -- cgit