Commit fb28e0be authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

added new action command data_copy_location_cmd_callback().

2005-10-31  Sven Neumann  <sven@gimp.org>

	* 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.
parent b6dc7ab0
2005-10-31 Sven Neumann <sven@gimp.org>
* 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 <tml@novell.com>
* gimptool-win32.c.in: Drop unnecessary <sys/stat.h>.
......
......@@ -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
......
......@@ -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)
......
......@@ -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,
......
......@@ -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
}
......@@ -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
}
......@@ -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
......
......@@ -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"
......
......@@ -8,6 +8,7 @@
<separator />
<menuitem action="brushes-new" />
<menuitem action="brushes-duplicate" />
<menuitem action="brushes-copy-location" />
<menuitem action="brushes-delete" />
<separator />
<menuitem action="brushes-refresh" />
......
......@@ -8,6 +8,7 @@
<menuitem action="gradients-new" />
<menuitem action="gradients-duplicate" />
<menuitem action="gradients-save-as-pov" />
<menuitem action="gradients-copy-location" />
<menuitem action="gradients-delete" />
<separator />
<menuitem action="gradients-refresh" />
......
......@@ -9,6 +9,7 @@
<menuitem action="palettes-import" />
<menuitem action="palettes-duplicate" />
<menuitem action="palettes-merge" />
<menuitem action="palettes-copy-location" />
<menuitem action="palettes-delete" />
<separator />
<menuitem action="palettes-refresh" />
......
......@@ -13,6 +13,7 @@
<menuitem action="patterns-duplicate" />
-->
<menuitem action="patterns-copy-location" />
<menuitem action="patterns-delete" />
<separator />
<menuitem action="patterns-refresh" />
......
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