Re: TODO #2: Write demo application for libgnomeui



Here you have a small patch to make it.

It's based on the original test-gnome.


It isn't finished, has many bugs and I hope correct it soon.


I need to know which widgets will be finally at libgnomeui or which ones
will be modified soon.

I have a problem with the Bonobo UI, I don't know how to tell test-gnome
to read it from the local directory and not from $prefix/share/gnome/ui,
so now you need to copy it.


Your help is welcome.


Martin, Could I commit this?


Thanks in advance.


Bye

El 15 Jun 2001 16:44:25 +0200, Martin Baulig escribió:
> 
> This is a really easy job and a good chance to learn the
> BonoboUI code.
> 
> We need a demo application for all the widgets in libgnomeui,
> something like gtk-demo in GTK+ 2.0 or test-gnome in GNOME 1.x.
> 
> This is a high priority job since we need such a demo application
> to test all the libgnomeui stuff.
> 
> -- 
> Martin Baulig
> martin gnome org (private)
> baulig suse de (work)
> 
> _______________________________________________
> gnome-libs-devel mailing list
> gnome-libs-devel gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-libs-devel
> 

-- 
Carlos Perelló Marín
mailto:carlos gnome-db org
mailto:carlos hispalinux es
http://www.gnome-db.org
http://www.Hispalinux.es
Valencia - Spain
diff -u -r --new-file libgnomeui/Makefile.am libgnomeui.cpm/Makefile.am
--- libgnomeui/Makefile.am	Sun Jun 24 21:15:03 2001
+++ libgnomeui.cpm/Makefile.am	Tue Jun 26 21:11:26 2001
@@ -1,4 +1,4 @@
-SUBDIRS = libgnomeui components images demos doc po intl
+SUBDIRS = libgnomeui components images demos test-gnome doc po intl
 
 EXTRA_DIST = message-of-doom
 
diff -u -r --new-file libgnomeui/configure.in libgnomeui.cpm/configure.in
--- libgnomeui/configure.in	Tue Jun 26 21:14:04 2001
+++ libgnomeui.cpm/configure.in	Tue Jun 26 21:11:35 2001
@@ -91,6 +91,7 @@
 components/Makefile
 images/Makefile
 demos/Makefile
+test-gnome/Makefile
 doc/Makefile
 ])
 
diff -u -r --new-file libgnomeui/test-gnome/ChangeLog libgnomeui.cpm/test-gnome/ChangeLog
--- libgnomeui/test-gnome/ChangeLog	Thu Jan  1 01:00:00 1970
+++ libgnomeui.cpm/test-gnome/ChangeLog	Tue Jun 26 21:11:05 2001
@@ -0,0 +1,410 @@
+2001-06-17  Carlos Perelló Marín <carlos gnome-db org>
+
+	* Started the port to Gnome 2.0
+
+1999-07-12    <jrb redhat com>
+
+	* testgnome.c (create_druid): Updated to include a druid.
+
+1999-06-21  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* testgnome.c (select_icon unselect_icon): More tests for the icon
+	list widget.
+
+1999-03-27  Raja R Harinath  <harinath cs umn edu>
+
+	* Makefile.am (test): New target.  Use this to run `test-gnome' in
+	$srcdir.  This should be better than Miguel's fix below.
+	(test-debug): Similar, but runs gdb on the test-gnome binary.
+
+1999-03-25  Miguel de Icaza  <miguel nuclecu unam mx>
+
+	* canvas-primitives.c: Do not make me look like a dofus on a
+	demostration not ran from $cwd.
+	(plant_flower): ditto.
+
+1999-02-12  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas-primitives.c (create_canvas_primitives): Create the
+	canvas items before the visual/colormap have been popped.  This
+	makes the widget item test work on multivisual machines.
+
+1999-02-10  Miguel de Icaza  <miguel nuclecu unam mx>
+
+	* testgnome.c (create_pixmap): Use a gnome_pixmap.  Why we were
+	using a gtk_pixmap here is a mistery for the Big Manatee.
+
+1999-02-10  James Henstridge  <james daa com au>
+
+	* testgnome.c(create_icon_list): do not add a viewport for the icon
+	list when adding it to the scrolled window -- it exports its own
+	scrolling behaviour.
+
+1999-01-21  Sebastian Wilhelmi  <wilhelmi ira uka de>
+
+	* Makefile.am (INCLUDES): s%$(datadir)/locale%$(gnomelocaledir)%
+
+1999-01-17  Jeff Garzik  <jgarzik pobox com>
+
+	* testgnome.c:
+	s/gtk_container_border_width/gtk_container_set_border_width/
+
+1999-01-15  Szekeres István <szekeres cyberspace mht bme hu>
+        * testgnome.c: as gtk-clock is corrected, it will work here well so
+        we can enable it.
+
+1999-01-02  Jeff Garzik  <jgarzik pobox com>
+
+	* canvas-fifteen.c:
+	Silence uninitialized-var warnings.
+
+Thu Dec 31 23:41:57 1998  Raph Levien  <raph gimp org>
+
+	* canvas-primitives.c: more changes for antialiased rendering
+	(mostly use of half-transparent color instead of stippling where
+	appropriate).
+
+1998-12-14  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* testgnome.c (create_app_helper): Use gtk_widget_set_usize() to
+	set the size of the canvas window.
+	* canvas-arrowhead.c (create_canvas_arrowhead): Likewise.
+	* canvas-primitives.c (create_canvas_primitives): Likewise.
+	* canvas-fifteen.c (create_canvas_fifteen): Likewise.
+	* canvas-features.c (create_canvas_features): Likewise.
+
+1998-12-12  James Henstridge  <james daa com au>
+
+	* testgnome.c (create_href): added a test of the GnomeHRef widget.
+
+Sun Dec  6 22:47:54 1998  Raph Levien  <raph gimp org>
+
+	* testgnome.h:
+	* canvas-primitives.c: added support for antialiased rendering.
+
+	* canvas.c: added an "Antialias" notebook tab for testing the
+	aa rendering back-end.
+
+1998-12-01  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* testgnome.c (help_menu): Removed the GNOME_APP_UI_HELP, since it
+	is not used and I got tired of the stupid warnings.
+
+1998-11-29  Miguel de Icaza  <miguel nuclecu unam mx>
+
+	* testgnome.c (create_icon_list): IconList now starts life in
+	normal state.
+
+1998-11-29  Justin Maurer  <justin openprojects net>
+
+	* get rid of deprecated gnome-color-selector and gnome-font-selector
+
+1998-11-29  Justin Maurer  <justin openprojects net>
+
+	* no more right-justify
+
+Thu Nov 26 00:59:07 1998  George Lebl  <jirka 5z com>
+
+	* testgnome.c: added a test window for dentry-edit
+
+1998-11-25  Havoc Pennington  <hp pobox com>
+
+	* testgnome.c (create_test_dialog): Use gtk_window_set_modal in
+	place of deprecated dialog version.
+
+Tue Nov 24 02:00:46 1998  George Lebl  <jirka 5z com>
+
+	* testgnome.c: add a test for gnome-icon-entry
+
+Mon Nov 23 02:20:03 PST 1998 Manish Singh <yosh gimp org>
+
+	* testgnome.c: use gtk_scrolled_window_add_with_viewport
+
+Sun Nov 22 03:40:52 1998  George Lebl  <jirka 5z com>
+
+	* testgnome.c: added new test for the directory browsing of
+	  file-entry
+
+Fri Nov 20 01:48:17 1998  George Lebl  <jirka 5z com>
+
+	* testgnome.c: added more tests for file-entry, and added a pixmap
+	  entry test
+
+Thu Nov 19 11:21:52 1998  Raph Levien  <raph gimp org>
+
+	* Makefile.am (test_gnome_LDADD): Added libart_lgpl.
+
+1998-11-16  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* testgnome.c (create_icon_list): Insert the icon list in a
+	scrolled window, now that it can handle the scrollbars for us.
+
+1998-11-07  Jeff Garzik  <jgarzik pobox com>
+
+	* testgnome.c: removed gnome-lamp references
+
+1998-11-04  Havoc Pennington  <hp pobox com>
+
+	* testgnome.c (create_guru): New gnome-guru test.
+
+1998-11-01  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas-primitives.c: Added some stippling to the items.
+
+1998-10-24  David Abilleira  <odaf nexo es>
+
+	* testgnome.c (create_font_picker) Changed gnome_pixmap_widget_new to
+        gnome_stock_new_with_icon
+
+1998-10-14  David Abilleira  <odaf nexo es>
+
+	* testgnome.c (create_font_picker) Added tests for new
+	gnome-font-picker widget
+
+1998-10-14  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas-primitives.c (setup_polygons): Added a test for the
+	polygon item.
+
+1998-10-13  Miguel de Icaza  <miguel nuclecu unam mx>
+
+	* testgnome.c (create_icon_list): Remove visual/colormap hack, as
+	the Icon list is more confident about itself now.
+
+1998-10-12  Miguel de Icaza  <miguel nuclecu unam mx>
+
+	* testgnome.c (create_icon_list): Use the new features in the
+	GnomeIconList.
+
+1998-09-27  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas-features.c: New file to test general features of the
+	canvas.  Right now it only has a test for item reparenting.
+
+	* Makefile.am (testgnome_SOURCES): Added canvas-features.c to the
+	list of sources.
+
+1998-09-18  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* testgnome.c (create_app_helper): Added tests for popup menus.
+
+	* canvas-fifteen.c: 
+	* canvas-arrowhead.c: 
+	* canvas-primitives.c: Removed occurrences of #ifdef GTK_HAVE_FEATURES_1_1_0.
+
+1998-09-16  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* testgnome.c (create_app_helper): Added a test for toolbars.
+
+	* testgnome.c (create_app_helper): Added a test for the new
+	GnomeAppHelper stuff.
+
+1998-09-01  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* testgnome.c (create_color_picker): New function to test the
+	GnomeColorPicker widget.
+
+1998-08-20  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas-primitives.c (setup_texts): Update tests for multiline,
+	justified, and clipped text.
+
+1998-08-18  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* testgnome.c (block_until_clicked): Fixed arguments.
+
+1998-08-04  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas-primitives.c (setup_widgets): Initial test of the widget
+	item type.
+
+	* canvas-fifteen.c (create_canvas_fifteen): Set the canvas
+	scrolling region correctly.
+	* canvas-arrowhead.c (create_canvas_arrowhead): Likewise.
+
+	* canvas-primitives.c (item_event): Drag the right way, not the
+	easy way.  Keep a flag that says whether we are dragging or not.
+
+1998-08-03  Richard Hestilow  <hestgray ionet net>
+
+	* testgnome.c (about_cb): Set the version to reflect what the current
+	gnome release is. (VERSION).
+	
+1998-07-30  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas-primitives.c (create_canvas_primitives): Made the
+	necessary changes for the new canvas.
+	(create_canvas_primitives): Use scrollbars instead of the stupid
+	scroll buttons we had before.  Removed the scroll() and
+	create_arrow() functions.
+
+	* canvas-arrowhead.c (create_canvas_arrowhead): Likewise.
+	* canvas-fifteen.c (create_canvas_fifteen): Likewise.
+
+1998-07-29  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas-arrowhead.c (create_canvas_arrowhead): New spiffy test
+	for the arrows in the line item.  It's a clone of Tk's arrowhead
+	editor.  It exposes a few bugs in the arrowheads, which I will be
+	fixing shortly.
+
+	* canvas-primitives.c:
+	* canvas-arrowhead.c:
+	* canvas-fifteen.c: New files.  I split up the canvas.c file
+	because it was getting too big.  Users may have an easier time
+	looking at the canvas demo sources this way.
+
+	* testgnome.h: Added prototypes for the canvas demo creation
+	functions.
+
+	* Makefile.am: Added the new files to the sources.
+
+1998-07-28  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (free_imlib_image): New function to free the imlib
+	images once we are done.
+	(setup_images): More tests for image items.
+	(setup_lines): Spiffy test for line items.
+
+1998-07-24  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (create_canvas): Split the item creation into separate
+	functions:  setup_rectangles(), setup_ellipses(), setup_texts(),
+	setup_images(), and setup_lines().
+
+1998-07-19  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (item_event): Use gnome_canvas_item_raise_to_top() and
+	gnome_canvas_item_lower_to_bottom().
+
+1998-07-17  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (create_fifteen create_primitives): Removed the canvas
+	parameter from calls to gnome_canvas_item_new().
+	(create_primitives): Added a test for the line item.
+
+1998-07-15  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (item_event): Grab/ungrab the item on button
+	press/release, respectively.
+	(item_event): Now you can click buttons 2 or 3 on an item to
+	lower/raise it, respectively.  If shift is pressed as well, the
+	item will be sent to the bottom/top of the stack.
+
+	* testgnome.c (main): Do not call gnome_init() and gtk_init().
+
+1998-07-13  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (piece_event): 
+	(create_primitives): 
+	(create_fifteen): Removed the "SomeGtkType::" prefixes for
+	arguments now that Gtk supports direct argument lookups.  The code
+	is actually nice right now :-)
+
+Sun Jul 12 23:01:56 1998  Havoc Pennington  <hp pobox com>
+
+	* testgnome.c (create_app_util): Added a test for the 
+	GnomeAppBar, gnome-app-util, and gnome-dialog-util (they're 
+	all interrelated, so it's just one test window). This is also
+	a decent demo for what these functions do (or don't).
+
+	Also added a "Reload preferences" button to load preferences
+	and observe the effect on the gnome libraries.
+
+1998-07-08  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (scroll): Added buttons to scroll the canvas.  When I
+	think of how to make a decent adjustment system for the canvas,
+	these will be replace by scrollbars.
+
+1998-07-07  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (zoom_changed): Added a scale to change the zoom
+	factor.  This exposes several bugs in the canvas, which I will be
+	fixing shortly.
+
+1998-07-06  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (scramble): Don't flush the X queue now that
+	gnome_canvas_update_now() does it for us.
+	(create_primitives): Added a test for all the canvas primitives.
+
+1998-07-05  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c: Added text to the fifteen game.  The text items change
+	color when the mouse enters/leaves the squares.
+	(scramble): Added function to scramble the board.
+
+1998-07-01  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c (piece_event): Use gnome_canvas_item_move instead of
+	re-setting the coordinates explicitly.
+
+1998-06-30  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c: Implemented a simple "fifteen" game.  You can move the
+	pieces and reorder them to win.  It does not have text yet,
+	because I haven't written a GnomeCanvasText item type yet.
+
+	* canvas.c: New test for new canvas -- work in progress.
+
+1998-06-22  Richard Hestilow  <hestgray ionet net>
+	
+	* testgnome.c: 	Fixed icon list (create_icon_list) and changed
+			create_pixmap to use gdk_imlib.
+		
+Thu Jun 18 02:48:17 1998  George Lebl  <jirka 5z com>
+
+	* testgnome.c: added test for number entry widget
+
+Sun Jun 14 13:47:41 1998  Tom Tromey  <tromey cygnus com>
+
+	* Makefile.am (INCLUDES): Include GTK_CFLAGS.  Look in intl source
+	and build directories.
+
+1998-05-30  Marius Vollmer  <mvo zagadka ping de>
+
+	* testgnome.c (create_newwin): Do not connect to the
+	"delete_event" when being NORMAL.  This was causing segfaults left
+	and right.
+
+Wed Jun 10 14:19:39 EDT 1998 Gregory McLean <gregm comstar net>
+
+	* fixed up this so that the canvas is only built if it was built in 
+	  libgnomeui.
+
+1998-06-09  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* Makefile.am (testgnome_LDADD): Made it use the libraries from
+	the build directories.
+
+Sat Jun  6 13:55:49 CEST 1998  Eckehard Berns  <eb berns prima de>
+
+	* testgnome.c (create_lamp): added call to gnome_lamp_set_window_type.
+
+Tue Jun  2 00:51:58 CEST 1998  Eckehard Berns  <eb berns prima de>
+
+	* testgnome.c (create_lamp): adjusted sequence value.
+
+1998-05-27  Federico Mena Quintero  <federico nuclecu unam mx>
+
+	* canvas.c: New file to test the canvas.  It is on a separate file
+	because it will have a lot of stuff.
+
+	* testgnome.h: New file with declarations useful to the whole program.
+
+Sat May 23 22:10:23 1998  Havoc Pennington  <hp pobox com>
+
+	* testgnome.c: Add a more comprehensive dialog test.
+
+Thu May 21 18:51:02 CEST 1998  Eckehard Berns  <eb berns prima de>
+
+	* testgnome.c (create_lamp, create_lamp_update): new functios.
+	(main): added GnomeLamp test.
+
+1998-05-11  Miguel de Icaza  <miguel nuclecu unam mx>
+
+	* testgnome.c (create_newwin): Create the menus with a data
+	pointer.  Add a routine to close the window, and not quit the
+	program. 
+
diff -u -r --new-file libgnomeui/test-gnome/Makefile.am libgnomeui.cpm/test-gnome/Makefile.am
--- libgnomeui/test-gnome/Makefile.am	Thu Jan  1 01:00:00 1970
+++ libgnomeui.cpm/test-gnome/Makefile.am	Tue Jun 26 20:07:44 2001
@@ -0,0 +1,43 @@
+## Process this file with automake to produce Makefile.in
+
+INCLUDES = \
+	-I$(top_builddir)				\
+	-I$(top_srcdir)					\
+	-I$(top_srcdir)/libgnomeui			\
+	$(WARN_CFLAGS)					\
+	$(LIBGNOMEUI_CFLAGS)				\
+	-DGNOMEUILIBDIR=\""$(libdir)"\"			\
+	-DGNOMEUIDATADIR=\""$(datadir)"\"		\
+	-DGNOMEUIUIDIR=\""$(datadir)/ui"\"		\
+	-DGNOMEUIPIXMAPDIR=\""$(datadir)/pixmaps"\"	\
+	-DGNOMEUIBINDIR=\""$(bindir)"\"			\
+	-DGNOMEUILOCALSTATEDIR=\""$(localstatedir)"\"	\
+	-DG_LOG_DOMAIN=\"GnomeUI\"			\
+	-DVERSION=\"$(VERSION)\"			\
+	$(GDK_PIXBUF_CFLAGS)
+
+LDADD = \
+	$(top_builddir)/libgnomeui/libgnomeui-2.la
+
+noinst_HEADERS = \
+	testgnome.h
+
+noinst_PROGRAMS = \
+	test-gnome
+
+test_gnome_SOURCES =		\
+	testgnome.c		\
+	$(noinst_HEADERS)
+
+EXTRA_DIST = 		\
+	bomb.xpm
+
+# the program has to be run from $srcdir to find its image files
+test: test-gnome
+	blddir=`pwd`; top_blddir=`cd $(top_builddir) && pwd`; cd $(srcdir); \
+	$(SHELL) $$top_blddir/libtool --mode=execute $$blddir/test-gnome
+
+test-debug: test-gnome
+	blddir=`pwd`; top_blddir=`cd $(top_builddir) && pwd`; cd $(srcdir); \
+	$(SHELL) $$top_blddir/libtool --mode=execute gdb $$blddir/test-gnome
+
diff -u -r --new-file libgnomeui/test-gnome/bomb.xpm libgnomeui.cpm/test-gnome/bomb.xpm
--- libgnomeui/test-gnome/bomb.xpm	Thu Jan  1 01:00:00 1970
+++ libgnomeui.cpm/test-gnome/bomb.xpm	Mon Apr  2 01:49:11 2001
@@ -0,0 +1,39 @@
+/* XPM */
+static char * bomb_xpm[] = {
+"32 32 4 1",
+" 	c None",
+".	c #F00000",
+"+	c #000000",
+"@	c #FFFFFF",
+"         .    .    .            ",
+"                                ",
+"           .  .  .              ",
+"            .   .               ",
+"      .  ..   .                 ",
+"            .  .                ",
+"           .   .                ",
+"                .               ",
+"         .     ..               ",
+"              ++++              ",
+"              ++++              ",
+"              ++++              ",
+"             ++++++             ",
+"           ++++++++++           ",
+"          +++++++@@+++          ",
+"         ++++++++++@@++         ",
+"        ++++++++++++@@++        ",
+"       ++++++++++++++@@++       ",
+"       +++++++++++++++@@+       ",
+"      +++++++++++++++++ ++      ",
+"      +++++++++++++++++ ++      ",
+"      ++++++++++++++++++++      ",
+"      ++++++++++++++++++++      ",
+"      ++++++++++++++++++++      ",
+"      ++++++++++++++++++++      ",
+"       +++ ++++++++++++++       ",
+"       ++++++++++++++++++       ",
+"        ++++ +++++++++++        ",
+"         ++++++++++++++         ",
+"          ++++++++++++          ",
+"           ++++++++++           ",
+"             ++++++             "};
diff -u -r --new-file libgnomeui/test-gnome/testgnome.c libgnomeui.cpm/test-gnome/testgnome.c
--- libgnomeui/test-gnome/testgnome.c	Thu Jan  1 01:00:00 1970
+++ libgnomeui.cpm/test-gnome/testgnome.c	Tue Jun 26 21:08:02 2001
@@ -0,0 +1,1091 @@
+/* testGNOME - program similar to testgtk which shows gnome lib functions.
+ *
+ * Authors : Richard Hestilow <hestgray ionet net> (GNOME 1.x version)
+ * 	     Carlos Perelló Marín <carlos gnome-db org> (Ported to GNOME 2.0)
+ *
+ * Copyright (C) 1998-2001 Free Software Foundation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <libgnomeui.h>
+#include <libgnomeui/gnome-window.h>
+/*#include <libgnomeui/gnome-ditem-edit.h>*/
+/* #include <libgnomeui/gnome-paper-selector.h>*/
+#include <liboaf/liboaf.h>
+#include <bonobo/bonobo-main.h>
+#include <bonobo/bonobo-win.h>
+#include <bonobo/bonobo-ui-util.h>
+
+#include "testgnome.h"
+#include "bomb.xpm"
+
+static const gchar *authors[] = {
+	"Richard Hestilow",
+	"Federico Mena",
+	"Eckehard Berns",
+	"Havoc Pennington",
+	"Miguel de Icaza",
+	"Jonathan Blandford",
+	"Carlos Perelló Marín",
+	NULL
+};
+
+static void
+test_exit (TestGnomeApp *app)
+{
+	bonobo_object_unref (BONOBO_OBJECT (app->ui_container));
+
+	gtk_widget_destroy (app->app);
+
+	gtk_main_quit ();
+}
+
+static void
+verb_FileTest_cb (BonoboUIComponent *uic, gpointer user_data, const char *cname)
+{
+	TestGnomeApp *app = user_data;
+
+	test_exit (app);
+}
+
+static void
+verb_FileClose_cb (BonoboUIComponent *uic, gpointer user_data, const char *cname)
+{
+	TestGnomeApp *app = user_data;
+
+	bonobo_object_unref (BONOBO_OBJECT (app->ui_container));
+
+	gtk_widget_destroy (app->app);
+}
+
+static void
+verb_FileExit_cb (BonoboUIComponent *uic, gpointer user_data, const char *cname){
+	TestGnomeApp *app = user_data;
+
+	test_exit (app);
+}
+
+static void
+verb_HelpAbout_cb (BonoboUIComponent *uic, gpointer user_data, const char *cname)
+{
+	GtkWidget *about = gnome_about_new ("GNOME Test Program", VERSION,
+					    "(C) 1998-2001 The Free Software Foundation",
+					    authors,
+					    "Program to display GNOME functions.",
+					    NULL);
+	gtk_widget_show (about);
+
+}
+
+static BonoboUIVerb verbs[] = {
+	BONOBO_UI_VERB ("FileTest", verb_FileTest_cb),
+	BONOBO_UI_VERB ("FileClose", verb_FileClose_cb),
+	BONOBO_UI_VERB ("FileExit", verb_FileExit_cb),
+	BONOBO_UI_VERB ("HelpAbout", verb_HelpAbout_cb),
+	BONOBO_UI_VERB_END
+};
+
+static gint
+quit_test (GtkWidget *caller, GdkEvent *event, TestGnomeApp *app)
+{
+	test_exit (app);
+
+        return TRUE;
+}
+
+static TestGnomeApp *
+create_newwin(gboolean normal, gchar *appname, gchar *title)
+{
+        TestGnomeApp		*app;
+	Bonobo_UIContainer	corba_container;
+	BonoboUIComponent	*uic;
+
+	app = g_new0 (TestGnomeApp, 1);
+	app->app = bonobo_window_new (appname, title);
+	if (!normal) {
+		gtk_signal_connect(GTK_OBJECT(app->app), "delete_event",
+				   GTK_SIGNAL_FUNC(quit_test), app);
+	};
+
+	gnome_window_set_icon_from_default (GTK_WINDOW(app->app));
+	app->ui_container = bonobo_ui_container_new ();
+	bonobo_ui_container_set_win (app->ui_container, 
+				     BONOBO_WINDOW (app->app));
+	uic = bonobo_ui_component_new (appname);
+	corba_container = bonobo_object_corba_objref (BONOBO_OBJECT (app->ui_container));
+	bonobo_ui_component_set_container (uic, corba_container);
+	bonobo_ui_component_freeze (uic, NULL);
+	bonobo_ui_util_set_ui (uic, GNOMEUIDATADIR, "testgnome.xml", appname);
+	bonobo_ui_component_thaw (uic, NULL);
+	bonobo_ui_component_add_verb_list_with_data (uic, verbs, app);
+	
+	return app;
+}
+
+/* Creates a color picker with the specified parameters */
+static void
+create_cp (GtkWidget *table, int dither, int use_alpha, int left, int right, int top, int bottom)
+{
+	GtkWidget *cp;
+
+	cp = gnome_color_picker_new ();
+	gnome_color_picker_set_dither (GNOME_COLOR_PICKER (cp), dither);
+	gnome_color_picker_set_use_alpha (GNOME_COLOR_PICKER (cp), use_alpha);
+	gnome_color_picker_set_d (GNOME_COLOR_PICKER (cp), 1.0, 0.0, 1.0, 0.5);
+
+	gtk_table_attach (GTK_TABLE (table), cp,
+			  left, right, top, bottom,
+			  0, 0, 0, 0);
+	gtk_widget_show (cp);
+}
+
+static void
+create_color_picker (void)
+{
+	TestGnomeApp *app;
+	GtkWidget *table;
+	GtkWidget *w;
+
+	app = create_newwin (TRUE, "testGNOME", "Color Picker");
+
+	table = gtk_table_new (3, 3, FALSE);
+	gtk_container_set_border_width (GTK_CONTAINER (table), GNOME_PAD_SMALL);
+	gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
+	gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
+	bonobo_window_set_contents (BONOBO_WINDOW (app->app), table);
+	gtk_widget_show (table);
+
+	/* Labels */
+
+	w = gtk_label_new ("Dither");
+	gtk_table_attach (GTK_TABLE (table), w,
+			  1, 2, 0, 1,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+	gtk_widget_show (w);
+
+	w = gtk_label_new ("No dither");
+	gtk_table_attach (GTK_TABLE (table), w,
+			  2, 3, 0, 1,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+	gtk_widget_show (w);
+
+	w = gtk_label_new ("No alpha");
+	gtk_table_attach (GTK_TABLE (table), w,
+			  0, 1, 1, 2,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+	gtk_widget_show (w);
+
+	w = gtk_label_new ("Alpha");
+	gtk_table_attach (GTK_TABLE (table), w,
+			  0, 1, 2, 3,
+			  GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+	gtk_widget_show (w);
+
+	/* Color pickers */
+
+	create_cp (table, TRUE,  FALSE, 1, 2, 1, 2);
+	create_cp (table, FALSE, FALSE, 2, 3, 1, 2);
+	create_cp (table, TRUE,  TRUE,  1, 2, 2, 3);
+	create_cp (table, FALSE, TRUE,  2, 3, 2, 3);
+
+	gtk_widget_show (app->app);
+}
+
+/*
+ * DateEdit
+ */
+
+static void
+create_date_edit (void)
+{
+	GtkWidget *datedit;
+	TestGnomeApp *app;
+	time_t curtime = time(NULL);
+
+	datedit = gnome_date_edit_new(curtime,1,1);
+	app = create_newwin(TRUE,"testGNOME","Date Edit");
+	bonobo_window_set_contents (BONOBO_WINDOW (app->app), datedit);
+	gtk_widget_show(datedit);
+	gtk_widget_show(app->app);
+}
+
+#if 0
+/*
+ * DItemEdit
+ */
+
+static void
+ditem_changed_callback(GnomeDItemEdit *dee, gpointer data)
+{
+	g_print("Changed!\n");
+	fflush(stdout);
+}
+
+static void
+ditem_icon_changed_callback(GnomeDItemEdit *dee, gpointer data)
+{
+	g_print("Icon changed!\n");
+	fflush(stdout);
+}
+
+static void
+ditem_name_changed_callback(GnomeDItemEdit *dee, gpointer data)
+{
+	g_print("Name changed!\n");
+	fflush(stdout);
+}
+
+static void
+create_ditem_edit (void)
+{
+	TestGnomeApp *app;
+	GtkWidget *notebook;
+	GtkWidget *dee;
+
+	app = create_newwin(TRUE,"testGNOME","Desktop Item Edit");
+	
+	notebook = gtk_notebook_new();
+
+	bonobo_window_set_contents (BONOBO_WINDOW (app->app), notebook);
+
+	dee = gnome_ditem_edit_new();
+	gtk_container_add (GTK_CONTAINER (notebook), dee);
+
+	gnome_ditem_edit_load_file(GNOME_DITEM_EDIT(dee),
+				   "/usr/local/share/gnome/apps/grun.desktop");
+#ifdef GNOME_ENABLE_DEBUG
+	g_print("Dialog (main): %p\n", GNOME_DITEM_EDIT(dee)->icon_dialog);
+#endif
+
+	gtk_signal_connect(GTK_OBJECT(dee), "changed",
+			   GTK_SIGNAL_FUNC(ditem_changed_callback),
+			   NULL);
+
+	gtk_signal_connect(GTK_OBJECT(dee), "icon_changed",
+			   GTK_SIGNAL_FUNC(ditem_icon_changed_callback),
+			   NULL);
+
+	gtk_signal_connect(GTK_OBJECT(dee), "name_changed",
+			   GTK_SIGNAL_FUNC(ditem_name_changed_callback),
+			   NULL);
+
+#ifdef GNOME_ENABLE_DEBUG
+	g_print("Dialog (main 2): %p\n", GNOME_DITEM_EDIT(dee)->icon_dialog);
+#endif
+
+	gtk_widget_show(notebook);
+	gtk_widget_show(app->app);
+
+#ifdef GNOME_ENABLE_DEBUG
+	g_print("Dialog (main 3): %p\n", GNOME_DITEM_EDIT(dee)->icon_dialog);
+#endif
+
+}
+#endif
+/*
+ * Druid
+ */
+#if 0
+
+typedef struct druid_data
+{
+	GtkWidget *radio_button; /* if set, goto A, else goto b */
+	GtkWidget *target_a;
+	GtkWidget *target_b;
+} druid_data;
+
+static gboolean
+simple_druid_next_callback (GnomeDruidPage *page, GnomeDruid *druid, GnomeDruidPage *next)
+{
+	gtk_object_set_data (GTK_OBJECT (next), "back", page);
+	gnome_druid_set_page (druid,
+	                      next);
+	return TRUE;
+}
+
+static gboolean
+complex_druid_next_callback (GnomeDruidPage *page, GnomeDruid *druid, druid_data *data)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->radio_button))) {
+		gtk_object_set_data (GTK_OBJECT (data->target_a), "back", page);
+		gnome_druid_set_page (druid,
+				      GNOME_DRUID_PAGE (data->target_a));
+	} else {
+		gtk_object_set_data (GTK_OBJECT (data->target_b), "back", page);
+		gnome_druid_set_page (druid,
+				      GNOME_DRUID_PAGE (data->target_b));
+	}
+	return TRUE;
+}
+
+static gboolean
+druid_back_callback (GnomeDruidPage *page, GnomeDruid *druid, gpointer data)
+{
+	GtkWidget *back_page = NULL;
+	back_page = gtk_object_get_data (GTK_OBJECT (page), "back");
+	if (back_page) {
+		gtk_object_set_data (GTK_OBJECT (page), "back", NULL);
+		gnome_druid_set_page (druid,
+				      GNOME_DRUID_PAGE (back_page));
+		return TRUE;
+	}
+	return FALSE;
+}
+
+/*
+ *  * The Druid's control flow looks something like this:
+ *   *
+ *    * page_start -> page_a -> page_b -> page_d -> page_f -> page_finish
+ *     *                      |          \                  /
+ *      *                      |            page_e -> page_g
+ *       *                       \                  /
+ *        *                         page_c ----------
+ *         */
+static void
+create_druid(void)
+{
+	GtkWidget *window;
+	GtkWidget *druid;
+	gchar *fname;
+	GtkWidget *page_start, *page_finish;
+	GtkWidget *page_a, *page_b, *page_c, *page_d, *page_e, *page_f, *page_g;
+	GdkPixbuf *logo = NULL;
+	GdkPixbuf *watermark = NULL;
+	GtkWidget *check_a, *check_b;
+	GSList *radio_group;
+	druid_data *data;
+
+	/* load the images */
+	fname = g_strconcat (GNOMEUIPIXMAPDIR, "gnome-logo-icon.png", NULL);
+	if (fname)
+		/* FIXME: We must test GError */
+		logo = gdk_pixbuf_new_from_file (fname, NULL);
+	g_free (fname);
+
+#if 0
+	/* We really need a better image for this.  For now, it'll do */
+	fname = g_strconcat (GNOMEUIPIXMAPDIR, "gnome-logo-large.png", NULL);
+	if (fname)
+		/* FIXME: We must test GError */
+		watermark = gdk_pixbuf_new_from_file (fname, NULL);
+	g_free (fname);
+#endif
+
+	/* The initial stuff */
+	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	druid = gnome_druid_new ();
+
+	/* The druid pages. */
+	page_start = gnome_druid_page_start_new_with_vals
+			("Beginning of the DRUID",
+			 "This is a Sample DRUID\nIt will walk you through absolutely nothing. (-:\n\nIt would be nice to have a watermark on the left.",
+			 logo,
+			 watermark);
+	page_a = gnome_druid_page_standard_new_with_vals ("Page A", logo);
+	page_b = gnome_druid_page_standard_new_with_vals ("Page B", logo);
+	page_c = gnome_druid_page_standard_new_with_vals ("Page C", logo);
+	page_d = gnome_druid_page_standard_new_with_vals ("Page D", logo);
+	page_e = gnome_druid_page_standard_new_with_vals ("Page E", logo);
+	page_f = gnome_druid_page_standard_new_with_vals ("Page F", logo);
+	page_g = gnome_druid_page_standard_new_with_vals ("Page G", logo);
+	page_finish = gnome_druid_page_finish_new_with_vals
+			("End of the DRUID",
+			 "I hope you found this demo informative.  You would\nnormally put a message here letting someone know\nthat they'd successfully installed something.",
+			 logo,
+			 watermark);
+
+	/* set each one up. */
+	/* page_a */
+	data = g_new (druid_data, 1);
+	radio_group = NULL;
+	check_a = gtk_radio_button_new_with_label (NULL, "Go to page B");
+	radio_group = gtk_radio_button_group (GTK_RADIO_BUTTON (check_a));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_a), TRUE);
+	check_b = gtk_radio_button_new_with_label (radio_group, "Go to page C");
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_a)->vbox),
+			    check_a, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_a)->vbox),
+			    check_b, FALSE, FALSE, 0);
+	data->radio_button = check_a;
+	data->target_a = page_b;
+	data->target_b = page_c;
+	gtk_signal_connect (GTK_OBJECT (page_a), "next", (GtkSignalFunc) complex_druid_next_callback, (gpointer) data);
+	gtk_signal_connect (GTK_OBJECT (page_a), "back", (GtkSignalFunc) druid_back_callback, (gpointer) NULL);
+
+	/* page_b */
+	data = g_new (druid_data, 1);
+	radio_group = NULL;
+	check_a = gtk_radio_button_new_with_label (NULL, "Go to page D");
+	radio_group = gtk_radio_button_group (GTK_RADIO_BUTTON (check_a));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_a), TRUE);
+	check_b = gtk_radio_button_new_with_label (radio_group, "Go to page E");
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_b)->vbox),
+			    check_a, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_b)->vbox),
+			    check_b, FALSE, FALSE, 0);
+	data->radio_button = check_a;
+	data->target_a = page_d;
+	data->target_b = page_e;
+	gtk_signal_connect (GTK_OBJECT (page_b), "next", (GtkSignalFunc) complex_druid_next_callback, (gpointer) data);
+	gtk_signal_connect (GTK_OBJECT (page_b), "back", (GtkSignalFunc) druid_back_callback, (gpointer) NULL);
+
+	/* page_c */
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_c)->vbox),
+			    gtk_label_new ("This page will take you to page G\nYou don't have any say in the matter. (-:"),
+			    FALSE, FALSE, 0);
+	gtk_signal_connect (GTK_OBJECT (page_c), "next", (GtkSignalFunc) simple_druid_next_callback, (gpointer) page_g);
+	gtk_signal_connect (GTK_OBJECT (page_c), "back", (GtkSignalFunc) druid_back_callback, (gpointer) NULL);
+
+	/* page_d */
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_d)->vbox),
+			    gtk_label_new ("This page will take you to page F"),
+			    FALSE, FALSE, 0);
+	gtk_signal_connect (GTK_OBJECT (page_d), "next", (GtkSignalFunc) simple_druid_next_callback, (gpointer) page_f);
+	gtk_signal_connect (GTK_OBJECT (page_d), "back", (GtkSignalFunc) druid_back_callback, (gpointer) NULL);
+
+	/* page_e */
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_e)->vbox),
+			    gtk_label_new ("This page will take you to page G\n\nShe sells sea shells by the sea shore."),
+			    FALSE, FALSE, 0);
+	gtk_signal_connect (GTK_OBJECT (page_e), "next", (GtkSignalFunc) simple_druid_next_callback, (gpointer) page_g);
+	gtk_signal_connect (GTK_OBJECT (page_e), "back", (GtkSignalFunc) druid_back_callback, (gpointer) NULL);
+
+	/* page_f */
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_f)->vbox),
+			    gtk_label_new ("This is a second to last page.\nIt isn't as nice as page G.\n\nClick Next to go to the last page\n"),
+			    FALSE, FALSE, 0);
+	gtk_signal_connect (GTK_OBJECT (page_f), "next", (GtkSignalFunc) simple_druid_next_callback, (gpointer) page_finish);
+	gtk_signal_connect (GTK_OBJECT (page_f), "back", (GtkSignalFunc) druid_back_callback, (gpointer) NULL);
+
+	/* page_g */
+	gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page_g)->vbox),
+			    gtk_label_new ("This is page G!!!!\n\nyay!!!!!!!"),
+			    FALSE, FALSE, 0);
+	gtk_signal_connect (GTK_OBJECT (page_g), "back", (GtkSignalFunc) druid_back_callback, (gpointer) NULL);
+
+
+	/* page_finish */
+	gtk_signal_connect (GTK_OBJECT (page_finish), "back", (GtkSignalFunc) druid_back_callback, (gpointer) NULL);
+
+	/*Tie it together */
+	gtk_container_add (GTK_CONTAINER (window), druid);
+	gnome_druid_append_page (GNOME_DRUID (druid),
+				 GNOME_DRUID_PAGE (page_start));
+	gnome_druid_append_page (GNOME_DRUID (druid),
+				 GNOME_DRUID_PAGE (page_a));
+	gome_druid_append_page (GNOME_DRUID (druid),
+				GNOME_DRUID_PAGE (page_b));
+	gnome_druid_append_page (GNOME_DRUID (druid),
+				 GNOME_DRUID_PAGE (page_c));
+	gnome_druid_append_page (GNOME_DRUID (druid),
+				 GNOME_DRUID_PAGE (page_d));
+	gnome_druid_append_page (GNOME_DRUID (druid),
+				 GNOME_DRUID_PAGE (page_e));
+	gnome_druid_append_page (GNOME_DRUID (druid),
+				 GNOME_DRUID_PAGE (page_f));
+	gnome_druid_append_page (GNOME_DRUID (druid),
+				 GNOME_DRUID_PAGE (page_g));
+	gnome_druid_append_page (GNOME_DRUID (druid),
+				 GNOME_DRUID_PAGE (page_finish));
+	gnome_druid_set_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (page_start));
+	gtk_widget_show_all (window);
+}
+
+#endif
+
+/*
+ * Entry
+ */
+
+static void
+create_entry(void)
+{
+	TestGnomeApp *app;
+	GtkWidget *entry;
+
+	app = create_newwin(TRUE,"testGNOME","Entry");
+	entry = gnome_entry_new();
+	g_assert(entry != NULL);
+//	gnome_entry_set_text (GNOME_ENTRY(entry), "Foo");
+	bonobo_window_set_contents(BONOBO_WINDOW(app->app), entry);
+	gtk_widget_show(entry);
+	gtk_widget_show(app->app);
+}
+
+/*
+ * FileEntry
+ */
+
+#if 0
+
+static void
+file_entry_update_files(GtkWidget *w, GnomeFileEntry *fentry)
+{
+	char *p;
+	char *pp;
+
+	GtkLabel *l1 = gtk_object_get_data(GTK_OBJECT(w),"l1");
+	GtkLabel *l2 = gtk_object_get_data(GTK_OBJECT(w),"l2");
+
+	p = gnome_file_entry_get_full_path(fentry,FALSE);
+	pp = g_strconcat("File name: ",p,NULL);
+	gtk_label_set_text(l1,pp);
+	g_free(pp);
+	if(p) g_free(p);
+
+	p = gnome_file_entry_get_full_path(fentry,TRUE);
+	pp = g_strconcat("File name(if exists only): ",p,NULL);
+	gtk_label_set_text(l2,pp);
+	g_free(pp);
+	if(p) g_free(p);
+}
+
+static void
+file_entry_modal_toggle(GtkWidget *w, GnomeFileEntry *fentry)
+{
+	gnome_file_entry_set_modal(fentry,GTK_TOGGLE_BUTTON(w)->active);
+}
+
+static void
+file_entry_directory_toggle(GtkWidget *w, GnomeFileEntry *fentry)
+{
+	gnome_file_entry_set_directory(fentry,GTK_TOGGLE_BUTTON(w)->active);
+}
+
+static void
+create_file_entry(void)
+{
+	TestGnomeApp *app;
+	GtkWidget *entry;
+	GtkWidget *l1,*l2;
+	GtkWidget *but;
+	GtkWidget *box;
+
+	app = create_newwin(TRUE,"testGNOME","File Entry");
+
+	box = gtk_vbox_new(FALSE,5);
+	entry = gnome_file_entry_new("Foo","Bar");
+	gtk_box_pack_start(GTK_BOX(box),entry,FALSE,FALSE,0);
+
+	l1 = gtk_label_new("File name: ");
+	gtk_box_pack_start(GTK_BOX(box),l1,FALSE,FALSE,0);
+
+	l2 = gtk_label_new("File name(if exists only): ");
+	gtk_box_pack_start(GTK_BOX(box),l2,FALSE,FALSE,0);
+
+	but = gtk_button_new_with_label("Update file labels");
+	gtk_object_set_data(GTK_OBJECT(but),"l1",l1);
+	gtk_object_set_data(GTK_OBJECT(but),"l2",l2);
+	gtk_signal_connect(GTK_OBJECT(but),"clicked",
+			   GTK_SIGNAL_FUNC(file_entry_update_files),
+			   entry);
+	gtk_box_pack_start(GTK_BOX(box),but,FALSE,FALSE,0);
+
+	but = gtk_toggle_button_new_with_label("Make browse dialog modal");
+	gtk_signal_connect(GTK_OBJECT(but),"toggled",
+			   GTK_SIGNAL_FUNC(file_entry_modal_toggle),
+			   entry);
+	gtk_box_pack_start(GTK_BOX(box),but,FALSE,FALSE,0);
+
+	but = gtk_toggle_button_new_with_label("Directory only picker");
+	gtk_signal_connect(GTK_OBJECT(but),"toggled",
+			   GTK_SIGNAL_FUNC(file_entry_directory_toggle),
+			   entry);
+	gtk_box_pack_start(GTK_BOX(box),but,FALSE,FALSE,0);
+
+	bonobo_window_set_contents (BONOBO_WINDOW(app->app), box);
+	gtk_widget_show_all(app->app);
+}
+
+#endif
+
+/*
+ * FontPicker
+ */
+#if 0
+static void
+cfp_ck_UseFont(GtkWidget *widget,GnomeFontPicker *gfp)
+{
+	gboolean show;
+	gint size;
+
+	show=!gfp->use_font_in_label;
+	size=gfp->use_font_in_label_size;
+
+	gnome_font_picker_fi_set_use_font_in_label(gfp,show,size);
+
+}
+
+static void
+cfp_sp_value_changed(GtkAdjustment *adj,GnomeFontPicker *gfp)
+{
+	gboolean show;
+	gint size;
+
+	show=gfp->use_font_in_label;
+	size=(gint)adj->value;
+
+	gnome_font_picker_fi_set_use_font_in_label(gfp,show,size);
+
+}
+
+static void
+cfp_ck_ShowSize(GtkWidget *widget,GnomeFontPicker *gfp)
+{
+	GtkToggleButton *tb;
+
+	tb=GTK_TOGGLE_BUTTON(widget);
+
+	gnome_font_picker_fi_set_show_size(gfp,tb->active);
+}
+
+static void
+cfp_set_font(GnomeFontPicker *gfp, gchar *font_name, GtkLabel *label)
+{
+	g_print("Font name: %s\n",font_name);
+	gtk_label_set_text(label,font_name);
+}
+
+static void
+create_font_picker (void)
+{
+	GtkWidget *fontpicker1,*fontpicker2,*fontpicker3;
+
+	TestGnomeApp *app;
+	GtkWidget *vbox,*vbox1,*vbox2,*vbox3;
+	GtkWidget *hbox1,*hbox3;
+	GtkWidget *frPixmap,*frFontInfo,*frUser;
+	GtkWidget *lbPixmap,*lbFontInfo,*lbUser;
+	GtkWidget *ckUseFont,*spUseFont,*ckShowSize;
+	GtkAdjustment *adj;
+
+	app = create_newwin(TRUE,"testGNOME","Font Picker");
+
+
+	vbox=gtk_vbox_new(FALSE,5);
+	gtk_container_set_border_width(GTK_CONTAINER(vbox),5);
+	bonobo_window_set_contents(BONOBO_WINDOW(app->app),vbox);
+
+	/* Pixmap */
+	frPixmap=gtk_frame_new(_("Default Pixmap"));
+	gtk_box_pack_start(GTK_BOX(vbox),frPixmap,TRUE,TRUE,0);
+	vbox1=gtk_vbox_new(FALSE,FALSE);
+	gtk_container_add(GTK_CONTAINER(frPixmap),vbox1);
+	
+	/* GnomeFontPicker with pixmap */
+	fontpicker1 = gnome_font_picker_new();
+	gtk_container_set_border_width(GTK_CONTAINER(fontpicker1),5);
+	gtk_box_pack_start(GTK_BOX(vbox1),fontpicker1,TRUE,TRUE,0);
+	lbPixmap=gtk_label_new(_("If you choose a font it will appear here"));
+	gtk_box_pack_start(GTK_BOX(vbox1),lbPixmap,TRUE,TRUE,5);
+
+	gtk_signal_connect(GTK_OBJECT(fontpicker1),"font_set",
+			   GTK_SIGNAL_FUNC(cfp_set_font),lbPixmap);
+
+	/* Font_Info */
+	frFontInfo=gtk_frame_new("Font Info");
+	gtk_box_pack_start(GTK_BOX(vbox),frFontInfo,TRUE,TRUE,0);
+	vbox2=gtk_vbox_new(FALSE,FALSE);
+	gtk_container_set_border_width(GTK_CONTAINER(vbox2),5);
+	gtk_container_add(GTK_CONTAINER(frFontInfo),vbox2);
+
+	/* GnomeFontPicker with fontinfo */
+	hbox1=gtk_hbox_new(FALSE,5);
+	gtk_box_pack_start(GTK_BOX(vbox2),hbox1,FALSE,FALSE,0);
+	ckUseFont=gtk_check_button_new_with_label(_("Use Font in button with size"));
+	gtk_box_pack_start(GTK_BOX(hbox1),ckUseFont,TRUE,TRUE,0);
+
+	adj=GTK_ADJUSTMENT(gtk_adjustment_new(14,5,150,1,1,1));
+	spUseFont=gtk_spin_button_new(adj,1,0);
+	gtk_box_pack_start(GTK_BOX(hbox1),spUseFont,FALSE,FALSE,0);
+
+	ckShowSize=gtk_check_button_new_with_label(_("Show font size"));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ckShowSize),TRUE);
+	gtk_box_pack_start(GTK_BOX(vbox2),ckShowSize,FALSE,FALSE,5);
+
+	fontpicker2 = gnome_font_picker_new();
+	gnome_font_picker_set_mode(GNOME_FONT_PICKER(fontpicker2),GNOME_FONT_PICKER_MODE_FONT_INFO);
+	gtk_box_pack_start(GTK_BOX(vbox2),fontpicker2,TRUE,TRUE,0);
+
+	gtk_signal_connect(GTK_OBJECT(ckUseFont),"toggled",
+			   (GtkSignalFunc)cfp_ck_UseFont,fontpicker2);
+
+	gtk_signal_connect(GTK_OBJECT(ckShowSize),"toggled",
+			   (GtkSignalFunc)cfp_ck_ShowSize,fontpicker2);
+
+	gtk_signal_connect(GTK_OBJECT(adj),"value_changed",
+			   (GtkSignalFunc)cfp_sp_value_changed,fontpicker2);
+
+	lbFontInfo=gtk_label_new(_("If you choose a font it will appear here"));
+	gtk_box_pack_start(GTK_BOX(vbox2),lbFontInfo,TRUE,TRUE,5);
+
+
+	gtk_signal_connect(GTK_OBJECT(fontpicker2),"font_set",
+			   GTK_SIGNAL_FUNC(cfp_set_font),lbFontInfo);
+
+
+	/* User Widget */
+	frUser=gtk_frame_new("User Widget");
+	gtk_box_pack_start(GTK_BOX(vbox),frUser,TRUE,TRUE,0);
+	vbox3=gtk_vbox_new(FALSE,FALSE);
+	gtk_container_add(GTK_CONTAINER(frUser),vbox3);
+	
+	/* GnomeFontPicker with User Widget */
+	fontpicker3 = gnome_font_picker_new();
+	gnome_font_picker_set_mode(GNOME_FONT_PICKER(fontpicker3),GNOME_FONT_PICKER_MODE_USER_WIDGET);
+
+	hbox3=gtk_hbox_new(FALSE,0);
+	gtk_box_pack_start(GTK_BOX(hbox3),gnome_stock_new_with_icon(GNOME_STOCK_PIXMAP_SPELLCHECK),
+			   FALSE,FALSE,5);
+	gtk_box_pack_start(GTK_BOX(hbox3),gtk_label_new(_("This is an hbox with pixmap and text")),
+			   FALSE,FALSE,5);
+	gnome_font_picker_uw_set_widget(GNOME_FONT_PICKER(fontpicker3),hbox3);
+	gtk_container_set_border_width(GTK_CONTAINER(fontpicker3),5);
+	gtk_box_pack_start(GTK_BOX(vbox3),fontpicker3,TRUE,TRUE,0);
+
+	lbUser=gtk_label_new(_("If you choose a font it will appear here"));
+	gtk_box_pack_start(GTK_BOX(vbox3),lbUser,TRUE,TRUE,5);
+
+	gtk_signal_connect(GTK_OBJECT(fontpicker3),"font_set",
+			   GTK_SIGNAL_FUNC(cfp_set_font),lbUser);
+
+	gtk_widget_show_all(app->app);
+
+}
+#endif
+/*
+ * HRef
+ */
+
+static void
+href_cb(GtkObject *button)
+{
+	GtkWidget *href = gtk_object_get_data(button, "href");
+	GtkWidget *url_ent = gtk_object_get_data(button, "url");
+	GtkWidget *label_ent = gtk_object_get_data(button, "label");
+	gchar *url, *text;
+
+	url = gtk_editable_get_chars (GTK_EDITABLE(url_ent), 0, -1);
+	text = gtk_editable_get_chars (GTK_EDITABLE(label_ent), 0, -1);
+	if (!text || ! text[0])
+		text = url;
+	gnome_href_set_url(GNOME_HREF(href), url);
+	gnome_href_set_text (GNOME_HREF(href), text);
+}
+
+static void
+create_href(void)
+{
+	TestGnomeApp *app;
+	GtkWidget *vbox, *href, *ent1, *ent2, *wid;
+
+	app = create_newwin(TRUE,"testGNOME","HRef test");
+	vbox = gtk_vbox_new(FALSE, 5);
+	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
+	bonobo_window_set_contents(BONOBO_WINDOW(app->app), vbox);
+
+	href = gnome_href_new("http://www.gnome.org/";, "Gnome Website");
+	gtk_box_pack_start(GTK_BOX(vbox), href, FALSE, FALSE, 0);
+
+	wid = gtk_hseparator_new();
+	gtk_box_pack_start(GTK_BOX(vbox), wid, TRUE, FALSE, 0);
+
+	wid = gtk_label_new("The launch behaviour of the\n"
+			    "configured with the control center");
+	gtk_box_pack_start(GTK_BOX(vbox), wid, TRUE, FALSE, 0);
+
+	ent1 = gtk_entry_new();
+	gtk_entry_set_text (GTK_ENTRY(ent1), "http://www.gnome.org/";);
+	gtk_box_pack_start (GTK_BOX(vbox), ent1, TRUE, TRUE, 0);
+
+	ent2 = gtk_entry_new ();
+	gtk_entry_set_text (GTK_ENTRY(ent2), "Gnome Website");
+	gtk_box_pack_start (GTK_BOX(vbox), ent2, TRUE, TRUE, 0);
+
+	wid = gtk_button_new_with_label ("set href props");
+	gtk_object_set_data (GTK_OBJECT(wid), "href", href);
+	gtk_object_set_data (GTK_OBJECT(wid), "url", ent1);
+	gtk_object_set_data (GTK_OBJECT(wid), "label", ent2);
+	gtk_signal_connect (GTK_OBJECT(wid), "clicked",
+			    GTK_SIGNAL_FUNC(href_cb), NULL);
+	gtk_box_pack_start (GTK_BOX(vbox), wid, TRUE, TRUE, 0);
+
+	gtk_widget_show_all(app->app);
+}
+
+/*
+ * IconList
+ */
+
+static void
+select_icon (GnomeIconList *gil, gint n, GdkEvent *event, gpointer data)
+{
+	printf ("Icon %d selected", n);
+
+	if (event)
+		printf (" with event type %d\n", (int) event->type);
+	else
+		printf ("\n");
+}
+
+static void
+unselect_icon (GnomeIconList *gil, gint n, GdkEvent *event, gpointer data)
+{
+	printf ("Icon %d unselected", n);
+
+	if (event)
+		printf (" with event type %d\n", (int) event->type);
+	else
+		printf ("\n");
+}
+
+static void
+create_icon_list(void)
+{
+	TestGnomeApp *app;
+	GtkWidget *sw;
+	GtkWidget *iconlist;
+	GdkPixbuf *pix;
+	int i;
+
+	app = create_newwin(TRUE,"testGNOME","Icon List");
+
+	sw = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	bonobo_window_set_contents (BONOBO_WINDOW (app->app), sw);
+	gtk_widget_set_usize (sw, 430, 300);
+	gtk_widget_show (sw);
+
+	iconlist = gnome_icon_list_new (80, GNOME_ICON_LIST_IS_EDITABLE);
+	gtk_container_add (GTK_CONTAINER (sw), iconlist);
+	gtk_signal_connect (GTK_OBJECT (iconlist), "select_icon",
+			    GTK_SIGNAL_FUNC (select_icon),
+			    NULL);
+	gtk_signal_connect (GTK_OBJECT (iconlist), "unselect_icon",
+			    GTK_SIGNAL_FUNC (unselect_icon),
+			    NULL);
+
+	GTK_WIDGET_SET_FLAGS(iconlist, GTK_CAN_FOCUS);
+	pix = gdk_pixbuf_new_from_xpm_data ((const gchar **)bomb_xpm);
+/*	gdk_imlib_render (pix, pix->rgb_width, pix->rgb_height);*/
+
+	gtk_widget_grab_focus (iconlist);
+
+	gnome_icon_list_freeze (GNOME_ICON_LIST (iconlist));
+
+	for (i = 0; i < 30; i++) {
+		gnome_icon_list_append_pixbuf (GNOME_ICON_LIST(iconlist), pix, "bomb.xpm", "Foo");
+		gnome_icon_list_append_pixbuf (GNOME_ICON_LIST(iconlist), pix, "bomb.xpm", "Bar");
+		gnome_icon_list_append_pixbuf (GNOME_ICON_LIST(iconlist), pix, "bomb.xpm", "LaLa");
+	}
+
+
+	gnome_icon_list_set_selection_mode (GNOME_ICON_LIST (iconlist), GTK_SELECTION_EXTENDED);
+	gnome_icon_list_thaw (GNOME_ICON_LIST (iconlist));
+	gtk_widget_show (iconlist);
+	gtk_widget_show(app->app);
+}
+
+/*
+ * ImageEntry
+ */
+
+static void
+create_image_entry(void)
+{
+	TestGnomeApp *app;
+	GtkWidget *entry;
+
+	app = create_newwin(TRUE,"testGNOME","Pixmap Entry");
+	/* FIXME: The gnome_image_entry_new param. must be reviewed */
+	entry = gnome_image_entry_new_pixmap_entry (0,0);
+	bonobo_window_set_contents(BONOBO_WINDOW(app->app),entry);
+	gtk_widget_show(entry);
+	gtk_widget_show(app->app);
+}
+#if 0
+/*
+ * ImageSelector
+ */
+
+static void
+create_image_selector (void)
+{
+
+}
+#endif
+/*
+ * Less
+ */
+
+static void
+create_less(void)
+{
+	TestGnomeApp *app;
+	GtkWidget *less;
+
+	app = create_newwin(TRUE,"testGNOME","Less");
+	less = gnome_less_new();
+	gnome_less_set_font_fixed (GNOME_LESS(less));
+	bonobo_window_set_contents(BONOBO_WINDOW (app),less);
+	gtk_widget_show(less);
+	gtk_widget_show(app->app);
+	gnome_less_show_command(GNOME_LESS(less),"fortune");
+}
+
+#if 0
+/*
+ * GnomePaperSelector
+ */
+
+static void
+create_papersel(void)
+{
+	TestGnomeApp *app;
+	GtkWidget *papersel;
+
+	app = create_newwin(TRUE,"testGNOME","Paper Selection");
+	papersel = gnome_paper_selector_new( );
+	bonobo_window_set_contents(BONOBO_WINDOW(app->app),papersel);
+	gtk_widget_show(papersel);
+	gtk_widget_show(app->app);
+}
+
+#endif
+/*
+ * Pixmap
+ */
+
+static void
+create_pixmap(void)
+{
+	TestGnomeApp *app;
+	GtkWidget *pixmap;
+
+	app = create_newwin(TRUE,"testGNOME","Pixmap");
+	pixmap = gnome_pixmap_new_from_xpm_d ((const gchar **)bomb_xpm);
+
+	bonobo_window_set_contents(BONOBO_WINDOW (app->app),pixmap);
+	gtk_widget_show(pixmap);
+	gtk_widget_show(app->app);
+}
+#if 0
+/*
+ * UnitSpinner
+ */
+
+static void
+create_unit_spinner (void)
+{
+
+}
+#endif
+int
+main (int argc, char **argv)
+{
+	struct {
+		char *label;
+		void (*func) ();
+	} buttons[] =
+	  {
+		{ "color picker", create_color_picker },
+		{ "date edit", create_date_edit },
+/*		{ "ditem edit", create_ditem_edit },*/
+/*		{ "druid", create_druid },*/
+		{ "entry", create_entry },
+/*		{ "file entry", create_file_entry },*/
+/*		{ "font picker", create_font_picker },*/
+		{ "href", create_href },
+		{ "icon list", create_icon_list },
+		{ "image entry", create_image_entry },
+/*		{ "image selector", create_image_selector },*/
+		{ "less", create_less },
+/*		{ "paper selector", create_papersel },*/
+		{ "pixmap", create_pixmap },
+/*		{ "unit spinner", create_unit_spinner },*/
+	  };
+	int nbuttons = sizeof (buttons) / sizeof (buttons[0]);
+	CORBA_Environment ev;
+	TestGnomeApp *app;
+	GtkWidget *box1;
+	GtkWidget *box2;
+	GtkWidget *button;
+	GtkWidget *scrolled_window;
+	int i;
+
+	
+	CORBA_exception_init (&ev);
+	gnome_program_init ("testGNOME", VERSION, &libgnomeui_module_info, argc, argv, NULL);
+
+	if (bonobo_init (&argc, argv) == FALSE)
+		g_error ("Could not initialize Bonobo!\n");
+
+	app = create_newwin (FALSE, "testGNOME", "testGNOME");
+
+	gtk_widget_set_usize (app->app, 200, 300);
+	box1 = gtk_vbox_new (FALSE, 0);
+	bonobo_window_set_contents (BONOBO_WINDOW (app->app), box1);
+	gtk_widget_show (box1);
+	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+	gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (scrolled_window)->vscrollbar,
+				GTK_CAN_FOCUS);
+	gtk_box_pack_start (GTK_BOX (box1), scrolled_window, TRUE, TRUE, 0);
+	gtk_widget_show (scrolled_window);
+	box2 = gtk_vbox_new (FALSE, 0);
+	gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
+	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), box2);
+	gtk_container_set_focus_vadjustment (GTK_CONTAINER (box2),gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW(scrolled_window)));
+	gtk_widget_show (box2);
+	for (i = 0; i < nbuttons; i++) {
+		button = gtk_button_new_with_label (buttons[i].label);
+		if (buttons[i].func)
+			gtk_signal_connect (GTK_OBJECT (button),
+					    "clicked",
+					    GTK_SIGNAL_FUNC(buttons[i].func),
+					    NULL);
+		else
+			gtk_widget_set_sensitive (button, FALSE);
+		gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
+		gtk_widget_show (button);
+	}
+
+	gtk_widget_show (app->app);
+
+	bonobo_main ();
+
+	return 0;
+}
+
diff -u -r --new-file libgnomeui/test-gnome/testgnome.h libgnomeui.cpm/test-gnome/testgnome.h
--- libgnomeui/test-gnome/testgnome.h	Thu Jan  1 01:00:00 1970
+++ libgnomeui.cpm/test-gnome/testgnome.h	Sun Jun 24 21:27:48 2001
@@ -0,0 +1,18 @@
+#ifndef TESTGNOME_H
+#define TESTGNOME_H
+
+#include <bonobo/bonobo-object-client.h>
+#include <bonobo/bonobo-ui-container.h>
+
+typedef struct _TestGnomeApp		TestGnomeApp;
+
+struct _TestGnomeApp {
+	BonoboUIContainer	*ui_container;
+
+	GtkWidget		*app;
+
+};
+
+void    sample_app_exit         (TestGnomeApp        *app);
+
+#endif /* TESTGNOME_H */
diff -u -r --new-file libgnomeui/test-gnome/testgnome.xml libgnomeui.cpm/test-gnome/testgnome.xml
--- libgnomeui/test-gnome/testgnome.xml	Thu Jan  1 01:00:00 1970
+++ libgnomeui.cpm/test-gnome/testgnome.xml	Sun Jun 17 00:42:56 2001
@@ -0,0 +1,44 @@
+<Root>
+
+<commands>
+        <cmd name="FileTest" _label="Test"
+	_tip="Test" pixtype="stock" pixname="Exit"/>
+        
+        <cmd name="FileClose" _label="Close"
+	_tip="Close the current window" pixtype="stock" pixname="Close"
+	accel="*Control*w"/>
+	
+        <cmd name="FileExit" _label="Exit" _tip="Exit the test"
+           pixtype="stock" pixname="Exit" accel="*Control*q"/>
+
+        <cmd name="HelpAbout" _label="About..." _tip="About this application"
+	 pixtype="stock" pixname="About"/>
+
+</commands>
+
+<menu>
+
+<submenu name="File" _label="_File">
+        
+        <menuitem name="FileTest" verb="" _label="_Test"/>
+        
+	
+	<separator/>
+	
+        <menuitem name="FileClose" verb="" _label="_Close"/>
+	
+        <menuitem name="FileExit" verb="" _label="E_xit"/>
+
+</submenu>
+
+<submenu name="Help" _label="_Help">
+	
+	<placeholder name="BuiltMenuItems"/>
+
+        <menuitem name="HelpAbout" verb="" _label="_About..."/>
+
+</submenu>
+
+</menu>
+
+</Root>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]