~ubuntu-branches/ubuntu/saucy/gimp/saucy-security

« back to all changes in this revision

Viewing changes to app/display/gimpdisplay-foreach.c

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2012-05-20 19:21:01 UTC
  • mfrom: (1.1.26) (0.4.16 sid)
  • Revision ID: package-import@ubuntu.com-20120520192101-bs7zetx8ffoq2nfv
Tags: 2.8.0-2ubuntu1
* Merge from Debian unstable (LP: #908472). Remaining Changes:
  - debian/patches/02_help-message.patch,
    debian/patches/03_gimp.desktop.in.in.patch:
    + Update some strings for Ubuntu
  - debian/control:
    + Update description
  - debian/rules:
    + Set gettext domain and update translation templates
* Drop the following patches that were applied upstream:
  - debian/patches/ghost-cursor.patch: fix Wacom tablet cursor events
  - debian/patches/embed-page-setup-dialog.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
 
 * This program is free software; you can redistribute it and/or modify
 
4
 * This program is free software: you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
6
 
 * the Free Software Foundation; either version 2 of the License, or
 
6
 * the Free Software Foundation; either version 3 of the License, or
7
7
 * (at your option) any later version.
8
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
12
12
 * GNU General Public License for more details.
13
13
 *
14
14
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
16
 */
18
17
 
19
18
#include "config.h"
20
19
 
 
20
#include <gegl.h>
21
21
#include <gtk/gtk.h>
22
22
 
23
23
#include "display-types.h"
24
24
 
25
25
#include "core/gimp.h"
 
26
#include "core/gimpcontainer.h"
26
27
#include "core/gimpcontext.h"
27
28
#include "core/gimpimage.h"
28
29
#include "core/gimplist.h"
40
41
 
41
42
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
42
43
 
43
 
  for (list = GIMP_LIST (gimp->displays)->list;
 
44
  for (list = gimp_get_display_iter (gimp);
44
45
       list;
45
46
       list = g_list_next (list))
46
47
    {
47
48
      GimpDisplay *display = list->data;
 
49
      GimpImage   *image   = gimp_display_get_image (display);
48
50
 
49
 
      if (display->image && display->image->dirty)
 
51
      if (image && gimp_image_is_dirty (image))
50
52
        return TRUE;
51
53
    }
52
54
 
58
60
                                    GimpDirtyMask  dirty_mask,
59
61
                                    GimpContainer *container)
60
62
{
61
 
  if (image->dirty && image->disp_count > 0 &&
 
63
  if (gimp_image_is_dirty (image)              &&
 
64
      gimp_image_get_display_count (image) > 0 &&
62
65
      ! gimp_container_have (container, GIMP_OBJECT (image)))
63
66
    gimp_container_add (container, GIMP_OBJECT (image));
64
67
}
83
86
                                    GimpDirtyMask  dirty_mask,
84
87
                                    GimpContainer *container)
85
88
{
86
 
  if (! image->dirty)
 
89
  if (! gimp_image_is_dirty (image))
87
90
    gimp_container_remove (container, GIMP_OBJECT (image));
88
91
}
89
92
 
123
126
                                  G_CALLBACK (gimp_displays_image_clean_callback),
124
127
                                  container);
125
128
 
126
 
      for (list = GIMP_LIST (gimp->images)->list;
 
129
      for (list = gimp_get_image_iter (gimp);
127
130
           list;
128
131
           list = g_list_next (list))
129
132
        {
130
133
          GimpImage *image = list->data;
131
134
 
132
 
          if (image->dirty && image->disp_count > 0)
 
135
          if (gimp_image_is_dirty (image) &&
 
136
              gimp_image_get_display_count (image) > 0)
133
137
            gimp_container_add (container, GIMP_OBJECT (image));
134
138
        }
135
139
 
155
159
   */
156
160
  while (! gimp_container_is_empty (gimp->displays))
157
161
    {
158
 
      GimpDisplay *display = GIMP_LIST (gimp->displays)->list->data;
 
162
      GimpDisplay *display = gimp_get_display_iter (gimp)->data;
159
163
 
160
164
      gimp_display_delete (display);
161
165
    }
176
180
 
177
181
  g_return_if_fail (GIMP_IS_GIMP (gimp));
178
182
 
179
 
  list = g_list_copy (GIMP_LIST (gimp->displays)->list);
 
183
  list = g_list_copy (gimp_get_display_iter (gimp));
180
184
 
181
185
  for (iter = list; iter; iter = g_list_next (iter))
182
186
    {
209
213
        contexts = g_list_prepend (contexts, list->data);
210
214
    }
211
215
 
212
 
  for (list = GIMP_LIST (gimp->displays)->list;
 
216
  for (list = gimp_get_display_iter (gimp);
213
217
       list;
214
218
       list = g_list_next (list))
215
219
    {
216
220
      GimpDisplay *display = list->data;
217
221
 
218
 
      if (display->image == old)
 
222
      if (gimp_display_get_image (display) == old)
219
223
        gimp_display_set_image (display, new);
220
224
    }
221
225
 
227
231
  g_list_free (contexts);
228
232
}
229
233
 
 
234
gint
 
235
gimp_displays_get_num_visible (Gimp *gimp)
 
236
{
 
237
  GList *list;
 
238
  gint   visible = 0;
 
239
 
 
240
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
 
241
 
 
242
  for (list = gimp_get_display_iter (gimp);
 
243
       list;
 
244
       list = g_list_next (list))
 
245
    {
 
246
      GimpDisplay      *display = list->data;
 
247
      GimpDisplayShell *shell   = gimp_display_get_shell (display);
 
248
 
 
249
      if (gtk_widget_is_drawable (GTK_WIDGET (shell)))
 
250
        {
 
251
          GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
 
252
 
 
253
          if (GTK_IS_WINDOW (toplevel))
 
254
            {
 
255
              GdkWindow      *window = gtk_widget_get_window (toplevel);
 
256
              GdkWindowState  state  = gdk_window_get_state (window);
 
257
 
 
258
              if ((state & (GDK_WINDOW_STATE_WITHDRAWN |
 
259
                            GDK_WINDOW_STATE_ICONIFIED)) == 0)
 
260
                {
 
261
                  visible++;
 
262
                }
 
263
            }
 
264
        }
 
265
    }
 
266
 
 
267
  return visible;
 
268
}
 
269
 
230
270
void
231
271
gimp_displays_set_busy (Gimp *gimp)
232
272
{
234
274
 
235
275
  g_return_if_fail (GIMP_IS_GIMP (gimp));
236
276
 
237
 
  for (list = GIMP_LIST (gimp->displays)->list;
 
277
  for (list = gimp_get_display_iter (gimp);
238
278
       list;
239
279
       list = g_list_next (list))
240
280
    {
241
281
      GimpDisplayShell *shell =
242
 
        GIMP_DISPLAY_SHELL (GIMP_DISPLAY (list->data)->shell);
 
282
        gimp_display_get_shell (GIMP_DISPLAY (list->data));
243
283
 
244
284
      gimp_display_shell_set_override_cursor (shell, GDK_WATCH);
245
285
    }
252
292
 
253
293
  g_return_if_fail (GIMP_IS_GIMP (gimp));
254
294
 
255
 
  for (list = GIMP_LIST (gimp->displays)->list;
 
295
  for (list = gimp_get_display_iter (gimp);
256
296
       list;
257
297
       list = g_list_next (list))
258
298
    {
259
299
      GimpDisplayShell *shell =
260
 
        GIMP_DISPLAY_SHELL (GIMP_DISPLAY (list->data)->shell);
 
300
        gimp_display_get_shell (GIMP_DISPLAY (list->data));
261
301
 
262
302
      gimp_display_shell_unset_override_cursor (shell);
263
303
    }