~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/actions/documents-commands.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
30
30
#include "config/gimpcoreconfig.h"
31
31
 
32
32
#include "core/gimp.h"
 
33
#include "core/gimp-documents.h"
33
34
#include "core/gimpcontainer.h"
34
35
#include "core/gimpcontext.h"
35
36
#include "core/gimpimagefile.h"
37
38
#include "file/file-open.h"
38
39
#include "file/file-utils.h"
39
40
 
 
41
#include "widgets/gimpclipboard.h"
40
42
#include "widgets/gimpcontainerview.h"
41
43
#include "widgets/gimpdocumentview.h"
 
44
#include "widgets/gimpmessagebox.h"
 
45
#include "widgets/gimpmessagedialog.h"
42
46
 
43
47
#include "display/gimpdisplay.h"
44
48
#include "display/gimpdisplay-foreach.h"
69
73
/*  public functions */
70
74
 
71
75
void
72
 
documents_open_document_cmd_callback (GtkAction *action,
73
 
                                      gpointer   data)
 
76
documents_open_cmd_callback (GtkAction *action,
 
77
                             gpointer   data)
74
78
{
75
79
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
76
80
  GimpContext         *context;
93
97
}
94
98
 
95
99
void
96
 
documents_raise_or_open_document_cmd_callback (GtkAction *action,
97
 
                                               gpointer   data)
 
100
documents_raise_or_open_cmd_callback (GtkAction *action,
 
101
                                      gpointer   data)
98
102
{
99
103
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
100
104
  GimpContext         *context;
145
149
}
146
150
 
147
151
void
148
 
documents_remove_document_cmd_callback (GtkAction *action,
149
 
                                        gpointer   data)
 
152
documents_copy_location_cmd_callback (GtkAction *action,
 
153
                                      gpointer   data)
 
154
{
 
155
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
 
156
  GimpContext         *context;
 
157
  GimpImagefile       *imagefile;
 
158
 
 
159
  context   = gimp_container_view_get_context (editor->view);
 
160
  imagefile = gimp_context_get_imagefile (context);
 
161
 
 
162
  if (imagefile)
 
163
    gimp_clipboard_set_text (context->gimp,
 
164
                             gimp_object_get_name (GIMP_OBJECT (imagefile)));
 
165
}
 
166
 
 
167
void
 
168
documents_remove_cmd_callback (GtkAction *action,
 
169
                               gpointer   data)
150
170
{
151
171
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
152
172
  GimpContext         *context;
165
185
}
166
186
 
167
187
void
 
188
documents_clear_cmd_callback (GtkAction *action,
 
189
                              gpointer   data)
 
190
{
 
191
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
 
192
  GimpContext         *context;
 
193
  GtkWidget           *dialog;
 
194
 
 
195
  context = gimp_container_view_get_context (editor->view);
 
196
 
 
197
  dialog = gimp_message_dialog_new (_("Clear Document History"),
 
198
                                    GIMP_STOCK_QUESTION,
 
199
                                    GTK_WIDGET (editor),
 
200
                                    GTK_DIALOG_MODAL |
 
201
                                    GTK_DIALOG_DESTROY_WITH_PARENT,
 
202
                                    gimp_standard_help_func, NULL,
 
203
 
 
204
                                    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 
205
                                    GTK_STOCK_CLEAR,  GTK_RESPONSE_OK,
 
206
 
 
207
                                    NULL);
 
208
 
 
209
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
210
                                           GTK_RESPONSE_OK,
 
211
                                           GTK_RESPONSE_CANCEL,
 
212
                                           -1);
 
213
 
 
214
  g_signal_connect_object (gtk_widget_get_toplevel (GTK_WIDGET (editor)),
 
215
                           "unmap",
 
216
                           G_CALLBACK (gtk_widget_destroy),
 
217
                           dialog, G_CONNECT_SWAPPED);
 
218
 
 
219
  gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
 
220
                                     _("Remove all entries from the "
 
221
                                       "document history?"));
 
222
 
 
223
  gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
 
224
                             _("Clearing the document history will permanently "
 
225
                               "remove all currently listed entries."));
 
226
 
 
227
  if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
 
228
    {
 
229
      gimp_container_clear (context->gimp->documents);
 
230
      gimp_documents_save (context->gimp);
 
231
    }
 
232
 
 
233
  gtk_widget_destroy (dialog);
 
234
}
 
235
 
 
236
void
168
237
documents_recreate_preview_cmd_callback (GtkAction *action,
169
238
                                         gpointer   data)
170
239
{
202
271
}
203
272
 
204
273
static void
205
 
documents_delete_dangling_foreach (GimpImagefile *imagefile,
 
274
documents_remove_dangling_foreach (GimpImagefile *imagefile,
206
275
                                   GimpContainer *container)
207
276
{
208
277
  if (gimp_thumbnail_peek_image (imagefile->thumbnail) ==
213
282
}
214
283
 
215
284
void
216
 
documents_delete_dangling_documents_cmd_callback (GtkAction *action,
217
 
                                                  gpointer   data)
 
285
documents_remove_dangling_cmd_callback (GtkAction *action,
 
286
                                        gpointer   data)
218
287
{
219
288
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
220
289
  GimpContainer       *container;
222
291
  container = gimp_container_view_get_container (editor->view);
223
292
 
224
293
  gimp_container_foreach (container,
225
 
                          (GFunc) documents_delete_dangling_foreach,
 
294
                          (GFunc) documents_remove_dangling_foreach,
226
295
                          container);
227
296
}
228
297
 
234
303
                      GimpImagefile *imagefile)
235
304
{
236
305
  const gchar        *uri;
237
 
  GimpImage          *gimage;
 
306
  GimpImage          *image;
238
307
  GimpPDBStatusType   status;
239
308
  GError             *error = NULL;
240
309
 
241
310
  uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
242
311
 
243
 
  gimage = file_open_with_display (context->gimp, context, NULL,
244
 
                                   uri, &status, &error);
 
312
  image = file_open_with_display (context->gimp, context, NULL, uri, FALSE,
 
313
                                  &status, &error);
245
314
 
246
 
  if (! gimage && status != GIMP_PDB_CANCEL)
 
315
  if (! image && status != GIMP_PDB_CANCEL)
247
316
    {
248
 
      gchar *filename;
 
317
      gchar *filename = file_utils_uri_display_name (uri);
249
318
 
250
 
      filename = file_utils_uri_to_utf8_filename (uri);
251
 
      g_message (_("Opening '%s' failed:\n\n%s"),
252
 
                 filename, error->message);
 
319
      gimp_message (context->gimp, NULL, GIMP_MESSAGE_ERROR,
 
320
                    _("Opening '%s' failed:\n\n%s"),
 
321
                    filename, error->message);
253
322
      g_clear_error (&error);
254
323
 
255
324
      g_free (filename);
260
329
documents_raise_display (gpointer data,
261
330
                         gpointer user_data)
262
331
{
263
 
  GimpDisplay  *gdisp   = data;
 
332
  GimpDisplay  *display = data;
264
333
  RaiseClosure *closure = user_data;
265
334
  const gchar  *uri;
266
335
 
267
 
  uri = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
 
336
  uri = gimp_object_get_name (GIMP_OBJECT (display->image));
268
337
 
269
338
  if (uri && ! strcmp (closure->name, uri))
270
339
    {
271
340
      closure->found = TRUE;
272
 
      gtk_window_present (GTK_WINDOW (gdisp->shell));
 
341
      gtk_window_present (GTK_WINDOW (display->shell));
273
342
    }
274
343
}