aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/tasks-control.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-01-03 23:01:46 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-01-03 23:01:46 +0800
commit0fe2d5201603163b11341cb3719500fa762bc532 (patch)
tree3441593f37dc1a3de3bc534fdc969060e6cdf987 /calendar/gui/tasks-control.c
parentc3cc401ac8aee97bd9625ea5d420ce2bf70363bd (diff)
downloadgsoc2013-evolution-0fe2d5201603163b11341cb3719500fa762bc532.tar
gsoc2013-evolution-0fe2d5201603163b11341cb3719500fa762bc532.tar.gz
gsoc2013-evolution-0fe2d5201603163b11341cb3719500fa762bc532.tar.bz2
gsoc2013-evolution-0fe2d5201603163b11341cb3719500fa762bc532.tar.lz
gsoc2013-evolution-0fe2d5201603163b11341cb3719500fa762bc532.tar.xz
gsoc2013-evolution-0fe2d5201603163b11341cb3719500fa762bc532.tar.zst
gsoc2013-evolution-0fe2d5201603163b11341cb3719500fa762bc532.zip
confirm expunging of the tasks (tasks_control_expunge_cmd): verb callback
2002-01-03 JP Rosevear <jpr@ximian.com> * gui/tasks-control.c (confirm_expunge): confirm expunging of the tasks (tasks_control_expunge_cmd): verb callback * gui/calendar-config.c (config_read): read confirm expunge value (calendar_config_write): write confirm expunge value (calendar_config_write_on_exit): ditto (calendar_config_get_confirm_expunge): get value (calendar_config_set_confirm_expunge): set value * gui/calendar-config.h: new proto * gui/e-itip-control.c (start_calendar_server): kill warning * gui/e-tasks.c (e_tasks_init): init query member to NULL (set_status_message): util function to set status message (e_tasks_open): use above (cal_opened_cb): ditto (create_sexp): create sexp of items to be deleted (query_obj_updated_cb): remove any items found (query_eval_error_cb): bail out on error (query_query_done_cb): tidy when done (e_tasks_delete_completed): set up query * gui/e-tasks.h: new proto * gui/calendar-model.c (query_query_done_cb): use g_warning instead of printing to stderr (query_eval_error_cb): ditto (update_query): clear the status message if we can't create the query * gui/tag-calendar.c (resolve_tzid_cb): make this static svn path=/trunk/; revision=15233
Diffstat (limited to 'calendar/gui/tasks-control.c')
-rw-r--r--calendar/gui/tasks-control.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 57d3623090..504342fa88 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -26,8 +26,13 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-stock.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-ui-util.h>
+#include <gal/widgets/e-gui-utils.h>
+#include <e-util/e-dialog-utils.h>
#include "dialogs/cal-prefs-dialog.h"
#include "calendar-config.h"
#include "calendar-commands.h"
@@ -74,6 +79,9 @@ static void tasks_control_paste_cmd (BonoboUIComponent *uic,
static void tasks_control_delete_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
+static void tasks_control_expunge_cmd (BonoboUIComponent *uic,
+ gpointer data,
+ const char *path);
static void tasks_control_settings_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
@@ -238,6 +246,7 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("TasksCopy", tasks_control_copy_cmd),
BONOBO_UI_VERB ("TasksPaste", tasks_control_paste_cmd),
BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd),
+ BONOBO_UI_VERB ("TasksExpunge", tasks_control_expunge_cmd),
BONOBO_UI_VERB ("TasksSettings", tasks_control_settings_cmd),
BONOBO_UI_VERB_END
@@ -387,6 +396,91 @@ tasks_control_delete_cmd (BonoboUIComponent *uic,
e_tasks_delete_selected (tasks);
}
+static gboolean
+confirm_expunge (ETasks *tasks)
+{
+ GtkWidget *dialog, *label, *checkbox;
+ int button, val;
+ char *text = NULL;
+
+ if (!calendar_config_get_confirm_expunge ())
+ return TRUE;
+
+ dialog = gnome_dialog_new (_("Warning"),
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+ e_gnome_dialog_set_parent (GNOME_DIALOG (dialog),
+ GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (tasks),
+ GTK_TYPE_WINDOW)));
+
+ val = calendar_config_get_hide_completed_tasks_value ();
+ if (val == 0) {
+ text = g_strdup (_("This operation will permanently erase all tasks marked as completed. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"));
+ } else {
+ int units;
+
+ units = calendar_config_get_hide_completed_tasks_units ();
+ switch (units) {
+ case CAL_DAYS:
+ if (val == 1)
+ text = g_strdup (_("This operation will permanently erase all tasks marked as completed on or before 1 day ago. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"));
+ else
+ text = g_strdup_printf (_("This operation will permanently erase all tasks marked as completed on or before %d days ago. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"), val);
+ break;
+ case CAL_HOURS:
+ if (val == 1)
+ text = g_strdup (_("This operation will permanently erase all tasks marked as completed on or before 1 hour ago. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"));
+ else
+ text = g_strdup_printf (_("This operation will permanently erase all tasks marked as completed on or before %d hours ago. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"), val);
+ break;
+ case CAL_MINUTES:
+ if (val == 1)
+ text = g_strdup (_("This operation will permanently erase all tasks marked as completed on or before 1 minute ago. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"));
+ else
+ text = g_strdup_printf (_("This operation will permanently erase all tasks marked as completed on or before %d minutes ago. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"), val);
+ break;
+ }
+ }
+ label = gtk_label_new (text);
+ g_free (text);
+
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
+
+ checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
+ gtk_widget_show (checkbox);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
+
+ button = gnome_dialog_run (GNOME_DIALOG (dialog));
+
+ if (button == 0 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
+ calendar_config_set_confirm_expunge (FALSE);
+
+ gnome_dialog_close (GNOME_DIALOG (dialog));
+
+ if (button == 0)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static void
+tasks_control_expunge_cmd (BonoboUIComponent *uic,
+ gpointer data,
+ const char *path)
+{
+ ETasks *tasks;
+
+ tasks = E_TASKS (data);
+
+ if (confirm_expunge (tasks))
+ e_tasks_delete_completed (tasks);
+}
+
+
/* Callback used for the tasks settings command */
static void
tasks_control_settings_cmd (BonoboUIComponent *uic, gpointer data, const char *path)