diff options
author | Larry Ewing <lewing@helixcode.com> | 2000-05-08 13:06:12 +0800 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2000-05-08 13:06:12 +0800 |
commit | 68a38d1915a042cf481ba90c2afc208f9976b735 (patch) | |
tree | 79e1bdef03e179dee9c8c3d32053b5a5e83f65ad /widgets/shortcut-bar/e-icon-bar.c | |
parent | d36891485a6e00ebffd7ea83ecbbfe47bde5c2b5 (diff) | |
download | gsoc2013-evolution-68a38d1915a042cf481ba90c2afc208f9976b735.tar.gz gsoc2013-evolution-68a38d1915a042cf481ba90c2afc208f9976b735.tar.zst gsoc2013-evolution-68a38d1915a042cf481ba90c2afc208f9976b735.zip |
remove the no longer needed flatened_alpha member.
2000-05-07 Larry Ewing <lewing@helixcode.com>
* e-icon-bar.h (struct _EIconBarItem): remove the no longer needed
flatened_alpha member.
* e-icon-bar.c (flatten_alpha): using ~rgb can cause visual
artifacts.
(e_icon_bar_add_item): fixup refcounting of the flattend pixbuf,
the canvas item should hold the reference not us. Stop using
item.flattened_alpha since it no longer exists.
(e_icon_bar_remove_item): remove the unref since destroying the
item will take care of that for us.
* e-shortcut-bar.c (e_shortcut_bar_add_item): make sure to unref
the image we get back, the icon bar will hold any references it
needs.
(e_shortcut_bar_get_image_from_url): ref the default image each
time we return it so that references are counted correctly.
svn path=/trunk/; revision=2902
Diffstat (limited to 'widgets/shortcut-bar/e-icon-bar.c')
-rw-r--r-- | widgets/shortcut-bar/e-icon-bar.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/widgets/shortcut-bar/e-icon-bar.c b/widgets/shortcut-bar/e-icon-bar.c index 75623a8626..68eaeaffa7 100644 --- a/widgets/shortcut-bar/e-icon-bar.c +++ b/widgets/shortcut-bar/e-icon-bar.c @@ -536,7 +536,7 @@ flatten_alpha (GdkPixbuf *image, guint rgb) GDK_INTERP_NEAREST, 255, 32, - rgb, ~rgb); + rgb, rgb); } /* @@ -575,6 +575,7 @@ e_icon_bar_add_item (EIconBar *icon_bar, GtkStyle *style; GdkFont *font; gdouble text_x, clip_height; + GdkPixbuf *flattened = NULL; g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), -1); g_return_val_if_fail (text != NULL, -1); @@ -619,16 +620,21 @@ e_icon_bar_add_item (EIconBar *icon_bar, GTK_SIGNAL_FUNC (e_icon_bar_on_item_event), icon_bar); - item.flatened_alpha = flatten_alpha ( - image, - rgb_from_gdk_color (&style->bg [GTK_STATE_NORMAL])); - + flattened = flatten_alpha (image, + rgb_from_gdk_color (&style->bg [GTK_STATE_NORMAL])); + item.image = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root), gnome_canvas_pixbuf_get_type (), - "GnomeCanvasPixbuf::pixbuf", item.flatened_alpha?item. flatened_alpha:image, + "GnomeCanvasPixbuf::pixbuf", flattened ? flattened : image, "GnomeCanvasPixbuf::width", (gdouble) icon_bar->icon_w, "GnomeCanvasPixbuf::height", (gdouble) icon_bar->icon_h, NULL); + + + if (flattened) + /* the canvas item holds the reference now */ + gdk_pixbuf_unref (flattened); + gtk_signal_connect (GTK_OBJECT (item.image), "event", GTK_SIGNAL_FUNC (e_icon_bar_on_item_event), icon_bar); @@ -713,8 +719,7 @@ e_icon_bar_remove_item (EIconBar *icon_bar, gtk_object_destroy (GTK_OBJECT (item->text)); gtk_object_destroy (GTK_OBJECT (item->image)); - gdk_pixbuf_unref (item->flatened_alpha); - + g_array_remove_index (icon_bar->items, item_num); gtk_widget_queue_resize (GTK_WIDGET (icon_bar)); |