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

« back to all changes in this revision

Viewing changes to app/actions/templates-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
20
20
 
21
21
#include <gtk/gtk.h>
22
22
 
 
23
#include "libgimpconfig/gimpconfig.h"
23
24
#include "libgimpwidgets/gimpwidgets.h"
24
25
 
25
26
#include "actions-types.h"
26
27
 
27
 
#include "config/gimpconfig.h"
28
 
#include "config/gimpconfig-utils.h"
29
28
#include "config/gimpcoreconfig.h"
30
29
 
31
30
#include "core/gimp.h"
61
60
 
62
61
/*  local function prototypes  */
63
62
 
64
 
static void templates_new_template_response   (GtkWidget             *dialog,
65
 
                                               gint                   response_id,
66
 
                                               TemplateOptionsDialog *options);
67
 
static void templates_edit_template_response  (GtkWidget             *widget,
68
 
                                               gint                   response_id,
69
 
                                               TemplateOptionsDialog *options);
70
 
static void templates_delete_template_response (GtkWidget            *dialog,
71
 
                                                gint                  response_id,
72
 
                                                TemplateDeleteData   *delete_data);
 
63
static void   templates_new_response   (GtkWidget             *dialog,
 
64
                                        gint                   response_id,
 
65
                                        TemplateOptionsDialog *options);
 
66
static void   templates_edit_response  (GtkWidget             *widget,
 
67
                                        gint                   response_id,
 
68
                                        TemplateOptionsDialog *options);
 
69
static void   templates_delete_response (GtkWidget            *dialog,
 
70
                                         gint                  response_id,
 
71
                                         TemplateDeleteData   *delete_data);
73
72
 
74
73
 
75
74
/*  public functions */
109
108
}
110
109
 
111
110
void
112
 
templates_new_template_cmd_callback (GtkAction *action,
113
 
                                     gpointer   data)
 
111
templates_new_cmd_callback (GtkAction *action,
 
112
                            gpointer   data)
114
113
{
115
114
  GimpContainerEditor   *editor = GIMP_CONTAINER_EDITOR (data);
116
115
  GimpContext           *context;
118
117
 
119
118
  context = gimp_container_view_get_context (editor->view);
120
119
 
121
 
  options = template_options_dialog_new (context->gimp, NULL,
 
120
  options = template_options_dialog_new (NULL, context,
122
121
                                         GTK_WIDGET (editor),
123
122
                                         _("New Template"),
124
123
                                         "gimp-template-new",
127
126
                                         GIMP_HELP_TEMPLATE_NEW);
128
127
 
129
128
  g_signal_connect (options->dialog, "response",
130
 
                    G_CALLBACK (templates_new_template_response),
 
129
                    G_CALLBACK (templates_new_response),
131
130
                    options);
132
131
 
133
132
  gtk_widget_show (options->dialog);
134
133
}
135
134
 
136
135
void
137
 
templates_duplicate_template_cmd_callback (GtkAction *action,
138
 
                                           gpointer   data)
 
136
templates_duplicate_cmd_callback (GtkAction *action,
 
137
                                  gpointer   data)
139
138
{
140
139
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
141
140
  GimpContainer       *container;
158
157
                                GIMP_OBJECT (new_template));
159
158
      g_object_unref (new_template);
160
159
 
161
 
      templates_edit_template_cmd_callback (action, data);
 
160
      templates_edit_cmd_callback (action, data);
162
161
    }
163
162
}
164
163
 
165
164
void
166
 
templates_edit_template_cmd_callback (GtkAction *action,
167
 
                                      gpointer   data)
 
165
templates_edit_cmd_callback (GtkAction *action,
 
166
                             gpointer   data)
168
167
{
169
168
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
170
169
  GimpContainer       *container;
180
179
    {
181
180
      TemplateOptionsDialog *options;
182
181
 
183
 
      options = template_options_dialog_new (context->gimp, template,
 
182
      options = template_options_dialog_new (template, context,
184
183
                                             GTK_WIDGET (editor),
185
184
                                             _("Edit Template"),
186
185
                                             "gimp-template-edit",
187
 
                                             GIMP_STOCK_EDIT,
 
186
                                             GTK_STOCK_EDIT,
188
187
                                             _("Edit Template"),
189
188
                                             GIMP_HELP_TEMPLATE_EDIT);
190
189
 
191
190
      g_signal_connect (options->dialog, "response",
192
 
                        G_CALLBACK (templates_edit_template_response),
 
191
                        G_CALLBACK (templates_edit_response),
193
192
                        options);
194
193
 
195
194
      gtk_widget_show (options->dialog);
197
196
}
198
197
 
199
198
void
200
 
templates_delete_template_cmd_callback (GtkAction *action,
201
 
                                        gpointer   data)
 
199
templates_delete_cmd_callback (GtkAction *action,
 
200
                               gpointer   data)
202
201
{
203
202
  GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
204
203
  GimpContainer       *container;
230
229
 
231
230
                                 NULL);
232
231
 
 
232
      gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
233
                                               GTK_RESPONSE_OK,
 
234
                                               GTK_RESPONSE_CANCEL,
 
235
                                               -1);
 
236
 
233
237
      g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_free, delete_data);
234
238
      g_signal_connect_object (template, "disconnect",
235
239
                               G_CALLBACK (gtk_widget_destroy),
236
240
                               dialog, G_CONNECT_SWAPPED);
237
241
 
238
242
      g_signal_connect (dialog, "response",
239
 
                        G_CALLBACK (templates_delete_template_response),
 
243
                        G_CALLBACK (templates_delete_response),
240
244
                        delete_data);
241
245
 
242
246
      gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
252
256
/*  private functions  */
253
257
 
254
258
static void
255
 
templates_new_template_response (GtkWidget             *dialog,
256
 
                                 gint                   response_id,
257
 
                                 TemplateOptionsDialog *options)
 
259
templates_new_response (GtkWidget             *dialog,
 
260
                        gint                   response_id,
 
261
                        TemplateOptionsDialog *options)
258
262
{
259
263
  if (response_id == GTK_RESPONSE_OK)
260
264
    {
270
274
}
271
275
 
272
276
static void
273
 
templates_edit_template_response (GtkWidget             *dialog,
274
 
                                  gint                   response_id,
275
 
                                  TemplateOptionsDialog *options)
 
277
templates_edit_response (GtkWidget             *dialog,
 
278
                         gint                   response_id,
 
279
                         TemplateOptionsDialog *options)
276
280
{
277
281
  if (response_id == GTK_RESPONSE_OK)
278
282
    {
279
283
      GimpTemplateEditor *editor = GIMP_TEMPLATE_EDITOR (options->editor);
280
284
 
281
 
      gimp_config_sync (GIMP_CONFIG (editor->template),
282
 
                        GIMP_CONFIG (options->template), 0);
 
285
      gimp_config_sync (G_OBJECT (editor->template),
 
286
                        G_OBJECT (options->template), 0);
283
287
    }
284
288
 
285
289
  gtk_widget_destroy (dialog);
286
290
}
287
291
 
288
292
static void
289
 
templates_delete_template_response (GtkWidget          *dialog,
290
 
                                    gint                response_id,
291
 
                                    TemplateDeleteData *delete_data)
 
293
templates_delete_response (GtkWidget          *dialog,
 
294
                           gint                response_id,
 
295
                           TemplateDeleteData *delete_data)
292
296
{
293
297
  if (response_id == GTK_RESPONSE_OK)
294
298
    {