~ubuntu-branches/ubuntu/saucy/gimp/saucy-security

« back to all changes in this revision

Viewing changes to app/actions/dialogs-actions.c

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2012-05-20 19:21:01 UTC
  • mfrom: (1.1.26) (0.4.16 sid)
  • Revision ID: package-import@ubuntu.com-20120520192101-bs7zetx8ffoq2nfv
Tags: 2.8.0-2ubuntu1
* Merge from Debian unstable (LP: #908472). Remaining Changes:
  - debian/patches/02_help-message.patch,
    debian/patches/03_gimp.desktop.in.in.patch:
    + Update some strings for Ubuntu
  - debian/control:
    + Update description
  - debian/rules:
    + Set gettext domain and update translation templates
* Drop the following patches that were applied upstream:
  - debian/patches/ghost-cursor.patch: fix Wacom tablet cursor events
  - debian/patches/embed-page-setup-dialog.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
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.
8
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
12
12
 * GNU General Public License for more details.
13
13
 *
14
14
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
16
 */
18
17
 
19
18
#include "config.h"
24
23
 
25
24
#include "actions-types.h"
26
25
 
 
26
#include "core/gimp.h"
 
27
 
27
28
#include "widgets/gimpactiongroup.h"
 
29
#include "widgets/gimpdialogfactory.h"
28
30
#include "widgets/gimphelp-ids.h"
29
 
 
 
31
#include "widgets/gimpsessioninfo.h"
 
32
#include "widgets/gimptoolbox.h"
 
33
 
 
34
#include "display/gimpimagewindow.h"
 
35
 
 
36
#include "actions.h"
30
37
#include "dialogs-actions.h"
31
38
#include "dialogs-commands.h"
32
39
 
33
40
#include "gimp-intl.h"
34
41
 
35
42
 
 
43
static gboolean dialogs_actions_toolbox_exists (Gimp *gimp);
 
44
 
 
45
 
36
46
const GimpStringActionEntry dialogs_dockable_actions[] =
37
47
{
 
48
  { "dialogs-toolbox", NULL,
 
49
    NC_("windows-action", "Tool_box"), "<primary>B",
 
50
    NULL /* set in dialogs_actions_update() */,
 
51
    "gimp-toolbox",
 
52
    GIMP_HELP_TOOLBOX },
 
53
 
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 },
43
59
 
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 },
49
65
 
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"),
53
69
    "gimp-layer-list",
54
70
    GIMP_HELP_LAYER_DIALOG },
55
71
 
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 },
61
77
 
62
78
  { "dialogs-vectors", GIMP_STOCK_PATHS,
63
 
    N_("_Paths"), NULL,
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 },
67
83
 
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 },
73
89
 
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 },
79
95
 
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 },
85
101
 
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 },
91
107
 
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 },
97
113
 
98
114
  { "dialogs-cursor", GIMP_STOCK_CURSOR,
99
 
    N_("Pointer"), NULL,
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 },
103
119
 
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 },
109
125
 
110
126
  { "dialogs-colors", GIMP_STOCK_DEFAULT_COLORS,
111
 
    N_("Colo_rs"), NULL,
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 },
115
131
 
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 },
121
137
 
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 },
127
143
 
 
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 },
 
149
 
 
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 },
 
155
 
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 },
133
161
 
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 },
139
167
 
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 },
145
173
 
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 },
151
179
 
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 },
157
185
 
 
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 },
 
191
 
158
192
  { "dialogs-fonts", GIMP_STOCK_FONT,
159
 
    N_("_Fonts"), NULL,
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 },
163
197
 
164
198
  { "dialogs-buffers", GIMP_STOCK_BUFFER,
165
 
    N_("B_uffers"), "",
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 },
169
203
 
170
204
  { "dialogs-images", GIMP_STOCK_IMAGES,
171
 
    N_("_Images"), NULL,
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 },
175
209
 
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 },
181
215
 
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 },
187
221
 
188
 
  { "dialogs-tools", GIMP_STOCK_TOOLS,
189
 
    N_("T_ools"), NULL,
190
 
    N_("Open the tools dialog"),
191
 
    "gimp-tool-list|gimp-tool-grid",
192
 
    GIMP_HELP_TOOLS_DIALOG },
193
 
 
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 }
199
227
};
203
231
static const GimpStringActionEntry dialogs_toplevel_actions[] =
204
232
{
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 },
210
238
 
 
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 },
 
244
 
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 },
216
250
 
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 },
222
256
 
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 },
228
262
 
229
263
  { "dialogs-about", GTK_STOCK_ABOUT,
230
 
    N_("_About"), NULL,
231
 
    N_("About GIMP"),
 
264
    NC_("dialogs-action", "_About"), NULL,
 
265
    NC_("dialogs-action", "About GIMP"),
232
266
    "gimp-about-dialog",
233
267
    GIMP_HELP_ABOUT_DIALOG }
234
268
};
235
269
 
236
270
 
 
271
static gboolean
 
272
dialogs_actions_toolbox_exists (Gimp *gimp)
 
273
{
 
274
  GimpDialogFactory *factory       = gimp_dialog_factory_get_singleton ();
 
275
  gboolean           toolbox_found = FALSE;
 
276
  GList             *iter;
 
277
 
 
278
  /* First look in session managed windows */
 
279
  toolbox_found =
 
280
    gimp_dialog_factory_find_widget (factory, "gimp-toolbox-window") != NULL;
 
281
 
 
282
  /* Then in image windows */
 
283
  if (! toolbox_found)
 
284
    {
 
285
      GList *windows = gimp ? gimp_get_image_windows (gimp) : NULL;
 
286
 
 
287
      for (iter = windows; iter; iter = g_list_next (iter))
 
288
        {
 
289
          GimpImageWindow *window = GIMP_IMAGE_WINDOW (windows->data);
 
290
 
 
291
          if (gimp_image_window_has_toolbox (window))
 
292
            {
 
293
              toolbox_found = TRUE;
 
294
              break;
 
295
            }
 
296
        }
 
297
 
 
298
      g_list_free (windows);
 
299
    }
 
300
 
 
301
  return toolbox_found;
 
302
}
 
303
 
237
304
void
238
305
dialogs_actions_setup (GimpActionGroup *group)
239
306
{
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));
244
311
 
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));
252
319
dialogs_actions_update (GimpActionGroup *group,
253
320
                        gpointer         data)
254
321
{
 
322
  Gimp        *gimp            = action_data_get_gimp (data);
 
323
  const gchar *toolbox_label   = NULL;
 
324
  const gchar *toolbox_tooltip = NULL;
 
325
 
 
326
  if (dialogs_actions_toolbox_exists (gimp))
 
327
    {
 
328
      toolbox_label   = _("Toolbox");
 
329
      toolbox_tooltip = _("Raise the toolbox");
 
330
    }
 
331
  else
 
332
    {
 
333
      toolbox_label   = _("New Toolbox");
 
334
      toolbox_tooltip = _("Create a new toolbox");
 
335
    }
 
336
 
 
337
  gimp_action_group_set_action_label (group, "dialogs-toolbox", toolbox_label);
 
338
  gimp_action_group_set_action_tooltip (group, "dialogs-toolbox", toolbox_tooltip);
255
339
}