aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/backup-restore
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/backup-restore')
-rw-r--r--plugins/backup-restore/backup-restore.c56
-rw-r--r--plugins/backup-restore/backup.c36
2 files changed, 46 insertions, 46 deletions
diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c
index d2d4f3aae4..f5b608bb7a 100644
--- a/plugins/backup-restore/backup-restore.c
+++ b/plugins/backup-restore/backup-restore.c
@@ -51,7 +51,7 @@ sanity_check (const char *filename)
g_free (command);
g_message ("Sanity check result %d:%d %d", WIFEXITED (result), WEXITSTATUS (result), result);
-
+
return WIFEXITED (result) && (WEXITSTATUS (result) == 0);
}
@@ -73,7 +73,7 @@ dialog_prompt_user(GtkWindow *parent, const char *string, const char *tag, const
gtk_container_set_border_width((GtkContainer *)check, 12);
gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 0);
gtk_widget_show (check);
-
+
button = gtk_dialog_run ((GtkDialog *) mbox);
if (button == GTK_RESPONSE_YES)
@@ -82,7 +82,7 @@ dialog_prompt_user(GtkWindow *parent, const char *string, const char *tag, const
mask |= BR_START;
gtk_widget_destroy(mbox);
-
+
return mask;
}
@@ -94,17 +94,17 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target)
int response;
dlg = e_file_get_save_filesel(target->target.widget, _("Select name of the Evolution backup file"), NULL, GTK_FILE_CHOOSER_ACTION_SAVE);
-
+
/* dlg = gtk_file_chooser_dialog_new (_("Select name of the Evolution backup file"), GTK_WINDOW (target->target.widget), */
/* GTK_FILE_CHOOSER_ACTION_SAVE, */
/* GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, */
/* GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL); */
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlg), "evolution-backup.tar.gz");
-
+
vbox = gtk_vbox_new (FALSE, 6);
gtk_widget_show (vbox);
-
+
response = gtk_dialog_run (GTK_DIALOG (dlg));
if (response == GTK_RESPONSE_OK) {
char *filename;
@@ -113,19 +113,19 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target)
uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (dlg));
e_file_update_save_path(uri, TRUE);
-
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg));
gtk_widget_destroy (dlg);
-
+
mask = dialog_prompt_user (GTK_WINDOW (target->target.widget), _("_Restart Evolution after backup"), "org.gnome.backup-restore:backup-confirm", NULL);
- if (mask & BR_OK)
+ if (mask & BR_OK)
backup (filename, (mask & BR_START) ? TRUE: FALSE);
g_free (filename);
return;
}
-
+
gtk_widget_destroy (dlg);
}
@@ -137,15 +137,15 @@ org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target)
int response;
dlg = e_file_get_save_filesel(target->target.widget, _("Select name of the Evolution backup file to restore"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN);
-
+
/* dlg = gtk_file_chooser_dialog_new (_("Select Evolution backup file to restore"), GTK_WINDOW (target->target.widget), */
/* GTK_FILE_CHOOSER_ACTION_OPEN, */
/* GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, */
/* GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL); */
-
+
vbox = gtk_vbox_new (FALSE, 6);
gtk_widget_show (vbox);
-
+
response = gtk_dialog_run (GTK_DIALOG (dlg));
if (response == GTK_RESPONSE_OK) {
char *filename;
@@ -153,30 +153,30 @@ org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target)
uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (dlg));
e_file_update_save_path(uri, TRUE);
-
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg));
gtk_widget_destroy (dlg);
-
+
if (sanity_check (filename)) {
guint32 mask;
-
+
mask = dialog_prompt_user (GTK_WINDOW (target->target.widget), _("_Restart Evolution after restore"), "org.gnome.backup-restore:restore-confirm", NULL);
- if (mask & BR_OK)
+ if (mask & BR_OK)
restore (filename, mask & BR_START);
} else {
e_error_run (GTK_WINDOW (target->target.widget), "org.gnome.backup-restore:invalid-backup", NULL);
}
-
+
g_free (filename);
return;
}
-
+
gtk_widget_destroy (dlg);
}
static void
-check_toggled (GtkToggleButton *button, GnomeDruid *druid)
+check_toggled (GtkToggleButton *button, GnomeDruid *druid)
{
GtkWidget *box = g_object_get_data ((GObject *)button, "box");
gboolean state = gtk_toggle_button_get_active ((GtkToggleButton *)button);
@@ -184,17 +184,17 @@ check_toggled (GtkToggleButton *button, GnomeDruid *druid)
gtk_widget_set_sensitive (box, state);
gnome_druid_set_show_finish (druid, state);
- if (state && !prevfile)
+ if (state && !prevfile)
gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, TRUE);
else
gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE, TRUE);
g_object_set_data ((GObject *)druid, "restore", GINT_TO_POINTER (state?1:0));
-
+
}
static void
-restore_wizard (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data)
+restore_wizard (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data)
{
gboolean state = GPOINTER_TO_INT(g_object_get_data((GObject *)druid, "restore")) ? TRUE:FALSE;
char *file = g_object_get_data ((GObject *)druid, "restore-file");
@@ -204,7 +204,7 @@ restore_wizard (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data
e_error_run ((GtkWindow *)druid, "org.gnome.backup-restore:invalid-backup", NULL);
} else
restore (file, TRUE);
-
+
}
}
@@ -216,14 +216,14 @@ file_changed (GtkFileChooser *chooser, GnomeDruid *druid)
uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (chooser));
e_file_update_save_path(uri, TRUE);
-
+
file = gtk_file_chooser_get_filename (chooser);
prevfile = g_object_get_data ((GObject *)druid, "restore-file");
g_object_set_data ((GObject *)druid, "restore-file", file);
g_free (prevfile);
if (file) {
gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE, TRUE);
- } else
+ } else
gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, TRUE);
}
@@ -232,14 +232,14 @@ backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
{
GtkWidget *page;
GtkWidget *box, *hbox, *label, *cbox, *button;
-
+
page = gnome_druid_page_standard_new_with_vals (_("Restore from backup"), NULL, NULL);
hbox = gtk_hbox_new (FALSE, 6);
label = gtk_label_new (_("You can restore Evolution from your backup. It can restore all the Mails, Calendars, Tasks, Memos, Contacts. \nIt also restores all your personal settings, mail filters etc."));
gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 6);
box = gtk_vbox_new (FALSE, 6);
gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0);
-
+
hbox = gtk_hbox_new (FALSE, 6);
cbox = gtk_check_button_new_with_mnemonic (_("_Restore Evolution from the backup file"));
g_signal_connect (cbox, "toggled", G_CALLBACK (check_toggled), hook_data->parent);
diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c
index 90d389e239..ec3e0b16be 100644
--- a/plugins/backup-restore/backup.c
+++ b/plugins/backup-restore/backup.c
@@ -59,7 +59,7 @@ static const GOptionEntry options[] = {
#define CANCEL(x) if (x) return;
static void
-backup (const char *filename)
+backup (const char *filename)
{
char *command;
@@ -91,17 +91,17 @@ backup (const char *filename)
CANCEL (complete);
txt = _("Restarting Evolution");
complete=TRUE;
-
+
s (EVOLUTION);
}
}
static void
-restore (const char *filename)
+restore (const char *filename)
{
char *command;
-
+
/* FIXME Will the versioned setting always work? */
CANCEL (complete);
txt = _("Shutting down Evolution");
@@ -127,7 +127,7 @@ restore (const char *filename)
s ("rm -rf " GCONF_DUMP_PATH);
s ("rm -rf " EVOLUTION_DIR_BACKUP);
s ("rm -rf ~/.camel_certs_old");
-
+
if (restart_arg) {
CANCEL (complete);
txt = _("Restarting Evolution");
@@ -138,14 +138,14 @@ restore (const char *filename)
}
static void
-check (const char *filename)
+check (const char *filename)
{
char *command;
command = g_strdup_printf ("tar ztf %s | grep -e \"^\\.evolution/$\"", filename);
result = system (command);
g_free (command);
-
+
g_message ("First result %d", result);
if (result)
exit (result);
@@ -158,7 +158,7 @@ check (const char *filename)
}
-static gboolean
+static gboolean
pbar_update()
{
if (!complete) {
@@ -171,7 +171,7 @@ pbar_update()
return FALSE;
}
-static gpointer
+static gpointer
thread_start (gpointer data)
{
if (backup_op)
@@ -182,11 +182,11 @@ thread_start (gpointer data)
check (chk_file);
complete = TRUE;
-
+
return GINT_TO_POINTER(result);
}
-static gboolean
+static gboolean
idle_cb(gpointer data)
{
GThread *t;
@@ -207,11 +207,11 @@ dlg_response (GtkWidget *dlg, gint response, gpointer data)
{
/* We will cancel only backup/restore operations and not the check operation */
complete = TRUE;
-
+
/* If the response is not of delete_event then destroy the event */
if (response != GTK_RESPONSE_NONE)
gtk_widget_destroy (dlg);
-
+
/* We will kill just the tar operation. Rest of the them will be just a second of microseconds.*/
s ("pkill tar");
@@ -233,7 +233,7 @@ main (int argc, char **argv)
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
- program = gnome_program_init (PACKAGE, VERSION, LIBGNOME_MODULE, argc, argv,
+ program = gnome_program_init (PACKAGE, VERSION, LIBGNOME_MODULE, argc, argv,
GNOME_PROGRAM_STANDARD_PROPERTIES,
GNOME_PARAM_GOPTION_CONTEXT, context,
GNOME_PARAM_NONE);
@@ -267,9 +267,9 @@ main (int argc, char **argv)
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
NULL);
- if (oper && file)
+ if (oper && file)
str = g_strdup_printf(oper, file);
-
+
vbox = gtk_vbox_new (FALSE, 6);
if (str) {
hbox = gtk_hbox_new (FALSE, 12);
@@ -285,7 +285,7 @@ main (int argc, char **argv)
gtk_box_pack_start ((GtkBox *)vbox, hbox, FALSE, FALSE, 0);
-
+
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(progress_dialog)->vbox), vbox);
gtk_window_set_default_size ((GtkWindow *) progress_dialog,450, 120);
g_signal_connect (progress_dialog, "response", G_CALLBACK(dlg_response), NULL);
@@ -298,6 +298,6 @@ main (int argc, char **argv)
g_idle_add (idle_cb, NULL);
gtk_main ();
-
+
return result;
}