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

« back to all changes in this revision

Viewing changes to app/actions/debug-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
26
26
 
27
27
#include "actions-types.h"
28
28
 
29
 
#include "core/gimpobject.h"
 
29
#include "core/gimp.h"
 
30
#include "core/gimpcontext.h"
30
31
 
31
32
#include "widgets/gimpmenufactory.h"
32
33
#include "widgets/gimpuimanager.h"
33
34
 
34
35
#include "menus/menus.h"
35
36
 
 
37
#include "actions.h"
36
38
#include "debug-commands.h"
37
39
 
38
40
 
40
42
 
41
43
/*  local function prototypes  */
42
44
 
43
 
static void   debug_dump_menus_recurse_menu (GtkWidget *menu,
44
 
                                             gint       depth,
45
 
                                             gchar     *path);
 
45
static void   debug_dump_menus_recurse_menu (GtkWidget  *menu,
 
46
                                             gint        depth,
 
47
                                             gchar      *path);
 
48
static void   debug_print_qdata             (GimpObject *object);
 
49
static void   debug_print_qdata_foreach     (GQuark      key_id,
 
50
                                             gpointer    data,
 
51
                                             gpointer    user_data);
46
52
 
47
53
 
48
54
/*  public functions  */
51
57
debug_mem_profile_cmd_callback (GtkAction *action,
52
58
                                gpointer   data)
53
59
{
54
 
  extern gboolean gimp_debug_memsize;
 
60
  extern gboolean  gimp_debug_memsize;
 
61
  Gimp            *gimp;
 
62
  return_if_no_gimp (gimp, data);
55
63
 
56
64
  gimp_debug_memsize = TRUE;
57
65
 
58
 
  gimp_object_get_memsize (GIMP_OBJECT (data), NULL);
 
66
  gimp_object_get_memsize (GIMP_OBJECT (gimp), NULL);
59
67
 
60
68
  gimp_debug_memsize = FALSE;
61
69
}
70
78
       list;
71
79
       list = g_list_next (list))
72
80
    {
73
 
#if 0
74
 
      FIXME
75
81
      GimpMenuFactoryEntry *entry = list->data;
76
 
      GimpItemFactory      *item_factory;
77
 
 
78
 
      item_factory = gimp_item_factory_from_path (entry->identifier);
79
 
 
80
 
      if (item_factory)
 
82
      GList                *managers;
 
83
 
 
84
      managers = gimp_ui_managers_from_name (entry->identifier);
 
85
 
 
86
      if (managers)
81
87
        {
82
 
          GtkWidget *menu_item;
83
 
 
84
 
          g_print ("%s\n", entry->identifier);
85
 
 
86
 
          menu_item = gtk_item_factory_get_item (GTK_ITEM_FACTORY (item_factory),
87
 
                                                 entry->entries[0].entry.path);
88
 
 
89
 
          if (menu_item         &&
90
 
              menu_item->parent &&
91
 
              GTK_IS_MENU (menu_item->parent))
92
 
            debug_dump_menus_recurse_menu (menu_item->parent, 1,
93
 
                                           entry->identifier);
94
 
 
95
 
          g_print ("\n");
 
88
          GimpUIManager *manager = managers->data;
 
89
          GList         *list;
 
90
 
 
91
          for (list = manager->registered_uis; list; list = g_list_next (list))
 
92
            {
 
93
              GimpUIManagerUIEntry *ui_entry = list->data;
 
94
 
 
95
              if (GTK_IS_MENU_SHELL (ui_entry->widget))
 
96
                {
 
97
                  g_print ("\n\n========================================\n"
 
98
                           "Menu: %s%s\n"
 
99
                           "========================================\n\n",
 
100
                           entry->identifier, ui_entry->ui_path);
 
101
 
 
102
                  debug_dump_menus_recurse_menu (ui_entry->widget, 1,
 
103
                                                 entry->identifier);
 
104
                  g_print ("\n");
 
105
                }
 
106
            }
96
107
        }
97
 
#endif
98
108
    }
99
109
}
100
110
 
125
135
    }
126
136
}
127
137
 
 
138
void
 
139
debug_dump_attached_data_cmd_callback (GtkAction *action,
 
140
                                       gpointer   data)
 
141
{
 
142
  Gimp        *gimp         = action_data_get_gimp (data);
 
143
  GimpContext *user_context = gimp_get_user_context (gimp);
 
144
 
 
145
  debug_print_qdata (GIMP_OBJECT (gimp));
 
146
  debug_print_qdata (GIMP_OBJECT (user_context));
 
147
}
 
148
 
128
149
 
129
150
/*  private functions  */
130
151
 
133
154
                               gint       depth,
134
155
                               gchar     *path)
135
156
{
136
 
#if 0
137
 
  GtkItemFactory *item_factory;
138
 
  GtkWidget      *menu_item;
139
 
  GList          *list;
140
 
  const gchar    *label;
141
 
  gchar          *help_page;
142
 
  gchar          *full_path;
143
 
  gchar          *format_str;
 
157
  GtkWidget   *menu_item;
 
158
  GList       *list;
 
159
  const gchar *label;
 
160
  gchar       *help_page;
 
161
  gchar       *full_path;
 
162
  gchar       *format_str;
144
163
 
145
164
  for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list))
146
165
    {
147
166
      menu_item = GTK_WIDGET (list->data);
148
167
 
149
168
      if (GTK_IS_LABEL (GTK_BIN (menu_item)->child))
150
 
        {
151
 
          label = gtk_label_get_text (GTK_LABEL (GTK_BIN (menu_item)->child));
152
 
          full_path = g_strconcat (path, "/", label, NULL);
153
 
 
154
 
          item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path (path));
155
 
          help_page    = g_object_get_data (G_OBJECT (menu_item),
156
 
                                            "gimp-help-id");
157
 
 
 
169
        {
 
170
          label = gtk_label_get_text (GTK_LABEL (GTK_BIN (menu_item)->child));
 
171
          full_path = g_strconcat (path, "/", label, NULL);
 
172
 
 
173
          help_page = g_object_get_data (G_OBJECT (menu_item), "gimp-help-id");
158
174
          help_page = g_strdup (help_page);
159
175
 
160
 
          format_str = g_strdup_printf ("%%%ds%%%ds %%-20s %%s\n",
161
 
                                        depth * 2, depth * 2 - 40);
162
 
          g_print (format_str,
163
 
                   "", label, "", help_page ? help_page : "");
164
 
          g_free (format_str);
165
 
          g_free (help_page);
 
176
          format_str = g_strdup_printf ("%%%ds%%%ds %%-20s %%s\n",
 
177
                                        depth * 2, depth * 2 - 40);
 
178
          g_print (format_str,
 
179
                   "", label, "", help_page ? help_page : "");
 
180
          g_free (format_str);
 
181
          g_free (help_page);
166
182
 
167
 
          if (GTK_MENU_ITEM (menu_item)->submenu)
168
 
            debug_dump_menus_recurse_menu (GTK_MENU_ITEM (menu_item)->submenu,
 
183
          if (GTK_MENU_ITEM (menu_item)->submenu)
 
184
            debug_dump_menus_recurse_menu (GTK_MENU_ITEM (menu_item)->submenu,
169
185
                                           depth + 1, full_path);
170
186
 
171
 
          g_free (full_path);
172
 
        }
 
187
          g_free (full_path);
 
188
        }
173
189
    }
174
 
#endif
 
190
}
 
191
 
 
192
static void
 
193
debug_print_qdata (GimpObject *object)
 
194
{
 
195
  g_print ("\nData attached to '%s':\n\n", gimp_object_get_name (object));
 
196
  g_datalist_foreach (&G_OBJECT (object)->qdata,
 
197
                      debug_print_qdata_foreach,
 
198
                      NULL);
 
199
  g_print ("\n");
 
200
}
 
201
 
 
202
static void
 
203
debug_print_qdata_foreach (GQuark   key_id,
 
204
                           gpointer data,
 
205
                           gpointer user_data)
 
206
{
 
207
  g_print ("%s: %p\n", g_quark_to_string (key_id), data);
175
208
}
176
209
 
177
210
#endif /* ENABLE_DEBUG_MENU */