Commit 24c90dca authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/Makefile.am app/main.c app/config/Makefile.am app/config/makefile.msc

2003-10-14  Sven Neumann  <sven@gimp.org>

	* app/Makefile.am
	* app/main.c
	* app/config/Makefile.am
	* app/config/makefile.msc
	* app/config/gimpconfig-dump.[ch]: removed the separate
	gimpconfig-dump binary and moved the functionality into gimp
	itself. It became a mess to build and seems cleaner this way.
parent fad03466
2003-10-14 Sven Neumann <sven@gimp.org>
* app/Makefile.am
* app/main.c
* app/config/Makefile.am
* app/config/makefile.msc
* app/config/gimpconfig-dump.[ch]: removed the separate
gimpconfig-dump binary and moved the functionality into gimp
itself. It became a mess to build and seems cleaner this way.
2003-10-13 Dave Neary <bolsh@gimp.org>
* libgimpcolor/gimpcolorspace.c: Added gtk-docs to a few functions.
......@@ -153,3 +153,11 @@ if ENABLE_GIMP_CONSOLE
rm -f $(DESTDIR)$(bindir)/gimp-console-$(EXEEXT)
endif
endif
# hooks to assure that the system gimprc and the gimprc manpage are
# uptodate when a release is made
dist-hook: gimp-1.3
./$< --dump-gimprc-system > $(top_srcdir)/etc/gimprc
./$< --dump-gimprc-manpage > $(top_srcdir)/docs/gimprc-$(LT_RELEASE).5.in
......@@ -4,8 +4,5 @@ Makefile.in
.libs
*.lo
foorc
gimprc
gimprc-1.3.5.in
gimpconfig-dump
libappconfig.la
test-config
......@@ -8,6 +8,8 @@ libappconfig_a_SOURCES = \
gimpconfig.h \
gimpconfig-deserialize.c \
gimpconfig-deserialize.h \
gimpconfig-dump.c \
gimpconfig-dump.h \
gimpconfig-error.c \
gimpconfig-error.h \
gimpconfig-params.c \
......@@ -53,38 +55,7 @@ INCLUDES = \
-I$(includedir)
gimpconfig_libs = \
libappconfig.a \
../base/libappbase.a \
../core/libappcore.a \
../display/libappdisplay.a \
../widgets/libappwidgets.a \
$(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la
EXTRA_PROGRAMS = gimpconfig-dump test-config
#
# GimpConfig dump utility that generates a system gimprc and the manpage
#
gimpconfig_dump_SOURCES = gimpconfig-dump.c
gimpconfig_dump_LDADD = $(GLIB_LIBS) $(gimpconfig_libs)
dump: gimpconfig-dump
./$<
gimprc: gimpconfig-dump
./$< --system-gimprc > gimprc
man: gimpconfig-dump
./$< --man-page > gimprc-$(LT_RELEASE).5.in
EXTRA_PROGRAMS = test-config
#
# unit tests for the GimpConfig system
......@@ -94,17 +65,16 @@ TESTS = test-config
test_config_DEPENDENCIES = $(gimpconfig_libs)
test_config_LDADD = $(GLIB_LIBS) $(gimpconfig_libs)
CLEANFILES = $(EXTRA_PROGRAMS) foorc gimprc gimprc-$(LT_RELEASE).5.in
test_config_LDADD = \
libappconfig.a \
../base/libappbase.a \
../core/libappcore.a \
../display/libappdisplay.a \
../widgets/libappwidgets.a \
$(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \
$(GLIB_LIBS)
#
# hooks to assure that files generated by gimpconfig-dump are
# uptodate when a release is made
#
dist-hook: gimpconfig-dump
./$< --man-page > $(top_srcdir)/docs/gimprc-$(LT_RELEASE).5.in
./$< --system-gimprc > $(top_srcdir)/etc/gimprc
CLEANFILES = $(EXTRA_PROGRAMS) foorc
......@@ -29,14 +29,12 @@
#include <glib-object.h>
#include "libgimpbase/gimplimits.h"
#include "libgimpbase/gimpversion.h"
#include "libgimpbase/gimpbasetypes.h"
#include "libgimpbase/gimpversion.h"
#include "libgimpbase/gimpbase.h"
#include "config-types.h"
#include "gimpconfig.h"
#include "gimpconfig-dump.h"
#include "gimpconfig-params.h"
#include "gimpconfig-serialize.h"
#include "gimpconfig-types.h"
......@@ -44,16 +42,7 @@
#include "gimprc.h"
typedef enum
{
DUMP_NONE,
DUMP_DEFAULT,
DUMP_COMMENT,
DUMP_MANPAGE
} DumpFormat;
static gint dump_gimprc (DumpFormat format);
static void dump_gimprc_system (GimpConfig *rc,
GimpConfigWriter *writer,
gint fd);
......@@ -65,89 +54,41 @@ static void dump_with_linebreaks (gint fd,
const gchar *text);
int
main (int argc,
char *argv[])
{
DumpFormat format = DUMP_DEFAULT;
if (argc > 1)
{
if (strcmp (argv[1], "--system-gimprc") == 0)
{
format = DUMP_COMMENT;
}
else if (strcmp (argv[1], "--man-page") == 0)
{
format = DUMP_MANPAGE;
}
else if (strcmp (argv[1], "--version") == 0)
{
g_printerr ("gimpconfig-dump version %s\n", GIMP_VERSION);
return EXIT_SUCCESS;
}
else
{
g_printerr ("gimpconfig-dump version %s\n\n", GIMP_VERSION);
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 with default values\n"
" --help output usage information\n"
" --version output version information\n"
"\n");
if (strcmp (argv[1], "--help") == 0)
return EXIT_SUCCESS;
else
return EXIT_FAILURE;
}
}
return dump_gimprc (format);
}
static gint
dump_gimprc (DumpFormat format)
gboolean
gimp_config_dump (GimpConfigDumpFormat format)
{
GimpConfigWriter *writer;
GimpConfig *rc;
gint fd = 1;
if (format == DUMP_NONE)
return EXIT_SUCCESS;
g_type_init ();
rc = g_object_new (GIMP_TYPE_RC, NULL);
writer = gimp_config_writer_new_fd (fd);
writer = gimp_config_writer_new_fd (1);
switch (format)
{
case DUMP_DEFAULT:
case GIMP_CONFIG_DUMP_NONE:
break;
case GIMP_CONFIG_DUMP_GIMPRC:
gimp_config_writer_comment (writer,
"Dump of the GIMP default configuration");
gimp_config_writer_linefeed (writer);
gimp_config_serialize_properties (rc, writer);
g_print ("\n");
break;
case DUMP_COMMENT:
dump_gimprc_system (rc, writer, fd);
gimp_config_writer_linefeed (writer);
break;
case DUMP_MANPAGE:
dump_gimprc_manpage (rc, writer, fd);
case GIMP_CONFIG_DUMP_GIMPRC_SYSTEM:
dump_gimprc_system (rc, writer, 1);
break;
default:
case GIMP_CONFIG_DUMP_GIMPRC_MANPAGE:
dump_gimprc_manpage (rc, writer, 1);
break;
}
gimp_config_writer_finish (writer, NULL, NULL);
g_object_unref (rc);
return EXIT_SUCCESS;
return TRUE;
}
......@@ -567,34 +508,3 @@ dump_with_linebreaks (gint fd,
len -= i;
}
}
/*
* some dummy funcs so we can properly link this beast
*/
const gchar *
gimp_unit_get_identifier (GimpUnit unit)
{
switch (unit)
{
case GIMP_UNIT_PIXEL:
return "pixels";
case GIMP_UNIT_INCH:
return "inches";
case GIMP_UNIT_MM:
return "millimeters";
case GIMP_UNIT_POINT:
return "points";
case GIMP_UNIT_PICA:
return "picas";
default:
return NULL;
}
}
gint
gimp_unit_get_number_of_units (void)
{
return GIMP_UNIT_END;
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Copyright (C) 2003 Sven Neumann <sven@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_CONFIG_DUMP_H__
#define __GIMP_CONFIG_DUMP_H__
typedef enum
{
GIMP_CONFIG_DUMP_NONE,
GIMP_CONFIG_DUMP_GIMPRC,
GIMP_CONFIG_DUMP_GIMPRC_SYSTEM,
GIMP_CONFIG_DUMP_GIMPRC_MANPAGE
} GimpConfigDumpFormat;
gboolean gimp_config_dump (GimpConfigDumpFormat format);
#endif /* __GIMP_CONFIG_DUMP_H__ */
......@@ -19,6 +19,7 @@ OBJECTS = \
gimpbaseconfig.obj \
gimpconfig.obj \
gimpconfig-deserialize.obj \
gimpconfig-dump.obj \
gimpconfig-error.obj \
gimpconfig-params.obj \
gimpconfig-path.obj \
......
......@@ -42,7 +42,10 @@
#include "libgimpbase/gimpbase.h"
#include "config/gimpconfig-dump.h"
#include "core/core-types.h"
#include "core/gimp.h"
#include "app_procs.h"
#include "errors.h"
......@@ -60,7 +63,7 @@ static void gimp_sigchld_handler (gint sig_num);
static void gimp_show_version (void);
static void gimp_show_help (const gchar *progname);
static void gimp_text_console_exit (gboolean fail);
static void gimp_text_console_exit (gint status);
/*
......@@ -136,23 +139,48 @@ main (int argc,
*/
for (i = 1; i < argc; i++)
{
if ((strcmp (argv[i], "--no-interface") == 0) ||
(strcmp (argv[i], "-i") == 0))
const gchar *arg = argv[i];
if (arg[0] != '-')
continue;
if ((strcmp (arg, "--no-interface") == 0) ||
(strcmp (arg, "-i") == 0))
{
no_interface = TRUE;
}
else if ((strcmp (argv[i], "--version") == 0) ||
(strcmp (argv[i], "-v") == 0))
else if ((strcmp (arg, "--version") == 0) ||
(strcmp (arg, "-v") == 0))
{
gimp_show_version ();
gimp_text_console_exit (FALSE);
gimp_text_console_exit (EXIT_SUCCESS);
}
else if ((strcmp (argv[i], "--help") == 0) ||
(strcmp (argv[i], "-h") == 0))
else if ((strcmp (arg, "--help") == 0) ||
(strcmp (arg, "-h") == 0))
{
gimp_show_help (full_prog_name);
gimp_text_console_exit (FALSE);
gimp_text_console_exit (EXIT_SUCCESS);
}
else if (strncmp (arg, "--dump-gimprc", 13) == 0)
{
GimpConfigDumpFormat format = GIMP_CONFIG_DUMP_NONE;
if (strcmp (arg, "--dump-gimprc") == 0)
format = GIMP_CONFIG_DUMP_GIMPRC;
if (strcmp (arg, "--dump-gimprc-system") == 0)
format = GIMP_CONFIG_DUMP_GIMPRC_SYSTEM;
else if (strcmp (arg, "--dump-gimprc-manpage") == 0)
format = GIMP_CONFIG_DUMP_GIMPRC_MANPAGE;
if (format)
{
g_type_init ();
the_gimp = g_object_new (GIMP_TYPE_GIMP, NULL);
gimp_text_console_exit (gimp_config_dump (format) ?
EXIT_SUCCESS : EXIT_FAILURE);
}
}
}
if (no_interface)
......@@ -173,7 +201,7 @@ main (int argc,
"Make sure a proper setup for your display environment exists.");
g_print ("%s\n\n", msg);
gimp_text_console_exit (TRUE);
gimp_text_console_exit (EXIT_FAILURE);
}
g_set_application_name (_("The GIMP"));
......@@ -182,7 +210,7 @@ main (int argc,
use_shm = TRUE;
#endif
batch_cmds = g_new (char *, argc);
batch_cmds = g_new (gchar *, argc);
batch_cmds[0] = NULL;
for (i = 1; i < argc; i++)
......@@ -345,7 +373,7 @@ main (int argc,
if (show_help)
{
gimp_show_help (full_prog_name);
gimp_text_console_exit (TRUE);
gimp_text_console_exit (EXIT_FAILURE);
}
#ifndef G_OS_WIN32
......@@ -405,6 +433,8 @@ main (int argc,
stack_trace_mode,
restore_session);
g_free (batch_cmds);
return EXIT_SUCCESS;
}
......@@ -443,7 +473,7 @@ gimp_show_help (const gchar *progname)
}
static void
gimp_text_console_exit (gboolean fail)
gimp_text_console_exit (gint status)
{
#ifdef G_OS_WIN32
/* Give them time to read the message if it was printed in a
......@@ -462,7 +492,7 @@ gimp_text_console_exit (gboolean fail)
}
#endif
exit (fail ? EXIT_FAILURE : EXIT_SUCCESS);
exit (status);
}
......
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