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

« back to all changes in this revision

Viewing changes to app/dialogs/tips-dialog.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 "core/gimp.h"
31
31
 
32
32
#include "widgets/gimphelp-ids.h"
33
 
#include "widgets/gimppropwidgets.h"
34
33
 
35
34
#include "tips-dialog.h"
36
35
#include "tips-parser.h"
66
65
  GtkWidget     *hbox;
67
66
  GtkWidget     *bbox;
68
67
  GtkWidget     *button;
69
 
  GdkPixbuf     *wilber;
70
 
  gchar         *filename;
 
68
  GtkWidget     *image;
71
69
 
72
70
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
73
71
 
81
79
 
82
80
      tips = gimp_tips_from_file (filename, &error);
83
81
 
84
 
      if (!tips)
 
82
      if (! tips)
85
83
        {
86
84
          GimpTip *tip;
87
85
 
88
86
          if (error->code == G_FILE_ERROR_NOENT)
89
87
            {
90
 
              tip = gimp_tip_new (_("<b>Your GIMP tips file appears to be missing!</b>"),
91
 
                                  NULL);
92
 
              tip->thetip = g_strdup_printf (_("There should be a file called '%s'. "
93
 
                                               "Please check your installation."),
94
 
                                             filename);
 
88
              tip = gimp_tip_new ("<b>%s</b>",
 
89
                                  _("Your GIMP tips file appears to be missing!"));
 
90
              gimp_tip_set (tip,
 
91
                            _("There should be a file called '%s'. "
 
92
                              "Please check your installation."), filename);
95
93
            }
96
94
          else
97
95
            {
98
 
              tip = gimp_tip_new (_("<b>The GIMP tips file could not be parsed!</b>"),
99
 
                                  error->message);
 
96
              tip = gimp_tip_new ("<b>%s</b>",
 
97
                                  _("The GIMP tips file could not be parsed!"));
 
98
              gimp_tip_set (tip, "%s", error->message);
100
99
            }
101
100
 
102
101
          tips = g_list_prepend (tips, tip);
126
125
 
127
126
  tips_dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
128
127
  gtk_window_set_type_hint (GTK_WINDOW (tips_dialog),
129
 
                            GDK_WINDOW_TYPE_HINT_DIALOG);
 
128
                            GDK_WINDOW_TYPE_HINT_DIALOG);
130
129
  gtk_window_set_role (GTK_WINDOW (tips_dialog), "gimp-tip-of-the-day");
131
130
  gtk_window_set_title (GTK_WINDOW (tips_dialog), _("GIMP Tip of the Day"));
132
131
  gtk_window_set_position (GTK_WINDOW (tips_dialog), GTK_WIN_POS_CENTER);
133
132
  gtk_window_set_resizable (GTK_WINDOW (tips_dialog), TRUE);
134
133
 
135
 
  g_signal_connect (tips_dialog, "delete_event",
 
134
  g_signal_connect (tips_dialog, "delete-event",
136
135
                    G_CALLBACK (gtk_widget_destroy),
137
136
                    NULL);
138
137
 
139
138
  g_signal_connect (tips_dialog, "destroy",
140
 
                    G_CALLBACK (tips_dialog_destroy),
141
 
                    config);
 
139
                    G_CALLBACK (tips_dialog_destroy),
 
140
                    config);
142
141
 
143
142
  vbox = gtk_vbox_new (FALSE, 0);
144
143
  gtk_container_add (GTK_CONTAINER (tips_dialog), vbox);
167
166
  gtk_widget_show (thetip_label);
168
167
 
169
168
  vbox2 = gtk_vbox_new (FALSE, 0);
170
 
  gtk_box_pack_end (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
 
169
  gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
171
170
  gtk_widget_show (vbox2);
172
171
 
173
 
  filename = g_build_filename (gimp_data_directory (),
174
 
                               "images", "wilber-tips.png", NULL);
175
 
  wilber = gdk_pixbuf_new_from_file (filename, NULL);
176
 
  g_free (filename);
177
 
 
178
 
  if (wilber)
179
 
    {
180
 
      GtkWidget *image;
181
 
 
182
 
      image = gtk_image_new_from_pixbuf (wilber);
183
 
      g_object_unref (wilber);
184
 
 
185
 
      gtk_box_pack_start (GTK_BOX (vbox2), image, TRUE, FALSE, 0);
186
 
      gtk_widget_show (image);
187
 
    }
 
172
  image = gtk_image_new_from_stock (GIMP_STOCK_INFO, GTK_ICON_SIZE_DIALOG);
 
173
  gtk_box_pack_start (GTK_BOX (vbox2), image, TRUE, FALSE, 0);
 
174
  gtk_widget_show (image);
188
175
 
189
176
  hbox = gtk_hbox_new (FALSE, 12);
190
177
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
207
194
  gtk_widget_show (button);
208
195
 
209
196
  g_signal_connect_swapped (button, "clicked",
210
 
                            G_CALLBACK (gtk_widget_destroy),
211
 
                            tips_dialog);
 
197
                            G_CALLBACK (gtk_widget_destroy),
 
198
                            tips_dialog);
212
199
 
213
200
  bbox = gtk_hbutton_box_new ();
214
201
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
216
203
  gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
217
204
  gtk_widget_show (bbox);
218
205
 
219
 
  button = tips_button_new (_("_Previous tip"), TRUE);
220
 
  gtk_widget_set_sensitive (button, (tips_count > 1));
221
 
  gtk_container_add (GTK_CONTAINER (bbox), button);
222
 
  gtk_widget_show (button);
223
 
 
224
 
  g_signal_connect (button, "clicked",
225
 
                    G_CALLBACK (tips_show_previous),
226
 
                    NULL);
227
 
 
228
 
  button = tips_button_new (_("_Next tip"), FALSE);
229
 
  gtk_widget_set_sensitive (button, (tips_count > 1));
230
 
  gtk_container_add (GTK_CONTAINER (bbox), button);
231
 
  gtk_widget_show (button);
232
 
 
233
 
  g_signal_connect (button, "clicked",
234
 
                    G_CALLBACK (tips_show_next),
235
 
                    NULL);
 
206
  button = tips_button_new (_("_Previous Tip"), TRUE);
 
207
  gtk_widget_set_sensitive (button, (tips_count > 1));
 
208
  gtk_container_add (GTK_CONTAINER (bbox), button);
 
209
  gtk_widget_show (button);
 
210
 
 
211
  g_signal_connect (button, "clicked",
 
212
                    G_CALLBACK (tips_show_previous),
 
213
                    NULL);
 
214
 
 
215
  button = tips_button_new (_("_Next Tip"), FALSE);
 
216
  gtk_widget_set_sensitive (button, (tips_count > 1));
 
217
  gtk_container_add (GTK_CONTAINER (bbox), button);
 
218
  gtk_widget_show (button);
 
219
 
 
220
  g_signal_connect (button, "clicked",
 
221
                    G_CALLBACK (tips_show_next),
 
222
                    NULL);
236
223
 
237
224
  gimp_help_connect (tips_dialog, gimp_standard_help_func,
238
 
                     GIMP_HELP_TIPS_DIALOG, NULL);
 
225
                     GIMP_HELP_TIPS_DIALOG, NULL);
239
226
 
240
227
  tips_set_labels (current_tip->data);
241
228
 
244
231
 
245
232
static void
246
233
tips_dialog_destroy (GtkWidget *widget,
247
 
                     gpointer   data)
 
234
                     gpointer   data)
248
235
{
249
236
  GimpGuiConfig *config = GIMP_GUI_CONFIG (data);
250
237
 
316
303
 
317
304
static void
318
305
tips_show_previous (GtkWidget *widget,
319
 
                    gpointer  data)
 
306
                    gpointer  data)
320
307
{
321
308
  current_tip = current_tip->prev ? current_tip->prev : g_list_last (tips);
322
309
 
325
312
 
326
313
static void
327
314
tips_show_next (GtkWidget *widget,
328
 
                gpointer   data)
 
315
                gpointer   data)
329
316
{
330
317
  current_tip = current_tip->next ? current_tip->next : tips;
331
318