diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-09-19 04:56:38 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-09-19 04:56:38 +0800 |
commit | 54141f67b759d3533605a06305ead06d1d3ec4f7 (patch) | |
tree | b8793851ff338d1e79e1bfa98ca4c5623e4caeed | |
parent | cc2f35f2b15566cbd90f673ec2f7d3caa017a988 (diff) | |
download | gsoc2013-evolution-54141f67b759d3533605a06305ead06d1d3ec4f7.tar gsoc2013-evolution-54141f67b759d3533605a06305ead06d1d3ec4f7.tar.gz gsoc2013-evolution-54141f67b759d3533605a06305ead06d1d3ec4f7.tar.bz2 gsoc2013-evolution-54141f67b759d3533605a06305ead06d1d3ec4f7.tar.lz gsoc2013-evolution-54141f67b759d3533605a06305ead06d1d3ec4f7.tar.xz gsoc2013-evolution-54141f67b759d3533605a06305ead06d1d3ec4f7.tar.zst gsoc2013-evolution-54141f67b759d3533605a06305ead06d1d3ec4f7.zip |
Fixes bug #2830.
2001-09-18 Federico Mena Quintero <federico@ximian.com>
Fixes bug #2830.
* gui/calendar-config.c (calendar_config_get_confirm_delete): New
function.
(calendar_config_set_confirm_delete): New function.
(config_read): Get the default value for the ConfirmDelete option.
(calendar_config_write): Set the value of ConfirmDelete.
* gui/dialogs/delete-comp.c (delete_component_dialog): Handle the
configuration option for confirmation.
* gui/dialogs/cal-prefs-dialog.c (CalPrefsDialogPrivate): Added
the fields for the Other page.
(get_widgets): Handle the new widgets.
(cal_prefs_dialog_show_config): Likewise.
(cal_prefs_dialog_update_config): Likewise.
svn path=/trunk/; revision=12953
-rw-r--r-- | calendar/ChangeLog | 19 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 32 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 62 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.glade | 8 | ||||
-rw-r--r-- | calendar/gui/dialogs/delete-comp.c | 12 |
6 files changed, 109 insertions, 28 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 3ec0905c43..ac79893664 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,22 @@ +2001-09-18 Federico Mena Quintero <federico@ximian.com> + + Fixes bug #2830. + + * gui/calendar-config.c (calendar_config_get_confirm_delete): New + function. + (calendar_config_set_confirm_delete): New function. + (config_read): Get the default value for the ConfirmDelete option. + (calendar_config_write): Set the value of ConfirmDelete. + + * gui/dialogs/delete-comp.c (delete_component_dialog): Handle the + configuration option for confirmation. + + * gui/dialogs/cal-prefs-dialog.c (CalPrefsDialogPrivate): Added + the fields for the Other page. + (get_widgets): Handle the new widgets. + (cal_prefs_dialog_show_config): Likewise. + (cal_prefs_dialog_update_config): Likewise. + 2001-09-18 Rodrigo Moya <rodrigo@ximian.com> * cal-client/cal-client-multi.[ch]: new class for managing multiple diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index aed61238ec..995eac2fb3 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -65,6 +65,7 @@ typedef struct gboolean hide_completed_tasks; CalUnits hide_completed_tasks_units; gint hide_completed_tasks_value; + gboolean confirm_delete; } CalendarConfig; @@ -208,6 +209,8 @@ config_read (void) config->hide_completed_tasks_value = bonobo_config_get_long_with_default ( db, "/Calendar/Tasks/HideCompletedTasksValue", 1, NULL); + config->confirm_delete = bonobo_config_get_boolean_with_default ( + db, "/Calendar/Other/ConfirmDelete", TRUE, NULL); bonobo_object_release_unref (db, NULL); } @@ -278,6 +281,8 @@ calendar_config_write (void) "/Calendar/Tasks/HideCompletedTasksValue", config->hide_completed_tasks_value, NULL); + bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmDelete", config->confirm_delete, NULL); + Bonobo_ConfigDatabase_sync (db, &ev); bonobo_object_release_unref (db, NULL); @@ -626,6 +631,33 @@ calendar_config_set_hide_completed_tasks_value (gint value) config->hide_completed_tasks_value = 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 +calendar_config_get_confirm_delete (void) +{ + return config->confirm_delete; +} + +/** + * 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. + **/ +void +calendar_config_set_confirm_delete (gboolean confirm) +{ + config->confirm_delete = confirm; +} + /* This sets all the common config settings for an ECalendar widget. These are the week start day, and whether we show week numbers. */ diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index d579cd8190..dac55611d1 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -148,6 +148,10 @@ void calendar_config_set_hide_completed_tasks_units(CalUnits units); gint calendar_config_get_hide_completed_tasks_value(void); void calendar_config_set_hide_completed_tasks_value(gint value); +/* Confirmation options */ +gboolean calendar_config_get_confirm_delete (void); +void calendar_config_set_confirm_delete (gboolean confirm); + /* Convenience functions to configure common properties of ECalendar, EDateEdit & ECalendarTable widgets, and the ECellDateEdit ETable cell. */ diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 0b3d43e98b..2cd3872881 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -68,6 +68,12 @@ struct _CalPrefsDialogPrivate { GtkWidget *tasks_hide_completed_checkbutton; GtkWidget *tasks_hide_completed_spinbutton; GtkWidget *tasks_hide_completed_optionmenu; + + /* Other page options */ + GtkWidget *confirm_delete; + GtkWidget *default_reminder; + GtkWidget *default_reminder_interval; + GtkWidget *default_reminder_units; }; static const int week_start_day_map[] = { @@ -239,6 +245,11 @@ get_widgets (CalPrefsDialog *prefs) priv->tasks_hide_completed_spinbutton = GW ("tasks-hide-completed-spinbutton"); priv->tasks_hide_completed_optionmenu = GW ("tasks-hide-completed-optionmenu"); + priv->confirm_delete = GW ("confirm-delete"); + priv->default_reminder = GW ("default-reminder"); + priv->default_reminder_interval = GW ("default-reminder-interval"); + priv->default_reminder_units = GW ("default-reminder-units"); + #undef GW return (priv->dialog @@ -264,7 +275,11 @@ get_widgets (CalPrefsDialog *prefs) && priv->tasks_overdue_color && priv->tasks_hide_completed_checkbutton && priv->tasks_hide_completed_spinbutton - && priv->tasks_hide_completed_optionmenu); + && priv->tasks_hide_completed_optionmenu + && priv->confirm_delete + && priv->default_reminder + && priv->default_reminder_interval + && priv->default_reminder_units); } @@ -497,7 +512,7 @@ cal_prefs_dialog_show_config (CalPrefsDialog *prefs) working_days = calendar_config_get_working_days (); mask = 1 << 0; for (day = 0; day < 7; day++) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->working_days[day]), (working_days & mask) ? TRUE : FALSE); + e_dialog_toggle_set (priv->working_days[day], (working_days & mask) ? TRUE : FALSE); mask <<= 1; } @@ -518,9 +533,9 @@ cal_prefs_dialog_show_config (CalPrefsDialog *prefs) /* 12/24 Hour Format. */ if (calendar_config_get_24_hour_format ()) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_24_hour), TRUE); + e_dialog_toggle_set (priv->use_24_hour, TRUE); else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_12_hour), TRUE); + e_dialog_toggle_set (priv->use_12_hour, TRUE); sensitive = calendar_config_locale_supports_12_hour_format (); gtk_widget_set_sensitive (priv->use_12_hour, sensitive); @@ -533,18 +548,21 @@ cal_prefs_dialog_show_config (CalPrefsDialog *prefs) time_division_map); /* Show Appointment End Times. */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->show_end_times), - calendar_config_get_show_event_end ()); + e_dialog_toggle_set (priv->show_end_times, calendar_config_get_show_event_end ()); /* Compress Weekend. */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->compress_weekend), calendar_config_get_compress_weekend ()); + e_dialog_toggle_set (priv->compress_weekend, calendar_config_get_compress_weekend ()); /* Date Navigator - Show Week Numbers. */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->dnav_show_week_no), calendar_config_get_dnav_show_week_no ()); + e_dialog_toggle_set (priv->dnav_show_week_no, calendar_config_get_dnav_show_week_no ()); /* Task list */ show_task_list_config (prefs); + + /* Other page */ + + e_dialog_toggle_set (priv->confirm_delete, calendar_config_get_confirm_delete ()); } /* Returns a pointer to a static string with an X color spec for the current @@ -597,49 +615,51 @@ cal_prefs_dialog_update_config (CalPrefsDialog *prefs) working_days = 0; mask = 1 << 0; for (day = 0; day < 7; day++) { - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->working_days[day]))) + if (e_dialog_toggle_get (priv->working_days[day])) working_days |= mask; mask <<= 1; } calendar_config_set_working_days (working_days); /* Week Start Day. */ - week_start_day = e_dialog_option_menu_get (priv->week_start_day, - week_start_day_map); + week_start_day = e_dialog_option_menu_get (priv->week_start_day, week_start_day_map); calendar_config_set_week_start_day (week_start_day); /* Start of Day. */ - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_of_day), - &hour, &minute); + e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_of_day), &hour, &minute); calendar_config_set_day_start_hour (hour); calendar_config_set_day_start_minute (minute); /* End of Day. */ - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_of_day), - &hour, &minute); + e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_of_day), &hour, &minute); calendar_config_set_day_end_hour (hour); calendar_config_set_day_end_minute (minute); /* 12/24 Hour Format. */ - calendar_config_set_24_hour_format (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_24_hour))); + calendar_config_set_24_hour_format (e_dialog_toggle_get (priv->use_24_hour)); /* Time Divisions. */ - time_divisions = e_dialog_option_menu_get (priv->time_divisions, - time_division_map); + time_divisions = e_dialog_option_menu_get (priv->time_divisions, time_division_map); calendar_config_set_time_divisions (time_divisions); /* Show Appointment End Times. */ - calendar_config_set_show_event_end (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->show_end_times))); + calendar_config_set_show_event_end (e_dialog_toggle_get (priv->show_end_times)); /* Compress Weekend. */ - calendar_config_set_compress_weekend (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->compress_weekend))); + calendar_config_set_compress_weekend (e_dialog_toggle_get (priv->compress_weekend)); /* Date Navigator - Show Week Numbers. */ - calendar_config_set_dnav_show_week_no (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->dnav_show_week_no))); + calendar_config_set_dnav_show_week_no (e_dialog_toggle_get (priv->dnav_show_week_no)); /* Task list */ update_task_list_config (prefs); + /* Other page */ + + calendar_config_set_confirm_delete (e_dialog_toggle_get (priv->confirm_delete)); + + /* Done */ + calendar_config_write (); update_all_config_settings (); e_tasks_update_all_config_settings (); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade index ed301e805c..a6eb2ceb66 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ b/calendar/gui/dialogs/cal-prefs-dialog.glade @@ -851,7 +851,7 @@ Days <widget> <class>GtkCheckButton</class> - <name>checkbutton1</name> + <name>confirm-delete</name> <can_focus>True</can_focus> <label>_Ask for confirmation when deleting items</label> <active>False</active> @@ -865,7 +865,7 @@ Days <widget> <class>GtkCheckButton</class> - <name>checkbutton2</name> + <name>default-reminder</name> <can_focus>True</can_focus> <label>Create new appointments with a default _reminder</label> <active>False</active> @@ -909,7 +909,7 @@ Days <widget> <class>GtkSpinButton</class> - <name>spinbutton1</name> + <name>default-reminder-interval</name> <can_focus>True</can_focus> <climb_rate>1</climb_rate> <digits>0</digits> @@ -932,7 +932,7 @@ Days <widget> <class>GtkOptionMenu</class> - <name>optionmenu1</name> + <name>default-reminder-units</name> <can_focus>True</can_focus> <items>Minutes Hours diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index a5ba1162db..39755832cb 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -45,10 +45,13 @@ * @widget: A widget to use as a basis for conversion from UTF8 into font * encoding. * - * Pops up a dialog box asking the user whether he wants to delete a number - * of calendar components. + * Pops up a dialog box asking the user whether he wants to delete a number of + * calendar components. The dialog will not appear, however, if the + * configuration option for confirmation is turned off. * - * Return value: TRUE if the user clicked Yes, FALSE otherwise. + * Return value: TRUE if the user clicked Yes, FALSE otherwise. If the + * configuration option for confirmation is turned off, this function will + * unconditionally return TRUE. **/ gboolean delete_component_dialog (CalComponent *comp, @@ -69,6 +72,9 @@ delete_component_dialog (CalComponent *comp, g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); + if (!calendar_config_get_confirm_delete ()) + return TRUE; + if (comp) { CalComponentText summary; char *tmp; |