Commit 75e6fc56 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

add newly created children to the container *after* deserializing them so

2004-06-17  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpcontainer.c (gimp_container_deserialize): add newly
	created children to the container *after* deserializing them so
	GimpContainer::add() callbacks get the already deserialized
	object.

	* app/widgets/gimpcontrollers.c: connect to "add" and "remove" of
	the controller list and remember / clear the wheel controller when
	it appears / disappears.
parent 21ecf07c
2004-06-17 Michael Natterer <mitch@gimp.org>
* app/core/gimpcontainer.c (gimp_container_deserialize): add newly
created children to the container *after* deserializing them so
GimpContainer::add() callbacks get the already deserialized
object.
* app/widgets/gimpcontrollers.c: connect to "add" and "remove" of
the controller list and remember / clear the wheel controller when
it appears / disappears.
2004-06-17 Sven Neumann <sven@gimp.org>
* autogen.sh: check for xsltproc and mention that the intltool
......
......@@ -429,7 +429,8 @@ gimp_container_deserialize (GimpConfig *config,
{
GimpObject *child;
GType type;
gchar *name = NULL;
gchar *name = NULL;
gboolean add_child = FALSE;
type = g_type_from_name (scanner->value.v_identifier);
......@@ -483,10 +484,7 @@ gimp_container_deserialize (GimpConfig *config,
"name", name, NULL);
}
gimp_container_add (container, child);
if (container->policy == GIMP_CONTAINER_POLICY_STRONG)
g_object_unref (child);
add_child = TRUE;
}
g_free (name);
......@@ -496,9 +494,20 @@ gimp_container_deserialize (GimpConfig *config,
nest_level + 1,
FALSE))
{
if (add_child)
g_object_unref (child);
/* warning should be already set by child */
return FALSE;
}
if (add_child)
{
gimp_container_add (container, child);
if (container->policy == GIMP_CONTAINER_POLICY_STRONG)
g_object_unref (child);
}
}
token = G_TOKEN_RIGHT_PAREN;
break;
......
......@@ -63,6 +63,13 @@ struct _GimpControllerManager
static GimpControllerManager * gimp_controller_manager_get (Gimp *gimp);
static void gimp_controller_manager_free (GimpControllerManager *manager);
static void gimp_controllers_add (GimpContainer *container,
GimpControllerInfo *info,
GimpControllerManager *manager);
static void gimp_controllers_remove (GimpContainer *container,
GimpControllerInfo *info,
GimpControllerManager *manager);
static gboolean gimp_controllers_event_mapped (GimpControllerInfo *info,
GimpController *controller,
const GimpControllerEvent *event,
......@@ -88,6 +95,13 @@ gimp_controllers_init (Gimp *gimp)
manager->controllers = gimp_list_new (GIMP_TYPE_CONTROLLER_INFO, TRUE);
g_signal_connect (manager->controllers, "add",
G_CALLBACK (gimp_controllers_add),
manager);
g_signal_connect (manager->controllers, "remove",
G_CALLBACK (gimp_controllers_remove),
manager);
manager->event_mapped_id =
gimp_container_add_handler (manager->controllers, "event-mapped",
G_CALLBACK (gimp_controllers_event_mapped),
......@@ -252,6 +266,24 @@ gimp_controller_manager_free (GimpControllerManager *manager)
g_free (manager);
}
static void
gimp_controllers_add (GimpContainer *container,
GimpControllerInfo *info,
GimpControllerManager *manager)
{
if (GIMP_IS_CONTROLLER_WHEEL (info->controller))
manager->wheel = info->controller;
}
static void
gimp_controllers_remove (GimpContainer *container,
GimpControllerInfo *info,
GimpControllerManager *manager)
{
if (info->controller == manager->wheel)
manager->wheel = NULL;
}
static gboolean
gimp_controllers_event_mapped (GimpControllerInfo *info,
GimpController *controller,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment