[gimp/gimp-2-8] Bug 685559 - view-close action modified to close only an image view.



commit 22d4cd02fc6b56e342d4645921575b7f3f462a90
Author: Jehan <jehan girinstud io>
Date:   Mon Nov 26 00:18:00 2012 +0900

    Bug 685559 - view-close action modified to close only an image view.
    
    view-close was closing also toolbox docks if they had the focus. Now
    this action will close only the current active image view (if any),
    whatever the window which has actual focus.
    Additionally all other view actions are available on dock focus.
    (cherry picked from commit 2ad8634c06814219728bb10fbe59a63afc42fdea)

 app/actions/file-actions.c  |    3 +++
 app/actions/view-actions.c  |    6 +++---
 app/actions/view-commands.c |   20 ++++++++++++++++++++
 app/actions/view-commands.h |    2 ++
 4 files changed, 28 insertions(+), 3 deletions(-)
---
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index 45185a2..09992af 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -246,6 +246,9 @@ file_actions_setup (GimpActionGroup *group)
                            group, 0);
 
   file_actions_close_all_update (group->gimp->displays, NULL, group);
+
+  /* Allows to interact with the active file view from docks. */
+  view_actions_setup (group);
 }
 
 void
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index c74f7f6..acda1d4 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -79,9 +79,9 @@ static const GimpActionEntry view_actions[] =
     GIMP_HELP_VIEW_NEW },
 
   { "view-close", GTK_STOCK_CLOSE,
-    NC_("view-action",  "_Close"), "<primary>W",
-    NC_("view-action", "Close this image window"),
-    G_CALLBACK (window_close_cmd_callback),
+    NC_("view-action",  "_Close View"), "<primary>W",
+    NC_("view-action", "Close the active image view"),
+    G_CALLBACK (view_close_cmd_callback),
     GIMP_HELP_FILE_CLOSE },
 
   { "view-zoom-fit-in", GTK_STOCK_ZOOM_FIT,
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index fbd291d..ccbc3bd 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -49,6 +49,7 @@
 #include "display/gimpdisplayshell-scale.h"
 #include "display/gimpdisplayshell-scale-dialog.h"
 #include "display/gimpdisplayshell-scroll.h"
+#include "display/gimpdisplayshell-close.h"
 #include "display/gimpimagewindow.h"
 
 #include "actions.h"
@@ -93,6 +94,25 @@ view_new_cmd_callback (GtkAction *action,
 }
 
 void
+view_close_cmd_callback (GtkAction *action,
+                         gpointer   data)
+{
+  GimpDisplay      *display;
+  GimpDisplayShell *shell;
+  GimpImage        *image;
+
+  return_if_no_display (display, data);
+  shell  = gimp_display_get_shell(display);
+  image = gimp_display_get_image (display);
+
+  /* Check for active image so we don't close the last display. */
+  if (! GIMP_IS_IMAGE (image) || ! gimp_image_get_active_drawable (image))
+    return;
+  if (shell)
+    gimp_display_shell_close (shell, FALSE);
+}
+
+void
 view_zoom_fit_in_cmd_callback (GtkAction *action,
                                gpointer   data)
 {
diff --git a/app/actions/view-commands.h b/app/actions/view-commands.h
index 614ad36..0c19207 100644
--- a/app/actions/view-commands.h
+++ b/app/actions/view-commands.h
@@ -21,6 +21,8 @@
 
 void   view_new_cmd_callback                   (GtkAction *action,
                                                 gpointer   data);
+void   view_close_cmd_callback                 (GtkAction *action,
+                                                gpointer   data);
 
 void   view_zoom_fit_in_cmd_callback           (GtkAction *action,
                                                 gpointer   data);


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