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

only work around option menu reference problems if the removed item was

2001-04-26  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcontainermenuimpl.c: only work around option
	menu reference problems if the removed item was the active one.

	* app/widgets/gimpimagedock.c: don't try to avoid a recursive
	signal emission in gimp_image_dock_image_changed() but work around
	it. This makes the image menu work finally.

	* app/gui/dialogs-constructors.c: removed debugging output.
parent a1223c92
2001-04-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainermenuimpl.c: only work around option
menu reference problems if the removed item was the active one.
* app/widgets/gimpimagedock.c: don't try to avoid a recursive
signal emission in gimp_image_dock_image_changed() but work around
it. This makes the image menu work finally.
* app/gui/dialogs-constructors.c: removed debugging output.
2001-04-25 Michael Natterer <mitch@gimp.org>
* app/gimpobject.c: free the object's name on destruction.
......
......@@ -886,8 +886,5 @@ dialogs_drawable_view_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDrawableListView *view)
{
g_print ("%p: image changed %s\n",
context, gimage ? GIMP_OBJECT (gimage)->name : "NULL");
gimp_drawable_list_view_set_image (view, gimage);
}
......@@ -886,8 +886,5 @@ dialogs_drawable_view_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDrawableListView *view)
{
g_print ("%p: image changed %s\n",
context, gimage ? GIMP_OBJECT (gimage)->name : "NULL");
gimp_drawable_list_view_set_image (view, gimage);
}
......@@ -209,18 +209,17 @@ gimp_container_menu_impl_remove_item (GimpContainerMenu *menu,
if (menu_item)
{
gboolean active;
active = (gtk_menu_get_active (GTK_MENU (menu)) == menu_item);
if (g_list_length (GTK_MENU_SHELL (menu)->children) == 2)
gtk_widget_show (GIMP_CONTAINER_MENU_IMPL (menu)->empty_item);
gtk_container_remove (GTK_CONTAINER (menu), menu_item);
if (g_list_length (GTK_MENU_SHELL (menu)->children) == 1)
{
gtk_widget_show (GIMP_CONTAINER_MENU_IMPL (menu)->empty_item);
}
/* FIXME: this is due to gtkoptionmenu brokenness */
gimp_container_menu_impl_set_history (menu, 0);
if (active)
gimp_container_menu_impl_set_history (menu, 0);
}
}
......@@ -231,7 +230,6 @@ gimp_container_menu_impl_reorder_item (GimpContainerMenu *menu,
gpointer insert_data)
{
GtkWidget *menu_item;
gboolean active;
if (insert_data)
menu_item = GTK_WIDGET (insert_data);
......@@ -240,6 +238,8 @@ gimp_container_menu_impl_reorder_item (GimpContainerMenu *menu,
if (menu_item)
{
gboolean active;
active = (gtk_menu_get_active (GTK_MENU (menu)) == menu_item);
gtk_menu_reorder_child (GTK_MENU (menu),
......
......@@ -216,19 +216,22 @@ gimp_image_dock_image_changed (GimpContext *context,
image_dock = GIMP_IMAGE_DOCK (dock);
g_print ("%p: got image %s\n",
context, gimage ? GIMP_OBJECT (gimage)->name : "NULL");
if (! gimage && image_dock->image_container->num_children)
if (! gimage && image_dock->image_container->num_children > 0)
{
gimage = GIMP_IMAGE (gimp_container_get_child_by_index (image_dock->image_container, 0));
gtk_signal_emit_stop_by_name (GTK_OBJECT (context), "image_changed");
g_print ("%p: set image %s\n",
context, gimage ? GIMP_OBJECT (gimage)->name : "NULL");
gimp_context_set_image (dock->context, gimage);
if (gimage)
{
/* this invokes this function recursively but we don't enter
* the if() branch the second time
*/
gimp_context_set_image (dock->context, gimage);
/* stop the emission of the original signal (the emission of
* the recursive signal is finished)
*/
gtk_signal_emit_stop_by_name (GTK_OBJECT (context), "image_changed");
}
}
}
......
......@@ -216,19 +216,22 @@ gimp_image_dock_image_changed (GimpContext *context,
image_dock = GIMP_IMAGE_DOCK (dock);
g_print ("%p: got image %s\n",
context, gimage ? GIMP_OBJECT (gimage)->name : "NULL");
if (! gimage && image_dock->image_container->num_children)
if (! gimage && image_dock->image_container->num_children > 0)
{
gimage = GIMP_IMAGE (gimp_container_get_child_by_index (image_dock->image_container, 0));
gtk_signal_emit_stop_by_name (GTK_OBJECT (context), "image_changed");
g_print ("%p: set image %s\n",
context, gimage ? GIMP_OBJECT (gimage)->name : "NULL");
gimp_context_set_image (dock->context, gimage);
if (gimage)
{
/* this invokes this function recursively but we don't enter
* the if() branch the second time
*/
gimp_context_set_image (dock->context, gimage);
/* stop the emission of the original signal (the emission of
* the recursive signal is finished)
*/
gtk_signal_emit_stop_by_name (GTK_OBJECT (context), "image_changed");
}
}
}
......
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