diff --git a/ChangeLog b/ChangeLog index da62f08e653f1469c36215850b7d10cfcb132327..aa65d1300ea68f6fd19ef979d9cd327004b8e6c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-07-07 Michael Natterer + + * app/actions/documents-actions.c + * app/actions/documents-commands.[ch] + * app/widgets/gimphelp-ids.h + * menus/documents-menu.xml: added "Copy Image Location" to the + document history popup menu which copies the image's URI to + clipbpard and primary. + 2005-07-07 Sven Neumann * app/actions/gradient-editor-commands.c diff --git a/app/actions/documents-actions.c b/app/actions/documents-actions.c index 142f7a6f2a1412290368fd81ed58d3ff6fcbaf4a..43e200fd24937d8a9301fe64c6f7b571d68f4574 100644 --- a/app/actions/documents-actions.c +++ b/app/actions/documents-actions.c @@ -60,6 +60,12 @@ static GimpActionEntry documents_actions[] = G_CALLBACK (documents_file_open_dialog_cmd_callback), GIMP_HELP_DOCUMENT_OPEN }, + { "documents-copy-location", GTK_STOCK_COPY, + N_("Copy Image _Location"), "", + N_("Copy image location to clipboard"), + G_CALLBACK (documents_copy_location_cmd_callback), + GIMP_HELP_DOCUMENT_COPY_LOCATION }, + { "documents-remove", GTK_STOCK_REMOVE, N_("Remove _Entry"), "", N_("Remove the selected entry"), @@ -118,6 +124,7 @@ documents_actions_update (GimpActionGroup *group, SET_SENSITIVE ("documents-open", imagefile); SET_SENSITIVE ("documents-raise-or-open", imagefile); SET_SENSITIVE ("documents-file-open-dialog", TRUE); + SET_SENSITIVE ("documents-copy-location", imagefile); SET_SENSITIVE ("documents-remove", imagefile); SET_SENSITIVE ("documents-clear", TRUE); SET_SENSITIVE ("documents-recreate-preview", imagefile); diff --git a/app/actions/documents-commands.c b/app/actions/documents-commands.c index c292b69691f99cce9db4deffb66338e39e8777e3..e3f04c83135adae7ce22a80ad3231b43f221f59b 100644 --- a/app/actions/documents-commands.c +++ b/app/actions/documents-commands.c @@ -147,6 +147,34 @@ documents_file_open_dialog_cmd_callback (GtkAction *action, } } +void +documents_copy_location_cmd_callback (GtkAction *action, + gpointer data) +{ + GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data); + GimpContext *context; + GimpImagefile *imagefile; + + context = gimp_container_view_get_context (editor->view); + imagefile = gimp_context_get_imagefile (context); + + if (imagefile) + { + GtkClipboard *clipboard; + const gchar *uri; + + uri = gimp_object_get_name (GIMP_OBJECT (imagefile)); + + clipboard = gtk_clipboard_get_for_display (gdk_display_get_default (), + GDK_SELECTION_CLIPBOARD); + gtk_clipboard_set_text (clipboard, uri, -1); + + clipboard = gtk_clipboard_get_for_display (gdk_display_get_default (), + GDK_SELECTION_PRIMARY); + gtk_clipboard_set_text (clipboard, uri, -1); + } +} + void documents_remove_cmd_callback (GtkAction *action, gpointer data) diff --git a/app/actions/documents-commands.h b/app/actions/documents-commands.h index 772801c4ef0c58e198e86ef9b3075244113764fe..2edc5daf3cdb394de83f8d0fe5ace04efcba8d6d 100644 --- a/app/actions/documents-commands.h +++ b/app/actions/documents-commands.h @@ -26,6 +26,8 @@ void documents_raise_or_open_cmd_callback (GtkAction *action, gpointer data); void documents_file_open_dialog_cmd_callback (GtkAction *action, gpointer data); +void documents_copy_location_cmd_callback (GtkAction *action, + gpointer data); void documents_remove_cmd_callback (GtkAction *action, gpointer data); void documents_clear_cmd_callback (GtkAction *action, diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h index 563a65da73de9ca606748d9c417701f32992e631..2f5c9b30e36a5e8fd6981f3e86ad2d286ebc0fc1 100644 --- a/app/widgets/gimphelp-ids.h +++ b/app/widgets/gimphelp-ids.h @@ -351,6 +351,7 @@ #define GIMP_HELP_BUFFER_DELETE "gimp-buffer-delete" #define GIMP_HELP_DOCUMENT_CLEAR "gimp-document-clear" +#define GIMP_HELP_DOCUMENT_COPY_LOCATION "gimp-document-copy-location" #define GIMP_HELP_DOCUMENT_DIALOG "gimp-document-dialog" #define GIMP_HELP_DOCUMENT_OPEN "gimp-document-open" #define GIMP_HELP_DOCUMENT_REMOVE "gimp-document-remove" diff --git a/menus/documents-menu.xml b/menus/documents-menu.xml index f230799cc33bd31cf99e2a0b6b9d8a931b0fc938..fc26b335eb1fb1df759dcc975a39a3b80ffe91e8 100644 --- a/menus/documents-menu.xml +++ b/menus/documents-menu.xml @@ -6,6 +6,7 @@ +