aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-cal-shell-backend.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-02-17 00:22:28 +0800
committerMilan Crha <mcrha@redhat.com>2012-02-17 00:23:07 +0800
commit83d001baa23d3cce1d983dbc7946a7c5375c05f2 (patch)
tree5c19dd40d965b35d2ca26a926e964946dcd91178 /modules/calendar/e-cal-shell-backend.c
parentaeb3238ad0fc239a26a9b3708679bb677030063b (diff)
downloadgsoc2013-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/e-cal-shell-backend.c')
-rw-r--r--modules/calendar/e-cal-shell-backend.c14
1 files changed, 12 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);
}