[evolution/kill-bonobo] Get the backup-restore plugin working.



commit 2febb125d6abd0e9f485a13ae99281112a97416a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Aug 12 11:37:59 2009 -0400

    Get the backup-restore plugin working.

 configure.ac                                       |    3 +-
 modules/calendar/e-cal-shell-view-private.c        |    2 -
 plugins/backup-restore/Makefile.am                 |    8 +-
 plugins/backup-restore/backup-restore.c            |   76 +++++++++++++++-----
 .../org-gnome-backup-restore.eplug.xml             |   39 ++++------
 .../backup-restore/org-gnome-backup-restore.xml    |   21 ------
 po/POTFILES.in                                     |    1 -
 7 files changed, 79 insertions(+), 71 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c4a468c..fa397c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1735,11 +1735,10 @@ plugins_experimental="$plugins_experimental_always $IPOD_SYNC $TNEF_ATTACHMENTS
 all_plugins_experimental="$plugins_experimental_always ipod-sync tnef-attachments"
 
 dnl Temporary KILL-BONOBO hack
-enable_plugins="attachment-reminder addressbook-file audio-inline bbdb bogo-junk-plugin caldav calendar-file calendar-http calendar-weather default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features itip-formatter mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler pst-import sa-junk-plugin save-calendar startup-wizard subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup"
+enable_plugins="attachment-reminder addressbook-file audio-inline backup-restore bbdb bogo-junk-plugin caldav calendar-file calendar-http calendar-weather default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features itip-formatter mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler pst-import sa-junk-plugin save-calendar startup-wizard subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup"
 
 dnl PLUGINS NOT BUILDING YET
 dnl ------------------------
-dnl backup-restore
 dnl exchange-operations
 dnl groupwise-features
 dnl ipod-sync
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 49c07ca..063e746 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -656,7 +656,6 @@ e_cal_shell_view_set_status_message (ECalShellView *cal_shell_view,
 void
 e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
 {
-#if 0  /* KILL-BONOBO */
 	EShellView *shell_view;
 	EShellSidebar *shell_sidebar;
 	GnomeCalendar *calendar;
@@ -777,7 +776,6 @@ e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
 	}
 
 	e_shell_sidebar_set_secondary_text (shell_sidebar, buffer);
-#endif
 }
 
 void
diff --git a/plugins/backup-restore/Makefile.am b/plugins/backup-restore/Makefile.am
index c1792ab..bc27b1d 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 79221d4..8aa41e5 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 2ed7222..6d92cf4 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/po/POTFILES.in b/po/POTFILES.in
index e434f62..2d55ce2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -282,7 +282,6 @@ plugins/backup-restore/backup-restore.c
 plugins/backup-restore/backup.c
 plugins/backup-restore/org-gnome-backup-restore.eplug.xml
 plugins/backup-restore/org-gnome-backup-restore.error.xml
-plugins/backup-restore/org-gnome-backup-restore.xml
 plugins/bbdb/bbdb.c
 plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml
 plugins/bogo-junk-plugin/bf-junk-filter.c



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