gimp r25131 - in trunk: . app/actions app/dialogs app/display app/gui



Author: mitch
Date: Wed Mar 19 20:29:30 2008
New Revision: 25131
URL: http://svn.gnome.org/viewvc/gimp?rev=25131&view=rev

Log:
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".



Modified:
   trunk/ChangeLog
   trunk/app/actions/file-actions.c
   trunk/app/actions/file-commands.c
   trunk/app/actions/view-actions.c
   trunk/app/dialogs/quit-dialog.c
   trunk/app/display/gimpdisplay-foreach.c
   trunk/app/display/gimpdisplay-foreach.h
   trunk/app/gui/gui.c

Modified: trunk/app/actions/file-actions.c
==============================================================================
--- trunk/app/actions/file-actions.c	(original)
+++ trunk/app/actions/file-actions.c	Wed Mar 19 20:29:30 2008
@@ -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 @@
                                                 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_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 @@
   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 @@
 }
 
 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);
 }

Modified: trunk/app/actions/file-commands.c
==============================================================================
--- trunk/app/actions/file-commands.c	(original)
+++ trunk/app/actions/file-commands.c	Wed Mar 19 20:29:30 2008
@@ -403,7 +403,7 @@
 
   if (! gimp_displays_dirty (gimp))
     {
-      gimp_displays_delete (gimp);
+      gimp_displays_delete (gimp, FALSE);
     }
   else
     {

Modified: trunk/app/actions/view-actions.c
==============================================================================
--- trunk/app/actions/view-actions.c	(original)
+++ trunk/app/actions/view-actions.c	Wed Mar 19 20:29:30 2008
@@ -560,7 +560,7 @@
         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);

Modified: trunk/app/dialogs/quit-dialog.c
==============================================================================
--- trunk/app/dialogs/quit-dialog.c	(original)
+++ trunk/app/dialogs/quit-dialog.c	Wed Mar 19 20:29:30 2008
@@ -196,7 +196,7 @@
       if (do_quit)
         gimp_exit (gimp, TRUE);
       else
-        gimp_displays_delete (gimp);
+        gimp_displays_delete (gimp, FALSE);
     }
 }
 

Modified: trunk/app/display/gimpdisplay-foreach.c
==============================================================================
--- trunk/app/display/gimpdisplay-foreach.c	(original)
+++ trunk/app/display/gimpdisplay-foreach.c	Wed Mar 19 20:29:30 2008
@@ -140,7 +140,8 @@
 }
 
 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 @@
    */
   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;
+        }
     }
 }
 

Modified: trunk/app/display/gimpdisplay-foreach.h
==============================================================================
--- trunk/app/display/gimpdisplay-foreach.h	(original)
+++ trunk/app/display/gimpdisplay-foreach.h	Wed Mar 19 20:29:30 2008
@@ -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);

Modified: trunk/app/gui/gui.c
==============================================================================
--- trunk/app/gui/gui.c	(original)
+++ trunk/app/gui/gui.c	Wed Mar 19 20:29:30 2008
@@ -578,7 +578,7 @@
                                         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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]