diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-07-17 07:15:04 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-07-17 07:15:04 +0800 |
commit | 96d8c5e1a3ade337ee1e7dcbe81b2b52d2a90901 (patch) | |
tree | c4151f2597d4d74d966f4bfd0c3aa1f33a5fae20 /calendar/gui/calendar-commands.c | |
parent | a15a6521f85105956a651e96e7e671f7b819ff95 (diff) | |
download | gsoc2013-evolution-96d8c5e1a3ade337ee1e7dcbe81b2b52d2a90901.tar.gz gsoc2013-evolution-96d8c5e1a3ade337ee1e7dcbe81b2b52d2a90901.tar.zst gsoc2013-evolution-96d8c5e1a3ade337ee1e7dcbe81b2b52d2a90901.zip |
new function, which uses a CalQuery to retrieve the objects older than a
2003-07-16 Rodrigo Moya <rodrigo@ximian.com>
* gui/gnome-cal.[ch] (gnome_calendar_purge): new function,
which uses a CalQuery to retrieve the objects older than a given date.
(check_instance_cb): callback for cal_recur_generate_instances.
(purging_obj_updated_cb): call check_instance_cb on each recurrence
to double-check the event can be deleted.
(purging_query_done_cb, purging_eval_error_cb): needed callbacks to
finish the query.
(gnome_calendar_destroy): free new members.
* gui/calendar-commands.c (purge_cmd): added implementation for the
'Purge' menu item.
svn path=/trunk/; revision=21846
Diffstat (limited to 'calendar/gui/calendar-commands.c')
-rw-r--r-- | calendar/gui/calendar-commands.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index ce921bbc44..82cf5e1976 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -36,7 +36,8 @@ #include <gtk/gtkfilesel.h> #include <gtk/gtkmain.h> #include <gtk/gtksignal.h> - +#include <gtk/gtkspinbutton.h> +#include <gtk/gtkmessagedialog.h> #include <libgnome/gnome-util.h> #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-messagebox.h> @@ -338,6 +339,54 @@ publish_freebusy_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path) } } +static void +purge_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path) +{ + GnomeCalendar *gcal; + GtkWidget *dialog, *parent, *box, *label, *spin, *unit; + int response; + + gcal = GNOME_CALENDAR (data); + + /* create the dialog */ + parent = gtk_widget_get_toplevel (GTK_WIDGET (gcal)); + dialog = gtk_message_dialog_new ( + parent, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK_CANCEL, + _("This operation will permanently erase all events older than the selected amount of time. If you continue, you will not be able to recover these events.")); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); + + box = gtk_hbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), box, TRUE, FALSE, 6); + + label = gtk_label_new (_("Purge events older than")); + gtk_box_pack_start (GTK_BOX (box), label, TRUE, FALSE, 6); + spin = gtk_spin_button_new_with_range (0.0, 1000.0, 1.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 60.0); + gtk_box_pack_start (GTK_BOX (box), spin, FALSE, FALSE, 6); + label = gtk_label_new (_("days")); + gtk_box_pack_start (GTK_BOX (box), label, TRUE, FALSE, 6); + + gtk_widget_show_all (box); + + /* run the dialog */ + response = gtk_dialog_run (GTK_DIALOG (dialog)); + if (response == GTK_RESPONSE_OK) { + gint days; + time_t tt; + + days = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)); + tt = time (NULL); + tt -= (days * (24 * 3600)); + + gnome_calendar_purge (gcal, tt); + } + + gtk_widget_destroy (dialog); +} + /* Does a queryInterface on the control's parent control frame for the ShellView interface */ static GNOME_Evolution_ShellView get_shell_view_interface (BonoboControl *control) @@ -719,6 +768,7 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("ShowMonthView", show_month_view_clicked), BONOBO_UI_VERB ("PublishFreeBusy", publish_freebusy_cmd), + BONOBO_UI_VERB ("CalendarPurge", purge_cmd), BONOBO_UI_VERB_END }; |