Commit 2ad8634c authored by Jehan's avatar Jehan

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.
parent 28669b07
......@@ -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
......
......@@ -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,
......
......@@ -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"
......@@ -91,6 +92,25 @@ view_new_cmd_callback (GtkAction *action,
shell->unit, gimp_zoom_model_get_factor (shell->zoom));
}
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)
......
......@@ -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);
......
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