Commit bbe8721a authored by Ivan, Wong Yat Cheung's avatar Ivan, Wong Yat Cheung Committed by Ivan Wong Yat Cheung

New subdir 'tools', we now have a win32 binary to build.

2005-04-16  Ivan, Wong Yat Cheung  <email@ivanwong.info>

	* configure.in:
	* Makefile.am: New subdir 'tools', we now have a win32
	binary to build.

	* schemas/Makefile.am: Install .reg files into
	$prefix/etc/win32/reg. Two versions are served, i.e.
	.hkcu.reg and .reg. When the user chooses to install
	gnumeric/win32 for the "current user" only, use .hkcu.reg
	and otherwise .reg.

	* src/tools/Makefile.am:
	* src/tools/gconf-schemas-to-win32-reg.c: Removed. It don't
	belong here.
	* tools/Makefile.am:
	* tools/gconf-schemas-to-win32-reg.c: New. It should be
	placed here. Add a new parameter that controls whether the
	converter should output .hkcu.reg style or .reg style. And
	Jody told me that what I want is g_printerr but not g_error.
parent 57f298aa
2005-04-16 Ivan, Wong Yat Cheung <email@ivanwong.info>
* configure.in:
* Makefile.am: New subdir 'tools', we now have a win32
binary to build.
* schemas/Makefile.am: Install .reg files into
$prefix/etc/win32/reg. Two versions are served, i.e.
.hkcu.reg and .reg. When the user chooses to install
gnumeric/win32 for the "current user" only, use .hkcu.reg
and otherwise .reg.
* src/tools/Makefile.am:
* src/tools/gconf-schemas-to-win32-reg.c: Removed. It don't
belong here.
* tools/Makefile.am:
* tools/gconf-schemas-to-win32-reg.c: New. It should be
placed here. Add a new parameter that controls whether the
converter should output .hkcu.reg style or .reg style. And
Jody told me that what I want is g_printerr but not g_error.
2005-04-15 Stepan Kasal <kasal@ucw.cz>
* schemas/Makefile.am (CLEANFILES): Add $(reg_DATA), if we are
......
SUBDIRS = . po po-functions src plugins icons templates doc schemas
# automake does not like subdirs that are not directly below
#if WITH_WIN32
# SUBDIRS += src/cut-n-paste-code/goffice/graph/plugins
#endif
if WITH_WIN32
SUBDIRS += tools
endif
XML_I18N_XML_KIND = --pass-through
......
2005-04-16 Ivan, Wong Yat Cheung <email@ivanwong.info>
* configure.in:
* Makefile.am: New subdir 'tools', we now have a win32
binary to build.
* schemas/Makefile.am: Install .reg files into
$prefix/etc/win32/reg. Two versions are served, i.e.
.hkcu.reg and .reg. When the user chooses to install
gnumeric/win32 for the "current user" only, use .hkcu.reg
and otherwise .reg.
* src/tools/Makefile.am:
* src/tools/gconf-schemas-to-win32-reg.c: Removed. It don't
belong here.
* tools/Makefile.am:
* tools/gconf-schemas-to-win32-reg.c: New. It should be
placed here. Add a new parameter that controls whether the
converter should output .hkcu.reg style or .reg style. And
Jody told me that what I want is g_printerr but not g_error.
2005-04-15 Stepan Kasal <kasal@ucw.cz>
* schemas/Makefile.am (CLEANFILES): Add $(reg_DATA), if we are
......
......@@ -987,6 +987,7 @@ schemas/Makefile
templates/Makefile
templates/english/Makefile
templates/autoformat/Makefile
tools/Makefile
])
echo "
......
......@@ -14,7 +14,7 @@ if GCONF_SCHEMAS_INSTALL
install-data-local:
if test -z "$(DESTDIR)" ; then \
for p in $(schema_DATA) ; do \
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p; \
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \
done \
fi
else
......@@ -23,12 +23,14 @@ endif
if WITH_WIN32
if !CROSS_COMPILING
SUFFIXES = .reg
regdir = $(prefix)/share/gnumeric
reg_DATA = $(schema_in_files:.schemas.in=.reg)
SUFFIXES = .reg .hkcu.reg
regdir = $(prefix)/etc/win32/reg
reg_DATA = $(schema_in_files:.schemas.in=.reg) $(schema_in_files:.schemas.in=.hkcu.reg)
CLEANFILES += $(reg_DATA)
%.reg: %.schemas.in
../src/tools/gconf-schemas-to-win32-reg.exe $< >$@
$(top_builddir)/tools/gconf-schemas-to-win32-reg.exe $< >$@
%.hkcu.reg: %.schemas.in
$(top_builddir)/tools/gconf-schemas-to-win32-reg.exe -c $< >$@
endif
endif
......@@ -42,8 +42,3 @@ libtools_a_SOURCES = \
tabulate.h \
tools.h
if WITH_WIN32
noinst_PROGRAMS = gconf-schemas-to-win32-reg
gconf_schemas_to_win32_reg_SOURCES = gconf-schemas-to-win32-reg.c
gconf_schemas_to_win32_reg_LDADD = $(GNUMERIC_LIBS)
endif
#
# Gnumeric's Tools Makefile.
# Author: Ivan, Wong Yat Cheung (email@ivanwong.info)
AM_CPPFLAGS = $(GNUMERIC_CFLAGS)
if WITH_WIN32
noinst_PROGRAMS = gconf-schemas-to-win32-reg
gconf_schemas_to_win32_reg_SOURCES = gconf-schemas-to-win32-reg.c
gconf_schemas_to_win32_reg_LDADD = $(GNUMERIC_LIBS)
endif
......@@ -26,6 +26,17 @@
#include <glib-2.0/glib.h>
#define GCONF_APP_ROOT "/apps"
#define WIN32_USERS_APP_ROOT "[HKEY_USERS\\.DEFAULT\\Software"
#define WIN32_CURRENT_USER_APP_ROOT "[HKEY_CURRENT_USER\\Software"
static gboolean current_user = FALSE;
static GOptionEntry entries[] =
{
{ "current-user-only", 'c', 0, G_OPTION_ARG_NONE, &current_user,
"Output HKEY_CURRENT_USER instead of HKEY_USERS.", NULL },
{ NULL }
};
enum {
KEY_TYPE_NONE = 0,
......@@ -142,7 +153,7 @@ convert_key (KeyInfo *info)
putchar ('"');
break;
default:
g_error ("General type not implemented: %d", info->type);
g_printerr ("General type not implemented: %d\n", info->type);
}
putchar ('\n');
......@@ -215,7 +226,7 @@ convert_schema (xmlDocPtr doc, xmlNodePtr schema, GHashTable *table)
GSList **values;
if (xmlStrncmp (info.name, GCONF_APP_ROOT "/", 6)) {
g_error ("Don't know how to handle this key: %s", info.name);
g_printerr ("Don't know how to handle this key: %s\n", info.name);
return;
}
......@@ -227,7 +238,7 @@ convert_schema (xmlDocPtr doc, xmlNodePtr schema, GHashTable *table)
} while (!(node = g_hash_table_lookup (table, info.name)));
if (!node) {
g_error ("Can find the root node?");
g_printerr ("Can find the root node?\n");
return;
}
......@@ -285,7 +296,7 @@ print_node (GNode *node, gpointer data)
if (node == root)
return FALSE;
g_print ("[HKEY_USERS\\.DEFAULT\\Software");
g_print (current_user ? WIN32_CURRENT_USER_APP_ROOT : WIN32_USERS_APP_ROOT);
for (n = node; n != root; n = n->parent) {
g_string_prepend (path, ((NodeInfo *) n->data)->name);
......@@ -337,12 +348,12 @@ convert (xmlDocPtr doc, xmlNodePtr root)
xmlNodePtr node = NULL;
if (!root) {
g_error ("Empty document\n");
g_printerr ("Empty document\n");
return;
}
if (xmlStrcmp (root->name, "gconfschemafile")) {
g_error ("Document of the wrong type, root node != gconfschemafile");
g_printerr ("Document of the wrong type, root node != gconfschemafile\n");
return;
}
......@@ -360,9 +371,15 @@ int main (int argc, char **argv)
{
xmlDocPtr doc;
xmlNodePtr root;
GOptionContext *context;
context = g_option_context_new ("inputfile\nConvert gconf .schemas file into win32 registry .reg file");
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free (context);
if (argc != 2) {
g_error ("Usage: %s [.schemas file]", argv[0]);
g_printerr ("Please provide exactly one input filename\n");
return 1;
}
......@@ -370,7 +387,7 @@ int main (int argc, char **argv)
doc = xmlReadFile (argv[1], NULL, 0);
if (!doc) {
g_error ("Failed to parse %s", argv[1]);
g_printerr ("Failed to parse %s\n", argv[1]);
return 2;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment