reverted my latest change since it broke the build in a fresh CVS

2003-01-11  Sven Neumann  <sven@gimp.org>

	    * app/config/Makefile.am: reverted my latest change since it broke
	    the build in a fresh CVS checkout. Instead added make targets to
	    create a man-page and a default gimprc that take care of building
	    gimpconfig-dump.

	    * app/config/gimpconfig-dump.c: started to work on the man-page
	    dump functionality.
This commit is contained in:
Sven Neumann 2003-01-11 02:48:38 +00:00 committed by Sven Neumann
parent eaa4eeba3d
commit 1e8a49d248
4 changed files with 144 additions and 28 deletions

View File

@ -1,3 +1,13 @@
2003-01-11 Sven Neumann <sven@gimp.org>
* app/config/Makefile.am: reverted my latest change since it broke
the build in a fresh CVS checkout. Instead added make targets to
create a man-page and a default gimprc that take care of building
gimpconfig-dump.
* app/config/gimpconfig-dump.c: started to work on the man-page
dump functionality.
2003-01-11 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdialogfactory.c

View File

@ -4,6 +4,8 @@ Makefile.in
.libs
*.lo
foorc
gimprc
gimprc.5
gimpconfig-dump
libappconfig.la
test-config

View File

@ -57,25 +57,37 @@ gimpconfig_libs = \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la
EXTRA_PROGRAMS = gimpconfig-dump test-config
#
# GimpConfig dump utility that generates a system gimprc and the manpage
#
noinst_PROGRAMS = gimpconfig-dump
gimpconfig_dump_SOURCES = gimpconfig-dump.c
gimpconfig_dump_LDADD = $(GLIB_LIBS) $(gimpconfig_libs)
dump: gimpconfig-dump
./$<
gimprc: gimpconfig-dump
./$< --system-gimprc > gimprc 2>/dev/null
man: gimpconfig-dump
./$< --man-page > gimprc.5 2>/dev/null
#
# unit tests for the GimpConfig system
#
EXTRA_PROGRAMS = test-config
TESTS = test-config
test_config_DEPENDENCIES = $(gimpconfig_dependencies)
test_config_LDADD = $(GLIB_LIBS) $(gimpconfig_libs)
CLEANFILES = $(EXTRA_PROGRAMS) foorc gimprc gimprc.5

View File

@ -30,6 +30,7 @@
#include <glib-object.h>
#include "libgimpbase/gimplimits.h"
#include "libgimpbase/gimpversion.h"
#include "libgimpbase/gimpbasetypes.h"
#include "libgimpbase/gimpversion.h"
@ -42,8 +43,8 @@
#include "gimprc.h"
static gint dump_man_page (void);
static gint dump_system_gimprc (void);
static gint dump_man_page (void);
static gchar * dump_get_comment (GParamSpec *param_spec);
@ -76,7 +77,7 @@ main (int argc,
g_printerr ("Usage: %s [option ... ]\n\n", argv[0]);
g_printerr ("Options:\n"
" --man-page create a gimprc manual page\n"
" --system-gimprc create a commented system gimprc\n"
" --system-gimprc create a commented system gimprc with default values\n"
" --help output usage information\n"
" --version output version information\n"
"\n");
@ -99,13 +100,22 @@ main (int argc,
return EXIT_SUCCESS;
}
static gint
dump_man_page (void)
{
g_warning ("dump_man_page() is not yet implemented.");
return EXIT_FAILURE;
}
static const gchar *system_gimprc_header =
"# This is the system-wide gimprc file. Any change made in this file\n"
"# will affect all users of this system, provided that they are not\n"
"# overriding the default values in their personal gimprc file.\n"
"#\n"
"# Lines that start with a '#' are comments. Blank lines are ignored.\n"
"#\n"
"# By default everything in this file is commented out. The file then\n"
"# documents the default values and shows what changes are possible.\n"
"\n"
"# The variable ${gimp_dir} is set to the value of the environment\n"
"# variable GIMP_DIRECTORY or, if that is not set, the compiled-in\n"
"# default value is used. If GIMP_DIRECTORY is not an absolute path,\n"
"# it is interpreted relative to your home directory.\n"
"\n";
static gint
dump_system_gimprc (void)
@ -117,21 +127,7 @@ dump_system_gimprc (void)
guint n_property_specs;
guint i;
str = g_string_new
("# This is the system-wide gimprc file. Any change made in this file\n"
"# will affect all users of this system, provided that they are not\n"
"# overriding the default values in their personal gimprc file.\n"
"#\n"
"# Lines that start with a '#' are comments. Blank lines are ignored.\n"
"#\n"
"# By default everything in this file is commented out. The file then\n"
"# documents the default values and shows what changes are possible.\n"
"\n"
"# The variable ${gimp_dir} is set to the value of the environment\n"
"# variable GIMP_DIRECTORY or, if that is not set, the compiled-in\n"
"# default value is used. If GIMP_DIRECTORY is not an absolute path,\n"
"# it is interpreted relative to your home directory.\n"
"\n");
str = g_string_new (system_gimprc_header);
write (1, str->str, str->len);
@ -169,12 +165,106 @@ dump_system_gimprc (void)
}
g_free (property_specs);
g_object_unref (rc);
g_string_free (str, TRUE);
return EXIT_SUCCESS;
}
static const gchar *man_page_header =
".\\\" This man-page is auto-generated by gimpconfig-dump.\n"
"\n"
".TH GIMPRC 5 \"Version %s\" \"GIMP Manual Pages\"\n"
".SH NAME\n"
"gimprc \\- gimp configuration file\n"
".SH DESCRIPTION\n"
"The\n"
".B gimprc\n"
"file is a configuation file read by the gimp when it starts up. There\n"
"are two of these: one system-wide one stored in\n"
"${prefix}/etc/gimp/1.3/gimprc and a per-user \\fB$HOME\\fP/.gimp-1.3/gimprc\n"
"which may override system settings.\n"
"\n"
"Comments are introduced by a hash sign (#), and continue until the end\n"
"of the line. Blank lines are ignored.\n"
"\n"
"The\n"
".B gimprc\n"
"file associates values with properties. These properties may be set\n"
"by lisp-like assignments of the form:\n"
".IP\n"
"\\f3(\\f2property-name\\ value\\f3)\\f1\n"
".TP\n"
"where:\n"
".TP 10\n"
".I property-name\n"
"is one of the property names described below.\n"
".TP\n"
".I value\n"
"is the value the property is to be set to.\n"
".PP\n"
"\n"
"Either spaces or tabs may be used to separate the name from the value.\n"
".PP\n"
".SH PROPERTIES\n"
"Valid properties and their types are:\n"
"\n";
static gint
dump_man_page (void)
{
GObjectClass *klass;
GParamSpec **property_specs;
GObject *rc;
GString *str;
guint n_property_specs;
guint i;
str = g_string_new (NULL);
g_string_printf (str, man_page_header, GIMP_VERSION);
write (1, str->str, str->len);
rc = g_object_new (GIMP_TYPE_RC, NULL);
klass = G_OBJECT_GET_CLASS (rc);
property_specs = g_object_class_list_properties (klass, &n_property_specs);
for (i = 0; i < n_property_specs; i++)
{
GParamSpec *prop_spec = property_specs[i];
gchar *comment;
if (! (prop_spec->flags & GIMP_PARAM_SERIALIZE))
continue;
g_string_assign (str, "");
comment = dump_get_comment (prop_spec);
g_free (comment);
if (gimp_config_serialize_property (rc, prop_spec, str, TRUE))
{
g_string_append (str, "\n");
write (1, str->str, str->len);
}
}
g_free (property_specs);
g_object_unref (rc);
g_string_free (str, TRUE);
return EXIT_SUCCESS;
}
static gchar *
dump_get_comment (GParamSpec *param_spec)
{
@ -324,7 +414,9 @@ dump_get_comment (GParamSpec *param_spec)
/* some dummy funcs so we can properly link this beast */
/*
* some dummy funcs so we can properly link this beast
*/
const gchar *
gimp_unit_get_identifier (GimpUnit unit)