mirror of https://github.com/GNOME/gimp.git
changed GimpConfig utility functions to take GObject variables instead of
2005-04-07 Sven Neumann <sven@gimp.org> * libgimpconfig/gimpconfig-utils.[ch]: changed GimpConfig utility functions to take GObject variables instead of GimpConfig. There's nothing GimpConfig specific about these utilities. * app/actions/templates-commands.c * app/actions/tool-options-commands.c * app/base/base.c * app/config/gimpcoreconfig.c * app/config/gimpdisplayconfig.c * app/config/gimprc.c * app/core/gimpimage-grid.c * app/core/gimpimage-new.c * app/core/gimpstrokedesc.c * app/dialogs/grid-dialog.c * app/dialogs/image-new-dialog.c * app/dialogs/stroke-dialog.c * app/display/gimpdisplayshell.c * app/text/gimptextlayer.c * app/text/gimptextundo.c * app/tools/gimptextoptions.c * libgimpconfig/gimpconfig-iface.c: changed accordingly.
This commit is contained in:
parent
ec1b12e14e
commit
333593daf4
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2005-04-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpconfig/gimpconfig-utils.[ch]: changed GimpConfig utility
|
||||
functions to take GObject variables instead of GimpConfig. There's
|
||||
nothing GimpConfig specific about these utilities.
|
||||
|
||||
* app/actions/templates-commands.c
|
||||
* app/actions/tool-options-commands.c
|
||||
* app/base/base.c
|
||||
* app/config/gimpcoreconfig.c
|
||||
* app/config/gimpdisplayconfig.c
|
||||
* app/config/gimprc.c
|
||||
* app/core/gimpimage-grid.c
|
||||
* app/core/gimpimage-new.c
|
||||
* app/core/gimpstrokedesc.c
|
||||
* app/dialogs/grid-dialog.c
|
||||
* app/dialogs/image-new-dialog.c
|
||||
* app/dialogs/stroke-dialog.c
|
||||
* app/display/gimpdisplayshell.c
|
||||
* app/text/gimptextlayer.c
|
||||
* app/text/gimptextundo.c
|
||||
* app/tools/gimptextoptions.c
|
||||
* libgimpconfig/gimpconfig-iface.c: changed accordingly.
|
||||
|
||||
2005-04-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/actions/plug-in-actions.c (plug_in_actions_add_branch)
|
||||
|
|
|
@ -282,8 +282,8 @@ templates_edit_response (GtkWidget *dialog,
|
|||
{
|
||||
GimpTemplateEditor *editor = GIMP_TEMPLATE_EDITOR (options->editor);
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (editor->template),
|
||||
GIMP_CONFIG (options->template), 0);
|
||||
gimp_config_sync (G_OBJECT (editor->template),
|
||||
G_OBJECT (options->template), 0);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
|
|
@ -98,8 +98,8 @@ tool_options_save_to_cmd_callback (GtkAction *action,
|
|||
|
||||
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (options)));
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (tool_info->tool_options),
|
||||
GIMP_CONFIG (options), 0);
|
||||
gimp_config_sync (G_OBJECT (tool_info->tool_options),
|
||||
G_OBJECT (options), 0);
|
||||
gimp_object_set_name (GIMP_OBJECT (options), name);
|
||||
|
||||
g_free (name);
|
||||
|
@ -120,8 +120,8 @@ tool_options_restore_from_cmd_callback (GtkAction *action,
|
|||
gimp_container_get_child_by_index (tool_info->options_presets, value);
|
||||
|
||||
if (options)
|
||||
gimp_config_sync (GIMP_CONFIG (options),
|
||||
GIMP_CONFIG (tool_info->tool_options), 0);
|
||||
gimp_config_sync (G_OBJECT (options),
|
||||
G_OBJECT (tool_info->tool_options), 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -86,7 +86,7 @@ base_init (GimpBaseConfig *config,
|
|||
NULL);
|
||||
|
||||
if (! config->swap_path || ! *config->swap_path)
|
||||
gimp_config_reset_property (GIMP_CONFIG (config), "swap-path");
|
||||
gimp_config_reset_property (G_OBJECT (config), "swap-path");
|
||||
|
||||
base_toast_old_swap_files (config->swap_path);
|
||||
|
||||
|
@ -96,7 +96,7 @@ base_init (GimpBaseConfig *config,
|
|||
|
||||
/* create the temp directory if it doesn't exist */
|
||||
if (! config->temp_path || ! *config->temp_path)
|
||||
gimp_config_reset_property (GIMP_CONFIG (config), "temp-path");
|
||||
gimp_config_reset_property (G_OBJECT (config), "temp-path");
|
||||
|
||||
temp_dir = gimp_config_path_expand (config->temp_path, TRUE, NULL);
|
||||
|
||||
|
|
|
@ -500,13 +500,13 @@ gimp_core_config_set_property (GObject *object,
|
|||
break;
|
||||
case PROP_DEFAULT_IMAGE:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)),
|
||||
GIMP_CONFIG (core_config->default_image), 0);
|
||||
gimp_config_sync (g_value_get_object (value) ,
|
||||
G_OBJECT (core_config->default_image), 0);
|
||||
break;
|
||||
case PROP_DEFAULT_GRID:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)),
|
||||
GIMP_CONFIG (core_config->default_grid), 0);
|
||||
gimp_config_sync (g_value_get_object (value),
|
||||
G_OBJECT (core_config->default_grid), 0);
|
||||
break;
|
||||
case PROP_UNDO_LEVELS:
|
||||
core_config->levels_of_undo = g_value_get_int (value);
|
||||
|
@ -541,8 +541,8 @@ gimp_core_config_set_property (GObject *object,
|
|||
break;
|
||||
case PROP_COLOR_MANAGEMENT:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)),
|
||||
GIMP_CONFIG (core_config->color_management), 0);
|
||||
gimp_config_sync (g_value_get_object (value),
|
||||
G_OBJECT (core_config->color_management), 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -362,13 +362,13 @@ gimp_display_config_set_property (GObject *object,
|
|||
break;
|
||||
case PROP_DEFAULT_VIEW:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)),
|
||||
GIMP_CONFIG (display_config->default_view), 0);
|
||||
gimp_config_sync (g_value_get_object (value),
|
||||
G_OBJECT (display_config->default_view), 0);
|
||||
break;
|
||||
case PROP_DEFAULT_FULLSCREEN_VIEW:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)),
|
||||
GIMP_CONFIG (display_config->default_fullscreen_view),
|
||||
gimp_config_sync (g_value_get_object (value),
|
||||
G_OBJECT (display_config->default_fullscreen_view),
|
||||
0);
|
||||
break;
|
||||
case PROP_ACTIVATE_ON_FOCUS:
|
||||
|
|
|
@ -277,7 +277,7 @@ gimp_rc_duplicate (GimpConfig *config)
|
|||
{
|
||||
GimpConfig *dup = g_object_new (GIMP_TYPE_RC, NULL);
|
||||
|
||||
gimp_config_sync (config, dup, 0);
|
||||
gimp_config_sync (G_OBJECT (config), G_OBJECT (dup), 0);
|
||||
|
||||
gimp_rc_foreach_unknown_token (config,
|
||||
gimp_rc_duplicate_unknown_token, dup);
|
||||
|
|
|
@ -57,5 +57,5 @@ gimp_image_set_grid (GimpImage *gimage,
|
|||
if (push_undo)
|
||||
gimp_image_undo_push_image_grid (gimage, _("Grid"), gimage->grid);
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (grid), GIMP_CONFIG (gimage->grid), 0);
|
||||
gimp_config_sync (G_OBJECT (grid), G_OBJECT (gimage->grid), 0);
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ gimp_image_new_get_last_template (Gimp *gimp,
|
|||
if (gimage)
|
||||
gimp_template_set_from_image (template, gimage);
|
||||
else
|
||||
gimp_config_sync (GIMP_CONFIG (gimp->image_new_last_template),
|
||||
GIMP_CONFIG (template), 0);
|
||||
gimp_config_sync (G_OBJECT (gimp->image_new_last_template),
|
||||
G_OBJECT (template), 0);
|
||||
|
||||
if (gimp->global_buffer && gimp->have_current_cut_buffer)
|
||||
{
|
||||
|
@ -68,8 +68,8 @@ gimp_image_new_set_last_template (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GIMP_IS_TEMPLATE (template));
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (template),
|
||||
GIMP_CONFIG (gimp->image_new_last_template), 0);
|
||||
gimp_config_sync (G_OBJECT (template),
|
||||
G_OBJECT (gimp->image_new_last_template), 0);
|
||||
|
||||
gimp->have_current_cut_buffer = FALSE;
|
||||
}
|
||||
|
|
|
@ -212,8 +212,8 @@ gimp_stroke_desc_set_property (GObject *object,
|
|||
break;
|
||||
case PROP_STROKE_OPTIONS:
|
||||
if (g_value_get_object (value))
|
||||
gimp_config_sync (GIMP_CONFIG (g_value_get_object (value)),
|
||||
GIMP_CONFIG (desc->stroke_options), 0);
|
||||
gimp_config_sync (g_value_get_object (value),
|
||||
G_OBJECT (desc->stroke_options), 0);
|
||||
break;
|
||||
case PROP_PAINT_INFO:
|
||||
if (desc->paint_info)
|
||||
|
|
|
@ -138,8 +138,8 @@ grid_dialog_response (GtkWidget *widget,
|
|||
switch (response_id)
|
||||
{
|
||||
case GRID_RESPONSE_RESET:
|
||||
gimp_config_sync (GIMP_CONFIG (gimage->gimp->config->default_grid),
|
||||
GIMP_CONFIG (grid), 0);
|
||||
gimp_config_sync (G_OBJECT (gimage->gimp->config->default_grid),
|
||||
G_OBJECT (grid), 0);
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_OK:
|
||||
|
|
|
@ -181,8 +181,7 @@ image_new_dialog_set (GtkWidget *widget,
|
|||
{
|
||||
template = gimp_image_new_get_last_template (dialog->gimp, gimage);
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (template),
|
||||
GIMP_CONFIG (dialog->template), 0);
|
||||
gimp_config_sync (G_OBJECT (template), G_OBJECT (dialog->template), 0);
|
||||
|
||||
g_object_unref (template);
|
||||
}
|
||||
|
@ -199,8 +198,8 @@ image_new_response (GtkWidget *widget,
|
|||
switch (response_id)
|
||||
{
|
||||
case RESPONSE_RESET:
|
||||
gimp_config_sync (GIMP_CONFIG (dialog->gimp->config->default_image),
|
||||
GIMP_CONFIG (dialog->template), 0);
|
||||
gimp_config_sync (G_OBJECT (dialog->gimp->config->default_image),
|
||||
G_OBJECT (dialog->template), 0);
|
||||
gimp_container_view_select_item (GIMP_CONTAINER_VIEW (dialog->combo),
|
||||
NULL);
|
||||
break;
|
||||
|
@ -233,7 +232,7 @@ image_new_template_select (GimpContainerView *view,
|
|||
if (!template->comment || !strlen (template->comment))
|
||||
comment = g_strdup (dialog->template->comment);
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (template), GIMP_CONFIG (dialog->template), 0);
|
||||
gimp_config_sync (G_OBJECT (template), G_OBJECT (dialog->template), 0);
|
||||
|
||||
if (comment)
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ stroke_dialog_new (GimpItem *item,
|
|||
saved_desc = g_object_get_data (G_OBJECT (context), "saved-stroke-desc");
|
||||
|
||||
if (saved_desc)
|
||||
gimp_config_sync (GIMP_CONFIG (saved_desc), GIMP_CONFIG (desc), 0);
|
||||
gimp_config_sync (G_OBJECT (saved_desc), G_OBJECT (desc), 0);
|
||||
|
||||
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (item),
|
||||
title, "gimp-stroke-options",
|
||||
|
@ -287,7 +287,7 @@ stroke_dialog_response (GtkWidget *widget,
|
|||
else
|
||||
saved_desc = gimp_stroke_desc_new (context->gimp, context);
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (desc), GIMP_CONFIG (saved_desc), 0);
|
||||
gimp_config_sync (G_OBJECT (desc), G_OBJECT (saved_desc), 0);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (context), "saved-stroke-desc",
|
||||
saved_desc,
|
||||
|
|
|
@ -591,10 +591,10 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
|
||||
shell->dot_for_dot = display_config->default_dot_for_dot;
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (display_config->default_view),
|
||||
GIMP_CONFIG (shell->options), 0);
|
||||
gimp_config_sync (GIMP_CONFIG (display_config->default_fullscreen_view),
|
||||
GIMP_CONFIG (shell->fullscreen_options), 0);
|
||||
gimp_config_sync (G_OBJECT (display_config->default_view),
|
||||
G_OBJECT (shell->options), 0);
|
||||
gimp_config_sync (G_OBJECT (display_config->default_fullscreen_view),
|
||||
G_OBJECT (shell->fullscreen_options), 0);
|
||||
|
||||
/* adjust the initial scale -- so that window fits on screen the 75%
|
||||
* value is the same as in gimp_display_shell_shrink_wrap. It
|
||||
|
|
|
@ -290,7 +290,7 @@ gimp_text_layer_duplicate (GimpItem *item,
|
|||
layer = GIMP_TEXT_LAYER (item);
|
||||
new_layer = GIMP_TEXT_LAYER (new_item);
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (layer), GIMP_CONFIG (new_layer), 0);
|
||||
gimp_config_sync (G_OBJECT (layer), G_OBJECT (new_layer), 0);
|
||||
|
||||
if (layer->text)
|
||||
{
|
||||
|
|
|
@ -245,8 +245,8 @@ gimp_text_undo_pop (GimpUndo *undo,
|
|||
gimp_config_duplicate (GIMP_CONFIG (layer->text)) : NULL);
|
||||
|
||||
if (layer->text && text_undo->text)
|
||||
gimp_config_sync (GIMP_CONFIG (text_undo->text),
|
||||
GIMP_CONFIG (layer->text), 0);
|
||||
gimp_config_sync (G_OBJECT (text_undo->text),
|
||||
G_OBJECT (layer->text), 0);
|
||||
else
|
||||
gimp_text_layer_set_text (layer, text_undo->text);
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ gimp_text_options_connect_text (GimpTextOptions *options,
|
|||
|
||||
gimp_context_get_foreground (context, &color);
|
||||
|
||||
gimp_config_sync (GIMP_CONFIG (options), GIMP_CONFIG (text), 0);
|
||||
gimp_config_sync (G_OBJECT (options), G_OBJECT (text), 0);
|
||||
|
||||
g_object_set (text,
|
||||
"color", &color,
|
||||
|
|
|
@ -42,7 +42,7 @@ Miscellaneous utility functions for libgimpconfig.
|
|||
|
||||
</para>
|
||||
|
||||
@config:
|
||||
@object:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_config_reset_property ##### -->
|
||||
|
@ -50,7 +50,7 @@ Miscellaneous utility functions for libgimpconfig.
|
|||
|
||||
</para>
|
||||
|
||||
@config:
|
||||
@object:
|
||||
@property_name:
|
||||
|
||||
|
||||
|
|
|
@ -123,15 +123,14 @@ gimp_config_iface_deserialize (GimpConfig *config,
|
|||
static GimpConfig *
|
||||
gimp_config_iface_duplicate (GimpConfig *config)
|
||||
{
|
||||
GObjectClass *klass;
|
||||
GObject *object = G_OBJECT (config);
|
||||
GObjectClass *klass = G_OBJECT_GET_CLASS (object);
|
||||
GParamSpec **property_specs;
|
||||
guint n_property_specs;
|
||||
GParameter *construct_params = NULL;
|
||||
gint n_construct_params = 0;
|
||||
guint i;
|
||||
GimpConfig *dup;
|
||||
|
||||
klass = G_OBJECT_GET_CLASS (config);
|
||||
GObject *dup;
|
||||
|
||||
property_specs = g_object_class_list_properties (klass, &n_property_specs);
|
||||
|
||||
|
@ -152,14 +151,14 @@ gimp_config_iface_duplicate (GimpConfig *config)
|
|||
construct_param->name = prop_spec->name;
|
||||
|
||||
g_value_init (&construct_param->value, prop_spec->value_type);
|
||||
g_object_get_property (G_OBJECT (config), prop_spec->name,
|
||||
&construct_param->value);
|
||||
g_object_get_property (object,
|
||||
prop_spec->name, &construct_param->value);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (property_specs);
|
||||
|
||||
dup = g_object_newv (G_TYPE_FROM_INSTANCE (config),
|
||||
dup = g_object_newv (G_TYPE_FROM_INSTANCE (object),
|
||||
n_construct_params, construct_params);
|
||||
|
||||
for (i = 0; i < n_construct_params; i++)
|
||||
|
@ -167,9 +166,9 @@ gimp_config_iface_duplicate (GimpConfig *config)
|
|||
|
||||
g_free (construct_params);
|
||||
|
||||
gimp_config_sync (config, dup, 0);
|
||||
gimp_config_sync (object, dup, 0);
|
||||
|
||||
return dup;
|
||||
return GIMP_CONFIG (dup);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -233,7 +232,7 @@ gimp_config_iface_equal (GimpConfig *a,
|
|||
static void
|
||||
gimp_config_iface_reset (GimpConfig *config)
|
||||
{
|
||||
gimp_config_reset_properties (config);
|
||||
gimp_config_reset_properties (G_OBJECT (config));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,8 +74,8 @@ gimp_config_diff_property (GObject *a,
|
|||
}
|
||||
|
||||
static GList *
|
||||
gimp_config_diff_same (GimpConfig *a,
|
||||
GimpConfig *b,
|
||||
gimp_config_diff_same (GObject *a,
|
||||
GObject *b,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GParamSpec **param_specs;
|
||||
|
@ -92,8 +92,7 @@ gimp_config_diff_same (GimpConfig *a,
|
|||
|
||||
if (! flags || ((prop_spec->flags & flags) == flags))
|
||||
{
|
||||
if (gimp_config_diff_property (G_OBJECT (a),
|
||||
G_OBJECT (b), prop_spec))
|
||||
if (gimp_config_diff_property (a, b, prop_spec))
|
||||
list = g_list_prepend (list, prop_spec);
|
||||
}
|
||||
}
|
||||
|
@ -104,8 +103,8 @@ gimp_config_diff_same (GimpConfig *a,
|
|||
}
|
||||
|
||||
static GList *
|
||||
gimp_config_diff_other (GimpConfig *a,
|
||||
GimpConfig *b,
|
||||
gimp_config_diff_other (GObject *a,
|
||||
GObject *b,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GParamSpec **param_specs;
|
||||
|
@ -126,7 +125,7 @@ gimp_config_diff_other (GimpConfig *a,
|
|||
(a_spec->value_type == b_spec->value_type) &&
|
||||
(! flags || (a_spec->flags & b_spec->flags & flags) == flags))
|
||||
{
|
||||
if (gimp_config_diff_property (G_OBJECT (a), G_OBJECT (b), b_spec))
|
||||
if (gimp_config_diff_property (a, b, b_spec))
|
||||
list = g_list_prepend (list, b_spec);
|
||||
}
|
||||
}
|
||||
|
@ -139,8 +138,8 @@ gimp_config_diff_other (GimpConfig *a,
|
|||
|
||||
/**
|
||||
* gimp_config_diff:
|
||||
* @a: a #GimpConfig object
|
||||
* @b: another #GimpConfig object
|
||||
* @a: a #GObject
|
||||
* @b: another #GObject object
|
||||
* @flags: a mask of GParamFlags
|
||||
*
|
||||
* Compares all properties of @a and @b that have all @flags set. If
|
||||
|
@ -155,14 +154,14 @@ gimp_config_diff_other (GimpConfig *a,
|
|||
* Since: GIMP 2.4
|
||||
**/
|
||||
GList *
|
||||
gimp_config_diff (GimpConfig *a,
|
||||
GimpConfig *b,
|
||||
gimp_config_diff (GObject *a,
|
||||
GObject *b,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GList *diff;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONFIG (a), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONFIG (b), NULL);
|
||||
g_return_val_if_fail (G_IS_OBJECT (a), NULL);
|
||||
g_return_val_if_fail (G_IS_OBJECT (b), NULL);
|
||||
|
||||
if (G_TYPE_FROM_INSTANCE (a) == G_TYPE_FROM_INSTANCE (b))
|
||||
diff = gimp_config_diff_same (a, b, flags);
|
||||
|
@ -174,8 +173,8 @@ gimp_config_diff (GimpConfig *a,
|
|||
|
||||
/**
|
||||
* gimp_config_sync:
|
||||
* @src: a #GimpConfig object
|
||||
* @dest: another #GimpConfig object
|
||||
* @src: a #GObject
|
||||
* @dest: another #GObject
|
||||
* @flags: a mask of GParamFlags
|
||||
*
|
||||
* Compares all read- and write-able properties from @src and @dest
|
||||
|
@ -184,24 +183,24 @@ gimp_config_diff (GimpConfig *a,
|
|||
*
|
||||
* Properties marked as "construct-only" are not touched.
|
||||
*
|
||||
* If the two objects are not of the same type, only
|
||||
* properties that exist in both object classes and are of the same
|
||||
* value_type are synchronized
|
||||
* If the two objects are not of the same type, only properties that
|
||||
* exist in both object classes and are of the same value_type are
|
||||
* synchronized
|
||||
*
|
||||
* Return value: %TRUE if @dest was modified, %FALSE otherwise
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
gboolean
|
||||
gimp_config_sync (GimpConfig *src,
|
||||
GimpConfig *dest,
|
||||
gimp_config_sync (GObject *src,
|
||||
GObject *dest,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GList *diff;
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONFIG (src), FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_CONFIG (dest), FALSE);
|
||||
g_return_val_if_fail (G_IS_OBJECT (src), FALSE);
|
||||
g_return_val_if_fail (G_IS_OBJECT (dest), FALSE);
|
||||
|
||||
/* we use the internal versions here for a number of reasons:
|
||||
* - it saves a g_list_reverse()
|
||||
|
@ -226,8 +225,8 @@ gimp_config_sync (GimpConfig *src,
|
|||
|
||||
g_value_init (&value, prop_spec->value_type);
|
||||
|
||||
g_object_get_property (G_OBJECT (src), prop_spec->name, &value);
|
||||
g_object_set_property (G_OBJECT (dest), prop_spec->name, &value);
|
||||
g_object_get_property (src, prop_spec->name, &value);
|
||||
g_object_set_property (dest, prop_spec->name, &value);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
@ -240,35 +239,33 @@ gimp_config_sync (GimpConfig *src,
|
|||
|
||||
/**
|
||||
* gimp_config_reset_properties:
|
||||
* @config: a #GimpConfig object
|
||||
* @object: a #GObject
|
||||
*
|
||||
* Resets all writable properties of @object to the default values as
|
||||
* defined in their #GParamSpec. Properties marked as "construct-only"
|
||||
* are not touched.
|
||||
*
|
||||
* If you want to reset a #GimpConfig object, please use gimp_config_reset().
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
void
|
||||
gimp_config_reset_properties (GimpConfig *config)
|
||||
gimp_config_reset_properties (GObject *object)
|
||||
{
|
||||
GObject *object;
|
||||
GObjectClass *klass;
|
||||
GParamSpec **property_specs;
|
||||
GValue value = { 0, };
|
||||
guint n_property_specs;
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONFIG (config));
|
||||
g_return_if_fail (G_IS_OBJECT (object));
|
||||
|
||||
klass = G_OBJECT_GET_CLASS (config);
|
||||
klass = G_OBJECT_GET_CLASS (object);
|
||||
|
||||
property_specs = g_object_class_list_properties (klass, &n_property_specs);
|
||||
|
||||
if (!property_specs)
|
||||
return;
|
||||
|
||||
object = G_OBJECT (config);
|
||||
|
||||
g_object_freeze_notify (object);
|
||||
|
||||
for (i = 0; i < n_property_specs; i++)
|
||||
|
@ -316,26 +313,25 @@ gimp_config_reset_properties (GimpConfig *config)
|
|||
|
||||
/**
|
||||
* gimp_config_reset_property:
|
||||
* @config: a #GimpConfig object
|
||||
* @object: a #GObject
|
||||
* @property_name: name of the property to reset
|
||||
*
|
||||
* Resets the property named @property_name to its default value.
|
||||
* Nothing happens if the property is not writable or marked as
|
||||
* "construct-only".
|
||||
* Resets the property named @property_name to its default value. The
|
||||
* property must be writable and must not be marked as "construct-only".
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
void
|
||||
gimp_config_reset_property (GimpConfig *config,
|
||||
gimp_config_reset_property (GObject *object,
|
||||
const gchar *property_name)
|
||||
{
|
||||
GObjectClass *klass;
|
||||
GParamSpec *prop_spec;
|
||||
|
||||
g_return_if_fail (GIMP_IS_CONFIG (config));
|
||||
g_return_if_fail (G_IS_OBJECT (object));
|
||||
g_return_if_fail (property_name != NULL);
|
||||
|
||||
klass = G_OBJECT_GET_CLASS (config);
|
||||
klass = G_OBJECT_GET_CLASS (object);
|
||||
|
||||
prop_spec = g_object_class_find_property (klass, property_name);
|
||||
|
||||
|
@ -345,7 +341,6 @@ gimp_config_reset_property (GimpConfig *config,
|
|||
if ((prop_spec->flags & G_PARAM_WRITABLE) &&
|
||||
! (prop_spec->flags & G_PARAM_CONSTRUCT_ONLY))
|
||||
{
|
||||
GObject *object = G_OBJECT (config);
|
||||
GValue value = { 0, };
|
||||
|
||||
if (G_IS_PARAM_SPEC_OBJECT (prop_spec))
|
||||
|
|
|
@ -23,16 +23,16 @@
|
|||
#ifndef __GIMP_CONFIG_UTILS_H__
|
||||
#define __GIMP_CONFIG_UTILS_H__
|
||||
|
||||
GList * gimp_config_diff (GimpConfig *a,
|
||||
GimpConfig *b,
|
||||
GList * gimp_config_diff (GObject *a,
|
||||
GObject *b,
|
||||
GParamFlags flags);
|
||||
|
||||
gboolean gimp_config_sync (GimpConfig *src,
|
||||
GimpConfig *dest,
|
||||
gboolean gimp_config_sync (GObject *src,
|
||||
GObject *dest,
|
||||
GParamFlags flags);
|
||||
|
||||
void gimp_config_reset_properties (GimpConfig *config);
|
||||
void gimp_config_reset_property (GimpConfig *config,
|
||||
void gimp_config_reset_properties (GObject *object);
|
||||
void gimp_config_reset_property (GObject *object,
|
||||
const gchar *property_name);
|
||||
|
||||
void gimp_config_string_append_escaped (GString *string,
|
||||
|
|
Loading…
Reference in New Issue