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 --- calendar/gui/calendar-config.c | 19 +++++++++++++++++++ calendar/gui/calendar-config.h | 2 ++ calendar/gui/e-day-view.c | 6 ++++-- calendar/gui/e-week-view.c | 3 ++- 4 files changed, 27 insertions(+), 3 deletions(-) (limited to 'calendar') diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 39431549dd..e293a6e41b 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -434,3 +434,22 @@ calendar_config_add_notification_day_second_zone (CalendarConfigChangedFunc func g_signal_connect (G_OBJECT (config), "changed::day-second-zone", G_CALLBACK (func), data); } + +gboolean +calendar_config_get_prefer_meeting (void) +{ + EShell *shell; + EShellSettings *shell_settings; + gchar *prefer_new_item; + gboolean prefer_meeting; + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + prefer_new_item = e_shell_settings_get_string (shell_settings, "cal-prefer-new-item"); + prefer_meeting = g_strcmp0 (prefer_new_item, "event-meeting-new") == 0; + + g_free (prefer_new_item); + + return prefer_meeting; +} diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index 483fbbd667..81f8534364 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -90,4 +90,6 @@ void calendar_config_add_notification_day_second_zone (CalendarConfigChangedFu gboolean calendar_config_get_month_scroll_by_week (void); void calendar_config_add_notification_month_scroll_by_week (CalendarConfigChangedFunc func, gpointer data); +gboolean calendar_config_get_prefer_meeting (void); + #endif /* _CALENDAR_CONFIG_H_ */ diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 8af5ffb3fa..cb19db0fe0 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -50,6 +50,7 @@ #include "dialogs/recur-comp.h" #include "dialogs/goto-dialog.h" #include "print.h" +#include "calendar-config.h" #include "comp-util.h" #include "itip-utils.h" #include "e-cal-model-calendar.h" @@ -3073,9 +3074,10 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, dtend = day_view->before_click_dtend; e_day_view_set_selected_time_range ((ECalendarView *) day_view, dtstart, dtend); } + e_calendar_view_new_appointment_for (E_CALENDAR_VIEW (day_view), dtstart, dtend, - TRUE, FALSE); + TRUE, calendar_config_get_prefer_meeting ()); return TRUE; } @@ -3214,7 +3216,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, } e_calendar_view_new_appointment_for (E_CALENDAR_VIEW (day_view), dtstart, dtend, - FALSE, FALSE); + FALSE, calendar_config_get_prefer_meeting ()); return TRUE; } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 4b2eeb02bf..45917c170c 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -48,6 +48,7 @@ #include "dialogs/cancel-comp.h" #include "dialogs/recur-comp.h" #include "dialogs/goto-dialog.h" +#include "calendar-config.h" #include "comp-util.h" #include "itip-utils.h" #include @@ -2417,7 +2418,7 @@ e_week_view_on_button_press (GtkWidget *widget, if (dtstart < week_view->before_click_dtend && dtend > week_view->before_click_dtstart) { e_week_view_set_selected_time_range ((ECalendarView *) week_view, week_view->before_click_dtstart, week_view->before_click_dtend); } - e_calendar_view_new_appointment_full (E_CALENDAR_VIEW (week_view), FALSE, FALSE, FALSE); + e_calendar_view_new_appointment_full (E_CALENDAR_VIEW (week_view), FALSE, FALSE, calendar_config_get_prefer_meeting ()); return TRUE; } -- cgit