summaryrefslogtreecommitdiff
path: root/demos/gtk-demo/textview.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-11-23 21:46:44 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-11-23 21:46:44 +0000
commit2936c8e9423cc28555dbe56877a315d16b7f7d8f (patch)
tree986279438d9adf88cbd8c88b0ae067ad0bc06107 /demos/gtk-demo/textview.c
parent393c47573ea197e2026133ec79eae7a02880b0d7 (diff)
downloadgtk+-2936c8e9423cc28555dbe56877a315d16b7f7d8f.tar.gz
Version 1.3.11 Require GLib-1.3.11, Pango-0.22, ATK-0.7. Restore toGTK_1_3_11
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> * Version 1.3.11 * configure.in (ATK_REQUIRED_VERSION): Require GLib-1.3.11, Pango-0.22, ATK-0.7. * tests/prop-editor.c (property_widget): Restore to working as well as it did before. * gtk/gtklistitem.h: Mark deprecated since it is an integral part of GtkList. * demos/gtk-demo/demo-common.h: New header file, for a common functions not important to the meat of the demos. * demos/gtk-demo/main.c (demo_ifind_file): Add a utility function to search for a file used by the demo. * demos/*.c: Use demo_find_file.
Diffstat (limited to 'demos/gtk-demo/textview.c')
-rw-r--r--demos/gtk-demo/textview.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c
index ced9c80525..23c2c914bd 100644
--- a/demos/gtk-demo/textview.c
+++ b/demos/gtk-demo/textview.c
@@ -10,6 +10,8 @@
#include <gtk/gtk.h>
#include <stdlib.h> /* for exit() */
+#include "demo-common.h"
+
static void easter_egg_callback (GtkWidget *button, gpointer data);
#define gray50_width 2
@@ -151,10 +153,19 @@ insert_text (GtkTextBuffer *buffer)
GdkPixbuf *pixbuf;
GdkPixbuf *scaled;
GtkTextChildAnchor *anchor;
+ char *filename;
- pixbuf = gdk_pixbuf_new_from_file ("./gtk-logo-rgb.gif", NULL);
- if (pixbuf == NULL)
- gdk_pixbuf_new_from_file (DEMOCODEDIR"/gtk-logo-rgb.gif", NULL);
+ /* demo_find_file() looks in the the current directory first,
+ * so you can run gtk-demo without installing GTK, then looks
+ * in the location where the file is installed.
+ */
+ pixbuf = NULL;
+ filename = demo_find_file ("gtk-logo-rgb.gif", NULL);
+ if (filename)
+ {
+ pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ g_free (filename);
+ }
if (pixbuf == NULL)
{
@@ -412,10 +423,9 @@ attach_widgets (GtkTextView *text_view)
}
else if (i == 3)
{
- if (g_file_test ("./floppybuddy.gif", G_FILE_TEST_EXISTS))
- widget = gtk_image_new_from_file ("./floppybuddy.gif");
- else
- widget = gtk_image_new_from_file (DEMOCODEDIR"/floppybuddy.gif");
+ gchar *filename = demo_find_file ("floppybuddy.gif", NULL);
+ widget = gtk_image_new_from_file (filename);
+ g_free (filename);
}
else if (i == 4)
{