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

« back to all changes in this revision

Viewing changes to app/dialogs/module-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
 * module-dialog.c
33
33
#include "core/gimp-modules.h"
34
34
 
35
35
#include "widgets/gimphelp-ids.h"
36
 
#include "widgets/gimpviewabledialog.h"
37
36
 
38
37
#include "module-dialog.h"
39
38
 
40
39
#include "gimp-intl.h"
41
40
 
42
41
 
43
 
#define MODULES_RESPONSE_REFRESH 1
 
42
#define RESPONSE_REFRESH 1
44
43
#define NUM_INFO_LINES           9
45
44
 
46
45
enum
118
117
 
119
118
  dialog->gimp = gimp;
120
119
 
121
 
  shell = gimp_viewable_dialog_new (NULL,
122
 
                                    _("Module Manager"), "gimp-modules",
123
 
                                    GTK_STOCK_EXECUTE,
124
 
                                    _("Manage Loadable Modules"),
125
 
                                    NULL,
126
 
                                    gimp_standard_help_func,
127
 
                                    GIMP_HELP_MODULE_DIALOG,
128
 
 
129
 
                                    GTK_STOCK_REFRESH, MODULES_RESPONSE_REFRESH,
130
 
                                    GTK_STOCK_CLOSE,   GTK_STOCK_CLOSE,
131
 
 
132
 
                                    NULL);
 
120
  shell = gimp_dialog_new (_("Manage Loadable Modules"),
 
121
                           "gimp-modules", NULL, 0,
 
122
                           gimp_standard_help_func, GIMP_HELP_MODULE_DIALOG,
 
123
 
 
124
                           GTK_STOCK_REFRESH, RESPONSE_REFRESH,
 
125
                           GTK_STOCK_CLOSE,   GTK_STOCK_CLOSE,
 
126
 
 
127
                           NULL);
 
128
 
 
129
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (shell),
 
130
                                           GTK_RESPONSE_CLOSE,
 
131
                                           RESPONSE_REFRESH,
 
132
                                           -1);
133
133
 
134
134
  g_signal_connect (shell, "response",
135
135
                    G_CALLBACK (dialog_response),
142
142
 
143
143
  listbox = gtk_scrolled_window_new (NULL, NULL);
144
144
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (listbox),
145
 
                                       GTK_SHADOW_IN);
 
145
                                       GTK_SHADOW_IN);
146
146
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (listbox),
147
 
                                  GTK_POLICY_AUTOMATIC,
148
 
                                  GTK_POLICY_AUTOMATIC);
 
147
                                  GTK_POLICY_AUTOMATIC,
 
148
                                  GTK_POLICY_AUTOMATIC);
149
149
  gtk_box_pack_start (GTK_BOX (vbox), listbox, TRUE, TRUE, 0);
150
150
  gtk_widget_set_size_request (listbox, 125, 100);
151
151
  gtk_widget_show (listbox);
152
152
 
153
153
  dialog->list = gtk_list_store_new (NUM_COLUMNS,
154
 
                                     G_TYPE_STRING, G_TYPE_BOOLEAN,
155
 
                                     G_TYPE_POINTER);
 
154
                                     G_TYPE_STRING,
 
155
                                     G_TYPE_BOOLEAN,
 
156
                                     GIMP_TYPE_MODULE);
156
157
  tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (dialog->list));
157
158
  g_object_unref (dialog->list);
158
159
 
172
173
  gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
173
174
 
174
175
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tv), 1,
175
 
                                               _("Module path"),
 
176
                                               _("Module Path"),
176
177
                                               gtk_cell_renderer_text_new (),
177
178
                                               "text", PATH_COLUMN,
178
179
                                               NULL);
186
187
  gtk_widget_show (dialog->table);
187
188
 
188
189
  hbox = gtk_hbutton_box_new ();
189
 
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD);
 
190
  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END);
190
191
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
191
192
  gtk_widget_show (hbox);
192
193
 
193
 
 
194
194
  dialog->button = gtk_button_new_with_label ("");
195
195
  dialog->button_label = gtk_bin_get_child (GTK_BIN (dialog->button));
196
 
  gtk_box_pack_start (GTK_BOX (hbox), dialog->button, TRUE, TRUE, 0);
 
196
  gtk_container_add (GTK_CONTAINER (hbox), dialog->button);
197
197
  gtk_widget_show (dialog->button);
198
198
 
199
199
  g_signal_connect (dialog->button, "clicked",
222
222
  g_signal_connect (gimp->module_db, "remove",
223
223
                    G_CALLBACK (dialog_info_remove),
224
224
                    dialog);
225
 
  g_signal_connect (gimp->module_db, "module_modified",
 
225
  g_signal_connect (gimp->module_db, "module-modified",
226
226
                    G_CALLBACK (dialog_info_update),
227
227
                    dialog);
228
228
 
241
241
                 gint          response_id,
242
242
                 ModuleDialog *dialog)
243
243
{
244
 
  if (response_id == MODULES_RESPONSE_REFRESH)
 
244
  if (response_id == RESPONSE_REFRESH)
245
245
    gimp_modules_refresh (dialog->gimp);
246
246
  else
247
247
    gtk_widget_destroy (widget);
275
275
  gtk_tree_model_get (GTK_TREE_MODEL (dialog->list), &iter,
276
276
                      MODULE_COLUMN, &module, -1);
277
277
 
 
278
  if (module)
 
279
    g_object_unref (module);
 
280
 
278
281
  if (dialog->last_update == module)
279
282
    return;
280
283
 
308
311
 
309
312
  if (module)
310
313
    {
 
314
      g_object_unref (module);
 
315
 
311
316
      gimp_module_set_load_inhibit (module, active);
312
317
 
313
318
      dialog->gimp->write_modulerc = TRUE;
340
345
 
341
346
static void
342
347
make_list_item (gpointer data,
343
 
                gpointer user_data)
 
348
                gpointer user_data)
344
349
{
345
350
  GimpModule   *module  = data;
346
351
  ModuleDialog *dialog = user_data;
351
356
 
352
357
  gtk_list_store_append (dialog->list, &iter);
353
358
  gtk_list_store_set (dialog->list, &iter,
354
 
                      PATH_COLUMN, module->filename,
 
359
                      PATH_COLUMN, module->filename,
355
360
                      AUTO_COLUMN, ! module->load_inhibit,
356
 
                      MODULE_COLUMN, module,
357
 
                      -1);
 
361
                      MODULE_COLUMN, module,
 
362
                      -1);
358
363
}
359
364
 
360
365
static void
381
386
  do
382
387
    {
383
388
      gtk_tree_model_get (GTK_TREE_MODEL (dialog->list), &iter,
384
 
                          MODULE_COLUMN, &module,
385
 
                          -1);
 
389
                          MODULE_COLUMN, &module,
 
390
                          -1);
 
391
 
 
392
      if (module)
 
393
        g_object_unref (module);
386
394
 
387
395
      if (module == mod)
388
 
        {
389
 
          gtk_list_store_remove (dialog->list, &iter);
390
 
          return;
391
 
        }
 
396
        {
 
397
          gtk_list_store_remove (dialog->list, &iter);
 
398
          return;
 
399
        }
392
400
    }
393
401
  while (gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->list), &iter));
394
402
 
395
403
  g_warning ("%s: Tried to remove a module not in the dialog's list.",
396
 
             G_STRFUNC);
 
404
             G_STRFUNC);
397
405
}
398
406
 
399
407
static void
414
422
  if (! module)
415
423
    {
416
424
      for (i = 0; i < NUM_INFO_LINES; i++)
417
 
        gtk_label_set_text (GTK_LABEL (dialog->label[i]), "");
 
425
        gtk_label_set_text (GTK_LABEL (dialog->label[i]), "");
418
426
      gtk_label_set_text (GTK_LABEL (dialog->button_label), _("<No modules>"));
419
427
      gtk_widget_set_sensitive (GTK_WIDGET (dialog->button), FALSE);
420
428
      return;
503
511
    N_("Date:"),
504
512
    N_("Location:"),
505
513
    N_("State:"),
506
 
    N_("Last Error:"),
507
 
    N_("Available Types:")
 
514
    N_("Last error:"),
 
515
    N_("Available types:")
508
516
  };
509
517
 
510
518
  for (i = 0; i < G_N_ELEMENTS (text); i++)
512
520
      label = gtk_label_new (gettext (text[i]));
513
521
      gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
514
522
      gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i + 1,
515
 
                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
 
523
                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
516
524
      gtk_widget_show (label);
517
525
 
518
526
      dialog->label[i] = gtk_label_new ("");
519
527
      gtk_misc_set_alignment (GTK_MISC (dialog->label[i]), 0.0, 0.5);
 
528
      gtk_label_set_ellipsize (GTK_LABEL (dialog->label[i]),
 
529
                               PANGO_ELLIPSIZE_END);
520
530
      gtk_table_attach (GTK_TABLE (dialog->table), dialog->label[i],
521
531
                        1, 2, i, i + 1,
522
 
                        GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
 
532
                        GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 2);
523
533
      gtk_widget_show (dialog->label[i]);
524
534
    }
525
535
}