diff options
author | Milan Crha <mcrha@redhat.com> | 2012-02-17 00:22:28 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-02-17 00:23:07 +0800 |
commit | 83d001baa23d3cce1d983dbc7946a7c5375c05f2 (patch) | |
tree | 5c19dd40d965b35d2ca26a926e964946dcd91178 /modules/calendar | |
parent | aeb3238ad0fc239a26a9b3708679bb677030063b (diff) | |
download | gsoc2013-evolution-83d001baa23d3cce1d983dbc7946a7c5375c05f2.tar.gz gsoc2013-evolution-83d001baa23d3cce1d983dbc7946a7c5375c05f2.tar.zst gsoc2013-evolution-83d001baa23d3cce1d983dbc7946a7c5375c05f2.zip |
Bug #320976 - Remember last New button choice in Calendar view
Diffstat (limited to 'modules/calendar')
-rw-r--r-- | modules/calendar/e-cal-shell-backend.c | 14 | ||||
-rw-r--r-- | modules/calendar/e-cal-shell-settings.c | 5 |
2 files changed, 17 insertions, 2 deletions
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 |