Commit bc03eded authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

add boolean "quit" parameter and leave the empty display open when it is

2008-03-19  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplay-foreach.[ch] (gimp_displays_delete): add
	boolean "quit" parameter and leave the empty display open when it
	is FALSE.

	* app/dialogs/quit-dialog.c
	* app/actions/file-commands.c: pass quit = FALSE for "close all".

	* app/gui/gui.c: pass quit = TRUE when quitting.

	* app/actions/file-actions.c: fix sensitivity of "Close all".

	* app/actions/view-actions.c: fix sensitivity of "Close".


svn path=/trunk/; revision=25131
parent 4936924f
2008-03-19 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplay-foreach.[ch] (gimp_displays_delete): add
boolean "quit" parameter and leave the empty display open when it
is FALSE.
* app/dialogs/quit-dialog.c
* app/actions/file-commands.c: pass quit = FALSE for "close all".
* app/gui/gui.c: pass quit = TRUE when quitting.
* app/actions/file-actions.c: fix sensitivity of "Close all".
* app/actions/view-actions.c: fix sensitivity of "Close".
2008-03-19 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-callbacks.c: clean up after Martin.
......
......@@ -38,6 +38,8 @@
#include "widgets/gimpactiongroup.h"
#include "widgets/gimphelp-ids.h"
#include "display/gimpdisplay.h"
#include "actions.h"
#include "file-actions.h"
#include "file-commands.h"
......@@ -54,7 +56,7 @@ static void file_actions_last_opened_reorder (GimpContainer *container,
GimpImagefile *unused1,
gint unused2,
GimpActionGroup *group);
static void file_actions_close_all_update (GimpContainer *container,
static void file_actions_close_all_update (GimpContainer *images,
GimpObject *unused,
GimpActionGroup *group);
......@@ -208,10 +210,13 @@ file_actions_setup (GimpActionGroup *group)
file_actions_last_opened_update (group->gimp->documents, NULL, group);
g_signal_connect_object (group->gimp->displays, "add",
/* also listen to image adding/removal so we catch the case where
* the last image is closed but its display stays open.
*/
g_signal_connect_object (group->gimp->images, "add",
G_CALLBACK (file_actions_close_all_update),
group, 0);
g_signal_connect_object (group->gimp->displays, "remove",
g_signal_connect_object (group->gimp->images, "remove",
G_CALLBACK (file_actions_close_all_update),
group, 0);
......@@ -238,6 +243,9 @@ file_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("file-save-as-template", image);
SET_SENSITIVE ("file-revert", image && GIMP_OBJECT (image)->name);
/* needed for the empty display */
SET_SENSITIVE ("file-close-all", image);
#undef SET_SENSITIVE
}
......@@ -318,12 +326,22 @@ file_actions_last_opened_reorder (GimpContainer *container,
}
static void
file_actions_close_all_update (GimpContainer *container,
file_actions_close_all_update (GimpContainer *images,
GimpObject *unused,
GimpActionGroup *group)
{
gint n_displays = gimp_container_num_children (container);
GimpContainer *container = group->gimp->displays;
gint n_displays = gimp_container_num_children (container);
gboolean sensitive = (n_displays > 0);
if (n_displays == 1)
{
GimpDisplay *display = (GimpDisplay *)
gimp_container_get_child_by_index (container, 0);
if (! display->image)
sensitive = FALSE;
}
gimp_action_group_set_action_sensitive (group, "file-close-all",
n_displays > 0);
gimp_action_group_set_action_sensitive (group, "file-close-all", sensitive);
}
......@@ -403,7 +403,7 @@ file_close_all_cmd_callback (GtkAction *action,
if (! gimp_displays_dirty (gimp))
{
gimp_displays_delete (gimp);
gimp_displays_delete (gimp, FALSE);
}
else
{
......
......@@ -560,7 +560,7 @@ view_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_color (group, action, color, FALSE)
SET_SENSITIVE ("view-new", image);
SET_SENSITIVE ("view-close", display);
SET_SENSITIVE ("view-close", image);
SET_SENSITIVE ("view-dot-for-dot", image);
SET_ACTIVE ("view-dot-for-dot", display && shell->dot_for_dot);
......
......@@ -196,7 +196,7 @@ quit_close_all_dialog_response (GtkWidget *dialog,
if (do_quit)
gimp_exit (gimp, TRUE);
else
gimp_displays_delete (gimp);
gimp_displays_delete (gimp, FALSE);
}
}
......
......@@ -140,7 +140,8 @@ gimp_displays_get_dirty_images (Gimp *gimp)
}
void
gimp_displays_delete (Gimp *gimp)
gimp_displays_delete (Gimp *gimp,
gboolean quit)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
......@@ -149,9 +150,18 @@ gimp_displays_delete (Gimp *gimp)
*/
while (GIMP_LIST (gimp->displays)->list)
{
GimpDisplay *display = GIMP_LIST (gimp->displays)->list->data;
GList *list = GIMP_LIST (gimp->displays)->list;
GimpDisplay *display = list->data;
gimp_display_delete (display);
if (list->next || quit)
{
gimp_display_delete (display);
}
else
{
gimp_display_empty (display);
break;
}
}
}
......
......@@ -22,7 +22,8 @@
gboolean gimp_displays_dirty (Gimp *gimp);
GimpContainer * gimp_displays_get_dirty_images (Gimp *gimp);
void gimp_displays_delete (Gimp *gimp);
void gimp_displays_delete (Gimp *gimp,
gboolean quit);
void gimp_displays_reconnect (Gimp *gimp,
GimpImage *old,
GimpImage *new);
......
......@@ -578,7 +578,7 @@ gui_exit_callback (Gimp *gimp,
gui_display_changed,
gimp);
gimp_displays_delete (gimp);
gimp_displays_delete (gimp, TRUE);
gimp_tools_save (gimp, gui_config->save_tool_options, FALSE);
gimp_tools_exit (gimp);
......
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