app/config/Makefile.am new files with utility functions.

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

	* app/config/Makefile.am
	* app/config/gimpconfig-utils.[ch]: new files with utility functions.

	* app/config/gimpdisplayconfig.[ch]: new class with display config
	properties so GimpGuiConfig doesn't get too large.

	* app/config/gimpbaseconfig.c
	* app/config/gimpcoreconfig.[ch]
	* app/config/gimpguiconfig.[ch]: install path properties with
	useable defaults (substituted gimpdir and friends). Moved properties
	around.

	* app/gui/session.c: removed outdated comment.
This commit is contained in:
Sven Neumann 2001-12-18 12:39:45 +00:00 committed by Sven Neumann
parent e16e76438f
commit def233b497
14 changed files with 607 additions and 267 deletions

View file

@ -1,3 +1,19 @@
2001-12-18 Sven Neumann <sven@gimp.org>
* app/config/Makefile.am
* app/config/gimpconfig-utils.[ch]: new files with utility functions.
* app/config/gimpdisplayconfig.[ch]: new class with display config
properties so GimpGuiConfig doesn't get too large.
* app/config/gimpbaseconfig.c
* app/config/gimpcoreconfig.[ch]
* app/config/gimpguiconfig.[ch]: install path properties with
useable defaults (substituted gimpdir and friends). Moved properties
around.
* app/gui/session.c: removed outdated comment.
2001-12-18 Michael Natterer <mitch@gimp.org>
* configure.in: added -DGDK_PIXBUF_DISABLE_DEPRECATED to CPPFLAGS.

View file

@ -16,10 +16,14 @@ libappconfig_a_SOURCES = @STRIP_BEGIN@ \
gimpconfig-serialize.h \
gimpconfig-types.c \
gimpconfig-types.h \
gimpconfig-utils.c \
gimpconfig-utils.h \
gimpbaseconfig.c \
gimpbaseconfig.h \
gimpcoreconfig.c \
gimpcoreconfig.h \
gimpdisplayconfig.c \
gimpdisplayconfig.h \
gimpguiconfig.c \
gimpguiconfig.h \
@STRIP_END@

View file

@ -101,11 +101,12 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
object_class->get_property = gimp_base_config_get_property;
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_TEMP_PATH,
"temp-path",
"${gimp_dir}" G_DIR_SEPARATOR_S "tmp");
"temp-path",
g_build_filename (gimp_directory (),
"tmp", NULL));
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_SWAP_PATH,
"swap-path",
"${gimp_dir}");
"swap-path",
g_strdup (gimp_directory ()));
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_STINGY_MEMORY_USE,
"stingy-memory-use",
FALSE);

View file

@ -0,0 +1,47 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Utitility functions for GimpConfig.
* 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.h>
#include "libgimpbase/gimpenv.h"
#include "gimpconfig-utils.h"
gchar *
gimp_config_build_data_path (const gchar *name)
{
return g_strconcat (gimp_directory (), G_DIR_SEPARATOR_S, name,
G_SEARCHPATH_SEPARATOR_S,
gimp_data_directory (), G_DIR_SEPARATOR_S, name,
NULL);
}
gchar *
gimp_config_build_plug_in_path (const gchar *name)
{
return g_strconcat (gimp_directory (), G_DIR_SEPARATOR_S, name,
G_SEARCHPATH_SEPARATOR_S,
gimp_plug_in_directory (), G_DIR_SEPARATOR_S, name,
NULL);
}

View file

@ -0,0 +1,30 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Utitility functions for GimpConfig.
* 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_CONFIG_UTILS_H__
#define __GIMP_CONFIG_UTILS_H__
gchar * gimp_config_build_data_path (const gchar *name);
gchar * gimp_config_build_plug_in_path (const gchar *name);
#endif /* __GIMP_CONFIG_UTILS_H__ */

View file

@ -31,18 +31,11 @@
#include "gimpconfig.h"
#include "gimpconfig-params.h"
#include "gimpconfig-types.h"
#include "gimpconfig-utils.h"
#include "gimpcoreconfig.h"
#define BUILD_PLUG_IN_PATH(name)\
("${gimp_dir}" G_DIR_SEPARATOR_S name G_SEARCHPATH_SEPARATOR_S \
"${gimp_plugin_dir}" G_DIR_SEPARATOR_S name)
#define BUILD_DATA_PATH(name)\
("${gimp_dir}" G_DIR_SEPARATOR_S name G_SEARCHPATH_SEPARATOR_S \
"${gimp_datadir}" G_DIR_SEPARATOR_S name)
static void gimp_core_config_class_init (GimpCoreConfigClass *klass);
static void gimp_core_config_set_property (GObject *object,
guint property_id,
@ -77,7 +70,11 @@ enum
PROP_UNDO_LEVELS,
PROP_PLUGINRC_PATH,
PROP_MODULE_LOAD_INHIBIT,
PROP_WRITE_THUMBNAILS
PROP_PREVIEW_SIZE,
PROP_WRITE_THUMBNAILS,
PROP_GAMMA_CORRECTION,
PROP_INSTALL_COLORMAP,
PROP_MIN_COLORS
};
@ -121,22 +118,22 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PLUG_IN_PATH,
"plug-in-path",
BUILD_PLUG_IN_PATH ("plug-ins"));
gimp_config_build_plug_in_path ("plug-ins"));
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_MODULE_PATH,
"module-path",
BUILD_PLUG_IN_PATH ("modules"));
gimp_config_build_plug_in_path ("modules"));
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_BRUSH_PATH,
"brush-path",
BUILD_DATA_PATH ("brushes"));
gimp_config_build_data_path ("brushes"));
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PATTERN_PATH,
"pattern-path",
BUILD_DATA_PATH ("patterns"));
gimp_config_build_data_path ("patterns"));
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PALETTE_PATH,
"palette-path",
BUILD_DATA_PATH ("palettes"));
gimp_config_build_data_path ("palettes"));
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_GRADIENT_PATH,
"gradient-path",
BUILD_DATA_PATH ("gradients"));
gimp_config_build_data_path ("gradients"));
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_DEFAULT_BRUSH,
"default-brush",
NULL);
@ -178,13 +175,26 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
0, G_MAXINT, 5);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PLUGINRC_PATH,
"pluginrc-path",
"${gimp_dir}" G_DIR_SEPARATOR_S "pluginrc");
g_build_filename (gimp_directory (),
"pluginrc", NULL));
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_MODULE_LOAD_INHIBIT,
"module-load-inhibit",
NULL);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PREVIEW_SIZE,
"preview-size",
GIMP_TYPE_PREVIEW_SIZE, GIMP_PREVIEW_SIZE_SMALL);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_WRITE_THUMBNAILS,
"write-thumbnails",
TRUE);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GAMMA_CORRECTION,
"gamma-correction",
0.0, 100.0, 1.0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INSTALL_COLORMAP,
"install-colormap",
FALSE);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MIN_COLORS,
"min-colors",
27, 256, 144);
}
static void
@ -275,9 +285,21 @@ gimp_core_config_set_property (GObject *object,
g_free (core_config->module_load_inhibit);
core_config->module_load_inhibit = g_value_dup_string (value);
break;
case PROP_PREVIEW_SIZE:
core_config->preview_size = g_value_get_enum (value);
break;
case PROP_WRITE_THUMBNAILS:
core_config->write_thumbnails = g_value_get_boolean (value);
break;
case PROP_GAMMA_CORRECTION:
core_config->gamma_val = g_value_get_double (value);
break;
case PROP_INSTALL_COLORMAP:
core_config->install_cmap = g_value_get_boolean (value);
break;
case PROP_MIN_COLORS:
core_config->min_colors = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -360,9 +382,21 @@ gimp_core_config_get_property (GObject *object,
case PROP_MODULE_LOAD_INHIBIT:
g_value_set_string (value, core_config->module_load_inhibit);
break;
case PROP_PREVIEW_SIZE:
g_value_set_enum (value, core_config->preview_size);
break;
case PROP_WRITE_THUMBNAILS:
g_value_set_boolean (value, core_config->write_thumbnails);
break;
case PROP_GAMMA_CORRECTION:
g_value_set_double (value, core_config->gamma_val);
break;
case PROP_INSTALL_COLORMAP:
g_value_set_boolean (value, core_config->install_cmap);
break;
case PROP_MIN_COLORS:
g_value_set_int (value, core_config->min_colors);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);

View file

@ -67,7 +67,13 @@ struct _GimpCoreConfig
gchar *plug_in_rc_path;
gchar *module_load_inhibit;
GimpPreviewSize preview_size;
gboolean write_thumbnails;
gdouble gamma_val;
gboolean install_cmap;
gint min_colors;
};
struct _GimpCoreConfigClass

View file

@ -0,0 +1,257 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpDisplayConfig class
* 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 "base/base-enums.h"
#include "core/core-enums.h"
#include "gimpconfig.h"
#include "gimpconfig-params.h"
#include "gimpconfig-types.h"
#include "gimpconfig-utils.h"
#include "gimpdisplayconfig.h"
static void gimp_display_config_class_init (GimpDisplayConfigClass *klass);
static void gimp_display_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_display_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
enum
{
PROP_0,
PROP_MARCHING_ANTS_SPEED,
PROP_COLORMAP_CYCLING,
PROP_RESIZE_WINDOWS_ON_ZOOM,
PROP_RESIZE_WINDOWS_ON_RESIZE,
PROP_DEFAULT_DOT_FOR_DOT,
PROP_CURSOR_MODE,
PROP_CURSOR_UPDATING,
PROP_IMAGE_TITLE_FORMAT,
PROP_SHOW_RULERS,
PROP_SHOW_STATUSBAR,
PROP_CONFIRM_ON_CLOSE,
PROP_MONITOR_XRESOLUTION,
PROP_MONITOR_YRESOLUTION,
PROP_MONITOR_RES_FROM_GDK
};
GType
gimp_display_config_get_type (void)
{
static GType config_type = 0;
if (! config_type)
{
static const GTypeInfo config_info =
{
sizeof (GimpDisplayConfigClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gimp_display_config_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpDisplayConfig),
0, /* n_preallocs */
NULL /* instance_init */
};
config_type = g_type_register_static (GIMP_TYPE_CORE_CONFIG,
"GimpDisplayConfig",
&config_info, 0);
}
return config_type;
}
static void
gimp_display_config_class_init (GimpDisplayConfigClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_display_config_set_property;
object_class->get_property = gimp_display_config_get_property;
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MARCHING_ANTS_SPEED,
"marching-ants-speed",
50, G_MAXINT, 300);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_COLORMAP_CYCLING,
"colormap-cycling",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RESIZE_WINDOWS_ON_ZOOM,
"resize-windows-on-zoom",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RESIZE_WINDOWS_ON_RESIZE,
"resize-windows-on-resize",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DEFAULT_DOT_FOR_DOT,
"default-dot-for-dot",
TRUE);
/* FIXME: insert cursor_mode and cursor_updating here */
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_IMAGE_TITLE_FORMAT,
"image-title-format",
"%f-%p.%i (%t)");
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS,
"show-rulers",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_STATUSBAR,
"show-statusbar",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_CONFIRM_ON_CLOSE,
"confirm-on-close",
TRUE);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MONITOR_XRESOLUTION,
"monitor-xresolution",
GIMP_MIN_RESOLUTION, G_MAXDOUBLE, 72.0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MONITOR_YRESOLUTION,
"monitor-yresolution",
GIMP_MIN_RESOLUTION, G_MAXDOUBLE, 72.0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MONITOR_RES_FROM_GDK,
"monitor-resolution-from-windowing-system",
TRUE);
}
static void
gimp_display_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpDisplayConfig *display_config;
display_config = GIMP_DISPLAY_CONFIG (object);
switch (property_id)
{
case PROP_MARCHING_ANTS_SPEED:
display_config->marching_ants_speed = g_value_get_int (value);
break;
case PROP_COLORMAP_CYCLING:
display_config->colormap_cycling = g_value_get_boolean (value);
break;
case PROP_RESIZE_WINDOWS_ON_ZOOM:
display_config->resize_windows_on_zoom = g_value_get_boolean (value);
break;
case PROP_RESIZE_WINDOWS_ON_RESIZE:
display_config->resize_windows_on_resize = g_value_get_boolean (value);
break;
case PROP_DEFAULT_DOT_FOR_DOT:
display_config->default_dot_for_dot = g_value_get_boolean (value);
break;
case PROP_IMAGE_TITLE_FORMAT:
g_free (display_config->image_title_format);
display_config->image_title_format = g_value_dup_string (value);
break;
case PROP_SHOW_RULERS:
display_config->show_rulers = g_value_get_boolean (value);
break;
case PROP_SHOW_STATUSBAR:
display_config->show_statusbar = g_value_get_boolean (value);
break;
case PROP_CONFIRM_ON_CLOSE:
display_config->confirm_on_close = g_value_get_boolean (value);
break;
case PROP_MONITOR_XRESOLUTION:
display_config->monitor_xres = g_value_get_double (value);
break;
case PROP_MONITOR_YRESOLUTION:
display_config->monitor_yres = g_value_get_double (value);
break;
case PROP_MONITOR_RES_FROM_GDK:
display_config->monitor_res_from_gdk = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_display_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpDisplayConfig *display_config;
display_config = GIMP_DISPLAY_CONFIG (object);
switch (property_id)
{
case PROP_MARCHING_ANTS_SPEED:
g_value_set_int (value, display_config->marching_ants_speed);
break;
case PROP_COLORMAP_CYCLING:
g_value_set_boolean (value, display_config->colormap_cycling);
break;
case PROP_RESIZE_WINDOWS_ON_ZOOM:
g_value_set_boolean (value, display_config->resize_windows_on_zoom);
break;
case PROP_RESIZE_WINDOWS_ON_RESIZE:
g_value_set_boolean (value, display_config->resize_windows_on_resize);
break;
case PROP_DEFAULT_DOT_FOR_DOT:
g_value_set_boolean (value, display_config->default_dot_for_dot);
break;
case PROP_IMAGE_TITLE_FORMAT:
g_value_set_string (value, display_config->image_title_format);
break;
case PROP_SHOW_RULERS:
g_value_set_boolean (value, display_config->show_rulers);
break;
case PROP_SHOW_STATUSBAR:
g_value_set_boolean (value, display_config->show_statusbar);
break;
case PROP_CONFIRM_ON_CLOSE:
g_value_set_boolean (value, display_config->confirm_on_close);
break;
case PROP_MONITOR_XRESOLUTION:
g_value_set_double (value, display_config->monitor_xres);
break;
case PROP_MONITOR_YRESOLUTION:
g_value_set_double (value, display_config->monitor_yres);
break;
case PROP_MONITOR_RES_FROM_GDK:
g_value_set_boolean (value, display_config->monitor_res_from_gdk);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}

View file

@ -0,0 +1,73 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpDisplayConfig class
* 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_DISPLAY_CONFIG_H__
#define __GIMP_DISPLAY_CONFIG_H__
#include "gimpcoreconfig.h"
#define GIMP_TYPE_DISPLAY_CONFIG (gimp_display_config_get_type ())
#define GIMP_DISPLAY_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY_CONFIG, GimpDisplayConfig))
#define GIMP_DISPLAY_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY_CONFIG, GimpDisplayConfigClass))
#define GIMP_IS_DISPLAY_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY_CONFIG))
#define GIMP_IS_DISPLAY_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY_CONFIG))
typedef struct _GimpDisplayConfig GimpDisplayConfig;
typedef struct _GimpDisplayConfigClass GimpDisplayConfigClass;
struct _GimpDisplayConfig
{
GimpCoreConfig parent_instance;
gint marching_ants_speed;
gboolean colormap_cycling;
gboolean resize_windows_on_zoom;
gboolean resize_windows_on_resize;
gboolean default_dot_for_dot;
gint cursor_mode;
gboolean cursor_updating;
gchar *image_title_format;
gboolean show_rulers;
gboolean show_statusbar;
gboolean confirm_on_close;
gdouble monitor_xres;
gdouble monitor_yres;
gboolean monitor_res_from_gdk;
};
struct _GimpDisplayConfigClass
{
GimpCoreConfigClass parent_class;
};
GType gimp_display_config_get_type (void) G_GNUC_CONST;
#endif /* GIMP_DISPLAY_CONFIG_H__ */

View file

@ -31,15 +31,11 @@
#include "gimpconfig.h"
#include "gimpconfig-params.h"
#include "gimpconfig-types.h"
#include "gimpconfig-utils.h"
#include "gimpguiconfig.h"
#define BUILD_DATA_PATH(name)\
("${gimp_dir}" G_DIR_SEPARATOR_S name G_SEARCHPATH_SEPARATOR_S \
"${gimp_datadir}" G_DIR_SEPARATOR_S name)
static void gimp_gui_config_class_init (GimpGuiConfigClass *klass);
static void gimp_gui_config_set_property (GObject *object,
guint property_id,
@ -53,38 +49,22 @@ static void gimp_gui_config_get_property (GObject *object,
enum
{
PROP_0,
PROP_MARCHING_ANTS_SPEED,
PROP_COLORMAP_CYCLING,
PROP_LAST_OPENED_SIZE,
PROP_TRANSPARENCY_SIZE,
PROP_TRANSPARENCY_TYPE,
PROP_GAMMA_CORRECTION,
PROP_PERFECT_MOUSE,
PROP_INSTALL_COLORMAP,
PROP_MIN_COLORS,
PROP_DEFAULT_THRESHOLD,
PROP_RESIZE_WINDOWS_ON_ZOOM,
PROP_RESIZE_WINDOWS_ON_RESIZE,
PROP_PREVIEW_SIZE,
PROP_NAV_PREVIEW_SIZE,
PROP_IMAGE_TITLE_FORMAT,
PROP_SHOW_RULERS,
PROP_SHOW_STATUSBAR,
PROP_SHOW_TOOL_TIPS,
PROP_GLOBAL_PAINT_OPTIONS,
PROP_CONFIRM_ON_CLOSE,
PROP_TRUST_DIRTY_FLAG,
PROP_DEFAULT_DOT_FOR_DOT,
PROP_NAV_WINDOW_PER_DISPLAY,
PROP_INFO_WINDOW_PER_DISPLAY,
PROP_GLOBAL_PAINT_OPTIONS,
PROP_TRUST_DIRTY_FLAG,
PROP_SAVE_DEVICE_STATUS,
PROP_SAVE_SESSION_INFO,
PROP_RESTORE_SESSION,
PROP_SHOW_TIPS,
PROP_SHOW_TOOL_TIPS,
PROP_TEAROFF_MENUS,
PROP_MONITOR_XRESOLUTION,
PROP_MONITOR_YRESOLUTION,
PROP_MONITOR_RES_FROM_GDK,
PROP_MAX_NEW_IMAGE_SIZE,
PROP_THEME_PATH,
PROP_THEME
@ -111,7 +91,7 @@ gimp_gui_config_get_type (void)
NULL /* instance_init */
};
config_type = g_type_register_static (GIMP_TYPE_CORE_CONFIG,
config_type = g_type_register_static (GIMP_TYPE_DISPLAY_CONFIG,
"GimpGuiConfig",
&config_info, 0);
}
@ -129,12 +109,6 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
object_class->set_property = gimp_gui_config_set_property;
object_class->get_property = gimp_gui_config_get_property;
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MARCHING_ANTS_SPEED,
"marching-ants-speed",
50, G_MAXINT, 300);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_COLORMAP_CYCLING,
"colormap-cycling",
FALSE);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_LAST_OPENED_SIZE,
"last-opened-size",
0, G_MAXINT, 4);
@ -144,63 +118,27 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_TYPE,
"transparency-type",
GIMP_TYPE_CHECK_TYPE, GIMP_GRAY_CHECKS);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GAMMA_CORRECTION,
"gamma-correction",
0.0, 100.0, 1.0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PERFECT_MOUSE,
"perfect-mouse",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INSTALL_COLORMAP,
"install-colormap",
FALSE);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MIN_COLORS,
"min-colors",
27, 256, 144);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_DEFAULT_THRESHOLD,
"default-threshold",
0, 255, 15);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RESIZE_WINDOWS_ON_ZOOM,
"resize-windows-on-zoom",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RESIZE_WINDOWS_ON_RESIZE,
"resize-windows-on-resize",
FALSE);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PREVIEW_SIZE,
"preview-size",
GIMP_TYPE_PREVIEW_SIZE, GIMP_PREVIEW_SIZE_SMALL);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_NAV_PREVIEW_SIZE,
"navigation-preview-size",
GIMP_TYPE_PREVIEW_SIZE, GIMP_PREVIEW_SIZE_HUGE);
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_IMAGE_TITLE_FORMAT,
"image-title-format",
"%f-%p.%i (%t)");
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_RULERS,
"show-rulers",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_STATUSBAR,
"show-statusbar",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOL_TIPS,
"show-tool-tips",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GLOBAL_PAINT_OPTIONS,
"global-paint-options",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_CONFIRM_ON_CLOSE,
"confirm-on-close",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TRUST_DIRTY_FLAG,
"trust-dirty-flag",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DEFAULT_DOT_FOR_DOT,
"default-dot-for-dot",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_NAV_WINDOW_PER_DISPLAY,
"navigation-window-per-display",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INFO_WINDOW_PER_DISPLAY,
"info-window-per-display",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_GLOBAL_PAINT_OPTIONS,
"global-paint-options",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TRUST_DIRTY_FLAG,
"trust-dirty-flag",
FALSE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAVE_DEVICE_STATUS,
"save-device-status",
FALSE);
@ -213,24 +151,18 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TIPS,
"show-tips",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOL_TIPS,
"show-tool-tips",
TRUE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEAROFF_MENUS,
"tearoff-menus",
TRUE);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MONITOR_XRESOLUTION,
"monitor-xresolution",
GIMP_MIN_RESOLUTION, G_MAXDOUBLE, 72.0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_MONITOR_YRESOLUTION,
"monitor-yresolution",
GIMP_MIN_RESOLUTION, G_MAXDOUBLE, 72.0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MONITOR_RES_FROM_GDK,
"monitor-resolution-from-windowing-system",
TRUE);
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_MAX_NEW_IMAGE_SIZE,
"max-new-image-size",
0, G_MAXUINT, 1 << 25);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_THEME_PATH,
"theme-path",
BUILD_DATA_PATH ("themes"));
gimp_config_build_data_path ("themes"));
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_THEME,
"theme",
NULL);
@ -248,12 +180,6 @@ gimp_gui_config_set_property (GObject *object,
switch (property_id)
{
case PROP_MARCHING_ANTS_SPEED:
gui_config->marching_ants_speed = g_value_get_int (value);
break;
case PROP_COLORMAP_CYCLING:
gui_config->colormap_cycling = g_value_get_boolean (value);
break;
case PROP_LAST_OPENED_SIZE:
gui_config->last_opened_size = g_value_get_int (value);
break;
@ -263,64 +189,27 @@ gimp_gui_config_set_property (GObject *object,
case PROP_TRANSPARENCY_TYPE:
gui_config->transparency_type = g_value_get_enum (value);
break;
case PROP_GAMMA_CORRECTION:
gui_config->gamma_val = g_value_get_double (value);
break;
case PROP_PERFECT_MOUSE:
gui_config->perfect_mouse = g_value_get_boolean (value);
break;
case PROP_INSTALL_COLORMAP:
gui_config->install_cmap = g_value_get_boolean (value);
break;
case PROP_MIN_COLORS:
gui_config->min_colors = g_value_get_int (value);
break;
case PROP_DEFAULT_THRESHOLD:
gui_config->default_threshold = g_value_get_int (value);
break;
case PROP_RESIZE_WINDOWS_ON_ZOOM:
gui_config->resize_windows_on_zoom = g_value_get_boolean (value);
break;
case PROP_RESIZE_WINDOWS_ON_RESIZE:
gui_config->resize_windows_on_resize = g_value_get_boolean (value);
break;
case PROP_PREVIEW_SIZE:
gui_config->preview_size = g_value_get_enum (value);
break;
case PROP_NAV_PREVIEW_SIZE:
gui_config->nav_preview_size = g_value_get_enum (value);
break;
case PROP_IMAGE_TITLE_FORMAT:
g_free (gui_config->image_title_format);
gui_config->image_title_format = g_value_dup_string (value);
break;
case PROP_SHOW_RULERS:
gui_config->show_rulers = g_value_get_boolean (value);
break;
case PROP_SHOW_STATUSBAR:
gui_config->show_statusbar = g_value_get_boolean (value);
break;
case PROP_SHOW_TOOL_TIPS:
gui_config->show_tool_tips = g_value_get_boolean (value);
break;
case PROP_GLOBAL_PAINT_OPTIONS:
gui_config->global_paint_options = g_value_get_boolean (value);
break;
case PROP_CONFIRM_ON_CLOSE:
gui_config->confirm_on_close = g_value_get_boolean (value);
break;
case PROP_TRUST_DIRTY_FLAG:
gui_config->trust_dirty_flag = g_value_get_boolean (value);
break;
case PROP_DEFAULT_DOT_FOR_DOT:
gui_config->default_dot_for_dot = g_value_get_boolean (value);
break;
case PROP_NAV_WINDOW_PER_DISPLAY:
gui_config->nav_window_per_display = g_value_get_boolean (value);
break;
case PROP_INFO_WINDOW_PER_DISPLAY:
gui_config->info_window_per_display = g_value_get_boolean (value);
break;
case PROP_GLOBAL_PAINT_OPTIONS:
gui_config->global_paint_options = g_value_get_boolean (value);
break;
case PROP_TRUST_DIRTY_FLAG:
gui_config->trust_dirty_flag = g_value_get_boolean (value);
break;
case PROP_SAVE_DEVICE_STATUS:
gui_config->save_device_status = g_value_get_boolean (value);
break;
@ -333,18 +222,12 @@ gimp_gui_config_set_property (GObject *object,
case PROP_SHOW_TIPS:
gui_config->show_tips = g_value_get_boolean (value);
break;
case PROP_SHOW_TOOL_TIPS:
gui_config->show_tool_tips = g_value_get_boolean (value);
break;
case PROP_TEAROFF_MENUS:
gui_config->tearoff_menus = g_value_get_boolean (value);
break;
case PROP_MONITOR_XRESOLUTION:
gui_config->monitor_xres = g_value_get_double (value);
break;
case PROP_MONITOR_YRESOLUTION:
gui_config->monitor_yres = g_value_get_double (value);
break;
case PROP_MONITOR_RES_FROM_GDK:
gui_config->monitor_res_from_gdk = g_value_get_boolean (value);
break;
case PROP_MAX_NEW_IMAGE_SIZE:
gui_config->max_new_image_size = g_value_get_uint (value);
break;
@ -375,12 +258,6 @@ gimp_gui_config_get_property (GObject *object,
switch (property_id)
{
case PROP_MARCHING_ANTS_SPEED:
g_value_set_int (value, gui_config->marching_ants_speed);
break;
case PROP_COLORMAP_CYCLING:
g_value_set_boolean (value, gui_config->colormap_cycling);
break;
case PROP_LAST_OPENED_SIZE:
g_value_set_int (value, gui_config->last_opened_size);
break;
@ -390,63 +267,27 @@ gimp_gui_config_get_property (GObject *object,
case PROP_TRANSPARENCY_TYPE:
g_value_set_enum (value, gui_config->transparency_type);
break;
case PROP_GAMMA_CORRECTION:
g_value_set_double (value, gui_config->gamma_val);
break;
case PROP_PERFECT_MOUSE:
g_value_set_boolean (value, gui_config->perfect_mouse);
break;
case PROP_INSTALL_COLORMAP:
g_value_set_boolean (value, gui_config->install_cmap);
break;
case PROP_MIN_COLORS:
g_value_set_int (value, gui_config->min_colors);
break;
case PROP_DEFAULT_THRESHOLD:
g_value_set_int (value, gui_config->default_threshold);
break;
case PROP_RESIZE_WINDOWS_ON_ZOOM:
g_value_set_boolean (value, gui_config->resize_windows_on_zoom);
break;
case PROP_RESIZE_WINDOWS_ON_RESIZE:
g_value_set_boolean (value, gui_config->resize_windows_on_resize);
break;
case PROP_PREVIEW_SIZE:
g_value_set_enum (value, gui_config->preview_size);
break;
case PROP_NAV_PREVIEW_SIZE:
g_value_set_enum (value, gui_config->nav_preview_size);
break;
case PROP_IMAGE_TITLE_FORMAT:
g_value_set_string (value, gui_config->image_title_format);
break;
case PROP_SHOW_RULERS:
g_value_set_boolean (value, gui_config->show_rulers);
break;
case PROP_SHOW_STATUSBAR:
g_value_set_boolean (value, gui_config->show_statusbar);
break;
case PROP_SHOW_TOOL_TIPS:
g_value_set_boolean (value, gui_config->show_tool_tips);
break;
case PROP_GLOBAL_PAINT_OPTIONS:
g_value_set_boolean (value, gui_config->global_paint_options);
break;
case PROP_CONFIRM_ON_CLOSE:
g_value_set_boolean (value, gui_config->confirm_on_close);
break;
case PROP_TRUST_DIRTY_FLAG:
g_value_set_boolean (value, gui_config->trust_dirty_flag);
break;
case PROP_DEFAULT_DOT_FOR_DOT:
g_value_set_boolean (value, gui_config->default_dot_for_dot);
break;
case PROP_NAV_WINDOW_PER_DISPLAY:
g_value_set_boolean (value, gui_config->nav_window_per_display);
break;
case PROP_INFO_WINDOW_PER_DISPLAY:
g_value_set_boolean (value, gui_config->info_window_per_display);
break;
case PROP_GLOBAL_PAINT_OPTIONS:
g_value_set_boolean (value, gui_config->global_paint_options);
break;
case PROP_TRUST_DIRTY_FLAG:
g_value_set_boolean (value, gui_config->trust_dirty_flag);
break;
case PROP_SAVE_DEVICE_STATUS:
g_value_set_boolean (value, gui_config->save_device_status);
break;
@ -459,18 +300,12 @@ gimp_gui_config_get_property (GObject *object,
case PROP_SHOW_TIPS:
g_value_set_boolean (value, gui_config->show_tips);
break;
case PROP_SHOW_TOOL_TIPS:
g_value_set_boolean (value, gui_config->show_tool_tips);
break;
case PROP_TEAROFF_MENUS:
g_value_set_boolean (value, gui_config->tearoff_menus);
break;
case PROP_MONITOR_XRESOLUTION:
g_value_set_double (value, gui_config->monitor_xres);
break;
case PROP_MONITOR_YRESOLUTION:
g_value_set_double (value, gui_config->monitor_yres);
break;
case PROP_MONITOR_RES_FROM_GDK:
g_value_set_boolean (value, gui_config->monitor_res_from_gdk);
break;
case PROP_MAX_NEW_IMAGE_SIZE:
g_value_set_uint (value, gui_config->max_new_image_size);
break;

View file

@ -22,7 +22,7 @@
#ifndef __GIMP_GUI_CONFIG_H__
#define __GIMP_GUI_CONFIG_H__
#include "gimpcoreconfig.h"
#include "gimpdisplayconfig.h"
#define GIMP_TYPE_GUI_CONFIG (gimp_gui_config_get_type ())
@ -37,50 +37,30 @@ typedef struct _GimpGuiConfigClass GimpGuiConfigClass;
struct _GimpGuiConfig
{
GimpCoreConfig parent_instance;
gint marching_ants_speed;
gboolean colormap_cycling;
GimpDisplayConfig parent_instance;
gint last_opened_size;
GimpCheckSize transparency_size;
GimpCheckType transparency_type;
gdouble gamma_val;
gboolean perfect_mouse;
gboolean install_cmap;
gint min_colors;
gint default_threshold;
gboolean resize_windows_on_zoom;
gboolean resize_windows_on_resize;
GimpPreviewSize preview_size;
GimpPreviewSize nav_preview_size;
gchar *image_title_format;
gboolean show_rulers;
gboolean show_statusbar;
gboolean show_tool_tips;
gboolean default_dot_for_dot;
gboolean nav_window_per_display;
gboolean info_window_per_display;
gboolean global_paint_options;
gboolean confirm_on_close;
gboolean trust_dirty_flag;
gboolean save_device_status;
gboolean save_session_info;
gboolean restore_session;
gboolean show_tips;
gboolean tearoff_menus;
gdouble monitor_xres;
gdouble monitor_yres;
gboolean monitor_res_from_gdk;
gboolean show_tool_tips;
gboolean tearoff_menus;
guint max_new_image_size;
@ -93,14 +73,11 @@ struct _GimpGuiConfig
gboolean use_help;
gint help_browser;
gint cursor_mode;
gboolean no_cursor_updating;
};
struct _GimpGuiConfigClass
{
GimpCoreConfigClass parent_class;
GimpDisplayConfigClass parent_class;
};

View file

@ -1,6 +1,9 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Session-managment stuff
* Copyright (C) 1998 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
@ -16,26 +19,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Session-managment stuff Copyright (C) 1998 Sven Neumann <sven@gimp.org>
I include a short description here on what is done and what problems
are left:
Since everything saved in sessionrc changes often (with each session?)
the whole file is rewritten each time the gimp exits. I don't see any
use in implementing a more flexible scheme like it is used for gimprc.
Right now session-managment is limited to window geometry. Restoring
openend images is planned, but I'm still not sure how to deal with dirty
images.
Dialogs are now reopened if the gimp is called with the command-line-option
--restore-session or if the related entry is set in gimprc.
Probably there should alternatively be a list of dialogs in the preferences
that should always be opened on start-up.
Please point me into the right direction to make this work with Gnome-SM.
*/
#include "config.h"

View file

@ -0,0 +1,47 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Utitility functions for GimpConfig.
* 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.h>
#include "libgimpbase/gimpenv.h"
#include "gimpconfig-utils.h"
gchar *
gimp_config_build_data_path (const gchar *name)
{
return g_strconcat (gimp_directory (), G_DIR_SEPARATOR_S, name,
G_SEARCHPATH_SEPARATOR_S,
gimp_data_directory (), G_DIR_SEPARATOR_S, name,
NULL);
}
gchar *
gimp_config_build_plug_in_path (const gchar *name)
{
return g_strconcat (gimp_directory (), G_DIR_SEPARATOR_S, name,
G_SEARCHPATH_SEPARATOR_S,
gimp_plug_in_directory (), G_DIR_SEPARATOR_S, name,
NULL);
}

View file

@ -0,0 +1,30 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
*
* Utitility functions for GimpConfig.
* 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_CONFIG_UTILS_H__
#define __GIMP_CONFIG_UTILS_H__
gchar * gimp_config_build_data_path (const gchar *name);
gchar * gimp_config_build_plug_in_path (const gchar *name);
#endif /* __GIMP_CONFIG_UTILS_H__ */