[gimp] Bug 685559 - view-close action modified to close only an image view.
- From: Jehan PagÃs <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 685559 - view-close action modified to close only an image view.
- Date: Wed, 12 Dec 2012 06:51:55 +0000 (UTC)
commit 2ad8634c06814219728bb10fbe59a63afc42fdea
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.
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 7e272cb..58d8ea8 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -78,9 +78,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 97b1228..33fa14a 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -48,6 +48,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"
@@ -92,6 +93,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 3c68a3e..4312c1c 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]