From 83d001baa23d3cce1d983dbc7946a7c5375c05f2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 16 Feb 2012 17:22:28 +0100 Subject: Bug #320976 - Remember last New button choice in Calendar view --- modules/calendar/e-cal-shell-backend.c | 14 ++++++++++++-- modules/calendar/e-cal-shell-settings.c | 5 +++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index f13cc2d715..f9400707a2 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -357,6 +357,8 @@ action_event_new_cb (GtkAction *action, const gchar *action_name; gchar *uid; + action_name = gtk_action_get_name (action); + /* With a 'calendar' active shell view pass the new appointment * request to it, thus the event will inherit selected time from * the view. */ @@ -367,6 +369,7 @@ action_event_new_cb (GtkAction *action, GnomeCalendarViewType view_type; ECalendarView *view; + shell_backend = e_shell_view_get_shell_backend (shell_view); shell_content = e_shell_view_get_shell_content (shell_view); gcal = e_cal_shell_content_get_calendar ( @@ -376,7 +379,7 @@ action_event_new_cb (GtkAction *action, view = gnome_calendar_get_calendar_view (gcal, view_type); if (view) { - action_name = gtk_action_get_name (action); + g_object_set (G_OBJECT (shell_backend), "prefer-new-item", action_name, NULL); e_calendar_view_new_appointment_full ( view, @@ -412,9 +415,10 @@ action_event_new_cb (GtkAction *action, g_return_if_fail (E_IS_SOURCE (source)); + g_object_set (G_OBJECT (shell_backend), "prefer-new-item", action_name, NULL); + /* Use a callback function appropriate for the action. * FIXME Need to obtain a better default time zone. */ - action_name = gtk_action_get_name (action); if (strcmp (action_name, "event-all-day-new") == 0) e_client_utils_open_new (source, source_type, FALSE, NULL, e_client_utils_authenticate_handler, GTK_WINDOW (shell_window), @@ -796,6 +800,12 @@ cal_shell_backend_constructed (GObject *object) e_calendar_preferences_new, 600); + g_object_bind_property ( + e_shell_get_shell_settings (shell), "cal-prefer-new-item", + shell_backend, "prefer-new-item", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); + /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_cal_shell_backend_parent_class)->constructed (object); } diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c index 9810d816e6..0c77063f46 100644 --- a/modules/calendar/e-cal-shell-settings.c +++ b/modules/calendar/e-cal-shell-settings.c @@ -714,6 +714,11 @@ e_cal_shell_backend_init_settings (EShell *shell) CALENDAR_SCHEMA, "working-days"); + e_shell_settings_install_property_for_key ( + "cal-prefer-new-item", + CALENDAR_SCHEMA, + "prefer-new-item"); + /* These properties use transform functions to convert * GConf values to forms more useful to Evolution. We * have to use separate properties because GConfBridge -- cgit v1.2.3