[gimp] app: add File -> Copy Image Location
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add File -> Copy Image Location
- Date: Tue, 17 Feb 2015 12:33:49 +0000 (UTC)
commit d3600ab379b358a2db1c1289459c63fbd3500357
Author: Michael Natterer <mitch gimp org>
Date: Tue Feb 17 13:33:10 2015 +0100
app: add File -> Copy Image Location
app/actions/file-actions.c | 9 ++++++++-
app/actions/file-commands.c | 25 +++++++++++++++++++++++++
app/actions/file-commands.h | 2 ++
app/widgets/gimphelp-ids.h | 1 +
menus/image-menu.xml.in | 1 +
5 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index 566a07e..e3cb208 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -108,8 +108,14 @@ static const GimpActionEntry file_actions[] =
G_CALLBACK (file_close_all_cmd_callback),
GIMP_HELP_FILE_CLOSE_ALL },
+ { "file-copy-location", "edit-copy",
+ NC_("file-action", "Copy _Image Location"), NULL,
+ NC_("file-action", "Copy image file location to clipboard"),
+ G_CALLBACK (file_copy_location_cmd_callback),
+ GIMP_HELP_FILE_COPY_LOCATION },
+
{ "file-show-in-file-manager", "gtk-directory",
- NC_("file-action", "Show in File Manager"), "<primary><alt>F",
+ NC_("file-action", "Show in _File Manager"), "<primary><alt>F",
NC_("file-action", "Show image file location in the file manager"),
G_CALLBACK (file_show_in_file_manager_cmd_callback),
GIMP_HELP_FILE_SHOW_IN_FILE_MANAGER },
@@ -297,6 +303,7 @@ file_actions_update (GimpActionGroup *group,
SET_VISIBLE ("file-overwrite", show_overwrite);
SET_SENSITIVE ("file-export-as", drawable);
SET_SENSITIVE ("file-create-template", image);
+ SET_SENSITIVE ("file-copy-location", file || source || export);
SET_SENSITIVE ("file-show-in-file-manager", file || source || export);
if (export)
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 13ccb01..3cae699 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -44,6 +44,7 @@
#include "file/gimp-file.h"
#include "widgets/gimpactiongroup.h"
+#include "widgets/gimpclipboard.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpfiledialog.h"
#include "widgets/gimphelp-ids.h"
@@ -471,6 +472,30 @@ file_close_all_cmd_callback (GtkAction *action,
}
void
+file_copy_location_cmd_callback (GtkAction *action,
+ gpointer data)
+{
+ Gimp *gimp;
+ GimpDisplay *display;
+ GimpImage *image;
+ GFile *file;
+ return_if_no_gimp (gimp, data);
+ return_if_no_display (display, data);
+
+ image = gimp_display_get_image (display);
+
+ file = gimp_image_get_any_file (image);
+
+ if (file)
+ {
+ gchar *uri = g_file_get_uri (file);
+
+ gimp_clipboard_set_text (gimp, uri);
+ g_free (uri);
+ }
+}
+
+void
file_show_in_file_manager_cmd_callback (GtkAction *action,
gpointer data)
{
diff --git a/app/actions/file-commands.h b/app/actions/file-commands.h
index 5a8a5ed..81408af 100644
--- a/app/actions/file-commands.h
+++ b/app/actions/file-commands.h
@@ -39,6 +39,8 @@ void file_revert_cmd_callback (GtkAction *action,
gpointer data);
void file_close_all_cmd_callback (GtkAction *action,
gpointer data);
+void file_copy_location_cmd_callback (GtkAction *action,
+ gpointer data);
void file_show_in_file_manager_cmd_callback (GtkAction *action,
gpointer data);
void file_quit_cmd_callback (GtkAction *action,
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index d9e08ee..a9bff67 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -41,6 +41,7 @@
#define GIMP_HELP_FILE_REVERT "gimp-file-revert"
#define GIMP_HELP_FILE_CLOSE "gimp-file-close"
#define GIMP_HELP_FILE_CLOSE_ALL "gimp-file-close-all"
+#define GIMP_HELP_FILE_COPY_LOCATION "gimp-file-copy-location"
#define GIMP_HELP_FILE_SHOW_IN_FILE_MANAGER "gimp-file-show-in-file-manager"
#define GIMP_HELP_FILE_CREATE_TEMPLATE "gimp-file-save-as-template" /* Update string along with
gimp-help-2 */
#define GIMP_HELP_FILE_QUIT "gimp-file-quit"
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 7af3915..8b0b146 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -53,6 +53,7 @@
<placeholder name="Send" />
<separator />
<placeholder name="Info">
+ <menuitem action="file-copy-location" />
<menuitem action="file-show-in-file-manager" />
</placeholder>
<separator />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]