1
1
/* GIMP - The GNU Image Manipulation Program
2
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
4
* This program is free software: you can redistribute it and/or modify
5
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
6
* the Free Software Foundation; either version 3 of the License, or
7
7
* (at your option) any later version.
9
9
* This program is distributed in the hope that it will be useful,
40
39
static const GimpActionEntry brushes_actions[] =
42
41
{ "brushes-popup", GIMP_STOCK_BRUSH,
43
N_("Brushes Menu"), NULL, NULL, NULL,
42
NC_("brushes-action", "Brushes Menu"), NULL, NULL, NULL,
44
43
GIMP_HELP_BRUSH_DIALOG },
46
45
{ "brushes-open-as-image", GTK_STOCK_OPEN,
47
N_("_Open Brush as Image"), "",
48
N_("Open brush as image"),
46
NC_("brushes-action", "_Open Brush as Image"), "",
47
NC_("brushes-action", "Open brush as image"),
49
48
G_CALLBACK (data_open_as_image_cmd_callback),
50
49
GIMP_HELP_BRUSH_OPEN_AS_IMAGE },
52
51
{ "brushes-new", GTK_STOCK_NEW,
52
NC_("brushes-action", "_New Brush"), "",
53
NC_("brushes-action", "Create a new brush"),
55
54
G_CALLBACK (data_new_cmd_callback),
56
55
GIMP_HELP_BRUSH_NEW },
58
57
{ "brushes-duplicate", GIMP_STOCK_DUPLICATE,
59
N_("D_uplicate Brush"), NULL,
60
N_("Duplicate brush"),
58
NC_("brushes-action", "D_uplicate Brush"), NULL,
59
NC_("brushes-action", "Duplicate this brush"),
61
60
G_CALLBACK (data_duplicate_cmd_callback),
62
61
GIMP_HELP_BRUSH_DUPLICATE },
64
63
{ "brushes-copy-location", GTK_STOCK_COPY,
65
N_("Copy Brush _Location"), "",
66
N_("Copy brush file location to clipboard"),
64
NC_("brushes-action", "Copy Brush _Location"), "",
65
NC_("brushes-action", "Copy brush file location to clipboard"),
67
66
G_CALLBACK (data_copy_location_cmd_callback),
68
67
GIMP_HELP_BRUSH_COPY_LOCATION },
70
69
{ "brushes-delete", GTK_STOCK_DELETE,
71
N_("_Delete Brush"), "",
70
NC_("brushes-action", "_Delete Brush"), "",
71
NC_("brushes-action", "Delete this brush"),
73
72
G_CALLBACK (data_delete_cmd_callback),
74
73
GIMP_HELP_BRUSH_DELETE },
76
75
{ "brushes-refresh", GTK_STOCK_REFRESH,
77
N_("_Refresh Brushes"), "",
78
N_("Refresh brushes"),
76
NC_("brushes-action", "_Refresh Brushes"), "",
77
NC_("brushes-action", "Refresh brushes"),
79
78
G_CALLBACK (data_refresh_cmd_callback),
80
79
GIMP_HELP_BRUSH_REFRESH }
94
93
brushes_actions_setup (GimpActionGroup *group)
96
gimp_action_group_add_actions (group,
95
gimp_action_group_add_actions (group, "brushes-action",
98
97
G_N_ELEMENTS (brushes_actions));
100
gimp_action_group_add_string_actions (group,
99
gimp_action_group_add_string_actions (group, "brushes-action",
101
100
brushes_edit_actions,
102
101
G_N_ELEMENTS (brushes_edit_actions),
103
102
G_CALLBACK (data_edit_cmd_callback));
107
106
brushes_actions_update (GimpActionGroup *group,
108
107
gpointer user_data)
110
GimpContext *context = action_data_get_context (user_data);
111
GimpBrush *brush = NULL;
112
GimpData *data = NULL;
109
GimpContext *context = action_data_get_context (user_data);
110
GimpBrush *brush = NULL;
111
GimpData *data = NULL;
112
const gchar *filename = NULL;
116
116
brush = gimp_context_get_brush (context);
118
if (action_data_sel_count (user_data) > 1)
119
data = GIMP_DATA (brush);
125
data = GIMP_DATA (brush);
127
filename = gimp_data_get_filename (data);
122
131
#define SET_SENSITIVE(action,condition) \
123
132
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
125
134
SET_SENSITIVE ("brushes-edit", brush);
126
SET_SENSITIVE ("brushes-open-as-image", brush && data->filename && ! GIMP_IS_BRUSH_GENERATED (brush));
135
SET_SENSITIVE ("brushes-open-as-image", brush && filename && ! GIMP_IS_BRUSH_GENERATED (brush));
127
136
SET_SENSITIVE ("brushes-duplicate", brush && GIMP_DATA_GET_CLASS (data)->duplicate);
128
SET_SENSITIVE ("brushes-copy-location", brush && data->filename);
129
SET_SENSITIVE ("brushes-delete", brush && data->deletable);
137
SET_SENSITIVE ("brushes-copy-location", brush && filename);
138
SET_SENSITIVE ("brushes-delete", brush && gimp_data_is_deletable (data));
131
140
#undef SET_SENSITIVE