aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-12 23:37:59 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-12 23:37:59 +0800
commit2febb125d6abd0e9f485a13ae99281112a97416a (patch)
tree76b35f9cbfde9127f1e7301d236fcea962c9d8ef /plugins
parent9199f2c5b1925b6d1092738bf1a1c026e53d37f0 (diff)
downloadgsoc2013-evolution-2febb125d6abd0e9f485a13ae99281112a97416a.tar.gz
gsoc2013-evolution-2febb125d6abd0e9f485a13ae99281112a97416a.tar.zst
gsoc2013-evolution-2febb125d6abd0e9f485a13ae99281112a97416a.zip
Get the backup-restore plugin working.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/backup-restore/Makefile.am8
-rw-r--r--plugins/backup-restore/backup-restore.c76
-rw-r--r--plugins/backup-restore/org-gnome-backup-restore.eplug.xml39
-rw-r--r--plugins/backup-restore/org-gnome-backup-restore.xml21
4 files changed, 78 insertions, 66 deletions
diff --git a/plugins/backup-restore/Makefile.am b/plugins/backup-restore/Makefile.am
index c1792abb64..bc27b1d7a3 100644
--- a/plugins/backup-restore/Makefile.am
+++ b/plugins/backup-restore/Makefile.am
@@ -1,11 +1,12 @@
AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \
-DPREFIX=\""$(prefix)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\" \
- -I$(top_srcdir) \
$(EVOLUTION_CALENDAR_CFLAGS) \
$(SHELL_CFLAGS) \
$(E_UTIL_CFLAGS)
@@ -15,7 +16,7 @@ AM_CPPFLAGS = \
error_DATA = org-gnome-backup-restore.error
errordir = $(privdatadir)/errors
-plugin_DATA = org-gnome-backup-restore.eplug org-gnome-backup-restore.xml
+plugin_DATA = org-gnome-backup-restore.eplug
plugin_LTLIBRARIES = liborg-gnome-backup-restore.la
liborg_gnome_backup_restore_la_SOURCES = backup-restore.c
@@ -35,8 +36,7 @@ endif
EXTRA_DIST = \
org-gnome-backup-restore.eplug.xml \
- org-gnome-backup-restore.error.xml \
- org-gnome-backup-restore.xml
+ org-gnome-backup-restore.error.xml
BUILT_SOURCES = org-gnome-backup-restore.eplug \
org-gnome-backup-restore.error
diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c
index 79221d4573..8aa41e5fe7 100644
--- a/plugins/backup-restore/backup-restore.c
+++ b/plugins/backup-restore/backup-restore.c
@@ -33,15 +33,16 @@
#include <glib/gstdio.h>
#include <libgnomeui/gnome-druid.h>
#include <libgnomeui/gnome-druid-page-standard.h>
-#include "shell/es-menu.h"
#include "mail/em-config.h"
#include "mail/em-account-editor.h"
#include "e-util/e-error.h"
#include "e-util/e-util.h"
#include "e-util/e-dialog-utils.h"
+#include "shell/e-shell-window.h"
+
+gboolean e_plugin_ui_init (GtkUIManager *ui_manager,
+ EShellWindow *shell_window);
-void org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target);
-void org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target);
GtkWidget * backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data);
void backup_restore_commit (EPlugin *ep, EMConfigTargetAccount *target);
void backup_restore_abort (EPlugin *ep, EMConfigTargetAccount *target);
@@ -130,18 +131,19 @@ epbr_perform_pre_backup_checks (gchar * dir)
}
void
-org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target)
+action_settings_backup_cb (GtkAction *action,
+ EShellWindow *shell_window)
{
GtkWidget *dlg;
GtkWidget *vbox;
+ GtkWindow *parent;
gint response;
- dlg = e_file_get_save_filesel(target->target.widget, _("Select name of the Evolution backup file"), NULL, GTK_FILE_CHOOSER_ACTION_SAVE);
+ parent = GTK_WINDOW (shell_window);
-/* 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); */
+ dlg = e_file_get_save_filesel (
+ parent, _("Select name of the Evolution backup file"),
+ NULL, GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlg), "evolution-backup.tar.gz");
@@ -164,7 +166,9 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target)
if (epbr_perform_pre_backup_checks (dir)) {
- mask = dialog_prompt_user (GTK_WINDOW (target->target.widget), _("_Restart Evolution after backup"), "org.gnome.backup-restore:backup-confirm", NULL);
+ mask = dialog_prompt_user (
+ parent, _("_Restart Evolution after backup"),
+ "org.gnome.backup-restore:backup-confirm", NULL);
if (mask & BR_OK)
backup (filename, (mask & BR_START) ? TRUE: FALSE);
} else {
@@ -181,18 +185,20 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target)
}
void
-org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target)
+action_settings_restore_cb (GtkAction *action,
+ EShellWindow *shell_window)
{
GtkWidget *dlg;
GtkWidget *vbox;
+ GtkWindow *parent;
gint 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);
+ parent = GTK_WINDOW (shell_window);
-/* 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); */
+ dlg = e_file_get_save_filesel (
+ parent,
+ _("Select name of the Evolution backup file to restore"),
+ NULL, GTK_FILE_CHOOSER_ACTION_OPEN);
vbox = gtk_vbox_new (FALSE, 6);
gtk_widget_show (vbox);
@@ -211,11 +217,13 @@ org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target)
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);
+ mask = dialog_prompt_user (
+ parent, _("_Restart Evolution after restore"),
+ "org.gnome.backup-restore:restore-confirm", NULL);
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);
+ e_error_run (parent, "org.gnome.backup-restore:invalid-backup", NULL);
}
g_free (filename);
@@ -331,3 +339,35 @@ backup_restore_abort (EPlugin *ep, EMConfigTargetAccount *target)
/* Nothing really */
}
+static GtkActionEntry entries[] = {
+
+ { "settings-backup",
+ NULL,
+ N_("_Backup Settings..."),
+ NULL,
+ N_("Backup Evolution data and settings to an archive file"),
+ G_CALLBACK (action_settings_backup_cb) },
+
+ { "settings-restore",
+ NULL,
+ N_("R_estore Settings..."),
+ 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;
+
+ action_group = e_shell_window_get_action_group (shell_window, "shell");
+
+ /* Add actions to the "shell" action group. */
+ gtk_action_group_add_actions (
+ action_group, entries,
+ G_N_ELEMENTS (entries), shell_window);
+
+ return TRUE;
+}
diff --git a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml
index 2ed7222adc..6d92cf48ae 100644
--- a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml
+++ b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml
@@ -9,31 +9,24 @@
<author name="JP Rosevear" email="jpr@novell.com"/>
<_description>Backup and restore your Evolution data and settings.</_description>
- <hook class="org.gnome.evolution.shell.bonobomenu:1.0">
-
- <menu id="org.gnome.evolution.shell" target="shell">
- <!-- the path to the bonobo menu description -->
- <ui file="@PLUGINDIR@/org-gnome-backup-restore.xml"/>
- <item
- type="item"
- verb="EPBRBackup"
- path="/commands/EPBRBackup"
- enable="one"
- activate="org_gnome_backup_restore_backup"/>
- <item
- type="item"
- verb="EPBRRestore"
- path="/commands/EPBRRestore"
- enable="one"
- activate="org_gnome_backup_restore_restore"/>
- </menu>
+ <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="account" id="org.gnome.evolution.mail.config.accountWizard" commit="backup_restore_commit" abort="backup_restore_abort">
+ <item type="page" path="0.startup_page.10" factory="backup_restore_page"/>
+ </group>
</hook>
- <hook class="org.gnome.evolution.mail.config:1.0">
- <group target="account" id="org.gnome.evolution.mail.config.accountWizard" commit="backup_restore_commit" abort="backup_restore_abort">
- <item type="page" path="0.startup_page.10" factory="backup_restore_page"/>
- </group>
- </hook>
</e-plugin>
</e-plugin-list>
diff --git a/plugins/backup-restore/org-gnome-backup-restore.xml b/plugins/backup-restore/org-gnome-backup-restore.xml
deleted file mode 100644
index e546ce5581..0000000000
--- a/plugins/backup-restore/org-gnome-backup-restore.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<Root>
- <commands>
- <cmd name="EPBRBackup" _label="_Backup Settings..."
- _tip="Backup and restore Evolution data and settings"
- pixtype="pixmap"/>
-
- <cmd name="EPBRRestore" _label="R_estore Settings..."
- _tip="Backup and restore Evolution data and settings"
- pixtype="pixmap"/>
-
- </commands>
-
- <menu>
- <submenu name="File">
- <placeholder name="FileOps">
- <menuitem name="EPBRBackup" verb=""/>
- <menuitem name="EPBRRestore" verb=""/>
- </placeholder>
- </submenu>
- </menu>
-</Root>