~ubuntu-branches/ubuntu/oneiric/xfce4-terminal/oneiric

« back to all changes in this revision

Viewing changes to terminal/terminal-image-loader.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2011-01-30 18:02:08 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130180208-ivounjufdj1gjmog
Tags: 0.4.6-0ubuntu1
* New upstream release.
* Switch to 3.0 (quilt) source format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
                                                           GdkPixbuf                *pixbuf);
53
53
 
54
54
 
 
55
struct _TerminalImageLoaderClass
 
56
{
 
57
  GObjectClass  __parent__;
 
58
};
 
59
 
 
60
struct _TerminalImageLoader
 
61
{
 
62
  GObject                  __parent__;
 
63
  TerminalPreferences     *preferences;
 
64
 
 
65
  /* the cached image data */
 
66
  gchar                   *path;
 
67
  GSList                  *cache;
 
68
  GSList                  *cache_invalid;
 
69
  gdouble                  darkness;
 
70
  GdkColor                 bgcolor;
 
71
  GdkPixbuf               *pixbuf;
 
72
  TerminalBackgroundStyle  style;
 
73
};
 
74
 
 
75
 
55
76
 
56
77
G_DEFINE_TYPE (TerminalImageLoader, terminal_image_loader, G_TYPE_OBJECT)
57
78
 
116
137
 
117
138
  if (!exo_str_is_equal (selected_path, loader->path))
118
139
    {
119
 
      if (G_LIKELY (loader->path != NULL))
120
 
        g_free (loader->path);
 
140
      g_free (loader->path);
121
141
      loader->path = g_strdup (selected_path);
122
142
 
123
143
      if (GDK_IS_PIXBUF (loader->pixbuf))
478
498
      if (gdk_pixbuf_get_height (pixbuf) == height
479
499
          && gdk_pixbuf_get_width (pixbuf) == width)
480
500
        {
481
 
          g_object_ref (G_OBJECT (pixbuf));
482
 
          return pixbuf;
 
501
          return g_object_ref (G_OBJECT (pixbuf));
483
502
        }
484
503
      else if (gdk_pixbuf_get_height (pixbuf) >= height
485
504
            && gdk_pixbuf_get_width (pixbuf) >= width
486
505
            && loader->style == TERMINAL_BACKGROUND_STYLE_TILED)
487
506
        {
488
 
          g_object_ref (G_OBJECT (pixbuf));
489
 
          return pixbuf;
 
507
          return g_object_ref (G_OBJECT (pixbuf));
490
508
        }
491
509
    }
492
510
 
519
537
 
520
538
  terminal_image_loader_saturate (loader, pixbuf);
521
539
 
522
 
  loader->cache = g_slist_append (loader->cache, pixbuf);
523
 
  g_object_weak_ref (G_OBJECT (pixbuf), terminal_image_loader_pixbuf_destroyed, loader);
524
 
  g_object_ref (G_OBJECT (loader));
 
540
  loader->cache = g_slist_prepend (loader->cache, pixbuf);
 
541
  g_object_weak_ref (G_OBJECT (pixbuf), terminal_image_loader_pixbuf_destroyed,
 
542
                     g_object_ref (G_OBJECT (loader)));
525
543
 
526
544
  return pixbuf;
527
545
}