Bug 599573 - Remember dialog defaults between Gimp sessions
Add GimpFillOptions and GimpStrokeOptions to GimpDialogConfig and use them in the Fill/Stroke Selection/Path dialogs and for the "with last values" commands. Add GUI for them to Preferences -> Dialog Defaults. This requires most of the stuff in my last few commits, and some more changes: GimpFillOptions is a GimpContext which has all sorts of connections to everything, including a Gimp pointer. Hack around in GimpDialogConfig to add a Gimp property, and add "gimp" parameters to quite some GimpRC functions. Treat the Gimp* as a GObject* in all public API because core/ stuff is not known in config/.
This commit is contained in:
@ -427,7 +427,7 @@ select_fill_last_vals_cmd_callback (GtkAction *action,
|
||||
GimpImage *image;
|
||||
GimpDrawable *drawable;
|
||||
GtkWidget *widget;
|
||||
GimpFillOptions *options;
|
||||
GimpDialogConfig *config;
|
||||
GError *error = NULL;
|
||||
return_if_no_image (image, data);
|
||||
return_if_no_widget (widget, data);
|
||||
@ -442,16 +442,10 @@ select_fill_last_vals_cmd_callback (GtkAction *action,
|
||||
return;
|
||||
}
|
||||
|
||||
options = g_object_get_data (G_OBJECT (image->gimp), "saved-fill-options");
|
||||
|
||||
if (options)
|
||||
g_object_ref (options);
|
||||
else
|
||||
options = gimp_fill_options_new (image->gimp,
|
||||
action_data_get_context (data), TRUE);
|
||||
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
||||
|
||||
if (! gimp_item_fill (GIMP_ITEM (gimp_image_get_mask (image)),
|
||||
drawable, options, TRUE, NULL, &error))
|
||||
drawable, config->fill_options, TRUE, NULL, &error))
|
||||
{
|
||||
gimp_message_literal (image->gimp,
|
||||
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
||||
@ -462,8 +456,6 @@ select_fill_last_vals_cmd_callback (GtkAction *action,
|
||||
{
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
void
|
||||
@ -514,7 +506,7 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||
GimpDrawable *drawable;
|
||||
GimpContext *context;
|
||||
GtkWidget *widget;
|
||||
GimpStrokeOptions *options;
|
||||
GimpDialogConfig *config;
|
||||
GError *error = NULL;
|
||||
return_if_no_image (image, data);
|
||||
return_if_no_context (context, data);
|
||||
@ -530,15 +522,10 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||
return;
|
||||
}
|
||||
|
||||
options = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-options");
|
||||
|
||||
if (options)
|
||||
g_object_ref (options);
|
||||
else
|
||||
options = gimp_stroke_options_new (image->gimp, context, TRUE);
|
||||
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
||||
|
||||
if (! gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
|
||||
drawable, context, options, NULL,
|
||||
drawable, context, config->stroke_options, NULL,
|
||||
TRUE, NULL, &error))
|
||||
{
|
||||
gimp_message_literal (image->gimp,
|
||||
@ -550,8 +537,6 @@ select_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||
{
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
|
||||
|
@ -426,7 +426,7 @@ vectors_fill_last_vals_cmd_callback (GtkAction *action,
|
||||
GimpVectors *vectors;
|
||||
GimpDrawable *drawable;
|
||||
GtkWidget *widget;
|
||||
GimpFillOptions *options;
|
||||
GimpDialogConfig *config;
|
||||
GError *error = NULL;
|
||||
return_if_no_vectors (image, vectors, data);
|
||||
return_if_no_widget (widget, data);
|
||||
@ -441,16 +441,10 @@ vectors_fill_last_vals_cmd_callback (GtkAction *action,
|
||||
return;
|
||||
}
|
||||
|
||||
options = g_object_get_data (G_OBJECT (image->gimp), "saved-fill-options");
|
||||
|
||||
if (options)
|
||||
g_object_ref (options);
|
||||
else
|
||||
options = gimp_fill_options_new (image->gimp,
|
||||
action_data_get_context (data), TRUE);
|
||||
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
||||
|
||||
if (! gimp_item_fill (GIMP_ITEM (vectors),
|
||||
drawable, options, TRUE, NULL, &error))
|
||||
drawable, config->fill_options, TRUE, NULL, &error))
|
||||
{
|
||||
gimp_message_literal (image->gimp, G_OBJECT (widget),
|
||||
GIMP_MESSAGE_WARNING, error->message);
|
||||
@ -460,8 +454,6 @@ vectors_fill_last_vals_cmd_callback (GtkAction *action,
|
||||
{
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
void
|
||||
@ -514,7 +506,7 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||
GimpDrawable *drawable;
|
||||
GimpContext *context;
|
||||
GtkWidget *widget;
|
||||
GimpStrokeOptions *options;
|
||||
GimpDialogConfig *config;
|
||||
GError *error = NULL;
|
||||
return_if_no_vectors (image, vectors, data);
|
||||
return_if_no_context (context, data);
|
||||
@ -530,15 +522,10 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||
return;
|
||||
}
|
||||
|
||||
options = g_object_get_data (G_OBJECT (image->gimp), "saved-stroke-options");
|
||||
|
||||
if (options)
|
||||
g_object_ref (options);
|
||||
else
|
||||
options = gimp_stroke_options_new (image->gimp, context, TRUE);
|
||||
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
||||
|
||||
if (! gimp_item_stroke (GIMP_ITEM (vectors),
|
||||
drawable, context, options, NULL,
|
||||
drawable, context, config->stroke_options, NULL,
|
||||
TRUE, NULL, &error))
|
||||
{
|
||||
gimp_message_literal (image->gimp, G_OBJECT (widget),
|
||||
@ -549,8 +536,6 @@ vectors_stroke_last_vals_cmd_callback (GtkAction *action,
|
||||
{
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
g_object_unref (options);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -216,7 +216,8 @@ app_run (const gchar *full_prog_name,
|
||||
if (g_file_query_file_type (gimpdir, G_FILE_QUERY_INFO_NONE, NULL) !=
|
||||
G_FILE_TYPE_DIRECTORY)
|
||||
{
|
||||
GimpUserInstall *install = gimp_user_install_new (be_verbose);
|
||||
GimpUserInstall *install = gimp_user_install_new (G_OBJECT (gimp),
|
||||
be_verbose);
|
||||
|
||||
#ifdef GIMP_CONSOLE_COMPILATION
|
||||
gimp_user_install_run (install);
|
||||
|
@ -56,13 +56,18 @@ static void dump_with_linebreaks (GOutputStream *output,
|
||||
|
||||
|
||||
gboolean
|
||||
gimp_config_dump (GimpConfigDumpFormat format)
|
||||
gimp_config_dump (GObject *gimp,
|
||||
GimpConfigDumpFormat format)
|
||||
{
|
||||
GOutputStream *output;
|
||||
GimpConfigWriter *writer;
|
||||
GimpConfig *rc;
|
||||
|
||||
rc = g_object_new (GIMP_TYPE_RC, NULL);
|
||||
g_return_val_if_fail (G_IS_OBJECT (gimp), FALSE);
|
||||
|
||||
rc = g_object_new (GIMP_TYPE_RC,
|
||||
"gimp", gimp,
|
||||
NULL);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
output = g_win32_output_stream_new ((gpointer) 1, FALSE);
|
||||
|
@ -30,7 +30,8 @@ typedef enum
|
||||
} GimpConfigDumpFormat;
|
||||
|
||||
|
||||
gboolean gimp_config_dump (GimpConfigDumpFormat format);
|
||||
gboolean gimp_config_dump (GObject *gimp,
|
||||
GimpConfigDumpFormat format);
|
||||
|
||||
|
||||
#endif /* __GIMP_CONFIG_DUMP_H__ */
|
||||
|
@ -28,6 +28,10 @@
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "core/core-types.h" /* fill and stroke options */
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpstrokeoptions.h"
|
||||
|
||||
#include "config-types.h"
|
||||
|
||||
#include "gimprc-blurbs.h"
|
||||
@ -39,6 +43,9 @@
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_GIMP,
|
||||
|
||||
PROP_COLOR_PROFILE_POLICY,
|
||||
|
||||
PROP_LAYER_NEW_NAME,
|
||||
@ -61,10 +68,27 @@ enum
|
||||
|
||||
PROP_SELECTION_BORDER_RADIUS,
|
||||
PROP_SELECTION_BORDER_STYLE,
|
||||
PROP_SELECTION_BORDER_EDGE_LOCK
|
||||
PROP_SELECTION_BORDER_EDGE_LOCK,
|
||||
|
||||
PROP_FILL_OPTIONS,
|
||||
PROP_STROKE_OPTIONS
|
||||
};
|
||||
|
||||
|
||||
typedef struct _GimpDialogConfigPrivate GimpDialogConfigPrivate;
|
||||
|
||||
struct _GimpDialogConfigPrivate
|
||||
{
|
||||
Gimp *gimp;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(config) \
|
||||
G_TYPE_INSTANCE_GET_PRIVATE (config, \
|
||||
GIMP_TYPE_DIALOG_CONFIG, \
|
||||
GimpDialogConfigPrivate)
|
||||
|
||||
|
||||
static void gimp_dialog_config_constructed (GObject *object);
|
||||
static void gimp_dialog_config_finalize (GObject *object);
|
||||
static void gimp_dialog_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
@ -75,6 +99,13 @@ static void gimp_dialog_config_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gimp_dialog_config_fill_options_notify (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer data);
|
||||
static void gimp_dialog_config_stroke_options_notify (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer data);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpDialogConfig, gimp_dialog_config, GIMP_TYPE_GUI_CONFIG)
|
||||
|
||||
@ -87,10 +118,18 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpRGB half_transparent = { 0.0, 0.0, 0.0, 0.5 };
|
||||
|
||||
object_class->constructed = gimp_dialog_config_constructed;
|
||||
object_class->finalize = gimp_dialog_config_finalize;
|
||||
object_class->set_property = gimp_dialog_config_set_property;
|
||||
object_class->get_property = gimp_dialog_config_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GIMP,
|
||||
g_param_spec_object ("gimp",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_GIMP,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_COLOR_PROFILE_POLICY,
|
||||
"color-profile-policy",
|
||||
"Color profile policy",
|
||||
@ -200,6 +239,24 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
|
||||
GIMP_TYPE_CHANNEL_BORDER_STYLE,
|
||||
GIMP_CHANNEL_BORDER_STYLE_SMOOTH,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_OBJECT (object_class, PROP_FILL_OPTIONS,
|
||||
"fill-options",
|
||||
"Fill Options",
|
||||
FILL_OPTIONS_BLURB,
|
||||
GIMP_TYPE_FILL_OPTIONS,
|
||||
GIMP_PARAM_STATIC_STRINGS |
|
||||
GIMP_CONFIG_PARAM_AGGREGATE);
|
||||
|
||||
GIMP_CONFIG_PROP_OBJECT (object_class, PROP_STROKE_OPTIONS,
|
||||
"stroke-options",
|
||||
"Stroke Options",
|
||||
STROKE_OPTIONS_BLURB,
|
||||
GIMP_TYPE_STROKE_OPTIONS,
|
||||
GIMP_PARAM_STATIC_STRINGS |
|
||||
GIMP_CONFIG_PARAM_AGGREGATE);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (GimpDialogConfigPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -207,6 +264,36 @@ gimp_dialog_config_init (GimpDialogConfig *config)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_config_constructed (GObject *object)
|
||||
{
|
||||
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (object);
|
||||
GimpDialogConfigPrivate *priv = GET_PRIVATE (object);
|
||||
GimpContext *context;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
|
||||
g_assert (GIMP_IS_GIMP (priv->gimp));
|
||||
|
||||
context = gimp_get_user_context (priv->gimp);
|
||||
|
||||
config->fill_options = gimp_fill_options_new (priv->gimp, context, TRUE);
|
||||
gimp_context_set_serialize_properties (GIMP_CONTEXT (config->fill_options),
|
||||
0);
|
||||
|
||||
g_signal_connect (config->fill_options, "notify",
|
||||
G_CALLBACK (gimp_dialog_config_fill_options_notify),
|
||||
config);
|
||||
|
||||
config->stroke_options = gimp_stroke_options_new (priv->gimp, context, TRUE);
|
||||
gimp_context_set_serialize_properties (GIMP_CONTEXT (config->stroke_options),
|
||||
0);
|
||||
|
||||
g_signal_connect (config->stroke_options, "notify",
|
||||
G_CALLBACK (gimp_dialog_config_stroke_options_notify),
|
||||
config);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_config_finalize (GObject *object)
|
||||
{
|
||||
@ -230,6 +317,18 @@ gimp_dialog_config_finalize (GObject *object)
|
||||
config->vectors_new_name = NULL;
|
||||
}
|
||||
|
||||
if (config->fill_options)
|
||||
{
|
||||
g_object_unref (config->fill_options);
|
||||
config->fill_options = NULL;
|
||||
}
|
||||
|
||||
if (config->stroke_options)
|
||||
{
|
||||
g_object_unref (config->stroke_options);
|
||||
config->stroke_options = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@ -240,9 +339,14 @@ gimp_dialog_config_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (object);
|
||||
GimpDialogConfigPrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GIMP:
|
||||
priv->gimp = g_value_get_object (value); /* don't ref */
|
||||
break;
|
||||
|
||||
case PROP_COLOR_PROFILE_POLICY:
|
||||
config->color_profile_policy = g_value_get_enum (value);
|
||||
break;
|
||||
@ -303,6 +407,17 @@ gimp_dialog_config_set_property (GObject *object,
|
||||
config->selection_border_style = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case PROP_FILL_OPTIONS:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (g_value_get_object (value) ,
|
||||
G_OBJECT (config->fill_options), 0);
|
||||
break;
|
||||
case PROP_STROKE_OPTIONS:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (g_value_get_object (value) ,
|
||||
G_OBJECT (config->stroke_options), 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -316,9 +431,14 @@ gimp_dialog_config_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (object);
|
||||
GimpDialogConfigPrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GIMP:
|
||||
g_value_set_object (value, priv->gimp);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_PROFILE_POLICY:
|
||||
g_value_set_enum (value, config->color_profile_policy);
|
||||
break;
|
||||
@ -373,8 +493,31 @@ gimp_dialog_config_get_property (GObject *object,
|
||||
g_value_set_enum (value, config->selection_border_style);
|
||||
break;
|
||||
|
||||
case PROP_FILL_OPTIONS:
|
||||
g_value_set_object (value, config->fill_options);
|
||||
break;
|
||||
case PROP_STROKE_OPTIONS:
|
||||
g_value_set_object (value, config->stroke_options);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_config_fill_options_notify (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
g_object_notify (G_OBJECT (data), "fill-options");
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dialog_config_stroke_options_notify (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
g_object_notify (G_OBJECT (data), "stroke-options");
|
||||
}
|
||||
|
@ -24,6 +24,13 @@
|
||||
#include "config/gimpguiconfig.h"
|
||||
|
||||
|
||||
/* We don't want to include stuff from core/ here, instead do the next
|
||||
* less ugly hack...
|
||||
*/
|
||||
typedef struct _GimpFillOptions GimpFillOptions;
|
||||
typedef struct _GimpStrokeOptions GimpStrokeOptions;
|
||||
|
||||
|
||||
#define GIMP_TYPE_DIALOG_CONFIG (gimp_dialog_config_get_type ())
|
||||
#define GIMP_DIALOG_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DIALOG_CONFIG, GimpDialogConfig))
|
||||
#define GIMP_DIALOG_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DIALOG_CONFIG, GimpDialogConfigClass))
|
||||
@ -60,6 +67,9 @@ struct _GimpDialogConfig
|
||||
gdouble selection_border_radius;
|
||||
gboolean selection_border_edge_lock;
|
||||
GimpChannelBorderStyle selection_border_style;
|
||||
|
||||
GimpFillOptions *fill_options;
|
||||
GimpStrokeOptions *stroke_options;
|
||||
};
|
||||
|
||||
struct _GimpDialogConfigClass
|
||||
|
@ -464,6 +464,12 @@ _("Sets the default 'Selected areas continue outside the image' setting " \
|
||||
#define SELECTION_BORDER_STYLE_BLURB \
|
||||
_("Sets the default border style for the 'Border Selection' dialog.")
|
||||
|
||||
#define FILL_OPTIONS_BLURB \
|
||||
"The default fill options for the fill dialogs."
|
||||
|
||||
#define STROKE_OPTIONS_BLURB \
|
||||
"The default stroke options for the stroke dialogs."
|
||||
|
||||
#define THUMBNAIL_SIZE_BLURB \
|
||||
_("Sets the size of the thumbnail shown in the Open dialog.")
|
||||
|
||||
|
@ -230,7 +230,17 @@ gimp_rc_duplicate_unknown_token (const gchar *key,
|
||||
static GimpConfig *
|
||||
gimp_rc_duplicate (GimpConfig *config)
|
||||
{
|
||||
GimpConfig *dup = g_object_new (GIMP_TYPE_RC, NULL);
|
||||
GObject *gimp;
|
||||
GimpConfig *dup;
|
||||
|
||||
g_object_get (config, "gimp", &gimp, NULL);
|
||||
|
||||
dup = g_object_new (GIMP_TYPE_RC,
|
||||
"gimp", gimp,
|
||||
NULL);
|
||||
|
||||
if (gimp)
|
||||
g_object_unref (gimp);
|
||||
|
||||
gimp_config_sync (G_OBJECT (config), G_OBJECT (dup), 0);
|
||||
|
||||
@ -302,6 +312,7 @@ gimp_rc_notify (GimpRc *rc,
|
||||
|
||||
/**
|
||||
* gimp_rc_new:
|
||||
* @gimp: a #Gimp
|
||||
* @system_gimprc: the name of the system-wide gimprc file or %NULL to
|
||||
* use the standard location
|
||||
* @user_gimprc: the name of the user gimprc file or %NULL to use the
|
||||
@ -314,18 +325,21 @@ gimp_rc_notify (GimpRc *rc,
|
||||
* Returns: the new #GimpRc.
|
||||
*/
|
||||
GimpRc *
|
||||
gimp_rc_new (GFile *system_gimprc,
|
||||
gimp_rc_new (GObject *gimp,
|
||||
GFile *system_gimprc,
|
||||
GFile *user_gimprc,
|
||||
gboolean verbose)
|
||||
{
|
||||
GimpRc *rc;
|
||||
|
||||
g_return_val_if_fail (G_IS_OBJECT (gimp), NULL);
|
||||
g_return_val_if_fail (system_gimprc == NULL || G_IS_FILE (system_gimprc),
|
||||
NULL);
|
||||
g_return_val_if_fail (user_gimprc == NULL || G_IS_FILE (user_gimprc),
|
||||
NULL);
|
||||
|
||||
rc = g_object_new (GIMP_TYPE_RC,
|
||||
"gimp", gimp,
|
||||
"verbose", verbose,
|
||||
"system-gimprc", system_gimprc,
|
||||
"user-gimprc", user_gimprc,
|
||||
@ -488,6 +502,7 @@ gimp_rc_set_unknown_token (GimpRc *rc,
|
||||
void
|
||||
gimp_rc_save (GimpRc *rc)
|
||||
{
|
||||
GObject *gimp;
|
||||
GimpRc *global;
|
||||
gchar *header;
|
||||
GError *error = NULL;
|
||||
@ -506,7 +521,14 @@ gimp_rc_save (GimpRc *rc)
|
||||
|
||||
g_return_if_fail (GIMP_IS_RC (rc));
|
||||
|
||||
global = g_object_new (GIMP_TYPE_RC, NULL);
|
||||
g_object_get (rc, "gimp", &gimp, NULL);
|
||||
|
||||
global = g_object_new (GIMP_TYPE_RC,
|
||||
"gimp", gimp,
|
||||
NULL);
|
||||
|
||||
if (gimp)
|
||||
g_object_unref (gimp);
|
||||
|
||||
gimp_config_deserialize_gfile (GIMP_CONFIG (global),
|
||||
rc->system_gimprc, NULL, NULL);
|
||||
|
@ -51,7 +51,8 @@ struct _GimpRcClass
|
||||
|
||||
|
||||
GType gimp_rc_get_type (void) G_GNUC_CONST;
|
||||
GimpRc * gimp_rc_new (GFile *system_gimprc,
|
||||
GimpRc * gimp_rc_new (GObject *gimp,
|
||||
GFile *system_gimprc,
|
||||
GFile *user_gimprc,
|
||||
gboolean verbose);
|
||||
|
||||
|
@ -61,6 +61,8 @@
|
||||
|
||||
struct _GimpUserInstall
|
||||
{
|
||||
GObject *gimp;
|
||||
|
||||
gboolean verbose;
|
||||
|
||||
gchar *old_dir;
|
||||
@ -145,10 +147,12 @@ static gboolean user_install_migrate_files (GimpUserInstall *install);
|
||||
/* public functions */
|
||||
|
||||
GimpUserInstall *
|
||||
gimp_user_install_new (gboolean verbose)
|
||||
gimp_user_install_new (GObject *gimp,
|
||||
gboolean verbose)
|
||||
{
|
||||
GimpUserInstall *install = g_slice_new0 (GimpUserInstall);
|
||||
|
||||
install->gimp = gimp;
|
||||
install->verbose = verbose;
|
||||
|
||||
user_install_detect_old (install, gimp_directory ());
|
||||
@ -782,7 +786,7 @@ user_install_migrate_files (GimpUserInstall *install)
|
||||
|
||||
gimp_templates_migrate (install->old_dir);
|
||||
|
||||
gimprc = gimp_rc_new (NULL, NULL, FALSE);
|
||||
gimprc = gimp_rc_new (install->gimp, NULL, NULL, FALSE);
|
||||
gimp_rc_migrate (gimprc);
|
||||
gimp_rc_save (gimprc);
|
||||
g_object_unref (gimprc);
|
||||
|
@ -26,7 +26,8 @@ typedef void (* GimpUserInstallLogFunc) (const gchar *message,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
GimpUserInstall * gimp_user_install_new (gboolean verbose);
|
||||
GimpUserInstall * gimp_user_install_new (GObject *gimp,
|
||||
gboolean verbose);
|
||||
gboolean gimp_user_install_run (GimpUserInstall *install);
|
||||
void gimp_user_install_free (GimpUserInstall *install);
|
||||
|
||||
|
@ -799,7 +799,8 @@ gimp_load_config (Gimp *gimp,
|
||||
*/
|
||||
gimp_unitrc_load (gimp);
|
||||
|
||||
gimprc = gimp_rc_new (alternate_system_gimprc,
|
||||
gimprc = gimp_rc_new (G_OBJECT (gimp),
|
||||
alternate_system_gimprc,
|
||||
alternate_gimprc,
|
||||
gimp->be_verbose);
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
#include "dialogs-types.h"
|
||||
|
||||
#include "config/gimpdialogconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
@ -61,8 +63,8 @@ fill_dialog_new (GimpItem *item,
|
||||
const gchar *help_id,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
GimpDialogConfig *config;
|
||||
GimpFillOptions *options;
|
||||
GimpFillOptions *saved_options;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *fill_editor;
|
||||
@ -73,13 +75,12 @@ fill_dialog_new (GimpItem *item,
|
||||
g_return_val_if_fail (help_id != NULL, NULL);
|
||||
g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
|
||||
|
||||
config = GIMP_DIALOG_CONFIG (context->gimp->config);
|
||||
|
||||
options = gimp_fill_options_new (context->gimp, context, TRUE);
|
||||
|
||||
saved_options = g_object_get_data (G_OBJECT (context->gimp),
|
||||
"saved-fill-options");
|
||||
|
||||
if (saved_options)
|
||||
gimp_config_sync (G_OBJECT (saved_options), G_OBJECT (options), 0);
|
||||
gimp_config_sync (G_OBJECT (config->fill_options),
|
||||
G_OBJECT (options), 0);
|
||||
|
||||
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (item), context,
|
||||
title, "gimp-fill-options",
|
||||
@ -151,8 +152,8 @@ fill_dialog_response (GtkWidget *widget,
|
||||
|
||||
case GTK_RESPONSE_OK:
|
||||
{
|
||||
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (context->gimp->config);
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
||||
GimpFillOptions *saved_options;
|
||||
GError *error = NULL;
|
||||
|
||||
if (! drawable)
|
||||
@ -164,19 +165,8 @@ fill_dialog_response (GtkWidget *widget,
|
||||
return;
|
||||
}
|
||||
|
||||
saved_options = g_object_get_data (G_OBJECT (context->gimp),
|
||||
"saved-fill-options");
|
||||
|
||||
if (saved_options)
|
||||
g_object_ref (saved_options);
|
||||
else
|
||||
saved_options = gimp_fill_options_new (context->gimp, context, TRUE);
|
||||
|
||||
gimp_config_sync (G_OBJECT (options), G_OBJECT (saved_options), 0);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (context->gimp), "saved-fill-options",
|
||||
saved_options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
gimp_config_sync (G_OBJECT (options),
|
||||
G_OBJECT (config->fill_options), 0);
|
||||
|
||||
if (! gimp_item_fill (item, drawable, options, TRUE, NULL, &error))
|
||||
{
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "widgets/gimpmessagedialog.h"
|
||||
#include "widgets/gimpprefsbox.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpstrokeeditor.h"
|
||||
#include "widgets/gimptemplateeditor.h"
|
||||
#include "widgets/gimptooleditor.h"
|
||||
#include "widgets/gimpwidgets-constructors.h"
|
||||
@ -2202,6 +2203,24 @@ prefs_dialog_new (Gimp *gimp,
|
||||
_("Selected areas continue outside the image"),
|
||||
GTK_BOX (vbox2));
|
||||
|
||||
/* Fill Options Dialog */
|
||||
vbox2 = prefs_frame_new (_("Fill Selection Outline & Fill Path Dialogs"),
|
||||
GTK_CONTAINER (vbox), FALSE);
|
||||
|
||||
table = gimp_fill_editor_new (GIMP_DIALOG_CONFIG (object)->fill_options,
|
||||
FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* Stroke Options Dialog */
|
||||
vbox2 = prefs_frame_new (_("Stroke Selection & Stroke Path Dialogs"),
|
||||
GTK_CONTAINER (vbox), FALSE);
|
||||
|
||||
table = gimp_stroke_editor_new (GIMP_DIALOG_CONFIG (object)->stroke_options,
|
||||
96.0 /* FIXME */, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
g_object_unref (size_group);
|
||||
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include "dialogs-types.h"
|
||||
|
||||
#include "config/gimpdialogconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
@ -64,8 +66,8 @@ stroke_dialog_new (GimpItem *item,
|
||||
const gchar *help_id,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
GimpDialogConfig *config;
|
||||
GimpStrokeOptions *options;
|
||||
GimpStrokeOptions *saved_options;
|
||||
GimpImage *image;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *main_vbox;
|
||||
@ -83,13 +85,12 @@ stroke_dialog_new (GimpItem *item,
|
||||
|
||||
image = gimp_item_get_image (item);
|
||||
|
||||
config = GIMP_DIALOG_CONFIG (context->gimp->config);
|
||||
|
||||
options = gimp_stroke_options_new (context->gimp, context, TRUE);
|
||||
|
||||
saved_options = g_object_get_data (G_OBJECT (context->gimp),
|
||||
"saved-stroke-options");
|
||||
|
||||
if (saved_options)
|
||||
gimp_config_sync (G_OBJECT (saved_options), G_OBJECT (options), 0);
|
||||
gimp_config_sync (G_OBJECT (config->stroke_options),
|
||||
G_OBJECT (options), 0);
|
||||
|
||||
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (item), context,
|
||||
title, "gimp-stroke-options",
|
||||
@ -270,8 +271,8 @@ stroke_dialog_response (GtkWidget *widget,
|
||||
|
||||
case GTK_RESPONSE_OK:
|
||||
{
|
||||
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (context->gimp->config);
|
||||
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
|
||||
GimpStrokeOptions *saved_options;
|
||||
GError *error = NULL;
|
||||
|
||||
if (! drawable)
|
||||
@ -283,19 +284,8 @@ stroke_dialog_response (GtkWidget *widget,
|
||||
return;
|
||||
}
|
||||
|
||||
saved_options = g_object_get_data (G_OBJECT (context->gimp),
|
||||
"saved-stroke-options");
|
||||
|
||||
if (saved_options)
|
||||
g_object_ref (saved_options);
|
||||
else
|
||||
saved_options = gimp_stroke_options_new (context->gimp, context, TRUE);
|
||||
|
||||
gimp_config_sync (G_OBJECT (options), G_OBJECT (saved_options), 0);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (context->gimp), "saved-stroke-options",
|
||||
saved_options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
gimp_config_sync (G_OBJECT (options),
|
||||
G_OBJECT (config->stroke_options), 0);
|
||||
|
||||
if (! gimp_item_stroke (item, drawable, context, options, NULL,
|
||||
TRUE, NULL, &error))
|
||||
|
@ -719,7 +719,7 @@ gimp_option_dump_gimprc (const gchar *option_name,
|
||||
gimp = g_object_new (GIMP_TYPE_GIMP, NULL);
|
||||
gimp_load_config (gimp, NULL, NULL);
|
||||
|
||||
success = gimp_config_dump (format);
|
||||
success = gimp_config_dump (G_OBJECT (gimp), format);
|
||||
|
||||
g_object_unref (gimp);
|
||||
|
||||
|
Reference in New Issue
Block a user