From 780218b34982f3fc313a087be9a1bf18fb257bd8 Mon Sep 17 00:00:00 2001 From: John Luke Date: Fri, 27 Aug 2004 19:16:13 +0000 Subject: [PATCH] fix my brokenness svn path=/trunk/gtk-sharp/; revision=32943 --- sample/GtkDemo/DemoImages.cs | 8 +++++--- sample/GtkDemo/DemoPixbuf.cs | 23 ++++++++++++----------- sample/GtkDemo/Makefile.am | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/sample/GtkDemo/DemoImages.cs b/sample/GtkDemo/DemoImages.cs index 673d9b753..cc17475f2 100644 --- a/sample/GtkDemo/DemoImages.cs +++ b/sample/GtkDemo/DemoImages.cs @@ -27,6 +27,7 @@ using System; using System.IO; +using System.Reflection; using Gtk; using Gdk; @@ -61,7 +62,7 @@ namespace GtkDemo alignment.Add (frame); vbox.PackStart (alignment, false, false, 0); - Gtk.Image image = new Gtk.Image ("images/gtk-logo-rgb.gif"); + Gtk.Image image = new Gtk.Image (Gdk.Pixbuf.LoadFromResource ("gtk-logo-rgb.gif")); frame.Add (image); // Animation @@ -76,7 +77,7 @@ namespace GtkDemo alignment.Add (frame); vbox.PackStart (alignment, false, false, 0); - image = new Gtk.Image ("images/floppybuddy.gif"); + image = new Gtk.Image (Gdk.Pixbuf.LoadFromResource ("floppybuddy.gif")); frame.Add (image); // Progressive @@ -143,7 +144,8 @@ namespace GtkDemo private bool ProgressiveTimeout () { if (imageStream == null) { - imageStream = new BinaryReader (new StreamReader ("images/alphatest.png").BaseStream); + Stream stream = Assembly.GetExecutingAssembly ().GetManifestResourceStream ("alphatest.png"); + imageStream = new BinaryReader (stream); pixbufLoader = new Gdk.PixbufLoader (); pixbufLoader.AreaPrepared += new EventHandler (ProgressivePreparedCallback); pixbufLoader.AreaUpdated += new AreaUpdatedHandler (ProgressiveUpdatedCallback); diff --git a/sample/GtkDemo/DemoPixbuf.cs b/sample/GtkDemo/DemoPixbuf.cs index 5892832bf..6f4644716 100644 --- a/sample/GtkDemo/DemoPixbuf.cs +++ b/sample/GtkDemo/DemoPixbuf.cs @@ -32,17 +32,17 @@ namespace GtkDemo { const int FrameDelay = 50; const int CycleLen = 60; - const string BackgroundName = "images/background.jpg"; + const string BackgroundName = "background.jpg"; string [] ImageNames = { - "images/apple-red.png", - "images/gnome-applets.png", - "images/gnome-calendar.png", - "images/gnome-foot.png", - "images/gnome-gmush.png", - "images/gnome-gimp.png", - "images/gnome-gsame.png", - "images/gnu-keys.png" + "apple-red.png", + "gnome-applets.png", + "gnome-calendar.png", + "gnome-foot.png", + "gnome-gmush.png", + "gnome-gimp.png", + "gnome-gsame.png", + "gnu-keys.png" }; // current frame @@ -69,8 +69,9 @@ namespace GtkDemo images = new Pixbuf[ImageNames.Length]; - for (int i = 0; i < ImageNames.Length; i++) - images[i] = Gdk.Pixbuf.LoadFromResource (ImageNames[i]); + int i = 0; + foreach (string im in ImageNames) + images[i++] = Gdk.Pixbuf.LoadFromResource (im); } // Expose callback for the drawing area diff --git a/sample/GtkDemo/Makefile.am b/sample/GtkDemo/Makefile.am index 5a23d53e3..0589d6c4b 100644 --- a/sample/GtkDemo/Makefile.am +++ b/sample/GtkDemo/Makefile.am @@ -29,7 +29,7 @@ images = \ /resource:$(srcdir)/images/gnome-foot.png,gnome-foot.png \ /resource:$(srcdir)/images/MonoIcon.png,MonoIcon.png \ /resource:$(srcdir)/images/gnome-calendar.png,gnome-calendar.png \ -/resource:$(srcdir)/images/gnome-gmush.png,gnome-mush.png \ +/resource:$(srcdir)/images/gnome-gmush.png,gnome-gmush.png \ /resource:$(srcdir)/images/gnu-keys.png,gnu-keys.png \ /resource:$(srcdir)/images/gnome-applets.png,gnome-applets.png \ /resource:$(srcdir)/images/gnome-gsame.png,gnome-gsame.png \