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 | |
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
-rw-r--r-- | widgets/shortcut-bar/ChangeLog | 19 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-icon-bar.c | 21 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-icon-bar.h | 2 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-shortcut-bar.c | 3 |
4 files changed, 35 insertions, 10 deletions
diff --git a/widgets/shortcut-bar/ChangeLog b/widgets/shortcut-bar/ChangeLog index 7258078925..2e1d9ae51f 100644 --- a/widgets/shortcut-bar/ChangeLog +++ b/widgets/shortcut-bar/ChangeLog @@ -1,3 +1,22 @@ +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. + 2000-05-04 Ettore Perazzoli <ettore@helixcode.com> * e-shortcut-bar.h (E_TYPE_SHORTCUT_BAR): New #define. 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)); diff --git a/widgets/shortcut-bar/e-icon-bar.h b/widgets/shortcut-bar/e-icon-bar.h index bcb15d0c5a..8ca458410a 100644 --- a/widgets/shortcut-bar/e-icon-bar.h +++ b/widgets/shortcut-bar/e-icon-bar.h @@ -59,8 +59,6 @@ struct _EIconBarItem gint text_height; gint icon_y, text_y; - - GdkPixbuf *flatened_alpha; }; diff --git a/widgets/shortcut-bar/e-shortcut-bar.c b/widgets/shortcut-bar/e-shortcut-bar.c index 89c5ef7468..63b511ed82 100644 --- a/widgets/shortcut-bar/e-shortcut-bar.c +++ b/widgets/shortcut-bar/e-shortcut-bar.c @@ -298,6 +298,7 @@ e_shortcut_bar_add_item (EShortcutBar *shortcut_bar, gint group_num, item_num = e_icon_bar_add_item (E_ICON_BAR (group->icon_bar), image, item_name, -1); + gdk_pixbuf_unref (image); e_icon_bar_set_item_data_full (E_ICON_BAR (group->icon_bar), item_num, g_strdup (item_url), g_free); return item_num; @@ -561,6 +562,8 @@ e_shortcut_bar_get_image_from_url (EShortcutBar *shortcut_bar, e_shortcut_bar_default_icon = e_shortcut_bar_load_image (e_shortcut_bar_default_icon_filename); } icon = e_shortcut_bar_default_icon; + /* ref the default icon each time we return it */ + gdk_pixbuf_ref (icon); } return icon; |