[nautilus-actions] Run the GConf migration tool at startup
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Run the GConf migration tool at startup
- Date: Wed, 19 Jan 2011 21:48:01 +0000 (UTC)
commit 5fd0ec0d64ccaa31c73c333355af04f86ede9dbf
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Jan 6 00:22:44 2011 +0100
Run the GConf migration tool at startup
Not all programs are concerned, but only:
- Nautilus-Actions Configuration Tool
- the Nautilus-Actions menu plugin
- nautilus-actions-new
- nautilus-actions-run.
ChangeLog | 11 ++
src/core/Makefile.am | 10 +-
...na-gsettings-migrate.h => na-gconf-migration.c} | 41 +++++-
...na-gsettings-migrate.h => na-gconf-migration.h} | 10 +-
src/core/na-gsettings-migrate.c | 136 --------------------
src/nact/nact-main.c | 8 +
src/plugin-menu/nautilus-module.c | 8 +
src/utils/nautilus-actions-new.c | 7 +
src/utils/nautilus-actions-run.c | 7 +
9 files changed, 83 insertions(+), 155 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 160f0b1..a768237 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -103,6 +103,17 @@
2011-01-05 Pierre Wieser <pwieser trychlos org>
+ * src/core/na-gconf-migration.c:
+ * src/core/na-gconf-migration.h (na_gconf_migration_run): New function.
+
+ * src/core/Makefile.am: Updated accordingly.
+
+ * src/nact/nact-main.c (main):
+ * src/plugin-menu/nautilus-module.c (nautilus_module_initialize):
+ * src/utils/nautilus-actions-new.c (main):
+ * src/utils/nautilus-actions-run.c (main):
+ Automatically run the migration tool at startup.
+
* src/utils/nautilus-actions-gconf2desktop.sh.in:
* src/utils/nautilus-actions-delete.c:
* src/utils/nautilus-actions-print.c:
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 715e126..10dcf18 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -32,6 +32,7 @@ AM_CPPFLAGS += \
-I $(top_srcdir) \
-I $(top_srcdir)/src \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
+ -DBINDIR=\"$(bindir)\" \
-DPKGDATADIR=\"$(pkgdatadir)\" \
-DPKGLIBDIR=\""$(pkglibdir)"\" \
-DG_LOG_DOMAIN=\"${NA_LOGDOMAIN_CORE}\" \
@@ -51,6 +52,8 @@ libna_core_la_SOURCES = \
na-factory-object.h \
na-factory-provider.c \
na-factory-provider.h \
+ na-gconf-migration.c \
+ na-gconf-migration.h \
na-gconf-monitor.c \
na-gconf-utils.c \
na-gnome-vfs-uri.c \
@@ -100,13 +103,6 @@ libna_core_la_SOURCES = \
na-tokens.h \
$(NULL)
-if HAVE_GSETTINGS_AND_GCONF
-libna_core_la_SOURCES += \
- na-gsettings-migrate.c \
- na-gsettings-migrate.h \
- $(NULL)
-endif
-
libna_core_la_LIBADD = \
$(NAUTILUS_ACTIONS_LIBS) \
$(NULL)
diff --git a/src/core/na-gsettings-migrate.h b/src/core/na-gconf-migration.c
similarity index 57%
copy from src/core/na-gsettings-migrate.h
copy to src/core/na-gconf-migration.c
index c9aaf85..f624bbf 100644
--- a/src/core/na-gsettings-migrate.h
+++ b/src/core/na-gconf-migration.c
@@ -28,15 +28,42 @@
* ... and many others (see AUTHORS)
*/
-#ifndef __CORE_NA_GSETTINGS_MIGRATE_H__
-#define __CORE_NA_GSETTINGS_MIGRATE_H__
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
-#include "na-pivot.h"
+#include "na-gconf-migration.h"
-G_BEGIN_DECLS
+/**
+ * na_gconf_migration_run:
+ *
+ * Migrate users actions and menus from GConf to .desktop files.
+ * Migrate users preferences to NASettings.
+ *
+ * Since: 3.1.0
+ */
+void
+na_gconf_migration_run( void )
+{
+ static const gchar *thisfn = "na_gconf_migration_run";
+ gchar *command, *out, *err;
+ GError *error;
+
+ command = g_strdup_printf( "%s/nautilus-actions-gconf2desktop.sh -print %s/nautilus-actions-print -delete -nodummy", BINDIR, BINDIR );
+ g_debug( "%s: command=%s", thisfn, command );
-void na_gsettings_migrate( const NAPivot *pivot );
+ error = NULL;
+ if( !g_spawn_command_line_sync( command, &out, &err, NULL, &error )){
+ g_warning( "%s: %s", thisfn, error->message );
+ g_error_free( error );
+ error = NULL;
-G_END_DECLS
+ } else {
+ g_debug( "%s: out=%s", thisfn, out );
+ g_debug( "%s: err=%s", thisfn, err );
+ g_free( out );
+ g_free( err );
+ }
-#endif /* __CORE_NA_GSETTINGS_MIGRATE_H__ */
+ g_free( command );
+}
diff --git a/src/core/na-gsettings-migrate.h b/src/core/na-gconf-migration.h
similarity index 84%
rename from src/core/na-gsettings-migrate.h
rename to src/core/na-gconf-migration.h
index c9aaf85..caae6e1 100644
--- a/src/core/na-gsettings-migrate.h
+++ b/src/core/na-gconf-migration.h
@@ -28,15 +28,15 @@
* ... and many others (see AUTHORS)
*/
-#ifndef __CORE_NA_GSETTINGS_MIGRATE_H__
-#define __CORE_NA_GSETTINGS_MIGRATE_H__
+#ifndef __NAUTILUS_ACTIONS_CORE_NA_GCONF_MIGRATION_H__
+#define __NAUTILUS_ACTIONS_CORE_NA_GCONF_MIGRATION_H__
-#include "na-pivot.h"
+#include <glib.h>
G_BEGIN_DECLS
-void na_gsettings_migrate( const NAPivot *pivot );
+void na_gconf_migration_run( void );
G_END_DECLS
-#endif /* __CORE_NA_GSETTINGS_MIGRATE_H__ */
+#endif /* __NAUTILUS_ACTIONS_CORE_NA_GCONF_MIGRATION_H__ */
diff --git a/src/nact/nact-main.c b/src/nact/nact-main.c
index 1c4cc64..51d0637 100644
--- a/src/nact/nact-main.c
+++ b/src/nact/nact-main.c
@@ -32,6 +32,8 @@
#include <config.h>
#endif
+#include <core/na-gconf-migration.h>
+
#include "nact-application.h"
static void set_log_handler( void );
@@ -47,6 +49,12 @@ main( int argc, char *argv[] )
set_log_handler();
+ /* pwi 2011-01-05
+ * run GConf migration tools before doing anything else
+ * above all before allocating a new NAPivot
+ */
+ na_gconf_migration_run();
+
app = nact_application_new_with_args( argc, argv );
ret = base_application_run( BASE_APPLICATION( app ));
diff --git a/src/plugin-menu/nautilus-module.c b/src/plugin-menu/nautilus-module.c
index db0461a..b83b529 100644
--- a/src/plugin-menu/nautilus-module.c
+++ b/src/plugin-menu/nautilus-module.c
@@ -38,6 +38,8 @@
#include <libnautilus-extension/nautilus-extension-types.h>
+#include <core/na-gconf-migration.h>
+
#include "nautilus-actions.h"
static void set_log_handler( void );
@@ -70,6 +72,12 @@ nautilus_module_initialize( GTypeModule *module )
g_type_module_set_name( module, PACKAGE_STRING );
+ /* pwi 2011-01-05
+ * run GConf migration tools before doing anything else
+ * above all before allocating a new NAPivot
+ */
+ na_gconf_migration_run();
+
nautilus_actions_register_type( module );
}
diff --git a/src/utils/nautilus-actions-new.c b/src/utils/nautilus-actions-new.c
index f7732c2..ef32319 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -43,6 +43,7 @@
#include <api/na-iio-provider.h>
#include <api/na-object-api.h>
+#include <core/na-gconf-migration.h>
#include <core/na-io-provider.h>
#include <core/na-exporter.h>
#include <core/na-updater.h>
@@ -167,6 +168,12 @@ main( int argc, char** argv )
setlocale( LC_ALL, "" );
console_init_log_handler();
+ /* pwi 2011-01-05
+ * run GConf migration tools before doing anything else
+ * above all before allocating a new NAPivot
+ */
+ na_gconf_migration_run();
+
context = init_options();
if( argc == 1 ){
diff --git a/src/utils/nautilus-actions-run.c b/src/utils/nautilus-actions-run.c
index 3145029..7073cef 100644
--- a/src/utils/nautilus-actions-run.c
+++ b/src/utils/nautilus-actions-run.c
@@ -42,6 +42,7 @@
#include <api/na-object-api.h>
#include <api/na-dbus.h>
+#include <core/na-gconf-migration.h>
#include <core/na-pivot.h>
#include <core/na-selected-info.h>
#include <core/na-tokens.h>
@@ -96,6 +97,12 @@ main( int argc, char** argv )
setlocale( LC_ALL, "" );
console_init_log_handler();
+ /* pwi 2011-01-05
+ * run GConf migration tools before doing anything else
+ * above all before allocating a new NAPivot
+ */
+ na_gconf_migration_run();
+
context = init_options();
if( argc == 1 ){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]