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

« back to all changes in this revision

Viewing changes to app/widgets/gimperrordialog.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
 * gimperrordialog.c
37
37
#define GIMP_ERROR_DIALOG_MAX_MESSAGES 3
38
38
 
39
39
 
40
 
static void   gimp_error_dialog_class_init (GimpErrorDialogClass *klass);
41
 
static void   gimp_error_dialog_init       (GimpErrorDialog      *dialog);
42
 
static void   gimp_error_dialog_finalize   (GObject              *object);
43
 
static void   gimp_error_dialog_response   (GtkDialog            *dialog,
44
 
                                            gint                  response_id);
45
 
 
46
 
 
47
 
static GimpDialogClass *parent_class = NULL;
48
 
 
49
 
 
50
 
GType
51
 
gimp_error_dialog_get_type (void)
52
 
{
53
 
  static GType dialog_type = 0;
54
 
 
55
 
  if (! dialog_type)
56
 
    {
57
 
      static const GTypeInfo dialog_info =
58
 
      {
59
 
        sizeof (GimpErrorDialogClass),
60
 
        (GBaseInitFunc) NULL,
61
 
        (GBaseFinalizeFunc) NULL,
62
 
        (GClassInitFunc) gimp_error_dialog_class_init,
63
 
        NULL,           /* class_finalize */
64
 
        NULL,           /* class_data     */
65
 
        sizeof (GimpErrorDialog),
66
 
        0,              /* n_preallocs    */
67
 
        (GInstanceInitFunc) gimp_error_dialog_init
68
 
      };
69
 
 
70
 
      dialog_type = g_type_register_static (GIMP_TYPE_DIALOG,
71
 
                                            "GimpErrorDialog",
72
 
                                            &dialog_info, 0);
73
 
    }
74
 
 
75
 
  return dialog_type;
76
 
}
 
40
static void   gimp_error_dialog_finalize (GObject   *object);
 
41
static void   gimp_error_dialog_response (GtkDialog *dialog,
 
42
                                          gint       response_id);
 
43
 
 
44
 
 
45
G_DEFINE_TYPE (GimpErrorDialog, gimp_error_dialog, GIMP_TYPE_DIALOG)
 
46
 
 
47
#define parent_class gimp_error_dialog_parent_class
 
48
 
77
49
 
78
50
static void
79
51
gimp_error_dialog_class_init (GimpErrorDialogClass *klass)
81
53
  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
82
54
  GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
83
55
 
84
 
  parent_class = g_type_class_peek_parent (klass);
85
 
 
86
56
  object_class->finalize = gimp_error_dialog_finalize;
87
57
 
88
58
  dialog_class->response = gimp_error_dialog_response;
139
109
}
140
110
 
141
111
 
142
 
static void
143
 
gimp_error_dialog_set_icon (GtkWidget   *dialog,
144
 
                            const gchar *stock_id)
145
 
{
146
 
  GtkIconSet *icon_set;
147
 
 
148
 
  gtk_widget_ensure_style (dialog);
149
 
 
150
 
  icon_set = gtk_style_lookup_icon_set (dialog->style, stock_id);
151
 
 
152
 
  if (icon_set)
153
 
    {
154
 
      GtkIconSize *sizes;
155
 
      GList       *icons = NULL;
156
 
      gint         i, n_sizes;
157
 
 
158
 
      gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
159
 
 
160
 
      for (i = 0; i < n_sizes; i++)
161
 
        {
162
 
          if (sizes[i] < GTK_ICON_SIZE_DIALOG)  /* skip the large version */
163
 
            icons = g_list_prepend (icons,
164
 
                                    gtk_widget_render_icon (dialog,
165
 
                                                            stock_id, sizes[i],
166
 
                                                            NULL));
167
 
        }
168
 
 
169
 
      g_free (sizes);
170
 
 
171
 
      if (icons)
172
 
        {
173
 
          gtk_window_set_icon_list (GTK_WINDOW (dialog), icons);
174
 
 
175
 
          g_list_foreach (icons, (GFunc) g_object_unref, NULL);
176
 
          g_list_free (icons);
177
 
        }
178
 
    }
179
 
}
180
 
 
181
 
 
182
112
/*  public functions  */
183
113
 
184
114
GtkWidget *
185
 
gimp_error_dialog_new (const gchar *title,
186
 
                       const gchar *stock_id)
 
115
gimp_error_dialog_new (const gchar *title)
187
116
{
188
 
  GtkWidget *dialog;
189
 
 
190
117
  g_return_val_if_fail (title != NULL, NULL);
191
118
 
192
 
  dialog = g_object_new (GIMP_TYPE_ERROR_DIALOG,
193
 
                         "title", title,
194
 
                         NULL);
195
 
 
196
 
  if (stock_id)
197
 
    gimp_error_dialog_set_icon (dialog, stock_id);
198
 
 
199
 
  return dialog;
 
119
  return g_object_new (GIMP_TYPE_ERROR_DIALOG,
 
120
                       "title", title,
 
121
                       NULL);
200
122
}
201
123
 
202
124
void
240
162
    }
241
163
 
242
164
  box = g_object_new (GIMP_TYPE_MESSAGE_BOX,
243
 
                      "stock_id", stock_id,
 
165
                      "stock-id", stock_id,
244
166
                      NULL);
245
167
 
246
168
  dialog->num_messages++;