don't build test-config by default.

2001-12-18  Sven Neumann  <sven@gimp.org>

	* app/config/Makefile.am: don't build test-config by default.

	* app/config/gimprc.[ch]: new files for the GimpRc implementation.

	* app/config/gimpcoreconfig.h
	* app/config/gimpdisplayconfig.h
	* app/config/gimpguiconfig.h: include the necessary enum headers
	here and prefix local includes with config so the files can be safely
	included from almost everywhere.

	* app/config/test-config.c: instantiate and test GimpRc.
This commit is contained in:
Sven Neumann 2001-12-18 19:23:26 +00:00 committed by Sven Neumann
parent 47d14e30c0
commit 5a48cb857c
8 changed files with 186 additions and 14 deletions

View File

@ -1,3 +1,17 @@
2001-12-18 Sven Neumann <sven@gimp.org>
* app/config/Makefile.am: don't build test-config by default.
* app/config/gimprc.[ch]: new files for the GimpRc implementation.
* app/config/gimpcoreconfig.h
* app/config/gimpdisplayconfig.h
* app/config/gimpguiconfig.h: include the necessary enum headers
here and prefix local includes with config so the files can be safely
included from almost everywhere.
* app/config/test-config.c: instantiate and test GimpRc.
2001-12-18 DindinX <David@dindinx.org>
* app/base/boundary.c:

View File

@ -26,6 +26,8 @@ libappconfig_a_SOURCES = @STRIP_BEGIN@ \
gimpdisplayconfig.h \
gimpguiconfig.c \
gimpguiconfig.h \
gimprc.c \
gimprc.h \
@STRIP_END@
AM_CPPFLAGS = @STRIP_BEGIN@ \
@ -42,9 +44,9 @@ INCLUDES = @STRIP_BEGIN@ \
@STRIP_END@
#
# test programs, not to be installed
# test programs, not to be built by default and never installed
#
noinst_PROGRAMS = test-config
EXTRA_PROGRAMS = test-config
test_config_DEPENDENCIES = @STRIP_BEGIN@ \
libappconfig.a \

View File

@ -24,7 +24,7 @@
#include "core/core-enums.h"
#include "gimpbaseconfig.h"
#include "config/gimpbaseconfig.h"
#define GIMP_TYPE_CORE_CONFIG (gimp_core_config_get_type ())

View File

@ -24,7 +24,7 @@
#include "display/display-enums.h"
#include "gimpcoreconfig.h"
#include "config/gimpcoreconfig.h"
#define GIMP_TYPE_DISPLAY_CONFIG (gimp_display_config_get_type ())

View File

@ -22,7 +22,7 @@
#ifndef __GIMP_GUI_CONFIG_H__
#define __GIMP_GUI_CONFIG_H__
#include "gimpdisplayconfig.h"
#include "config/gimpdisplayconfig.h"
#define GIMP_TYPE_GUI_CONFIG (gimp_gui_config_get_type ())

102
app/config/gimprc.c Normal file
View File

@ -0,0 +1,102 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpRc
* Copyright (C) 2001 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.
*/
#include "config.h"
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#include "gimpconfig.h"
#include "gimpconfig-serialize.h"
#include "gimprc.h"
static void gimp_rc_config_iface_init (gpointer iface,
gpointer iface_data);
static void gimp_rc_serialize (GObject *object,
gint fd);
GType
gimp_rc_get_type (void)
{
static GType rc_type = 0;
if (! rc_type)
{
static const GTypeInfo rc_info =
{
sizeof (GimpRcClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_init */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpRc),
0, /* n_preallocs */
NULL /* instance_init */
};
static const GInterfaceInfo rc_iface_info =
{
gimp_rc_config_iface_init,
NULL, /* iface_finalize */
NULL /* iface_data */
};
rc_type = g_type_register_static (GIMP_TYPE_GUI_CONFIG,
"GimpRc",
&rc_info, 0);
g_type_add_interface_static (rc_type,
GIMP_TYPE_CONFIG_INTERFACE,
&rc_iface_info);
}
return rc_type;
}
static void
gimp_rc_config_iface_init (gpointer iface,
gpointer iface_data)
{
GimpConfigInterface *config_iface = (GimpConfigInterface *) iface;
config_iface->serialize = gimp_rc_serialize;
}
static void
gimp_rc_serialize (GObject *object,
gint fd)
{
gimp_config_serialize_properties (object, fd);
gimp_config_serialize_unknown_tokens (object, fd);
}
GimpRc *
gimp_rc_new (void)
{
GimpRc *gimprc;
gimprc = GIMP_RC (g_object_new (GIMP_TYPE_RC, NULL));
return gimprc;
}

53
app/config/gimprc.h Normal file
View File

@ -0,0 +1,53 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpRc
* Copyright (C) 2001 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_RC_H__
#define __GIMP_RC_H__
#include "config/gimpguiconfig.h"
#define GIMP_TYPE_RC (gimp_rc_get_type ())
#define GIMP_RC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RC, GimpRc))
#define GIMP_RC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RC, GimpRcClass))
#define GIMP_IS_RC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RC))
#define GIMP_IS_RC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RC))
typedef struct _GimpRc GimpRc;
typedef struct _GimpRcClass GimpRcClass;
struct _GimpRc
{
GimpGuiConfig parent_instance;
};
struct _GimpRcClass
{
GimpGuiConfigClass parent_class;
};
GType gimp_rc_get_type (void) G_GNUC_CONST;
GimpRc * gimp_rc_new (void);
#endif /* GIMP_RC_H__ */

View File

@ -30,7 +30,7 @@
#include "core/core-enums.h"
#include "gimpconfig.h"
#include "gimpguiconfig.h"
#include "gimprc.h"
static void notify_callback (GObject *object,
@ -44,7 +44,7 @@ int
main (int argc,
char *argv[])
{
GObject *config;
GimpRc *gimprc;
const gchar *filename = "foorc";
gchar *header;
gint i;
@ -65,26 +65,27 @@ main (int argc,
g_print ("Testing GimpConfig ...\n\n");
config = g_object_new (GIMP_TYPE_GUI_CONFIG, NULL);
gimprc = gimp_rc_new ();
g_print (" Serializing %s to '%s' ... ",
g_type_name (G_TYPE_FROM_INSTANCE (config)), filename);
gimp_config_serialize (config, filename);
g_type_name (G_TYPE_FROM_INSTANCE (gimprc)), filename);
gimp_config_serialize (G_OBJECT (gimprc), filename);
g_print ("done.\n\n");
g_signal_connect (config, "notify",
g_signal_connect (G_OBJECT (gimprc), "notify",
G_CALLBACK (notify_callback),
NULL);
g_print (" Deserializing from '%s' ...\n", filename);
gimp_config_deserialize (config, filename, TRUE);
gimp_config_deserialize (G_OBJECT (gimprc), filename, TRUE);
header = "\n Unknown string tokens:\n";
gimp_config_foreach_unknown_token (config, output_unknown_token, &header);
gimp_config_foreach_unknown_token (G_OBJECT (gimprc),
output_unknown_token, &header);
g_print ("\n");
g_object_unref (config);
g_object_unref (G_OBJECT (gimprc));
g_print ("Done.\n");