Rename this testgtk to gtk-demo to avoid confusion, and install it so

2000-11-12  Havoc Pennington  <hp@pobox.com>

        Rename this testgtk to gtk-demo to avoid confusion, and
	install it so people can use it as a supplement to
	the documentation.

	        * demos/gtk-demo: Moved from demos/testgtk

		* demos/testgtk: Removed

		* configure.in: make Makefile in gtk-demo

		* demos/gtk-demo/Makefile.am: Install sample source to
		datadir/gtk-demo (maybe there's a better place?), and
		rename the binary to gtk-demo

		* demos/gtk-demo/main.c (load_file): Load installed sample
		source if source isn't found in pwd.
This commit is contained in:
Havoc Pennington
2000-11-13 04:36:38 +00:00
committed by Havoc Pennington
parent d8a06dbadc
commit 213680a436
19 changed files with 157 additions and 1116 deletions

View File

@ -1,5 +1,7 @@
## Makefile.am for gtk+/demos
democodedir=$(datadir)/gtk-demo
demos = @STRIP_BEGIN@ \
button_box.c \
item_factory.c \
@ -8,6 +10,7 @@ demos = @STRIP_BEGIN@ \
@STRIP_END@
INCLUDES = @STRIP_BEGIN@ \
-DDEMOCODEDIR="\"$(democodedir)\"" \
-I$(top_srcdir) \
-I$(top_builddir)/gdk \
-DGTK_DISABLE_COMPAT_H \
@ -37,7 +40,7 @@ LDADDS = @STRIP_BEGIN@ \
-lm \
@STRIP_END@
noinst_PROGRAMS = testgtk
bin_PROGRAMS = gtk-demo
BUILT_SOURCES = demos.h
@ -47,10 +50,12 @@ EXTRA_DIST = \
demos.h: $(demos) geninclude.pl
(cd $(srcdir) && ./geninclude.pl $(demos) > demos.h)
testgtk_SOURCES = \
gtk_demo_SOURCES = \
$(demos) \
main.c \
demos.h
testgtk_DEPENDENCIES = $(DEPS)
testgtk_LDADD = $(LDADDS)
gtk_demo_DEPENDENCIES = $(DEPS)
gtk_demo_LDADD = $(LDADDS)
democode_DATA = $(demos)

View File

@ -88,6 +88,19 @@ load_file (const gchar *filename)
gtk_text_buffer_delete (source_buffer, &start, &end);
file = fopen (filename, "r");
if (!file)
{
char *installed = g_strconcat (DEMOCODEDIR,
G_DIR_SEPARATOR_S,
filename,
NULL);
file = fopen (installed, "r");
g_free (installed);
}
if (!file)
{
g_warning ("Cannot open %s: %s\n", filename, g_strerror (errno));