aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-03-26 06:19:01 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-03 11:00:41 +0800
commitcd3759369b675e754dbed5ba19894cdd87a63a88 (patch)
tree3eaca93bd8630675c57896da239f5ade32300e40
parent71f5369ebfe5ee1d06b0bd1936cca80abc58e60a (diff)
downloadgsoc2013-evolution-cd3759369b675e754dbed5ba19894cdd87a63a88.tar
gsoc2013-evolution-cd3759369b675e754dbed5ba19894cdd87a63a88.tar.gz
gsoc2013-evolution-cd3759369b675e754dbed5ba19894cdd87a63a88.tar.bz2
gsoc2013-evolution-cd3759369b675e754dbed5ba19894cdd87a63a88.tar.lz
gsoc2013-evolution-cd3759369b675e754dbed5ba19894cdd87a63a88.tar.xz
gsoc2013-evolution-cd3759369b675e754dbed5ba19894cdd87a63a88.tar.zst
gsoc2013-evolution-cd3759369b675e754dbed5ba19894cdd87a63a88.zip
Add 'backup-restore' module.
Replaces the 'backup-restore' plugin.
-rw-r--r--configure.ac4
-rw-r--r--modules/Makefile.am1
-rw-r--r--modules/backup-restore/Makefile.am84
-rw-r--r--modules/backup-restore/e-mail-config-restore-page.c382
-rw-r--r--modules/backup-restore/e-mail-config-restore-page.h81
-rw-r--r--modules/backup-restore/e-mail-config-restore-ready-page.c80
-rw-r--r--modules/backup-restore/e-mail-config-restore-ready-page.h76
-rw-r--r--modules/backup-restore/evolution-backup-restore.c (renamed from plugins/backup-restore/backup-restore.c)419
-rw-r--r--modules/backup-restore/evolution-backup-tool.c (renamed from plugins/backup-restore/backup.c)17
-rw-r--r--modules/backup-restore/org-gnome-backup-restore.error.xml (renamed from plugins/backup-restore/org-gnome-backup-restore.error.xml)4
-rw-r--r--plugins/backup-restore/Makefile.am66
-rw-r--r--plugins/backup-restore/org-gnome-backup-restore.eplug.xml32
12 files changed, 929 insertions, 317 deletions
diff --git a/configure.ac b/configure.ac
index 51f37c03e5..1e8999a6ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1303,7 +1303,7 @@ plugins_base_always="calendar-file calendar-http itip-formatter default-source a
plugins_base="$plugins_base_always"
dist_plugins_base="$plugins_base_always calendar-weather"
-plugins_standard_always="bbdb save-calendar mail-to-task mailing-list-actions prefer-plain mail-notification attachment-reminder backup-restore email-custom-header face templates vcard-inline dbx-import external-editor"
+plugins_standard_always="bbdb save-calendar mail-to-task mailing-list-actions prefer-plain mail-notification attachment-reminder email-custom-header face templates vcard-inline dbx-import external-editor"
plugins_standard="$plugins_standard_always"
dist_plugins_standard="$plugins_standard audio-inline image-inline pst-import"
@@ -1632,6 +1632,7 @@ modules/addressbook/Makefile
modules/bogofilter/Makefile
modules/calendar/Makefile
modules/mail/Makefile
+modules/backup-restore/Makefile
modules/composer-autosave/Makefile
modules/mailto-handler/Makefile
modules/mdn/Makefile
@@ -1648,7 +1649,6 @@ plugins/Makefile
plugins/addressbook-file/Makefile
plugins/attachment-reminder/Makefile
plugins/audio-inline/Makefile
-plugins/backup-restore/Makefile
plugins/bbdb/Makefile
plugins/caldav/Makefile
plugins/calendar-file/Makefile
diff --git a/modules/Makefile.am b/modules/Makefile.am
index ce6c0aa94a..e52034bc42 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -15,6 +15,7 @@ SUBDIRS = \
bogofilter \
calendar \
mail \
+ backup-restore \
composer-autosave \
mailto-handler \
mdn \
diff --git a/modules/backup-restore/Makefile.am b/modules/backup-restore/Makefile.am
new file mode 100644
index 0000000000..42f2477904
--- /dev/null
+++ b/modules/backup-restore/Makefile.am
@@ -0,0 +1,84 @@
+NULL =
+
+module_LTLIBRARIES = module-backup-restore.la
+
+module_backup_restore_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
+ -DG_LOG_DOMAIN=\"evolution-backup-restore\" \
+ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
+ -DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
+ -DPREFIX=\""$(prefix)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DDATADIR=\""$(datadir)"\" \
+ -DLIBDIR=\""$(libdir)"\" \
+ $(EVOLUTION_DATA_SERVER_CFLAGS) \
+ $(GNOME_PLATFORM_CFLAGS) \
+ $(GTKHTML_CFLAGS) \
+ $(NULL)
+
+module_backup_restore_la_SOURCES = \
+ evolution-backup-restore.c \
+ e-mail-config-restore-page.c \
+ e-mail-config-restore-page.h \
+ e-mail-config-restore-ready-page.c \
+ e-mail-config-restore-ready-page.h \
+ $(NULL)
+
+module_backup_restore_la_LIBADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/mail/libevolution-mail.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/libemail-engine/libemail-engine.la \
+ $(top_builddir)/libevolution-utils/libevolution-utils.la \
+ $(EVOLUTION_DATA_SERVER_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
+ $(GTKHTML_LIBS) \
+ $(NULL)
+
+module_backup_restore_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED)
+
+privlibexec_PROGRAMS = evolution-backup
+
+evolution_backup_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
+ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
+ -DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
+ -DPREFIX=\""$(prefix)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DDATADIR=\""$(datadir)"\" \
+ -DLIBDIR=\""$(libdir)"\" \
+ $(EVOLUTION_DATA_SERVER_CFLAGS) \
+ $(GNOME_PLATFORM_CFLAGS) \
+ $(NULL)
+
+evolution_backup_SOURCES = \
+ evolution-backup-tool.c \
+ $(NULL)
+
+evolution_backup_LDADD = \
+ $(top_builddir)/e-util/libeutil.la \
+ $(EVOLUTION_DATA_SERVER_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
+ $(NULL)
+
+if OS_WIN32
+evolution_backup_LDFLAGS = -mwindows
+endif
+
+error_DATA = org-gnome-backup-restore.error
+errordir = $(privdatadir)/errors
+@EVO_PLUGIN_RULE@
+
+BUILT_SOURCES = $(error_DATA)
+
+EXTRA_DIST = \
+ org-gnome-backup-restore.error.xml \
+ $(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/backup-restore/e-mail-config-restore-page.c b/modules/backup-restore/e-mail-config-restore-page.c
new file mode 100644
index 0000000000..fa1a6fd25e
--- /dev/null
+++ b/modules/backup-restore/e-mail-config-restore-page.c
@@ -0,0 +1,382 @@
+/*
+ * e-mail-config-restore-page.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-mail-config-restore-page.h"
+
+#include <config.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#include <glib/gi18n-lib.h>
+
+#include <libevolution-utils/e-alert-sink.h>
+#include <libevolution-utils/e-alert-dialog.h>
+#include <misc/e-alert-bar.h>
+
+#define E_MAIL_CONFIG_RESTORE_PAGE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_CONFIG_RESTORE_PAGE, EMailConfigRestorePagePrivate))
+
+struct _EMailConfigRestorePagePrivate {
+ GtkWidget *toggle_button; /* not referenced */
+ GtkWidget *file_chooser; /* not referenced */
+ GtkWidget *alert_bar; /* not referenced */
+ gchar *filename;
+};
+
+enum {
+ PROP_0,
+ PROP_FILENAME
+};
+
+/* Forward Declarations */
+static void e_mail_config_restore_page_alert_sink_init
+ (EAlertSinkInterface *interface);
+static void e_mail_config_restore_page_interface_init
+ (EMailConfigPageInterface *interface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+ EMailConfigRestorePage,
+ e_mail_config_restore_page,
+ GTK_TYPE_BOX,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (
+ E_TYPE_ALERT_SINK,
+ e_mail_config_restore_page_alert_sink_init)
+ G_IMPLEMENT_INTERFACE_DYNAMIC (
+ E_TYPE_MAIL_CONFIG_PAGE,
+ e_mail_config_restore_page_interface_init))
+
+static void
+mail_config_restore_page_update_filename (EMailConfigRestorePage *page)
+{
+ GtkToggleButton *toggle_button;
+ GtkFileChooser *file_chooser;
+ gchar *filename = NULL;
+
+ file_chooser = GTK_FILE_CHOOSER (page->priv->file_chooser);
+ toggle_button = GTK_TOGGLE_BUTTON (page->priv->toggle_button);
+
+ e_alert_bar_clear (E_ALERT_BAR (page->priv->alert_bar));
+
+ if (gtk_toggle_button_get_active (toggle_button))
+ filename = gtk_file_chooser_get_filename (file_chooser);
+
+ if (!evolution_backup_restore_validate_backup_file (filename)) {
+ if (filename != NULL) {
+ e_alert_submit (
+ E_ALERT_SINK (page),
+ "org.gnome.backup-restore:invalid-backup",
+ NULL);
+ g_free (filename);
+ filename = NULL;
+ }
+ }
+
+ g_free (page->priv->filename);
+ page->priv->filename = filename;
+
+ g_object_notify (G_OBJECT (page), "filename");
+
+ e_mail_config_page_changed (E_MAIL_CONFIG_PAGE (page));
+}
+
+static void
+mail_config_restore_page_toggled_cb (GtkToggleButton *toggle_button,
+ EMailConfigRestorePage *page)
+{
+ mail_config_restore_page_update_filename (page);
+}
+
+static void
+mail_config_restore_page_file_set_cb (GtkFileChooser *file_chooser,
+ EMailConfigRestorePage *page)
+{
+ mail_config_restore_page_update_filename (page);
+}
+
+static void
+mail_config_restore_page_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_FILENAME:
+ g_value_set_string (
+ value,
+ e_mail_config_restore_page_get_filename (
+ E_MAIL_CONFIG_RESTORE_PAGE (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+mail_config_restore_page_finalize (GObject *object)
+{
+ EMailConfigRestorePagePrivate *priv;
+
+ priv = E_MAIL_CONFIG_RESTORE_PAGE_GET_PRIVATE (object);
+
+ g_free (priv->filename);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_mail_config_restore_page_parent_class)->
+ finalize (object);
+}
+
+static void
+mail_config_restore_page_constructed (GObject *object)
+{
+ EMailConfigRestorePage *page;
+ GtkWidget *widget;
+ GtkWidget *container;
+ const gchar *text;
+
+ page = E_MAIL_CONFIG_RESTORE_PAGE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_mail_config_restore_page_parent_class)->
+ constructed (object);
+
+ gtk_orientable_set_orientation (
+ GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL);
+
+ gtk_box_set_spacing (GTK_BOX (page), 24);
+
+ text = _("You can restore Evolution from a backup file.\n\n"
+ "This will restore all your personal data, settings "
+ "mail filters, etc.");
+ widget = gtk_label_new (text);
+ gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ text = _("_Restore from a backup file:");
+ widget = gtk_check_button_new_with_mnemonic (text);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ page->priv->toggle_button = widget; /* not referenced */
+ gtk_widget_show (widget);
+
+ g_signal_connect (
+ widget, "toggled",
+ G_CALLBACK (mail_config_restore_page_toggled_cb), page);
+
+ widget = gtk_file_chooser_button_new (
+ _("Choose a backup file to restore"),
+ GTK_FILE_CHOOSER_ACTION_OPEN);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (widget), TRUE);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ page->priv->file_chooser = widget; /* not referenced */
+ gtk_widget_show (widget);
+
+ g_signal_connect (
+ widget, "file-set",
+ G_CALLBACK (mail_config_restore_page_file_set_cb), page);
+
+ widget = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
+ gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
+ /* Visibility is bound to the EActivityBar. */
+
+ container = widget;
+
+ widget = e_alert_bar_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ page->priv->alert_bar = widget; /* not referenced */
+ /* EActivityBar controls its own visibility. */
+
+ g_object_bind_property (
+ widget, "visible",
+ container, "visible",
+ G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property (
+ page->priv->toggle_button, "active",
+ page->priv->file_chooser, "sensitive",
+ G_BINDING_SYNC_CREATE);
+}
+
+static void
+mail_config_restore_page_submit_alert (EAlertSink *alert_sink,
+ EAlert *alert)
+{
+ EMailConfigRestorePagePrivate *priv;
+ EAlertBar *alert_bar;
+ GtkWidget *dialog;
+ gpointer parent;
+
+ priv = E_MAIL_CONFIG_RESTORE_PAGE_GET_PRIVATE (alert_sink);
+
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (alert_sink));
+ parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
+
+ switch (e_alert_get_message_type (alert)) {
+ case GTK_MESSAGE_INFO:
+ case GTK_MESSAGE_WARNING:
+ case GTK_MESSAGE_ERROR:
+ alert_bar = E_ALERT_BAR (priv->alert_bar);
+ e_alert_bar_add_alert (alert_bar, alert);
+ break;
+
+ default:
+ dialog = e_alert_dialog_new (parent, alert);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ break;
+ }
+}
+
+static gboolean
+mail_config_restore_page_check_complete (EMailConfigPage *page)
+{
+ EMailConfigRestorePagePrivate *priv;
+ GtkToggleButton *toggle_button;
+ gboolean complete;
+
+ priv = E_MAIL_CONFIG_RESTORE_PAGE_GET_PRIVATE (page);
+
+ toggle_button = GTK_TOGGLE_BUTTON (priv->toggle_button);
+
+ complete =
+ !gtk_toggle_button_get_active (toggle_button) ||
+ (priv->filename != NULL && *priv->filename != '\0');
+
+ return complete;
+}
+
+static void
+e_mail_config_restore_page_class_init (EMailConfigRestorePageClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (
+ class, sizeof (EMailConfigRestorePagePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = mail_config_restore_page_get_property;
+ object_class->finalize = mail_config_restore_page_finalize;
+ object_class->constructed = mail_config_restore_page_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILENAME,
+ g_param_spec_string (
+ "filename",
+ "Filename",
+ "Selected filename to restore from",
+ NULL,
+ G_PARAM_READABLE));
+}
+
+static void
+e_mail_config_restore_page_class_finalize (EMailConfigRestorePageClass *class)
+{
+}
+
+static void
+e_mail_config_restore_page_alert_sink_init (EAlertSinkInterface *interface)
+{
+ interface->submit_alert = mail_config_restore_page_submit_alert;
+}
+
+static void
+e_mail_config_restore_page_interface_init (EMailConfigPageInterface *interface)
+{
+ interface->title = _("Restore from Backup");
+ interface->sort_order = E_MAIL_CONFIG_RESTORE_PAGE_SORT_ORDER;
+ interface->check_complete = mail_config_restore_page_check_complete;
+}
+
+static void
+e_mail_config_restore_page_init (EMailConfigRestorePage *page)
+{
+ page->priv = E_MAIL_CONFIG_RESTORE_PAGE_GET_PRIVATE (page);
+}
+
+void
+e_mail_config_restore_page_type_register (GTypeModule *type_module)
+{
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_mail_config_restore_page_register_type (type_module);
+}
+
+EMailConfigPage *
+e_mail_config_restore_page_new (void)
+{
+ return g_object_new (E_TYPE_MAIL_CONFIG_RESTORE_PAGE, NULL);
+}
+
+const gchar *
+e_mail_config_restore_page_get_filename (EMailConfigRestorePage *page)
+{
+ g_return_val_if_fail (E_IS_MAIL_CONFIG_RESTORE_PAGE (page), NULL);
+
+ return page->priv->filename;
+}
+
+gboolean
+evolution_backup_restore_validate_backup_file (const gchar *filename)
+{
+ gchar *command;
+ gint result;
+ gchar *quotedfname;
+ gchar *toolfname;
+ const gchar *basedir;
+
+ if (filename == NULL || *filename == '\0')
+ return FALSE;
+
+ /* FIXME We should be using g_spawn_command_line_sync() here. */
+
+ basedir = EVOLUTION_TOOLSDIR;
+ quotedfname = g_shell_quote (filename);
+ toolfname = g_build_filename (basedir, "evolution-backup", NULL);
+
+ command = g_strdup_printf("%s --check %s", toolfname, quotedfname);
+ result = system (command);
+
+ g_free (command);
+ g_free (quotedfname);
+ g_free (toolfname);
+
+#ifdef HAVE_SYS_WAIT_H
+ g_message (
+ "Sanity check result %d:%d %d",
+ WIFEXITED (result), WEXITSTATUS (result), result);
+
+ return WIFEXITED (result) && (WEXITSTATUS (result) == 0);
+#else
+ return (result == 0);
+#endif
+}
+
diff --git a/modules/backup-restore/e-mail-config-restore-page.h b/modules/backup-restore/e-mail-config-restore-page.h
new file mode 100644
index 0000000000..c6d4221a54
--- /dev/null
+++ b/modules/backup-restore/e-mail-config-restore-page.h
@@ -0,0 +1,81 @@
+/*
+ * e-mail-config-restore-page.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_MAIL_CONFIG_RESTORE_PAGE_H
+#define E_MAIL_CONFIG_RESTORE_PAGE_H
+
+#include <gtk/gtk.h>
+
+#include <mail/e-mail-config-page.h>
+#include <mail/e-mail-config-welcome-page.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_CONFIG_RESTORE_PAGE \
+ (e_mail_config_restore_page_get_type ())
+#define E_MAIL_CONFIG_RESTORE_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_CONFIG_RESTORE_PAGE, EMailConfigRestorePage))
+#define E_MAIL_CONFIG_RESTORE_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_CONFIG_RESTORE_PAGE, EMailConfigRestorePageClass))
+#define E_IS_MAIL_CONFIG_RESTORE_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_CONFIG_RESTORE_PAGE))
+#define E_IS_MAIL_CONFIG_RESTORE_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_CONFIG_RESTORE_PAGE))
+#define E_MAIL_CONFIG_RESTORE_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_CONFIG_RESTORE_PAGE, EMailConfigRestorePageClass))
+
+#define E_MAIL_CONFIG_RESTORE_PAGE_SORT_ORDER \
+ (E_MAIL_CONFIG_WELCOME_PAGE_SORT_ORDER + 10)
+
+G_BEGIN_DECLS
+
+typedef struct _EMailConfigRestorePage EMailConfigRestorePage;
+typedef struct _EMailConfigRestorePageClass EMailConfigRestorePageClass;
+typedef struct _EMailConfigRestorePagePrivate EMailConfigRestorePagePrivate;
+
+struct _EMailConfigRestorePage {
+ GtkBox parent;
+ EMailConfigRestorePagePrivate *priv;
+};
+
+struct _EMailConfigRestorePageClass {
+ GtkBoxClass parent_class;
+};
+
+GType e_mail_config_restore_page_get_type
+ (void) G_GNUC_CONST;
+void e_mail_config_restore_page_type_register
+ (GTypeModule *type_module);
+EMailConfigPage *
+ e_mail_config_restore_page_new (void);
+const gchar * e_mail_config_restore_page_get_filename
+ (EMailConfigRestorePage *page);
+
+/* This is a stand-alone function to validate the given backup file.
+ * It resides in this file because EMailConfigRestorePage uses it. */
+gboolean evolution_backup_restore_validate_backup_file
+ (const gchar *filename);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_RESTORE_PAGE_H */
+
diff --git a/modules/backup-restore/e-mail-config-restore-ready-page.c b/modules/backup-restore/e-mail-config-restore-ready-page.c
new file mode 100644
index 0000000000..2827e67e5b
--- /dev/null
+++ b/modules/backup-restore/e-mail-config-restore-ready-page.c
@@ -0,0 +1,80 @@
+/*
+ * e-mail-config-restore-ready-page.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+/* NOTE: This page is never actually shown to the user. It works as a
+ * placeholder, visible only when the user chooses a backup file
+ * to restore. As soon as we arrive on this page we execl() the
+ * "evolution-backup" tool, and the startup wizard disappears. */
+
+#include "e-mail-config-restore-ready-page.h"
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+
+/* Forward Declarations */
+static void e_mail_config_restore_ready_page_interface_init
+ (EMailConfigPageInterface *interface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+ EMailConfigRestoreReadyPage,
+ e_mail_config_restore_ready_page,
+ GTK_TYPE_BOX,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (
+ E_TYPE_MAIL_CONFIG_PAGE,
+ e_mail_config_restore_ready_page_interface_init))
+
+static void
+e_mail_config_restore_ready_page_class_init (EMailConfigRestoreReadyPageClass *class)
+{
+}
+
+static void
+e_mail_config_restore_ready_page_class_finalize (EMailConfigRestoreReadyPageClass *class)
+{
+}
+
+static void
+e_mail_config_restore_ready_page_interface_init (EMailConfigPageInterface *interface)
+{
+ /* Keep the title identical to EMailConfigRestorePage
+ * so it's only shown once in the assistant sidebar. */
+ interface->title = _("Restore from Backup");
+ interface->sort_order = E_MAIL_CONFIG_RESTORE_READY_PAGE_SORT_ORDER;
+}
+
+static void
+e_mail_config_restore_ready_page_init (EMailConfigRestoreReadyPage *page)
+{
+}
+
+void
+e_mail_config_restore_ready_page_type_register (GTypeModule *type_module)
+{
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_mail_config_restore_ready_page_register_type (type_module);
+}
+
+EMailConfigPage *
+e_mail_config_restore_ready_page_new (void)
+{
+ return g_object_new (E_TYPE_MAIL_CONFIG_RESTORE_READY_PAGE, NULL);
+}
+
diff --git a/modules/backup-restore/e-mail-config-restore-ready-page.h b/modules/backup-restore/e-mail-config-restore-ready-page.h
new file mode 100644
index 0000000000..fb196db1f5
--- /dev/null
+++ b/modules/backup-restore/e-mail-config-restore-ready-page.h
@@ -0,0 +1,76 @@
+/*
+ * e-mail-config-restore-ready-page.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef E_MAIL_CONFIG_RESTORE_READY_PAGE_H
+#define E_MAIL_CONFIG_RESTORE_READY_PAGE_H
+
+#include <gtk/gtk.h>
+
+#include <mail/e-mail-config-page.h>
+
+#include "e-mail-config-restore-page.h"
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_CONFIG_RESTORE_READY_PAGE \
+ (e_mail_config_restore_ready_page_get_type ())
+#define E_MAIL_CONFIG_RESTORE_READY_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_CONFIG_RESTORE_READY_PAGE, EMailConfigRestoreReadyPage))
+#define E_MAIL_CONFIG_RESTORE_READY_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_CONFIG_RESTORE_READY_PAGE, EMailConfigRestoreReadyPageClass))
+#define E_IS_MAIL_CONFIG_RESTORE_READY_PAGE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_CONFIG_RESTORE_READY_PAGE))
+#define E_IS_MAIL_CONFIG_RESTORE_READY_PAGE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_CONFIG_RESTORE_READY_PAGE))
+#define E_MAIL_CONFIG_RESTORE_READY_PAGE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_CONFIG_RESTORE_READY_PAGE, EMailConfigRestoreReadyPageClass))
+
+#define E_MAIL_CONFIG_RESTORE_READY_PAGE_SORT_ORDER \
+ (E_MAIL_CONFIG_RESTORE_PAGE_SORT_ORDER + 1)
+
+G_BEGIN_DECLS
+
+typedef struct _EMailConfigRestoreReadyPage EMailConfigRestoreReadyPage;
+typedef struct _EMailConfigRestoreReadyPageClass EMailConfigRestoreReadyPageClass;
+typedef struct _EMailConfigRestoreReadyPagePrivate EMailConfigRestoreReadyPagePrivate;
+
+struct _EMailConfigRestoreReadyPage {
+ GtkBox parent;
+ EMailConfigRestoreReadyPagePrivate *priv;
+};
+
+struct _EMailConfigRestoreReadyPageClass {
+ GtkBoxClass parent_class;
+};
+
+GType e_mail_config_restore_ready_page_get_type
+ (void) G_GNUC_CONST;
+void e_mail_config_restore_ready_page_type_register
+ (GTypeModule *type_module);
+EMailConfigPage *
+ e_mail_config_restore_ready_page_new
+ (void);
+
+G_END_DECLS
+
+#endif /* E_MAIL_CONFIG_RESTORE_READY_PAGE_H */
+
diff --git a/plugins/backup-restore/backup-restore.c b/modules/backup-restore/evolution-backup-restore.c
index e821113a88..75a070a353 100644
--- a/plugins/backup-restore/backup-restore.c
+++ b/modules/backup-restore/evolution-backup-restore.c
@@ -1,4 +1,5 @@
/*
+ * evolution-backup-restore.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -13,31 +14,31 @@
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
-
#include <unistd.h>
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#include <stdlib.h>
+
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include "mail/em-config.h"
-#include "mail/em-account-editor.h"
-#include "libevolution-utils/e-alert-dialog.h"
-#include "e-util/e-util.h"
-#include "e-util/e-dialog-utils.h"
-#include "shell/e-shell-utils.h"
-#include "shell/e-shell-window.h"
+
+#include <libebackend/e-extension.h>
+
+#include <mail/e-mail-config-assistant.h>
+#include <libevolution-utils/e-alert-dialog.h>
+#include <e-util/e-util.h>
+#include <e-util/e-dialog-utils.h>
+#include <shell/e-shell-utils.h>
+#include <shell/e-shell-window.h>
+
+#include "e-mail-config-restore-page.h"
+#include "e-mail-config-restore-ready-page.h"
#ifdef G_OS_WIN32
#ifdef localtime_r
@@ -49,28 +50,46 @@
(result), localtime (timep), sizeof (*(result))) : 0)
#endif
-gboolean e_plugin_ui_init (GtkUIManager *ui_manager,
- EShellWindow *shell_window);
-GtkWidget * backup_restore_page (EPlugin *ep,
- EConfigHookItemFactoryData *hook_data);
-void backup_restore_commit (EPlugin *ep,
- EMConfigTargetSettings *target);
-void backup_restore_abort (EPlugin *ep,
- EMConfigTargetSettings *target);
-
-typedef enum _br_flags {
- BR_OK = 1 << 0,
+typedef EExtension EvolutionBackupRestoreAssistant;
+typedef EExtensionClass EvolutionBackupRestoreAssistantClass;
+
+typedef EExtension EvolutionBackupRestoreMenuItems;
+typedef EExtensionClass EvolutionBackupRestoreMenuItemsClass;
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType evolution_backup_restore_assistant_get_type (void);
+GType evolution_backup_restore_menu_items_get_type (void);
+
+static const gchar *ui =
+"<ui>"
+" <menubar name='main-menu'>"
+" <menu action='file-menu'>"
+" <placeholder name='file-actions'>"
+" <menuitem action='settings-backup'/>"
+" <menuitem action='settings-restore'/>"
+" </placeholder>"
+" </menu>"
+" </menubar>"
+"</ui>";
+
+G_DEFINE_DYNAMIC_TYPE (
+ EvolutionBackupRestoreAssistant,
+ evolution_backup_restore_assistant,
+ E_TYPE_EXTENSION)
+
+G_DEFINE_DYNAMIC_TYPE (
+ EvolutionBackupRestoreMenuItems,
+ evolution_backup_restore_menu_items,
+ E_TYPE_EXTENSION)
+
+enum {
+ BR_OK = 1 << 0,
BR_START = 1 << 1
-}br_flags;
-
-gint e_plugin_lib_enable (EPlugin *ep, gint enable);
-
-gint
-e_plugin_lib_enable (EPlugin *ep,
- gint enable)
-{
- return 0;
-}
+};
static void
backup (const gchar *filename,
@@ -118,33 +137,6 @@ restore (const gchar *filename,
NULL);
}
-static gboolean
-sanity_check (const gchar *filename)
-{
- gchar *command;
- gint result;
- gchar *quotedfname, *toolfname;
-
- quotedfname = g_shell_quote (filename);
- toolfname = g_build_filename (EVOLUTION_TOOLSDIR, "evolution-backup", NULL);
-
- command = g_strdup_printf("%s --check %s", toolfname, quotedfname);
- result = system (command);
- g_free (command);
- g_free (quotedfname);
- g_free (toolfname);
-
-#ifdef HAVE_SYS_WAIT_H
- g_message (
- "Sanity check result %d:%d %d",
- WIFEXITED (result), WEXITSTATUS (result), result);
-
- return WIFEXITED (result) && (WEXITSTATUS (result) == 0);
-#else
- return result;
-#endif
-}
-
static guint32
dialog_prompt_user (GtkWindow *parent,
const gchar *string,
@@ -290,7 +282,7 @@ action_settings_restore_cb (GtkAction *action,
path = g_file_get_path (file);
- if (sanity_check (path)) {
+ if (evolution_backup_restore_validate_backup_file (path)) {
guint32 mask;
mask = dialog_prompt_user (
@@ -309,183 +301,143 @@ action_settings_restore_cb (GtkAction *action,
g_free (path);
}
-static void
-check_toggled (GtkToggleButton *button,
- GObject *assistant)
-{
- EConfig *config;
- GtkWidget *box;
- gboolean active;
+static GtkActionEntry entries[] = {
- active = gtk_toggle_button_get_active (button);
- box = g_object_get_data (G_OBJECT (button), "box");
- gtk_widget_set_sensitive (box, active);
+ { "settings-backup",
+ NULL,
+ N_("_Back up Evolution Data..."),
+ NULL,
+ N_("Back up Evolution data and settings to an archive file"),
+ G_CALLBACK (action_settings_backup_cb) },
- g_object_set_data (
- assistant, "restore",
- GINT_TO_POINTER (active ? 1 : 0));
+ { "settings-restore",
+ NULL,
+ N_("R_estore Evolution Data..."),
+ NULL,
+ N_("Restore Evolution data and settings from an archive file"),
+ G_CALLBACK (action_settings_restore_cb) }
+};
+
+static gboolean
+evolution_backup_restore_filename_to_visible (GBinding *binding,
+ const GValue *source_value,
+ GValue *target_value,
+ gpointer unused)
+{
+ const gchar *filename;
+ gboolean visible;
- config = g_object_get_data (assistant, "restore-config");
+ filename = g_value_get_string (source_value);
+ visible = (filename != NULL && *filename != '\0');
+ g_value_set_boolean (target_value, visible);
- e_config_target_changed (
- config, E_CONFIG_TARGET_CHANGED_STATE);
+ return TRUE;
}
static void
-file_changed (GtkFileChooser *chooser,
- GObject *assistant)
+evolution_backup_restore_prepare_cb (GtkAssistant *assistant,
+ GtkWidget *page,
+ EMailConfigRestorePage *restore_page)
{
- EConfig *config;
- gchar *file = NULL, *prevfile = NULL;
+ const gchar *filename;
- file = gtk_file_chooser_get_filename (chooser);
- prevfile = g_object_get_data (assistant, "restore-file");
- g_object_set_data (assistant, "restore-file", file);
- g_free (prevfile);
+ /* If we've landed on the EMailConfigRestoreReadyPage, that
+ * means the user has chosen a valid backup file to restore
+ * so start the "evolution-backup" tool immediately. */
- config = g_object_get_data (assistant, "restore-config");
+ filename = e_mail_config_restore_page_get_filename (restore_page);
- e_config_target_changed (
- config, E_CONFIG_TARGET_CHANGED_STATE);
+ if (E_IS_MAIL_CONFIG_RESTORE_READY_PAGE (page))
+ restore (filename, TRUE);
}
-static gboolean
-backup_restore_check (EConfig *ec,
- const gchar *pageid,
- gpointer data)
+static void
+evolution_backup_restore_assistant_constructed (GObject *object)
{
- GObject *assistant = data;
- gboolean do_restore;
- gchar *file;
-
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_ASSISTANT (data), FALSE);
+ EExtension *extension;
+ EExtensible *extensible;
+ EMailConfigAssistant *assistant;
+ const gchar *type_name;
+
+ extension = E_EXTENSION (object);
+ extensible = e_extension_get_extensible (extension);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (evolution_backup_restore_assistant_parent_class)->
+ constructed (object);
+
+ assistant = E_MAIL_CONFIG_ASSISTANT (extensible);
+
+ /* XXX We only want to add the EMailConfigRestorePage to an
+ * EStartupAssistant instance, not a normal EMailConfigAssistant.
+ * But EStartupAssistant is defined in the "startup-wizard" module
+ * and we can't access its GType without knowing its type name, so
+ * just hard-code the type name. */
+ type_name = G_OBJECT_TYPE_NAME (assistant);
+ if (g_strcmp0 (type_name, "EStartupAssistant") == 0) {
+ EMailConfigPage *restore_page;
+ EMailConfigPage *ready_page;
+
+ restore_page = e_mail_config_restore_page_new ();
+ e_mail_config_assistant_add_page (assistant, restore_page);
+
+ ready_page = e_mail_config_restore_ready_page_new ();
+ e_mail_config_assistant_add_page (assistant, ready_page);
+
+ g_object_bind_property_full (
+ restore_page, "filename",
+ ready_page, "visible",
+ G_BINDING_SYNC_CREATE,
+ evolution_backup_restore_filename_to_visible,
+ NULL,
+ NULL, (GDestroyNotify) NULL);
+
+ g_signal_connect (
+ assistant, "prepare",
+ G_CALLBACK (evolution_backup_restore_prepare_cb),
+ restore_page);
+ }
+}
- do_restore = (g_object_get_data (assistant, "restore") != NULL);
- file = g_object_get_data (assistant, "restore-file");
+static void
+evolution_backup_restore_assistant_class_init (EExtensionClass *class)
+{
+ GObjectClass *object_class;
- e_config_set_page_is_finish (
- ec, "0.startup_page.10.backup_restore", do_restore);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = evolution_backup_restore_assistant_constructed;
- return !do_restore || file;
+ class->extensible_type = E_TYPE_MAIL_CONFIG_ASSISTANT;
}
-GtkWidget *
-backup_restore_page (EPlugin *ep,
- EConfigHookItemFactoryData *hook_data)
+static void
+evolution_backup_restore_assistant_class_finalize (EExtensionClass *class)
{
- GtkWidget *page, *hbox, *label, *cbox, *button;
- GObject *assistant = G_OBJECT (hook_data->parent);
-
- page = gtk_vbox_new (FALSE, 6);
- gtk_container_set_border_width (GTK_CONTAINER (page), 12);
-
- 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. It also "
- "restores all your personal settings, mail filters etc."));
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_label_set_single_line_mode (GTK_LABEL (label), FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX (page), 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), assistant);
- gtk_box_pack_start (GTK_BOX (hbox), cbox, FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX (page), hbox, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 6);
- g_object_set_data ((GObject *)cbox, "box", hbox);
- label = gtk_label_new (
- _("Please select an Evolution Archive to restore:"));
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 12);
-
- button = gtk_file_chooser_button_new (
- _("Choose a file to restore"),
- GTK_FILE_CHOOSER_ACTION_OPEN);
- g_signal_connect (
- button, "selection-changed",
- G_CALLBACK (file_changed), assistant);
- gtk_file_chooser_button_set_width_chars (
- GTK_FILE_CHOOSER_BUTTON (button), 20);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (page), hbox, FALSE, FALSE, 0);
- gtk_widget_set_sensitive (hbox, FALSE);
-
- gtk_assistant_append_page (GTK_ASSISTANT (assistant), page);
- gtk_assistant_set_page_title (
- GTK_ASSISTANT (assistant),
- page, _("Restore from backup"));
- gtk_widget_show_all (page);
-
- g_object_set_data (assistant, "restore", GINT_TO_POINTER (FALSE));
- g_object_set_data (assistant, "restore-config", hook_data->config);
-
- e_config_add_page_check (
- hook_data->config,
- "0.startup_page.10.backup_restore",
- backup_restore_check, assistant);
-
- return GTK_WIDGET (page);
}
-void
-backup_restore_commit (EPlugin *ep,
- EMConfigTargetSettings *target)
+static void
+evolution_backup_restore_assistant_init (EExtension *extension)
{
- GObject *assistant;
- gchar *file;
-
- assistant = G_OBJECT (target->target.config->widget);
- file = g_object_get_data (assistant, "restore-file");
-
- if (g_object_get_data (assistant, "restore") != NULL) {
- if (file == NULL || !sanity_check (file)) {
- e_alert_run_dialog_for_args (
- GTK_WINDOW (assistant),
- "org.gnome.backup-restore:invalid-backup",
- NULL);
- } else {
- restore (file, TRUE);
- }
- }
}
-void
-backup_restore_abort (EPlugin *ep,
- EMConfigTargetSettings *target)
+static void
+evolution_backup_restore_menu_items_constructed (GObject *object)
{
- /* Nothing really */
-}
+ EExtension *extension;
+ EExtensible *extensible;
+ EShellWindow *shell_window;
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ GError *error = NULL;
-static GtkActionEntry entries[] = {
+ extension = E_EXTENSION (object);
+ extensible = e_extension_get_extensible (extension);
- { "settings-backup",
- NULL,
- N_("_Back up Evolution Data..."),
- NULL,
- N_("Back up Evolution data and settings to an archive file"),
- G_CALLBACK (action_settings_backup_cb) },
-
- { "settings-restore",
- NULL,
- N_("R_estore Evolution Data..."),
- NULL,
- N_("Restore Evolution data and settings from an archive file"),
- G_CALLBACK (action_settings_restore_cb) }
-};
-
-gboolean
-e_plugin_ui_init (GtkUIManager *ui_manager,
- EShellWindow *shell_window)
-{
- GtkActionGroup *action_group;
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (evolution_backup_restore_menu_items_parent_class)->
+ constructed (object);
+ shell_window = E_SHELL_WINDOW (extensible);
action_group = e_shell_window_get_action_group (shell_window, "shell");
/* Add actions to the "shell" action group. */
@@ -493,5 +445,50 @@ e_plugin_ui_init (GtkUIManager *ui_manager,
action_group, entries,
G_N_ELEMENTS (entries), shell_window);
- return TRUE;
+ /* Because we are loading from a hard-coded string, there is
+ * no chance of I/O errors. Failure here implies a malformed
+ * UI definition. Full stop. */
+ ui_manager = e_shell_window_get_ui_manager (shell_window);
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
+ if (error != NULL)
+ g_error ("%s", error->message);
+}
+
+static void
+evolution_backup_restore_menu_items_class_init (EExtensionClass *class)
+{
+ GObjectClass *object_class;
+ EExtensionClass *extension_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = evolution_backup_restore_menu_items_constructed;
+
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_SHELL_WINDOW;
+}
+
+static void
+evolution_backup_restore_menu_items_class_finalize (EExtensionClass *class)
+{
}
+
+static void
+evolution_backup_restore_menu_items_init (EExtension *extension)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ evolution_backup_restore_assistant_register_type (type_module);
+ evolution_backup_restore_menu_items_register_type (type_module);
+
+ e_mail_config_restore_page_type_register (type_module);
+ e_mail_config_restore_ready_page_type_register (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
+
diff --git a/plugins/backup-restore/backup.c b/modules/backup-restore/evolution-backup-tool.c
index bfbdf85be3..38a477e00d 100644
--- a/plugins/backup-restore/backup.c
+++ b/modules/backup-restore/evolution-backup-tool.c
@@ -1,4 +1,5 @@
/*
+ * evolution-backup-tool.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -13,9 +14,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
*/
#ifdef HAVE_CONFIG_H
@@ -560,7 +558,18 @@ restore (const gchar *filename,
if (g_cancellable_is_cancelled (cancellable))
return;
- txt = _("Ensuring local sources");
+ txt = _("Reloading registry service");
+
+ /* This runs migration routines on the newly-restored data.
+ *
+ * XXX Hard-coding the whole command like this is not ideal
+ * because the "SourcesX" interface name will occasionally
+ * change and I guarantee we'll forget to update this. */
+ run_cmd (
+ "gdbus call --session "
+ "--dest org.gnome.evolution.dataserver.Sources0 "
+ "--object-path /org/gnome/evolution/dataserver/SourceManager "
+ "--method org.gnome.evolution.dataserver.SourceManager.Reload");
end:
if (restart_arg) {
diff --git a/plugins/backup-restore/org-gnome-backup-restore.error.xml b/modules/backup-restore/org-gnome-backup-restore.error.xml
index 10a9966339..b38a134132 100644
--- a/plugins/backup-restore/org-gnome-backup-restore.error.xml
+++ b/modules/backup-restore/org-gnome-backup-restore.error.xml
@@ -18,7 +18,7 @@
<button _label="Close and Restore Evolution" response="GTK_RESPONSE_YES"/>
</error>
<error id="insufficient-permissions" type="error">
- <_primary>Insufficient Permissions</_primary>
- <_secondary>The selected folder is not writable.</_secondary>
+ <_primary>Insufficient Permissions</_primary>
+ <_secondary>The selected folder is not writable.</_secondary>
</error>
</error-list>
diff --git a/plugins/backup-restore/Makefile.am b/plugins/backup-restore/Makefile.am
deleted file mode 100644
index acf960525f..0000000000
--- a/plugins/backup-restore/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-@EVO_PLUGIN_RULE@
-
-error_DATA = org-gnome-backup-restore.error
-errordir = $(privdatadir)/errors
-
-plugin_DATA = org-gnome-backup-restore.eplug
-plugin_LTLIBRARIES = liborg-gnome-backup-restore.la
-
-liborg_gnome_backup_restore_la_CPPFLAGS = \
- $(AM_CPPFLAGS) \
- -I$(top_srcdir) \
- -I$(top_srcdir)/widgets \
- -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
- -DPREFIX=\""$(prefix)"\" \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
- -DDATADIR=\""$(datadir)"\" \
- -DLIBDIR=\""$(libdir)"\" \
- $(EVOLUTION_DATA_SERVER_CFLAGS) \
- $(GNOME_PLATFORM_CFLAGS) \
- $(GTKHTML_CFLAGS)
-
-liborg_gnome_backup_restore_la_SOURCES = backup-restore.c
-liborg_gnome_backup_restore_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
-liborg_gnome_backup_restore_la_LIBADD = \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/shell/libeshell.la \
- $(top_builddir)/libevolution-utils/libevolution-utils.la \
- $(EVOLUTION_DATA_SERVER_LIBS) \
- $(GNOME_PLATFORM_LIBS) \
- $(GTKHTML_LIBS)
-
-privlibexec_PROGRAMS = evolution-backup
-evolution_backup_SOURCES = backup.c
-evolution_backup_CPPFLAGS = \
- $(AM_CPPFLAGS) \
- -I$(top_srcdir) \
- -I$(top_srcdir)/widgets \
- -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
- -DPREFIX=\""$(prefix)"\" \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
- -DDATADIR=\""$(datadir)"\" \
- -DLIBDIR=\""$(libdir)"\" \
- $(EVOLUTION_DATA_SERVER_CFLAGS) \
- $(GNOME_PLATFORM_CFLAGS)
-
-evolution_backup_LDADD = \
- $(top_builddir)/e-util/libeutil.la \
- $(EVOLUTION_DATA_SERVER_LIBS) \
- $(GNOME_PLATFORM_LIBS)
-
-if OS_WIN32
-evolution_backup_LDFLAGS = -mwindows
-endif
-
-EXTRA_DIST = \
- org-gnome-backup-restore.eplug.xml \
- org-gnome-backup-restore.error.xml
-
-BUILT_SOURCES = org-gnome-backup-restore.eplug \
- org-gnome-backup-restore.error
-
-CLEANFILES = $(BUILT_SOURCES)
-
--include $(top_srcdir)/git.mk
diff --git a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml
deleted file mode 100644
index 4899b2dd8a..0000000000
--- a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<e-plugin-list>
- <!-- the path to the shared library -->
- <e-plugin
- id="org.gnome.plugin.backup.restore"
- type="shlib"
- location="@PLUGINDIR@/liborg-gnome-backup-restore@SOEXT@"
- _name="Back up and Restore">
- <author name="JP Rosevear" email="jpr@novell.com"/>
- <_description>Back up and restore your Evolution data and settings.</_description>
-
- <hook class="org.gnome.evolution.ui:1.0">
- <ui-manager id="org.gnome.evolution.shell">
- <menubar name='main-menu'>
- <menu action='file-menu'>
- <placeholder name='file-actions'>
- <menuitem action='settings-backup'/>
- <menuitem action='settings-restore'/>
- </placeholder>
- </menu>
- </menubar>
- </ui-manager>
- </hook>
-
- <hook class="org.gnome.evolution.mail.config:1.0">
- <group target="settings" id="org.gnome.evolution.mail.config.accountWizard" commit="backup_restore_commit" abort="backup_restore_abort">
- <item type="page" path="0.startup_page.10.backup_restore" factory="backup_restore_page"/>
- </group>
- </hook>
-
- </e-plugin>
-</e-plugin-list>