diff --git a/ChangeLog b/ChangeLog index 2047cf3d1f7df1ec472ac0a847d73082671cce0c..605032021e5f511f4aae0397c6627641ca95db29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2005-10-31 Sven Neumann + + * app/actions/data-commands.[ch]: added new action command + data_copy_location_cmd_callback(). + + * app/actions/brushes-actions.c + * app/actions/gradients-actions.c + * app/actions/palettes-actions.c + * app/actions/patterns-actions.c + * app/widgets/gimphelp-ids.h + * menus/brushes-menu.xml + * menus/gradients-menu.xml + * menus/palettes-menu.xml + * menus/patterns-menu.xml: added Copy Location menu entries to all + data views. Allows to retrieve the file location for data files. + 2005-10-31 Tor Lillqvist * gimptool-win32.c.in: Drop unnecessary . diff --git a/app/actions/brushes-actions.c b/app/actions/brushes-actions.c index f867ebdad44cbdca6273be980710bef3c8de99b2..7731443231f72d8a930036b2a6d6673b341a030c 100644 --- a/app/actions/brushes-actions.c +++ b/app/actions/brushes-actions.c @@ -61,6 +61,12 @@ static GimpActionEntry brushes_actions[] = G_CALLBACK (data_duplicate_cmd_callback), GIMP_HELP_BRUSH_DUPLICATE }, + { "brushes-copy-location", GTK_STOCK_COPY, + N_("Copy Brush _Location"), "", + N_("Copy brush file location to clipboard"), + G_CALLBACK (data_copy_location_cmd_callback), + GIMP_HELP_BRUSH_COPY_LOCATION }, + { "brushes-delete", GTK_STOCK_DELETE, N_("_Delete Brush"), "", N_("Delete brush"), @@ -119,6 +125,7 @@ brushes_actions_update (GimpActionGroup *group, SET_SENSITIVE ("brushes-edit", brush); SET_SENSITIVE ("brushes-open-as-image", brush && data->filename && ! GIMP_IS_BRUSH_GENERATED (brush)); SET_SENSITIVE ("brushes-duplicate", brush && GIMP_DATA_GET_CLASS (data)->duplicate); + SET_SENSITIVE ("brushes-copy-location", brush && data->filename); SET_SENSITIVE ("brushes-delete", brush && data->deletable); #undef SET_SENSITIVE diff --git a/app/actions/data-commands.c b/app/actions/data-commands.c index e7f1f3b7996647923e11feac157fd6c03fad20c9..7910dcd38cd378472b3fbadd1ef62fded22567a8 100644 --- a/app/actions/data-commands.c +++ b/app/actions/data-commands.c @@ -168,6 +168,41 @@ data_duplicate_cmd_callback (GtkAction *action, } } +void +data_copy_location_cmd_callback (GtkAction *action, + gpointer user_data) +{ + GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (user_data); + GimpContext *context; + GimpData *data; + + context = gimp_container_view_get_context (GIMP_CONTAINER_EDITOR (view)->view); + + data = (GimpData *) + gimp_context_get_by_type (context, + view->factory->container->children_type); + + if (data && data->filename && *data->filename) + { + gchar *uri = g_filename_to_uri (data->filename, NULL, NULL); + + if (uri) + { + GtkClipboard *clipboard; + + 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); + + g_free (uri); + } + } +} + void data_delete_cmd_callback (GtkAction *action, gpointer user_data) diff --git a/app/actions/data-commands.h b/app/actions/data-commands.h index bcff576a18f12d1e61ea68e8c74505c1c2397fe4..89a8250d847ecdc2f284ee51b80939f8552244d2 100644 --- a/app/actions/data-commands.h +++ b/app/actions/data-commands.h @@ -26,6 +26,8 @@ void data_new_cmd_callback (GtkAction *action, gpointer data); void data_duplicate_cmd_callback (GtkAction *action, gpointer data); +void data_copy_location_cmd_callback (GtkAction *action, + gpointer user_data); void data_delete_cmd_callback (GtkAction *action, gpointer data); void data_refresh_cmd_callback (GtkAction *action, diff --git a/app/actions/gradients-actions.c b/app/actions/gradients-actions.c index fd39956741d937e5e75f373a31bd1f945efba6ae..1560bf0648e42a8b5c72108eb17c94bdcfeb31fa 100644 --- a/app/actions/gradients-actions.c +++ b/app/actions/gradients-actions.c @@ -56,6 +56,12 @@ static GimpActionEntry gradients_actions[] = G_CALLBACK (data_duplicate_cmd_callback), GIMP_HELP_GRADIENT_DUPLICATE }, + { "gradients-copy-location", GTK_STOCK_COPY, + N_("Copy Gradient _Location"), "", + N_("Copy gradient file location to clipboard"), + G_CALLBACK (data_copy_location_cmd_callback), + GIMP_HELP_GRADIENT_COPY_LOCATION }, + { "gradients-save-as-pov", GTK_STOCK_SAVE_AS, N_("Save as _POV-Ray..."), "", N_("Save gradient as POV-Ray"), @@ -117,10 +123,11 @@ gradients_actions_update (GimpActionGroup *group, #define SET_SENSITIVE(action,condition) \ gimp_action_group_set_action_sensitive (group, action, (condition) != 0) - SET_SENSITIVE ("gradients-edit", gradient); - SET_SENSITIVE ("gradients-duplicate", gradient); - SET_SENSITIVE ("gradients-save-as-pov", gradient); - SET_SENSITIVE ("gradients-delete", gradient && data->deletable); + SET_SENSITIVE ("gradients-edit", gradient); + SET_SENSITIVE ("gradients-duplicate", gradient); + SET_SENSITIVE ("gradients-save-as-pov", gradient); + SET_SENSITIVE ("gradients-copy-location", gradient && data->filename); + SET_SENSITIVE ("gradients-delete", gradient && data->deletable); #undef SET_SENSITIVE } diff --git a/app/actions/palettes-actions.c b/app/actions/palettes-actions.c index d83e80db25d2f443575bd63ccc28572e0e0f7bb6..066cad3c6b15ddfbf89d63132d9ac48568474737 100644 --- a/app/actions/palettes-actions.c +++ b/app/actions/palettes-actions.c @@ -68,6 +68,12 @@ static GimpActionEntry palettes_actions[] = G_CALLBACK (palettes_merge_cmd_callback), GIMP_HELP_PALETTE_MERGE }, + { "palettes-copy-location", GTK_STOCK_COPY, + N_("Copy Palette _Location"), "", + N_("Copy palette file location to clipboard"), + G_CALLBACK (data_copy_location_cmd_callback), + GIMP_HELP_PALETTE_COPY_LOCATION }, + { "palettes-delete", GTK_STOCK_DELETE, N_("_Delete Palette"), "", N_("Delete palette"), @@ -123,10 +129,11 @@ palettes_actions_update (GimpActionGroup *group, #define SET_SENSITIVE(action,condition) \ gimp_action_group_set_action_sensitive (group, action, (condition) != 0) - SET_SENSITIVE ("palettes-edit", palette); - SET_SENSITIVE ("palettes-duplicate", palette && GIMP_DATA_GET_CLASS (data)->duplicate); - SET_SENSITIVE ("palettes-merge", FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */ - SET_SENSITIVE ("palettes-delete", palette && data->deletable); + SET_SENSITIVE ("palettes-edit", palette); + SET_SENSITIVE ("palettes-duplicate", palette && GIMP_DATA_GET_CLASS (data)->duplicate); + SET_SENSITIVE ("palettes-merge", FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */ + SET_SENSITIVE ("palettes-copy-location", palette && data->filename); + SET_SENSITIVE ("palettes-delete", palette && data->deletable); #undef SET_SENSITIVE } diff --git a/app/actions/patterns-actions.c b/app/actions/patterns-actions.c index b4afbb021de8aff9904fa1b2d5a1e936b59cffcd..4ba455c324125a882ccf0dad5540b0d9ac1ee8d2 100644 --- a/app/actions/patterns-actions.c +++ b/app/actions/patterns-actions.c @@ -61,6 +61,12 @@ static GimpActionEntry patterns_actions[] = G_CALLBACK (data_duplicate_cmd_callback), GIMP_HELP_PATTERN_DUPLICATE }, + { "patterns-copy-location", GTK_STOCK_COPY, + N_("Copy Pattern _Location"), "", + N_("Copy pattern file location to clipboard"), + G_CALLBACK (data_copy_location_cmd_callback), + GIMP_HELP_PATTERN_COPY_LOCATION }, + { "patterns-delete", GTK_STOCK_DELETE, N_("_Delete Pattern"), "", N_("Delete pattern"), @@ -119,6 +125,7 @@ patterns_actions_update (GimpActionGroup *group, SET_SENSITIVE ("patterns-edit", pattern && FALSE); SET_SENSITIVE ("patterns-open-as-image", pattern && data->filename); SET_SENSITIVE ("patterns-duplicate", pattern && GIMP_DATA_GET_CLASS (data)->duplicate); + SET_SENSITIVE ("patterns-copy-location", pattern && data->filename); SET_SENSITIVE ("patterns-delete", pattern && data->deletable); #undef SET_SENSITIVE diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h index 51ea88e5f24151b4ef9a62add43f3e45fe8db3a0..e3ebbcb53881d9ef34844d99026bec472fe5736c 100644 --- a/app/widgets/gimphelp-ids.h +++ b/app/widgets/gimphelp-ids.h @@ -282,6 +282,7 @@ #define GIMP_HELP_BRUSH_OPEN_AS_IMAGE "gimp-brush-open-as-image" #define GIMP_HELP_BRUSH_NEW "gimp-brush-new" #define GIMP_HELP_BRUSH_DUPLICATE "gimp-brush-duplicate" +#define GIMP_HELP_BRUSH_COPY_LOCATION "gimp-brush-copy-location" #define GIMP_HELP_BRUSH_DELETE "gimp-brush-delete" #define GIMP_HELP_BRUSH_REFRESH "gimp-brush-refresh" @@ -293,6 +294,7 @@ #define GIMP_HELP_PATTERN_OPEN_AS_IMAGE "gimp-pattern-open-as-image" #define GIMP_HELP_PATTERN_NEW "gimp-pattern-new" #define GIMP_HELP_PATTERN_DUPLICATE "gimp-pattern-duplicate" +#define GIMP_HELP_PATTERN_COPY_LOCATION "gimp-pattern-copy-location" #define GIMP_HELP_PATTERN_DELETE "gimp-pattern-delete" #define GIMP_HELP_PATTERN_REFRESH "gimp-pattern-refresh" @@ -300,6 +302,7 @@ #define GIMP_HELP_GRADIENT_EDIT "gimp-gradient-edit" #define GIMP_HELP_GRADIENT_NEW "gimp-gradient-new" #define GIMP_HELP_GRADIENT_DUPLICATE "gimp-gradient-duplicate" +#define GIMP_HELP_GRADIENT_COPY_LOCATION "gimp-gradient-copy-location" #define GIMP_HELP_GRADIENT_DELETE "gimp-gradient-delete" #define GIMP_HELP_GRADIENT_REFRESH "gimp-gradient-refresh" #define GIMP_HELP_GRADIENT_SAVE_AS_POV "gimp-gradient-save-as-pov" @@ -331,6 +334,7 @@ #define GIMP_HELP_PALETTE_EDIT "gimp-palette-edit" #define GIMP_HELP_PALETTE_NEW "gimp-palette-new" #define GIMP_HELP_PALETTE_DUPLICATE "gimp-palette-duplicate" +#define GIMP_HELP_PALETTE_COPY_LOCATION "gimp-palette-copy-location" #define GIMP_HELP_PALETTE_DELETE "gimp-palette-delete" #define GIMP_HELP_PALETTE_REFRESH "gimp-palette-refresh" #define GIMP_HELP_PALETTE_IMPORT "gimp-palette-import" diff --git a/menus/brushes-menu.xml b/menus/brushes-menu.xml index 2c649fad9cc752db66569d6c0316eca191707876..fe238235ff0167d87ccb46e347832c8817cffad9 100644 --- a/menus/brushes-menu.xml +++ b/menus/brushes-menu.xml @@ -8,6 +8,7 @@ + diff --git a/menus/gradients-menu.xml b/menus/gradients-menu.xml index ccfa3663688483a080d04034ed8dbee7652a19cd..f187f2d7bc4223a5812629561c2cb139c3c6f738 100644 --- a/menus/gradients-menu.xml +++ b/menus/gradients-menu.xml @@ -8,6 +8,7 @@ + diff --git a/menus/palettes-menu.xml b/menus/palettes-menu.xml index 194a9d3fd22917247a2bacce1dd3563dd3110b23..65264449ac08dd88d87ea50bac406de2bfdbdd0e 100644 --- a/menus/palettes-menu.xml +++ b/menus/palettes-menu.xml @@ -9,6 +9,7 @@ + diff --git a/menus/patterns-menu.xml b/menus/patterns-menu.xml index 2df747b0cb3ebbfb2b8aa4962bbf76a79ccfa972..3835cce8c128444b05e7e6c175362baf81e5d140 100644 --- a/menus/patterns-menu.xml +++ b/menus/patterns-menu.xml @@ -13,6 +13,7 @@ --> +