[gtk+] gtk-demo: Use gdk-pixbuf resource api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk-demo: Use gdk-pixbuf resource api
- Date: Thu, 9 Feb 2012 13:08:25 +0000 (UTC)
commit 72ede439284e03e77d1b12c1c2cb9e6fca46df1c
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Feb 9 07:59:57 2012 -0500
gtk-demo: Use gdk-pixbuf resource api
This is nicer than manual stream manipulation.
demos/gtk-demo/application.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/demos/gtk-demo/application.c b/demos/gtk-demo/application.c
index 7bce9fd..6b9d074 100644
--- a/demos/gtk-demo/application.c
+++ b/demos/gtk-demo/application.c
@@ -96,7 +96,6 @@ activate_about (GSimpleAction *action,
{
GtkWidget *window = user_data;
GdkPixbuf *pixbuf;
- GInputStream *stream;
const gchar *authors[] = {
"Peter Mattis",
@@ -114,9 +113,7 @@ activate_about (GSimpleAction *action,
NULL
};
- stream = g_resources_open_stream ("/logos/gtk-logo-48.png", 0, NULL);
- pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
- g_object_unref (stream);
+ pixbuf = gdk_pixbuf_new_from_resource ("/logos/gtk-logo-48.png", NULL);
gtk_show_about_dialog (GTK_WINDOW (window),
"program-name", "GTK+ Code Demos",
@@ -168,7 +165,6 @@ register_stock_icons (void)
GdkPixbuf *pixbuf;
GtkIconFactory *factory;
GtkIconSet *icon_set;
- GInputStream *stream;
static GtkStockItem items[] = {
{ "demo-gtk-logo", "_GTK!", 0, 0, NULL }
@@ -181,9 +177,7 @@ register_stock_icons (void)
factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (factory);
- stream = g_resources_open_stream ("/logos/gtk-logo-24.png", 0, NULL);
- pixbuf = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
- g_object_unref (stream);
+ pixbuf = gdk_pixbuf_new_from_resource ("/logos/gtk-logo-24.png", NULL);
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]