app, libgimpwidgets: allowing changing a dockable settings value while…

… blinking it.

This will be necessary to demo new features available only in some
situations. E.g. a new option in line art detection mode of bucket fill
would require said mode to be enabled.
This commit is contained in:
Jehan
2022-03-06 14:31:27 +01:00
parent dbe28aa6f7
commit 622d0da43e
8 changed files with 344 additions and 118 deletions

View File

@ -205,6 +205,13 @@ gimp_widgets_init (GimpHelpFunc standard_help_func,
* as widget identifier. You can always use this function to override a
* given widget identifier with a more specific name.
*
* Note that when a widget is bound to a property, in other words when
* in one of our propwidgets API, you should rather use
* gimp_widget_set_bound_property() because it allows more easily to
* tweak values.
* gimp_widget_set_identifier() is more destined to random widgets which
* you just want to be able to blink.
*
* It's doesn't need to be in public API because it is only used for
* internal blinking ability in core GIMP GUI.
*/
@ -220,6 +227,41 @@ gimp_widget_set_identifier (GtkWidget *widget,
(GDestroyNotify) g_free);
}
/**
* gimp_widget_set_bound_property:
* @widget:
* @config:
* @property_name:
*
* This is similar to gimp_widget_set_identifier() because the
* property_name can be used as identifier by our blink API.
* You can still set explicitly (and additionally)
* gimp_widget_set_identifier() for rare cases where 2 widgets in a same
* container would bind the same property (or 2 properties named the
* same way for 2 different config objects). The identifier will be used
* in priority to the property name (which can still be used for
* changing the widget value, so it remains important to also set it).
*
* It's doesn't need to be in public API because it is only used for
* internal blinking ability in core GIMP GUI.
*/
void
gimp_widget_set_bound_property (GtkWidget *widget,
GObject *config,
const gchar *property_name)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_object_set_data_full (G_OBJECT (widget),
"gimp-widget-property-name",
g_strdup (property_name),
(GDestroyNotify) g_free);
g_object_set_data_full (G_OBJECT (widget),
"gimp-widget-property-config",
g_object_ref (config),
(GDestroyNotify) g_object_unref);
}
/* clean up babl (in particular, so that the fish cache is constructed) if the
* compiler supports destructors
*/