Re: backup deleting old files



> this patch stops the extra backup dirs from being moved (anything under
>  5 chars, actually), creates the dirs at load time (not every backed-up
> file :-).
> 
> pls. apply to cvs (assuming you approve, of course :)
and this - it adds the capplet option.

can someone pls. check to make sure its 'correct'. i only know that it
'works'. thanks,

mibus
--
Robert Mibus <mibus@bigpond.com>
Staff meeting in the conference room in %d minutes.

--- backup-conduit-control-applet.c.orig	Sat Jul 29 22:10:11 2000
+++ backup-conduit-control-applet.c	Sat Jul 29 22:04:18 2000
@@ -293,6 +293,13 @@
 	capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
    }
 }
+
+static void adj_change_cb(GtkWidget *widget, gpointer data)
+{
+	if (!ignore_changes)
+		capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
+}
+
 static GtkWidget
 *createStateCfgWindow(void)
 {
@@ -356,11 +363,12 @@
 {
 	GtkWidget *vbox, *table;
 	GtkWidget *entry, *label;
-	GtkWidget *button;
+	GtkWidget *button, *spin;
+	GtkObject *adjustment;
 
 	vbox = gtk_vbox_new(FALSE, GNOME_PAD);
 
-	table = gtk_table_new(2, 3, FALSE);
+	table = gtk_table_new(2, 4, FALSE);
 	gtk_table_set_row_spacings(GTK_TABLE(table), 4);
 	gtk_table_set_col_spacings(GTK_TABLE(table), 10);
 	gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
@@ -401,7 +409,16 @@
 			   GTK_SIGNAL_FUNC(button_toggled_cb),
 			   NULL);
 
+	label = gtk_label_new(_("# of old backups to keep"));
+	gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3,4);
 
+	adjustment = gtk_adjustment_new (0, 0, 100, 1, 1, 1);
+	spin = gtk_spin_button_new (GTK_ADJUSTMENT(adjustment), 1, 0);
+	gtk_object_set_data(GTK_OBJECT(vbox), "no_of_backups", adjustment);
+	gtk_table_attach_defaults(GTK_TABLE(table), spin, 1, 2, 3, 4);
+	gtk_signal_connect(GTK_OBJECT(adjustment), "value_changed",
+					   GTK_SIGNAL_FUNC(adj_change_cb),
+					   NULL);
 	return vbox;
 }
 
@@ -409,20 +426,24 @@
 setOptionsCfg(GtkWidget *pilotcfg, ConduitCfg *state)
 {
 	GtkWidget *dir,*updated_only,*remove_deleted;
+	GtkObject *adj;
 
 	dir  = gtk_object_get_data(GTK_OBJECT(pilotcfg), "dir");
 	updated_only = gtk_object_get_data(GTK_OBJECT(pilotcfg), "only_changed");
 	remove_deleted = gtk_object_get_data(GTK_OBJECT(pilotcfg), "remove_local");
+	adj = gtk_object_get_data(GTK_OBJECT(pilotcfg), "no_of_backups");
 
 	g_assert(dir!=NULL);
 	g_assert(updated_only!=NULL);
 	g_assert(remove_deleted!=NULL);
+	g_assert(adj!=NULL);
 
 	ignore_changes = TRUE;
 
 	gtk_entry_set_text(GTK_ENTRY(dir), state->backup_dir);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(updated_only), state->updated_only);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remove_deleted), state->remove_deleted);
+	gtk_adjustment_set_value (GTK_ADJUSTMENT(adj), state->no_of_backups);
 
 	ignore_changes = FALSE;
 }
@@ -432,14 +453,17 @@
 readOptionsCfg(GtkWidget *pilotcfg, ConduitCfg *state)
 {
 	GtkWidget *dir,*updated_only,*remove_deleted;
+	GtkObject *adj;
 
 	dir  = gtk_object_get_data(GTK_OBJECT(pilotcfg), "dir");
 	updated_only = gtk_object_get_data(GTK_OBJECT(pilotcfg), "only_changed");
 	remove_deleted = gtk_object_get_data(GTK_OBJECT(pilotcfg), "remove_local");
-  
+	adj = gtk_object_get_data(GTK_OBJECT(pilotcfg), "no_of_backups");
+
 	state->backup_dir = g_strdup(gtk_entry_get_text(GTK_ENTRY(dir)));
 	state->updated_only = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(updated_only));
 	state->remove_deleted = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remove_deleted));
+	state->no_of_backups = GTK_ADJUSTMENT(adj)->value;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]