diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-10-30 17:25:24 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-10-30 17:25:24 +0800 |
commit | f3c4424cca6a4072d59c6de24524b0ca7f2a6ec5 (patch) | |
tree | 7ab4397aab4f3e85da00c269112ddc3b1a75b49c /calendar/gui/calendar-config.c | |
parent | 6bf38a0ba9bc70423c228445de61d6cbf4f7bd60 (diff) | |
download | gsoc2013-evolution-f3c4424cca6a4072d59c6de24524b0ca7f2a6ec5.tar.gz gsoc2013-evolution-f3c4424cca6a4072d59c6de24524b0ca7f2a6ec5.tar.zst gsoc2013-evolution-f3c4424cca6a4072d59c6de24524b0ca7f2a6ec5.zip |
Use an EMessageBox instead of a gnome_dialog_question so that the label
2001-10-30 Federico Mena Quintero <federico@ximian.com>
* gui/dialogs/delete-comp.c (delete_component_dialog): Use an
EMessageBox instead of a gnome_dialog_question so that the label
gets line breaking. Fixes bug #11260.
2001-10-29 Federico Mena Quintero <federico@ximian.com>
Fix bug #13649.
* gui/calendar-config.c
(calendar_config_get_use_default_reminder): New function.
(calendar_config_set_use_default_reminder): New function.
(calendar_config_get_default_reminder_interval): New function.
(calendar_config_set_default_reminder_interval): New function.
(calendar_config_get_default_reminder_units): New function.
(calendar_config_set_default_reminder_units): New function.
(config_read): Get the options for default reminders.
(calendar_config_write): Set the options for default reminders.
* gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_show_config):
Set the default reminder widgets from the config values.
(cal_prefs_dialog_update_config): Set the config values from the
widgets.
* gui/comp-util.c (cal_comp_event_new_with_defaults): New
function; creates a VEVENT component with the default alarm.
* gui/e-day-view.c (e_day_view_key_press): Use
cal_comp_event_new_with_defaults ();
* gui/e-week-view.c (e_week_view_key_press): Likewise.
* gui/calendar-model.c (calendar_model_append_row): Likewise.
* gui/comp-editor-factory.c (get_default_component): Likewise.
* gui/gnome-cal.c (gnome_calendar_new_appointment_for): Likewise.
* cal-util/cal-component.c (ensure_alarm_properties_cb): Ensure we
have a DESCRIPTION property.
(cal_component_commit_sequence): Ensure we have the mandatory
alarm properties.
svn path=/trunk/; revision=14446
Diffstat (limited to 'calendar/gui/calendar-config.c')
-rw-r--r-- | calendar/gui/calendar-config.c | 271 |
1 files changed, 200 insertions, 71 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 591bd4343f..699644767a 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -70,6 +70,9 @@ typedef struct CalUnits hide_completed_tasks_units; gint hide_completed_tasks_value; gboolean confirm_delete; + gboolean use_default_reminder; + int default_reminder_interval; + CalUnits default_reminder_units; } CalendarConfig; @@ -99,7 +102,7 @@ calendar_config_init (void) case the user can choose between 12 and 24-hour time formats. */ gboolean calendar_config_locale_supports_12_hour_format (void) -{ +{ char s[16]; time_t t = 0; @@ -115,9 +118,9 @@ config_read (void) char *units; CORBA_exception_init (&ev); - + db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - + if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { CORBA_exception_free (&ev); return; @@ -130,17 +133,17 @@ config_read (void) config->default_tasks_uri = bonobo_config_get_string (db, "/Calendar/DefaultTasksUri", NULL); - - config->timezone = bonobo_config_get_string (db, + + config->timezone = bonobo_config_get_string (db, "/Calendar/Display/Timezone", NULL); - config->working_days = bonobo_config_get_long_with_default (db, + config->working_days = bonobo_config_get_long_with_default (db, "/Calendar/Display/WorkingDays", CAL_MONDAY | CAL_TUESDAY | CAL_WEDNESDAY | CAL_THURSDAY | CAL_FRIDAY, NULL); - - config->week_start_day = bonobo_config_get_long_with_default (db, + + config->week_start_day = bonobo_config_get_long_with_default (db, "/Calendar/Display/WeekStartDay", 1, NULL); - + /* If the locale defines 'am' and 'pm' strings then the user has the choice of 12-hour or 24-hour time format, with 12-hour as the default. If the locale doesn't have 'am' and 'pm' strings we have @@ -151,43 +154,43 @@ config_read (void) config->use_24_hour_format = TRUE; } - config->week_start_day = bonobo_config_get_long_with_default (db, + config->week_start_day = bonobo_config_get_long_with_default (db, "/Calendar/Display/WeekStartDay", 1, NULL); - - config->day_start_hour = bonobo_config_get_long_with_default (db, + + config->day_start_hour = bonobo_config_get_long_with_default (db, "/Calendar/Display/DayStartHour", 9, NULL); - - config->day_start_minute = bonobo_config_get_long_with_default (db, + + config->day_start_minute = bonobo_config_get_long_with_default (db, "/Calendar/Display/DayStartMinute", 0, NULL); - - config->day_end_hour = bonobo_config_get_long_with_default (db, + + config->day_end_hour = bonobo_config_get_long_with_default (db, "/Calendar/Display/DayEndHour", 17, NULL); - config->day_end_minute = bonobo_config_get_long_with_default (db, + config->day_end_minute = bonobo_config_get_long_with_default (db, "/Calendar/Display/DayEndMinute", 0, NULL); - config->time_divisions = bonobo_config_get_long_with_default (db, + config->time_divisions = bonobo_config_get_long_with_default (db, "/Calendar/Display/TimeDivisions", 30, NULL); - config->view = bonobo_config_get_long_with_default (db, + config->view = bonobo_config_get_long_with_default (db, "/Calendar/Display/View", 0, NULL); - config->hpane_pos = bonobo_config_get_float_with_default (db, + config->hpane_pos = bonobo_config_get_float_with_default (db, "/Calendar/Display/HPanePosition", 1.0, NULL); - config->vpane_pos = bonobo_config_get_float_with_default (db, + config->vpane_pos = bonobo_config_get_float_with_default (db, "/Calendar/Display/VPanePosition", 1.0, NULL); - config->month_hpane_pos = bonobo_config_get_float_with_default (db, + config->month_hpane_pos = bonobo_config_get_float_with_default (db, "/Calendar/Display/MonthHPanePosition", 0.0, NULL); - config->month_vpane_pos = bonobo_config_get_float_with_default (db, + config->month_vpane_pos = bonobo_config_get_float_with_default (db, "/Calendar/Display/MonthVPanePosition", 1.0, NULL); config->compress_weekend = bonobo_config_get_boolean_with_default (db, "/Calendar/Display/CompressWeekend", TRUE, NULL); - config->show_event_end = bonobo_config_get_boolean_with_default (db, + config->show_event_end = bonobo_config_get_boolean_with_default (db, "/Calendar/Display/ShowEventEndTime", TRUE, NULL); /* 'DateNavigator' settings. */ @@ -216,27 +219,69 @@ config_read (void) else config->hide_completed_tasks_units = CAL_DAYS; + g_free (units); + config->hide_completed_tasks_value = bonobo_config_get_long_with_default ( db, "/Calendar/Tasks/HideCompletedTasksValue", 1, NULL); + /* Confirmation */ config->confirm_delete = bonobo_config_get_boolean_with_default ( db, "/Calendar/Other/ConfirmDelete", TRUE, NULL); + /* Default reminders */ + config->use_default_reminder = bonobo_config_get_boolean_with_default ( + db, "/Calendar/Other/UseDefaultReminder", FALSE, NULL); + + config->default_reminder_interval = bonobo_config_get_long_with_default ( + db, "/Calendar/Other/DefaultReminderInterval", 15, NULL); + + units = bonobo_config_get_string_with_default (db, + "/Calendar/Other/DefaultReminderUnits", "minutes", NULL); + + if (!strcmp (units, "days")) + config->default_reminder_units = CAL_DAYS; + else if (!strcmp (units, "hours")) + config->default_reminder_units = CAL_HOURS; + else + config->default_reminder_units = CAL_MINUTES; /* changed from above because + * if bonobo-config fucks up + * we want minutes, not days! + */ + g_free (units); + bonobo_object_release_unref (db, NULL); } +/* Returns the string representation of a units value */ +static const char * +units_to_string (CalUnits units) +{ + switch (units) { + case CAL_DAYS: + return "days"; + + case CAL_HOURS: + return "hours"; + + case CAL_MINUTES: + return "minutes"; + + default: + g_assert_not_reached (); + return NULL; + } +} void calendar_config_write (void) { Bonobo_ConfigDatabase db; CORBA_Environment ev; - char *units; CORBA_exception_init (&ev); - + db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - + if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { CORBA_exception_free (&ev); return; @@ -251,58 +296,61 @@ calendar_config_write (void) config->default_tasks_uri, NULL); if (config->timezone) - bonobo_config_set_string (db, "/Calendar/Display/Timezone", + bonobo_config_set_string (db, "/Calendar/Display/Timezone", config->timezone, NULL); - bonobo_config_set_long (db, "/Calendar/Display/WorkingDays", + bonobo_config_set_long (db, "/Calendar/Display/WorkingDays", config->working_days, NULL); - bonobo_config_set_boolean (db, "/Calendar/Display/Use24HourFormat", + bonobo_config_set_boolean (db, "/Calendar/Display/Use24HourFormat", config->use_24_hour_format, NULL); - bonobo_config_set_long (db, "/Calendar/Display/WeekStartDay", + bonobo_config_set_long (db, "/Calendar/Display/WeekStartDay", config->week_start_day, NULL); - bonobo_config_set_long (db, "/Calendar/Display/DayStartHour", + bonobo_config_set_long (db, "/Calendar/Display/DayStartHour", config->day_start_hour, NULL); - bonobo_config_set_long (db, "/Calendar/Display/DayStartMinute", + bonobo_config_set_long (db, "/Calendar/Display/DayStartMinute", config->day_start_minute, NULL); - bonobo_config_set_long (db, "/Calendar/Display/DayEndHour", + bonobo_config_set_long (db, "/Calendar/Display/DayEndHour", config->day_end_hour, NULL); - bonobo_config_set_long (db, "/Calendar/Display/DayEndMinute", + bonobo_config_set_long (db, "/Calendar/Display/DayEndMinute", config->day_end_minute, NULL); - bonobo_config_set_boolean (db, "/Calendar/Display/CompressWeekend", + bonobo_config_set_boolean (db, "/Calendar/Display/CompressWeekend", config->compress_weekend, NULL); - bonobo_config_set_boolean (db, "/Calendar/Display/ShowEventEndTime", + bonobo_config_set_boolean (db, "/Calendar/Display/ShowEventEndTime", config->show_event_end, NULL); - bonobo_config_set_boolean (db, - "/Calendar/DateNavigator/ShowWeekNumbers", + bonobo_config_set_boolean (db, + "/Calendar/DateNavigator/ShowWeekNumbers", config->dnav_show_week_no, NULL); - bonobo_config_set_string (db, "/Calendar/Tasks/Colors/TasksDueToday", + bonobo_config_set_string (db, "/Calendar/Tasks/Colors/TasksDueToday", config->tasks_due_today_color, NULL); - bonobo_config_set_string (db, "/Calendar/Tasks/Colors/TasksOverdue", + bonobo_config_set_string (db, "/Calendar/Tasks/Colors/TasksOverdue", config->tasks_overdue_color, NULL); - bonobo_config_set_boolean (db, "/Calendar/Tasks/HideCompletedTasks", + bonobo_config_set_boolean (db, "/Calendar/Tasks/HideCompletedTasks", config->hide_completed_tasks, NULL); - if (config->hide_completed_tasks_units == CAL_MINUTES) - units = "minutes"; - else if (config->hide_completed_tasks_units == CAL_HOURS) - units = "hours"; - else - units = "days"; bonobo_config_set_string (db, - "/Calendar/Tasks/HideCompletedTasksUnits", - units, NULL); - bonobo_config_set_long (db, - "/Calendar/Tasks/HideCompletedTasksValue", + "/Calendar/Tasks/HideCompletedTasksUnits", + units_to_string (config->hide_completed_tasks_units), NULL); + bonobo_config_set_long (db, + "/Calendar/Tasks/HideCompletedTasksValue", config->hide_completed_tasks_value, NULL); bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmDelete", config->confirm_delete, NULL); + bonobo_config_set_boolean (db, "/Calendar/Other/UseDefaultReminder", + config->use_default_reminder, NULL); + + bonobo_config_set_long (db, "/Calendar/Other/DefaultReminderInterval", + config->default_reminder_interval, NULL); + + bonobo_config_set_string (db, "/Calendar/Other/DefaultReminderUnits", + units_to_string (config->default_reminder_units), NULL); + Bonobo_ConfigDatabase_sync (db, &ev); - + bonobo_object_release_unref (db, NULL); CORBA_exception_free (&ev); @@ -317,27 +365,27 @@ calendar_config_write_on_exit (void) CORBA_exception_init (&ev); db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - + if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { CORBA_exception_free (&ev); return; } - bonobo_config_set_long (db, "/Calendar/Display/View", + bonobo_config_set_long (db, "/Calendar/Display/View", config->view, NULL); - bonobo_config_set_long (db, "/Calendar/Display/TimeDivisions", + bonobo_config_set_long (db, "/Calendar/Display/TimeDivisions", config->time_divisions, NULL); - bonobo_config_set_float (db, "/Calendar/Display/HPanePosition", + bonobo_config_set_float (db, "/Calendar/Display/HPanePosition", config->hpane_pos, NULL); - bonobo_config_set_float (db, "/Calendar/Display/VPanePosition", + bonobo_config_set_float (db, "/Calendar/Display/VPanePosition", config->vpane_pos, NULL); - bonobo_config_set_float (db, "/Calendar/Display/MonthHPanePosition", + bonobo_config_set_float (db, "/Calendar/Display/MonthHPanePosition", config->month_hpane_pos, NULL); - bonobo_config_set_float (db, "/Calendar/Display/MonthVPanePosition", + bonobo_config_set_float (db, "/Calendar/Display/MonthVPanePosition", config->month_vpane_pos, NULL); Bonobo_ConfigDatabase_sync (db, &ev); - + bonobo_object_release_unref (db, NULL); CORBA_exception_free (&ev); @@ -689,10 +737,10 @@ calendar_config_set_hide_completed_tasks_value (gint value) /** * calendar_config_get_confirm_delete: - * + * * Queries the configuration value for whether a confirmation dialog is * presented when deleting calendar/tasks items. - * + * * Return value: Whether confirmation is required when deleting items. **/ gboolean @@ -704,7 +752,7 @@ calendar_config_get_confirm_delete (void) /** * calendar_config_set_confirm_delete: * @confirm: Whether confirmation is required when deleting items. - * + * * Sets the configuration value for whether a confirmation dialog is presented * when deleting calendar/tasks items. **/ @@ -915,9 +963,9 @@ on_timezone_dialog_delete_event (GnomeDialog *dialog, /** * calendar_config_get_tasks_due_today_color: - * + * * Queries the color to be used to display tasks that are due today. - * + * * Return value: An X color specification. **/ const char * @@ -930,7 +978,7 @@ calendar_config_get_tasks_due_today_color (void) /** * calendar_config_set_tasks_due_today_color: * @color: X color specification - * + * * Sets the color to be used to display tasks that are due today. **/ void @@ -946,9 +994,9 @@ calendar_config_set_tasks_due_today_color (const char *color) /** * calendar_config_get_tasks_overdue_color: - * + * * Queries the color to be used to display overdue tasks. - * + * * Return value: An X color specification. **/ const char * @@ -961,7 +1009,7 @@ calendar_config_get_tasks_overdue_color (void) /** * calendar_config_set_tasks_overdue_color: * @color: X color specification - * + * * Sets the color to be used to display overdue tasks. **/ void @@ -975,10 +1023,91 @@ calendar_config_set_tasks_overdue_color (const char *color) config->tasks_overdue_color = g_strdup (color); } +/** + * calendar_config_get_use_default_reminder: + * + * Queries whether new appointments should be created with a default reminder. + * + * Return value: Boolean value indicating whether new appointments should be + * created with a default reminder from the values of + * calendar_config_get_default_reminder_interval() and + * calendar_config_get_default_reminder_units(). + **/ +gboolean +calendar_config_get_use_default_reminder (void) +{ + return config->use_default_reminder; +} + +/** + * calendar_config_set_use_default_reminder: + * @value: Whether to create new appointments with a default reminder. + * + * Sets whether newly-created appointments should get a default reminder set + * them. + **/ +void +calendar_config_set_use_default_reminder (gboolean value) +{ + config->use_default_reminder = value; +} + +/** + * calendar_config_get_default_reminder_interval: + * + * Queries the interval for the default reminder of newly-created + * appointments, i.e. 5 in "5 minutes". + * + * Return value: Interval for default reminders. + **/ +int +calendar_config_get_default_reminder_interval (void) +{ + return config->default_reminder_interval; +} + +/** + * calendar_config_set_default_reminder_interval: + * @interval: Interval value, e.g. 5 for "5 minutes". + * + * Sets the interval that should be used for the default reminder in new + * appointments. + **/ +void +calendar_config_set_default_reminder_interval (int interval) +{ + config->default_reminder_interval = interval; +} + +/** + * calendar_config_get_default_reminder_units: + * + * Queries the units of time in which default reminders should be created for + * new appointments, e.g. CAL_MINUTES for "5 minutes". + * + * Return value: Time units for default reminders. + **/ +CalUnits +calendar_config_get_default_reminder_units (void) +{ + return config->default_reminder_units; +} + +/** + * calendar_config_set_default_reminder_units: + * @units: Time units, e.g. CAL_MINUTES for "5 minutes". + * + * Sets the units to be used for default reminders in new appointments. + **/ +void +calendar_config_set_default_reminder_units (CalUnits units) +{ + config->default_reminder_units = units; +} /** * calendar_config_get_hide_completed_tasks_sexp: - * + * * Returns the subexpression to use to filter out completed tasks according * to the config settings. The returned sexp should be freed. **/ |