25
24
#include "actions-types.h"
26
#include "core/gimp.h"
27
28
#include "widgets/gimpactiongroup.h"
29
#include "widgets/gimpdialogfactory.h"
28
30
#include "widgets/gimphelp-ids.h"
31
#include "widgets/gimpsessioninfo.h"
32
#include "widgets/gimptoolbox.h"
34
#include "display/gimpimagewindow.h"
30
37
#include "dialogs-actions.h"
31
38
#include "dialogs-commands.h"
33
40
#include "gimp-intl.h"
43
static gboolean dialogs_actions_toolbox_exists (Gimp *gimp);
36
46
const GimpStringActionEntry dialogs_dockable_actions[] =
48
{ "dialogs-toolbox", NULL,
49
NC_("windows-action", "Tool_box"), "<primary>B",
50
NULL /* set in dialogs_actions_update() */,
38
54
{ "dialogs-tool-options", GIMP_STOCK_TOOL_OPTIONS,
39
N_("Tool _Options"), NULL,
40
N_("Open the tool options dialog"),
55
NC_("dialogs-action", "Tool _Options"), NULL,
56
NC_("dialogs-action", "Open the tool options dialog"),
41
57
"gimp-tool-options",
42
58
GIMP_HELP_TOOL_OPTIONS_DIALOG },
44
60
{ "dialogs-device-status", GIMP_STOCK_DEVICE_STATUS,
45
N_("_Device Status"), NULL,
46
N_("Open the device status dialog"),
61
NC_("dialogs-action", "_Device Status"), NULL,
62
NC_("dialogs-action", "Open the device status dialog"),
47
63
"gimp-device-status",
48
64
GIMP_HELP_DEVICE_STATUS_DIALOG },
50
66
{ "dialogs-layers", GIMP_STOCK_LAYERS,
51
N_("_Layers"), "<control>L",
52
N_("Open the layers dialog"),
67
NC_("dialogs-action", "_Layers"), "<primary>L",
68
NC_("dialogs-action", "Open the layers dialog"),
54
70
GIMP_HELP_LAYER_DIALOG },
56
72
{ "dialogs-channels", GIMP_STOCK_CHANNELS,
57
N_("_Channels"), NULL,
58
N_("Open the channels dialog"),
73
NC_("dialogs-action", "_Channels"), NULL,
74
NC_("dialogs-action", "Open the channels dialog"),
59
75
"gimp-channel-list",
60
76
GIMP_HELP_CHANNEL_DIALOG },
62
78
{ "dialogs-vectors", GIMP_STOCK_PATHS,
64
N_("Open the paths dialog"),
79
NC_("dialogs-action", "_Paths"), NULL,
80
NC_("dialogs-action", "Open the paths dialog"),
65
81
"gimp-vectors-list",
66
82
GIMP_HELP_PATH_DIALOG },
68
84
{ "dialogs-indexed-palette", GIMP_STOCK_COLORMAP,
69
N_("Color_map"), NULL,
70
N_("Open the colormap dialog"),
85
NC_("dialogs-action", "Color_map"), NULL,
86
NC_("dialogs-action", "Open the colormap dialog"),
71
87
"gimp-indexed-palette",
72
88
GIMP_HELP_INDEXED_PALETTE_DIALOG },
74
90
{ "dialogs-histogram", GIMP_STOCK_HISTOGRAM,
75
N_("Histogra_m"), NULL,
76
N_("Open the histogram dialog"),
91
NC_("dialogs-action", "Histogra_m"), NULL,
92
NC_("dialogs-action", "Open the histogram dialog"),
77
93
"gimp-histogram-editor",
78
94
GIMP_HELP_HISTOGRAM_DIALOG },
80
96
{ "dialogs-selection-editor", GIMP_STOCK_TOOL_RECT_SELECT,
81
N_("_Selection Editor"), NULL,
82
N_("Open the selection editor"),
97
NC_("dialogs-action", "_Selection Editor"), NULL,
98
NC_("dialogs-action", "Open the selection editor"),
83
99
"gimp-selection-editor",
84
100
GIMP_HELP_SELECTION_DIALOG },
86
102
{ "dialogs-navigation", GIMP_STOCK_NAVIGATION,
87
N_("Na_vigation"), NULL,
88
N_("Open the display navigation dialog"),
103
NC_("dialogs-action", "Na_vigation"), NULL,
104
NC_("dialogs-action", "Open the display navigation dialog"),
89
105
"gimp-navigation-view",
90
106
GIMP_HELP_NAVIGATION_DIALOG },
92
108
{ "dialogs-undo-history", GIMP_STOCK_UNDO_HISTORY,
93
N_("Undo _History"), NULL,
94
N_("Open the undo history dialog"),
109
NC_("dialogs-action", "Undo _History"), NULL,
110
NC_("dialogs-action", "Open the undo history dialog"),
95
111
"gimp-undo-history",
96
112
GIMP_HELP_UNDO_DIALOG },
98
114
{ "dialogs-cursor", GIMP_STOCK_CURSOR,
100
N_("Open the pointer information dialog"),
115
NC_("dialogs-action", "Pointer"), NULL,
116
NC_("dialogs-action", "Open the pointer information dialog"),
101
117
"gimp-cursor-view",
102
118
GIMP_HELP_POINTER_INFO_DIALOG },
104
120
{ "dialogs-sample-points", GIMP_STOCK_SAMPLE_POINT,
105
N_("_Sample Points"), NULL,
106
N_("Open the sample points dialog"),
121
NC_("dialogs-action", "_Sample Points"), NULL,
122
NC_("dialogs-action", "Open the sample points dialog"),
107
123
"gimp-sample-point-editor",
108
124
GIMP_HELP_SAMPLE_POINT_DIALOG },
110
126
{ "dialogs-colors", GIMP_STOCK_DEFAULT_COLORS,
112
N_("Open the FG/BG color dialog"),
127
NC_("dialogs-action", "Colo_rs"), NULL,
128
NC_("dialogs-action", "Open the FG/BG color dialog"),
113
129
"gimp-color-editor",
114
130
GIMP_HELP_COLOR_DIALOG },
116
132
{ "dialogs-brushes", GIMP_STOCK_BRUSH,
117
N_("_Brushes"), "<control><shift>B",
118
N_("Open the brushes dialog"),
133
NC_("dialogs-action", "_Brushes"), "<primary><shift>B",
134
NC_("dialogs-action", "Open the brushes dialog"),
119
135
"gimp-brush-grid|gimp-brush-list",
120
136
GIMP_HELP_BRUSH_DIALOG },
122
138
{ "dialogs-brush-editor", GIMP_STOCK_BRUSH,
123
N_("Brush Editor"), NULL,
124
N_("Open the brush editor"),
139
NC_("dialogs-action", "Brush Editor"), NULL,
140
NC_("dialogs-action", "Open the brush editor"),
125
141
"gimp-brush-editor",
126
142
GIMP_HELP_BRUSH_EDIT },
144
{ "dialogs-dynamics", GIMP_STOCK_DYNAMICS,
145
NC_("dialogs-action", "Paint Dynamics"), NULL,
146
NC_("dialogs-action", "Open paint dynamics dialog"),
147
"gimp-dynamics-list",
148
GIMP_HELP_DYNAMICS_DIALOG },
150
{ "dialogs-dynamics-editor", GIMP_STOCK_DYNAMICS,
151
NC_("dialogs-action", "Paint Dynamics Editor"), NULL,
152
NC_("dialogs-action", "Open the paint dynamics editor"),
153
"gimp-dynamics-editor",
154
GIMP_HELP_DYNAMICS_EDITOR_DIALOG },
128
156
{ "dialogs-patterns", GIMP_STOCK_PATTERN,
129
N_("P_atterns"), "<control><shift>P",
130
N_("Open the patterns dialog"),
157
NC_("dialogs-action", "P_atterns"), "<primary><shift>P",
158
NC_("dialogs-action", "Open the patterns dialog"),
131
159
"gimp-pattern-grid|gimp-pattern-list",
132
160
GIMP_HELP_PATTERN_DIALOG },
134
162
{ "dialogs-gradients", GIMP_STOCK_GRADIENT,
135
N_("_Gradients"), "<control>G",
136
N_("Open the gradients dialog"),
163
NC_("dialogs-action", "_Gradients"), "<primary>G",
164
NC_("dialogs-action", "Open the gradients dialog"),
137
165
"gimp-gradient-list|gimp-gradient-grid",
138
166
GIMP_HELP_GRADIENT_DIALOG },
140
168
{ "dialogs-gradient-editor", GIMP_STOCK_GRADIENT,
141
N_("Gradient Editor"), NULL,
142
N_("Open the gradient editor"),
169
NC_("dialogs-action", "Gradient Editor"), NULL,
170
NC_("dialogs-action", "Open the gradient editor"),
143
171
"gimp-gradient-editor",
144
172
GIMP_HELP_GRADIENT_EDIT },
146
174
{ "dialogs-palettes", GIMP_STOCK_PALETTE,
147
N_("Pal_ettes"), NULL,
148
N_("Open the palettes dialog"),
175
NC_("dialogs-action", "Pal_ettes"), NULL,
176
NC_("dialogs-action", "Open the palettes dialog"),
149
177
"gimp-palette-list|gimp-palette-grid",
150
178
GIMP_HELP_PALETTE_DIALOG },
152
180
{ "dialogs-palette-editor", GIMP_STOCK_PALETTE,
153
N_("Palette Editor"), NULL,
154
N_("Open the palette editor"),
181
NC_("dialogs-action", "Palette Editor"), NULL,
182
NC_("dialogs-action", "Open the palette editor"),
155
183
"gimp-palette-editor",
156
184
GIMP_HELP_PALETTE_EDIT },
186
{ "dialogs-tool-presets", GIMP_STOCK_TOOL_PRESET,
187
NC_("dialogs-action", "Tool presets"), NULL,
188
NC_("dialogs-action", "Open tool presets dialog"),
189
"gimp-tool-preset-list",
190
GIMP_HELP_TOOL_PRESET_DIALOG },
158
192
{ "dialogs-fonts", GIMP_STOCK_FONT,
160
N_("Open the fonts dialog"),
193
NC_("dialogs-action", "_Fonts"), NULL,
194
NC_("dialogs-action", "Open the fonts dialog"),
161
195
"gimp-font-list|gimp-font-grid",
162
196
GIMP_HELP_FONT_DIALOG },
164
198
{ "dialogs-buffers", GIMP_STOCK_BUFFER,
166
N_("Open the named buffers dialog"),
199
NC_("dialogs-action", "B_uffers"), "",
200
NC_("dialogs-action", "Open the named buffers dialog"),
167
201
"gimp-buffer-list|gimp-buffer-grid",
168
202
GIMP_HELP_BUFFER_DIALOG },
170
204
{ "dialogs-images", GIMP_STOCK_IMAGES,
172
N_("Open the images dialog"),
205
NC_("dialogs-action", "_Images"), NULL,
206
NC_("dialogs-action", "Open the images dialog"),
173
207
"gimp-image-list|gimp-image-grid",
174
208
GIMP_HELP_IMAGE_DIALOG },
176
210
{ "dialogs-document-history", "document-open-recent",
177
N_("Document Histor_y"), "",
178
N_("Open the document history dialog"),
211
NC_("dialogs-action", "Document Histor_y"), "",
212
NC_("dialogs-action", "Open the document history dialog"),
179
213
"gimp-document-list|gimp-document-grid",
180
214
GIMP_HELP_DOCUMENT_DIALOG },
182
216
{ "dialogs-templates", GIMP_STOCK_TEMPLATE,
183
N_("_Templates"), "",
184
N_("Open the image templates dialog"),
217
NC_("dialogs-action", "_Templates"), "",
218
NC_("dialogs-action", "Open the image templates dialog"),
185
219
"gimp-template-list|gimp-template-grid",
186
220
GIMP_HELP_TEMPLATE_DIALOG },
188
{ "dialogs-tools", GIMP_STOCK_TOOLS,
190
N_("Open the tools dialog"),
191
"gimp-tool-list|gimp-tool-grid",
192
GIMP_HELP_TOOLS_DIALOG },
194
222
{ "dialogs-error-console", GIMP_STOCK_WARNING,
195
N_("Error Co_nsole"), NULL,
196
N_("Open the error console"),
223
NC_("dialogs-action", "Error Co_nsole"), NULL,
224
NC_("dialogs-action", "Open the error console"),
197
225
"gimp-error-console",
198
226
GIMP_HELP_ERRORS_DIALOG }
203
231
static const GimpStringActionEntry dialogs_toplevel_actions[] =
205
233
{ "dialogs-preferences", GTK_STOCK_PREFERENCES,
206
N_("_Preferences"), NULL,
207
N_("Open the preferences dialog"),
234
NC_("dialogs-action", "_Preferences"), NULL,
235
NC_("dialogs-action", "Open the preferences dialog"),
208
236
"gimp-preferences-dialog",
209
237
GIMP_HELP_PREFS_DIALOG },
239
{ "dialogs-input-devices", GIMP_STOCK_INPUT_DEVICE,
240
NC_("dialogs-action", "_Input Devices"), NULL,
241
NC_("dialogs-action", "Open the input devices editor"),
242
"gimp-input-devices-dialog",
243
GIMP_HELP_INPUT_DEVICES },
211
245
{ "dialogs-keyboard-shortcuts", GIMP_STOCK_CHAR_PICKER,
212
N_("_Keyboard Shortcuts"), NULL,
213
N_("Open the keyboard shortcuts editor"),
246
NC_("dialogs-action", "_Keyboard Shortcuts"), NULL,
247
NC_("dialogs-action", "Open the keyboard shortcuts editor"),
214
248
"gimp-keyboard-shortcuts-dialog",
215
249
GIMP_HELP_KEYBOARD_SHORTCUTS },
217
251
{ "dialogs-module-dialog", GTK_STOCK_EXECUTE,
218
N_("_Modules"), NULL,
219
N_("Open the module manager dialog"),
252
NC_("dialogs-action", "_Modules"), NULL,
253
NC_("dialogs-action", "Open the module manager dialog"),
220
254
"gimp-module-dialog",
221
255
GIMP_HELP_MODULE_DIALOG },
223
257
{ "dialogs-tips", GIMP_STOCK_INFO,
224
N_("_Tip of the Day"), NULL,
225
N_("Show some helpful tips on using GIMP"),
258
NC_("dialogs-action", "_Tip of the Day"), NULL,
259
NC_("dialogs-action", "Show some helpful tips on using GIMP"),
226
260
"gimp-tips-dialog",
227
261
GIMP_HELP_TIPS_DIALOG },
229
263
{ "dialogs-about", GTK_STOCK_ABOUT,
264
NC_("dialogs-action", "_About"), NULL,
265
NC_("dialogs-action", "About GIMP"),
232
266
"gimp-about-dialog",
233
267
GIMP_HELP_ABOUT_DIALOG }
272
dialogs_actions_toolbox_exists (Gimp *gimp)
274
GimpDialogFactory *factory = gimp_dialog_factory_get_singleton ();
275
gboolean toolbox_found = FALSE;
278
/* First look in session managed windows */
280
gimp_dialog_factory_find_widget (factory, "gimp-toolbox-window") != NULL;
282
/* Then in image windows */
285
GList *windows = gimp ? gimp_get_image_windows (gimp) : NULL;
287
for (iter = windows; iter; iter = g_list_next (iter))
289
GimpImageWindow *window = GIMP_IMAGE_WINDOW (windows->data);
291
if (gimp_image_window_has_toolbox (window))
293
toolbox_found = TRUE;
298
g_list_free (windows);
301
return toolbox_found;
238
305
dialogs_actions_setup (GimpActionGroup *group)
240
gimp_action_group_add_string_actions (group,
307
gimp_action_group_add_string_actions (group, "dialogs-action",
241
308
dialogs_dockable_actions,
242
309
G_N_ELEMENTS (dialogs_dockable_actions),
243
310
G_CALLBACK (dialogs_create_dockable_cmd_callback));
245
gimp_action_group_add_string_actions (group,
312
gimp_action_group_add_string_actions (group, "dialogs-action",
246
313
dialogs_toplevel_actions,
247
314
G_N_ELEMENTS (dialogs_toplevel_actions),
248
315
G_CALLBACK (dialogs_create_toplevel_cmd_callback));