aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/dialogs/event-editor.c2
-rw-r--r--calendar/gui/e-cal-component-preview.c3
-rw-r--r--modules/calendar/e-cal-shell-backend.c88
3 files changed, 74 insertions, 19 deletions
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 6f0f338bf4..e7d602c335 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -670,7 +670,7 @@ event_editor_new (ECal *client,
CompEditorFlags flags)
{
g_return_val_if_fail (E_IS_CAL (client), NULL);
- g_return_val_if_fail (E_IS_SHELL (client), NULL);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
return g_object_new (
TYPE_EVENT_EDITOR,
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index 0374e1f093..de6f6fcd3d 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -326,7 +326,6 @@ cal_component_preview_class_init (ECalComponentPreviewClass *class)
static void
cal_component_preview_init (ECalComponentPreview *preview)
{
- ECalComponentPreviewPrivate *priv;
GtkHTML *html;
preview->priv = E_CAL_COMPONENT_PREVIEW_GET_PRIVATE (preview);
@@ -335,7 +334,7 @@ cal_component_preview_init (ECalComponentPreview *preview)
gtk_html_set_default_content_type (html, "charset=utf-8");
gtk_html_load_empty (html);
- priv->zone = icaltimezone_get_utc_timezone ();
+ preview->priv->zone = icaltimezone_get_utc_timezone ();
}
GType
diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c
index a914ae9e9e..145bff6db5 100644
--- a/modules/calendar/e-cal-shell-backend.c
+++ b/modules/calendar/e-cal-shell-backend.c
@@ -326,35 +326,76 @@ cal_shell_backend_ensure_sources (EShellBackend *shell_backend)
}
static void
-cal_shell_backend_cal_opened_cb (ECal *cal,
+cal_shell_backend_event_new_cb (ECal *cal,
ECalendarStatus status,
- GtkAction *action)
+ EShell *shell)
{
- EShell *shell;
ECalComponent *comp;
CompEditor *editor;
CompEditorFlags flags = 0;
- const gchar *action_name;
- gboolean all_day;
-
- /* FIXME Pass this in. */
- shell = e_shell_get_default ();
/* XXX Handle errors better. */
if (status != E_CALENDAR_STATUS_OK)
return;
- action_name = gtk_action_get_name (action);
+ flags |= COMP_EDITOR_NEW_ITEM;
+ flags |= COMP_EDITOR_USER_ORG;
+
+ editor = event_editor_new (cal, shell, flags);
+ comp = cal_comp_event_new_with_current_time (cal, FALSE);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (cal);
+}
+
+static void
+cal_shell_backend_event_all_day_new_cb (ECal *cal,
+ ECalendarStatus status,
+ EShell *shell)
+{
+ ECalComponent *comp;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+
+ /* XXX Handle errors better. */
+ if (status != E_CALENDAR_STATUS_OK)
+ return;
flags |= COMP_EDITOR_NEW_ITEM;
flags |= COMP_EDITOR_USER_ORG;
- if (strcmp (action_name, "event-meeting-new") == 0)
- flags |= COMP_EDITOR_MEETING;
- all_day = (strcmp (action_name, "event-all-day-new") == 0);
+ editor = event_editor_new (cal, shell, flags);
+ comp = cal_comp_event_new_with_current_time (cal, TRUE);
+ comp_editor_edit_comp (editor, comp);
+
+ gtk_window_present (GTK_WINDOW (editor));
+
+ g_object_unref (comp);
+ g_object_unref (cal);
+}
+
+static void
+cal_shell_backend_event_meeting_new_cb (ECal *cal,
+ ECalendarStatus status,
+ EShell *shell)
+{
+ ECalComponent *comp;
+ CompEditor *editor;
+ CompEditorFlags flags = 0;
+
+ /* XXX Handle errors better. */
+ if (status != E_CALENDAR_STATUS_OK)
+ return;
+
+ flags |= COMP_EDITOR_NEW_ITEM;
+ flags |= COMP_EDITOR_USER_ORG;
+ flags |= COMP_EDITOR_MEETING;
editor = event_editor_new (cal, shell, flags);
- comp = cal_comp_event_new_with_current_time (cal, all_day);
+ comp = cal_comp_event_new_with_current_time (cal, FALSE);
comp_editor_edit_comp (editor, comp);
gtk_window_present (GTK_WINDOW (editor));
@@ -372,6 +413,7 @@ action_event_new_cb (GtkAction *action,
ESourceList *source_list;
EShellSettings *shell_settings;
EShell *shell;
+ const gchar *action_name;
gchar *uid;
/* This callback is used for both appointments and meetings. */
@@ -403,9 +445,23 @@ action_event_new_cb (GtkAction *action,
g_return_if_fail (cal != NULL);
- g_signal_connect (
- cal, "cal-opened",
- G_CALLBACK (cal_shell_backend_cal_opened_cb), action);
+ /* Connect the appropriate signal handler. */
+ action_name = gtk_action_get_name (action);
+ if (strcmp (action_name, "event-all-day-new") == 0)
+ g_signal_connect (
+ cal, "cal-opened",
+ G_CALLBACK (cal_shell_backend_event_all_day_new_cb),
+ shell);
+ else if (strcmp (action_name, "event-meeting-new") == 0)
+ g_signal_connect (
+ cal, "cal-opened",
+ G_CALLBACK (cal_shell_backend_event_meeting_new_cb),
+ shell);
+ else
+ g_signal_connect (
+ cal, "cal-opened",
+ G_CALLBACK (cal_shell_backend_event_new_cb),
+ shell);
e_cal_open_async (cal, FALSE);
}