From f88d35bba7cd95b43728df771754e8d0d14a4456 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Tue, 20 Feb 2001 19:07:15 +0000 Subject: [PATCH] New function to create an icon set from a pixbuf. Tue Feb 20 12:16:12 2001 Jonathan Blandford * gtk/gtkiconfactory.c (gtk_icon_set_new_from_pixbuf): New function to create an icon set from a pixbuf. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtkiconfactory.c | 28 ++++++++++++++++++++++++++++ gtk/gtkiconfactory.h | 1 + gtk/gtkimage.c | 4 ++++ 10 files changed, 68 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6f499f155d..435ace142c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Feb 20 12:16:12 2001 Jonathan Blandford + + * gtk/gtkiconfactory.c (gtk_icon_set_new_from_pixbuf): New + function to create an icon set from a pixbuf. + 2001-02-20 Alexander Larsson * gtk/gtkcellrenderertext.[ch]: diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 6f499f155d..435ace142c 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Tue Feb 20 12:16:12 2001 Jonathan Blandford + + * gtk/gtkiconfactory.c (gtk_icon_set_new_from_pixbuf): New + function to create an icon set from a pixbuf. + 2001-02-20 Alexander Larsson * gtk/gtkcellrenderertext.[ch]: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6f499f155d..435ace142c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Tue Feb 20 12:16:12 2001 Jonathan Blandford + + * gtk/gtkiconfactory.c (gtk_icon_set_new_from_pixbuf): New + function to create an icon set from a pixbuf. + 2001-02-20 Alexander Larsson * gtk/gtkcellrenderertext.[ch]: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 6f499f155d..435ace142c 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Tue Feb 20 12:16:12 2001 Jonathan Blandford + + * gtk/gtkiconfactory.c (gtk_icon_set_new_from_pixbuf): New + function to create an icon set from a pixbuf. + 2001-02-20 Alexander Larsson * gtk/gtkcellrenderertext.[ch]: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 6f499f155d..435ace142c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Tue Feb 20 12:16:12 2001 Jonathan Blandford + + * gtk/gtkiconfactory.c (gtk_icon_set_new_from_pixbuf): New + function to create an icon set from a pixbuf. + 2001-02-20 Alexander Larsson * gtk/gtkcellrenderertext.[ch]: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 6f499f155d..435ace142c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Tue Feb 20 12:16:12 2001 Jonathan Blandford + + * gtk/gtkiconfactory.c (gtk_icon_set_new_from_pixbuf): New + function to create an icon set from a pixbuf. + 2001-02-20 Alexander Larsson * gtk/gtkcellrenderertext.[ch]: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 6f499f155d..435ace142c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Tue Feb 20 12:16:12 2001 Jonathan Blandford + + * gtk/gtkiconfactory.c (gtk_icon_set_new_from_pixbuf): New + function to create an icon set from a pixbuf. + 2001-02-20 Alexander Larsson * gtk/gtkcellrenderertext.[ch]: diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c index 56d2fccc27..07b5d5038c 100644 --- a/gtk/gtkiconfactory.c +++ b/gtk/gtkiconfactory.c @@ -673,6 +673,34 @@ gtk_icon_set_new (void) return icon_set; } +/** + * gtk_icon_set_new_from_pixbuf: + * @pixbuf: a #GdkPixbuf + * + * Creates a new #GtkIconSet seeded with @pixbuf. + * + * Return value: a new #GtkIconSet + **/ +GtkIconSet * +gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf) +{ + GtkIconSet *set; + + GtkIconSource source = { NULL, NULL, 0, 0, NULL, + TRUE, TRUE, TRUE }; + + g_return_val_if_fail (pixbuf != NULL, NULL); + + set = gtk_icon_set_new (); + + source.pixbuf = pixbuf; + + gtk_icon_set_add_source (set, &source); + + return set; +} + + /** * gtk_icon_set_ref: * @icon_set: a #GtkIconSet diff --git a/gtk/gtkiconfactory.h b/gtk/gtkiconfactory.h index 23f6059865..1f26abb823 100644 --- a/gtk/gtkiconfactory.h +++ b/gtk/gtkiconfactory.h @@ -103,6 +103,7 @@ void gtk_icon_size_register_alias (const gchar *alias, /* Icon sets */ GtkIconSet* gtk_icon_set_new (void); +GtkIconSet* gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf); GtkIconSet* gtk_icon_set_ref (GtkIconSet *icon_set); void gtk_icon_set_unref (GtkIconSet *icon_set); diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 53ea859d38..d82effbb77 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -191,6 +191,10 @@ gtk_image_new_from_file (const gchar *filename) * pixbuf; you still need to unref it if you own references. * #GtkImage will add its own reference rather than adopting yours. * + * Note that this function just creates an #GtkImage from the pixbuf. The + * #GtkImage created will not react to state changes. Should you want that, you + * should use @gtk_image_new_from_icon_set. + * * Return value: a new #GtkImage **/ GtkWidget*