aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2007-11-05 18:03:02 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-11-05 18:03:02 +0800
commitabf34a4520db2714e688fcdc01f3e5cbb890bc73 (patch)
tree55c9a141a81af5be89ec7cb38a5ac64aeee5fc11 /calendar
parent92d0fb79a748036a21403539a8c296eafb2e2613 (diff)
downloadgsoc2013-evolution-abf34a4520db2714e688fcdc01f3e5cbb890bc73.tar.gz
gsoc2013-evolution-abf34a4520db2714e688fcdc01f3e5cbb890bc73.tar.zst
gsoc2013-evolution-abf34a4520db2714e688fcdc01f3e5cbb890bc73.zip
** Fix for bug #318604
2007-11-05 Milan Crha <mcrha@redhat.com> ** 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
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog30
-rw-r--r--calendar/gui/e-calendar-table.c2
-rw-r--r--calendar/gui/e-calendar-table.h4
-rw-r--r--calendar/gui/e-calendar-view.c2
-rw-r--r--calendar/gui/e-day-view.c4
-rw-r--r--calendar/gui/e-memo-table.c2
-rw-r--r--calendar/gui/e-memo-table.h4
-rw-r--r--calendar/gui/e-memos.c13
-rw-r--r--calendar/gui/e-tasks.c17
-rw-r--r--calendar/gui/e-week-view.c2
-rw-r--r--calendar/gui/gnome-cal.c36
-rw-r--r--calendar/gui/gnome-cal.h2
-rw-r--r--calendar/gui/memos-component.c13
-rw-r--r--calendar/gui/tasks-component.c13
14 files changed, 129 insertions, 15 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 078bd8241a..473cf11508 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,35 @@
2007-11-05 Milan Crha <mcrha@redhat.com>
+ ** 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.
+
+2007-11-05 Milan Crha <mcrha@redhat.com>
+
** Fix for bug #346693
* gui/e-day-view-top-item.h: (EDayViewTopItem):
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index a2f54fb2e6..1d8d48ab13 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -244,6 +244,8 @@ e_calendar_table_init (ECalendarTable *cal_table)
cal_table->model = (ECalModel *) e_cal_model_tasks_new ();
g_signal_connect (cal_table->model, "row_appended", G_CALLBACK (row_appended_cb), cal_table);
+ cal_table->user_created_cal = NULL;
+
/* Create the header columns */
extras = e_table_extras_new();
diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h
index 39d4ee64ba..a769cf54dd 100644
--- a/calendar/gui/e-calendar-table.h
+++ b/calendar/gui/e-calendar-table.h
@@ -64,6 +64,10 @@ struct _ECalendarTable {
/* Activity ID for the EActivityHandler (i.e. the status bar). */
EActivityHandler *activity_handler;
guint activity_id;
+
+ /* We should know which calendar has been used to create object, so store it here
+ before emitting "user_created" signal and make it NULL just after the emit. */
+ ECal *user_created_cal;
};
struct _ECalendarTableClass {
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 23f391a1fb..fae8a2cb8e 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1957,7 +1957,7 @@ e_calendar_view_new_appointment (ECalendarView *cal_view)
static void
object_created_cb (CompEditor *ce, ECalendarView *cal_view)
{
- g_signal_emit_by_name (cal_view, "user_created");
+ gnome_calendar_emit_user_created_signal (cal_view, e_calendar_view_get_calendar (cal_view), comp_editor_get_e_cal (ce));
}
static void
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 350061e2c3..9422378d44 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -7745,7 +7745,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
else
- g_signal_emit_by_name (day_view, "user_created");
+ gnome_calendar_emit_user_created_signal (day_view, e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)), client);
/* we remove the object since we either got the update from the server or failed */
e_day_view_remove_event_cb (day_view, day, event_num, NULL);
@@ -7902,7 +7902,7 @@ e_day_view_on_editing_stopped (EDayView *day_view,
if (!e_cal_create_object (client, icalcomp, NULL, NULL))
g_message (G_STRLOC ": Could not create the object!");
else
- g_signal_emit_by_name (day_view, "user_created");
+ gnome_calendar_emit_user_created_signal (day_view, e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view)), client);
/* we remove the object since we either got the update from the server or failed */
e_day_view_remove_event_cb (day_view, day, event_num, NULL);
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index 5c80b158c4..4ac8147fdf 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -199,6 +199,8 @@ e_memo_table_init (EMemoTable *memo_table)
memo_table->model = (ECalModel *) e_cal_model_memos_new ();
g_signal_connect (memo_table->model, "row_appended", G_CALLBACK (row_appended_cb), memo_table);
+ memo_table->user_created_cal = NULL;
+
/* Create the header columns */
extras = e_table_extras_new();
diff --git a/calendar/gui/e-memo-table.h b/calendar/gui/e-memo-table.h
index 2bcd6e1c74..5168735c58 100644
--- a/calendar/gui/e-memo-table.h
+++ b/calendar/gui/e-memo-table.h
@@ -65,6 +65,10 @@ struct _EMemoTable {
/* Activity ID for the EActivityHandler (i.e. the status bar). */
EActivityHandler *activity_handler;
guint activity_id;
+
+ /* We should know which calendar has been used to create object, so store it here
+ before emitting "user_created" signal and make it NULL just after the emit. */
+ ECal *user_created_cal;
};
struct _EMemoTableClass {
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
index 60dc54a927..d20d909808 100644
--- a/calendar/gui/e-memos.c
+++ b/calendar/gui/e-memos.c
@@ -183,13 +183,20 @@ static void
user_created_cb (GtkWidget *view, EMemos *memos)
{
EMemosPrivate *priv;
+ EMemoTable *memo_table;
ECal *ecal;
- ECalModel *model;
priv = memos->priv;
+ memo_table = E_MEMO_TABLE (priv->memos_view);
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
- ecal = e_cal_model_get_default_client (model);
+ if (memo_table->user_created_cal)
+ ecal = memo_table->user_created_cal;
+ else {
+ ECalModel *model;
+
+ model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
+ ecal = e_cal_model_get_default_client (model);
+ }
e_memos_add_memo_source (memos, e_cal_get_source (ecal));
}
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index d1ede74793..13c1be8a4c 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -195,14 +195,21 @@ table_selection_change_cb (ETable *etable, gpointer data)
static void
user_created_cb (GtkWidget *view, ETasks *tasks)
{
- ETasksPrivate *priv;
+ ETasksPrivate *priv;
+ ECalendarTable *cal_table;
ECal *ecal;
- ECalModel *model;
-
+
priv = tasks->priv;
+ cal_table = E_CALENDAR_TABLE (priv->tasks_view);
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- ecal = e_cal_model_get_default_client (model);
+ if (cal_table->user_created_cal)
+ ecal = cal_table->user_created_cal;
+ else {
+ ECalModel *model;
+
+ model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
+ ecal = e_cal_model_get_default_client (model);
+ }
e_tasks_add_todo_source (tasks, e_cal_get_source (ecal));
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index c6115d8852..be189a0905 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -3500,7 +3500,7 @@ 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
- g_signal_emit_by_name (week_view, "user_created");
+ gnome_calendar_emit_user_created_signal (week_view, e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view)), client);
/* 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);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 3fe343dba9..235ec19582 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -189,6 +189,10 @@ struct _GnomeCalendarPrivate {
/* If this is true list view uses range of showing the events as the dates selected in date navigator which is one month, else
it uses the date range set in search bar */
gboolean lview_select_daten_range;
+
+ /* We should know which calendar has been used to create object, so store it here
+ before emitting "user_created" signal and make it NULL just after the emit. */
+ ECal *user_created_cal;
};
/* Signal IDs */
@@ -995,17 +999,43 @@ view_selection_changed_cb (GtkWidget *view, GnomeCalendar *gcal)
gnome_calendar_signals[CALENDAR_SELECTION_CHANGED]);
}
+
+/**
+ * gnome_calendar_emit_user_created_signal
+ * Emits "user_created" signal on a gcal and use calendar as a store where was event created.
+ *
+ * @param instance Instance on which emit signal.
+ * @param gcal GnomeCalendar, it will store info about used calendar here.
+ * @param calendar Used calendar, where was event created.
+ **/
+void
+gnome_calendar_emit_user_created_signal (gpointer instance, GnomeCalendar *gcal, ECal *calendar)
+{
+ GnomeCalendarPrivate *priv;
+
+ g_return_if_fail (gcal != NULL);
+
+ priv = gcal->priv;
+ priv->user_created_cal = calendar;
+ g_signal_emit_by_name (instance, "user_created");
+ priv->user_created_cal = NULL;
+}
+
static void
user_created_cb (GtkWidget *view, GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
ECal *ecal;
- ECalModel *model;
priv = gcal->priv;
+ ecal = priv->user_created_cal;
- model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
- ecal = e_cal_model_get_default_client (model);
+ if (!ecal) {
+ ECalModel *model;
+
+ model = e_calendar_view_get_model (priv->views[priv->current_view_type]);
+ ecal = e_cal_model_get_default_client (model);
+ }
gnome_calendar_add_source (gcal, E_CAL_SOURCE_TYPE_EVENT, e_cal_get_source (ecal));
}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 49d7c0cc97..8524545037 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -201,6 +201,8 @@ void gnome_calendar_edit_appointment (GnomeCalendar *gcal,
GtkWidget * gnome_calendar_get_tag (GnomeCalendar *gcal);
+void gnome_calendar_emit_user_created_signal (gpointer instance, GnomeCalendar *gcal, ECal *calendar);
+
G_END_DECLS
#endif
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));
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 3f5a13d9ec..cc87d9d287 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -919,6 +919,17 @@ setup_create_ecal (TasksComponent *component, TasksComponentView *component_view
return priv->create_ecal ;
}
+/* Ensures the calendar is selected */
+static void
+object_created_cb (CompEditor *ce, ECalendarTable *cal_table)
+{
+ g_return_if_fail (cal_table != NULL);
+
+ cal_table->user_created_cal = comp_editor_get_e_cal (ce);
+ g_signal_emit_by_name (cal_table, "user_created");
+ cal_table->user_created_cal = NULL;
+}
+
static gboolean
create_new_todo (TasksComponent *task_component, gboolean is_assigned, TasksComponentView *component_view)
{
@@ -939,6 +950,8 @@ create_new_todo (TasksComponent *task_component, gboolean is_assigned, TasksComp
editor = task_editor_new (ecal, flags);
comp = cal_comp_task_new_with_defaults (ecal);
+ g_signal_connect (editor, "object_created", G_CALLBACK (object_created_cb), e_tasks_get_calendar_table (component_view->tasks));
+
comp_editor_edit_comp (COMP_EDITOR (editor), comp);
if (is_assigned)
task_editor_show_assignment (editor);