From f35d1ffe1cdd6aae8dec7d1e23e7f55da41e7dfc Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 18 Dec 2006 11:57:29 +0000 Subject: [PATCH] cleanup up the code that shows the toolbox when the last display is 2006-12-18 Sven Neumann * app/gui/gui.c: cleanup up the code that shows the toolbox when the last display is closed. --- ChangeLog | 5 +++++ app/gui/gui.c | 41 +++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index c889b2d248..f10990d492 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-12-18 Sven Neumann + + * app/gui/gui.c: cleanup up the code that shows the toolbox when + the last display is closed. + 2006-12-18 Sven Neumann * app/paint/gimpbrushcore.c (gimp_brush_core_interpolate): applied diff --git a/app/gui/gui.c b/app/gui/gui.c index d8c635dc67..648a180e53 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -124,15 +124,13 @@ static void gui_menu_hide_tooltip (GimpUIManager *manager, static void gui_display_changed (GimpContext *context, GimpDisplay *display, Gimp *gimp); -static void gui_image_disconnect (GimpImage *image, - Gimp *gimp); +static void gui_display_remove (GimpContainer *displays); /* private variables */ -static Gimp *the_gui_gimp = NULL; -static GQuark image_disconnect_handler_id = 0; -static GimpUIManager *image_ui_manager = NULL; +static Gimp *the_gui_gimp = NULL; +static GimpUIManager *image_ui_manager = NULL; /* public functions */ @@ -362,11 +360,6 @@ gui_restore_callback (Gimp *gimp, gui_vtable_init (gimp); - image_disconnect_handler_id = - gimp_container_add_handler (gimp->images, "disconnect", - G_CALLBACK (gui_image_disconnect), - gimp); - if (! gui_config->show_tooltips) gimp_help_disable_tooltips (); @@ -387,6 +380,9 @@ gui_restore_callback (Gimp *gimp, g_signal_connect (gimp_get_user_context (gimp), "display-changed", G_CALLBACK (gui_display_changed), gimp); + g_signal_connect (gimp->displays, "remove", + G_CALLBACK (gui_display_remove), + NULL); /* make sure the monitor resolution is valid */ if (display_config->monitor_res_from_gdk || @@ -523,17 +519,17 @@ gui_exit_after_callback (Gimp *gimp, g_signal_handlers_disconnect_by_func (gimp->config, gui_show_help_button_notify, gimp); - g_signal_handlers_disconnect_by_func (gimp->config, gui_show_tooltips_notify, gimp); - gimp_container_remove_handler (gimp->images, image_disconnect_handler_id); - image_disconnect_handler_id = 0; - g_object_unref (image_ui_manager); image_ui_manager = NULL; + g_signal_handlers_disconnect_by_func (gimp->displays, + G_CALLBACK (gui_display_remove), + NULL); + session_exit (gimp); menus_exit (gimp); actions_exit (gimp); @@ -663,8 +659,8 @@ gui_display_changed (GimpContext *context, { gimp_context_set_display (context, display2); - /* stop the emission of the original signal (the emission of - * the recursive signal is finished) + /* stop the emission of the original signal + * (the emission of the recursive signal is finished) */ g_signal_stop_emission_by_name (context, "display-changed"); return; @@ -679,13 +675,10 @@ gui_display_changed (GimpContext *context, } static void -gui_image_disconnect (GimpImage *image, - Gimp *gimp) +gui_display_remove (GimpContainer *displays) { - /* check if this is the last image and if it had a display */ - if (gimp_container_num_children (gimp->images) == 1 && - image->instance_count > 0) - { - dialogs_show_toolbox (); - } + /* show the toolbox when the last image window is closed */ + + if (gimp_container_is_empty (displays)) + dialogs_show_toolbox (); }