? bonobo-sample-container.c
? sample-control-container
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/libbonoboui/samples/controls/Makefile.am,v
retrieving revision 1.24
diff -u -r1.24 Makefile.am
--- Makefile.am	6 Nov 2002 11:11:56 -0000	1.24
+++ Makefile.am	28 Jun 2004 08:29:41 -0000
@@ -1,3 +1,5 @@
+bin_PROGRAMS = sample-control-container
+
 Bonobo_Sample_Controls.server.in: Bonobo_Sample_Controls.server.in.in
 	sed -e "s|\@prefix\@|$(prefix)|" $< > $@
 
@@ -16,6 +18,15 @@
 	$(top_builddir)/bonobo/libbonoboui-2.la		\
 	$(BONOBOUI_LIBS)				\
 	$(INTLLIBS)
+
+sample_control_container_SOURCES =                      \
+        sample-control-container.c
+
+sample_control_container_LDADD =                        \
+	$(top_builddir)/bonobo/libbonoboui-2.la 	\
+        $(BONOBOX_TEST_LIBS)                            \
+        $(INTLLIBS)
+
 
 serverdir = $(libdir)/bonobo/servers
 server_in_files = Bonobo_Sample_Controls.server.in
Index: bonobo-sample-controls.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/samples/controls/bonobo-sample-controls.c,v
retrieving revision 1.14
diff -u -r1.14 bonobo-sample-controls.c
--- bonobo-sample-controls.c	10 Jun 2003 13:12:12 -0000	1.14
+++ bonobo-sample-controls.c	28 Jun 2004 08:29:41 -0000
@@ -11,25 +11,6 @@
 #include <string.h>
 #include <libbonoboui.h>
 #include <libgnomecanvas/gnome-canvas-widget.h>
-#undef USE_SCROLLED
-
-static void
-activate_cb (GtkEditable *editable, BonoboControl *control)
-{
-	GtkWidget *dialog;
-
-	dialog = gtk_message_dialog_new (
-		NULL, 0, GTK_MESSAGE_INFO,
-		GTK_BUTTONS_OK,
-		"This dialog demonstrates transient dialogs");
-
-	bonobo_control_set_transient_for (
-		control, GTK_WINDOW (dialog), NULL);
-
-	gtk_dialog_run (GTK_DIALOG (dialog));
-
-	gtk_widget_destroy (dialog);
-}
 
 BonoboObject *
 bonobo_entry_control_new (void)
@@ -45,60 +26,9 @@
 	
 	/* Create the control. */
 
-	box = gtk_vbox_new (FALSE, 0);
-	for (i = 0; i < 3; i++) {
-		entry = gtk_entry_new ();
-		gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 0);
-		gtk_widget_show (entry);
-	}
-
-	gtk_widget_show (box);
-
-#ifdef USE_SCROLLED
-	{
-		GtkWidget *canvas, *scrolled;
-		GnomeCanvasItem *item;
-		
-		canvas = gnome_canvas_new ();
-		gtk_widget_show (canvas);
-		
-		item = gnome_canvas_item_new (
-			gnome_canvas_root (GNOME_CANVAS (canvas)),
-			GNOME_TYPE_CANVAS_WIDGET,
-			"x", 0.0, "y", 0.0, "width", 100.0,
-			"height", 100.0, "widget", box, NULL);
-		gnome_canvas_item_show (item);
-
-		scrolled = gtk_scrolled_window_new (NULL, NULL);
-		gtk_scrolled_window_set_policy (
-			GTK_SCROLLED_WINDOW (scrolled),
-			GTK_POLICY_AUTOMATIC,
-			GTK_POLICY_AUTOMATIC);
-
-		gtk_container_add (
-			GTK_CONTAINER (scrolled), canvas);
-		gtk_widget_show (scrolled);
-
-		control = bonobo_control_new (scrolled);
-	}
-#else
-	control = bonobo_control_new (box);
-#endif
-	pb = bonobo_property_bag_new (NULL, NULL, NULL);
-	bonobo_control_set_properties (control, BONOBO_OBJREF (pb), NULL);
-	bonobo_object_unref (BONOBO_OBJECT (pb));
-
-	g_signal_connect (
-		GTK_OBJECT (entry), "activate",
-		G_CALLBACK (activate_cb), control);
-
-	pspecs = g_object_class_list_properties (
-		G_OBJECT_GET_CLASS (entry), &n_pspecs);
-
-	bonobo_property_bag_map_params (
-		pb, G_OBJECT (entry), (const GParamSpec **)pspecs, n_pspecs);
-
-	g_free (pspecs);
+	entry = gtk_entry_new ();
+	gtk_widget_show (entry);
+	control = bonobo_control_new (entry);
 
 	bonobo_control_life_instrument (control);
 
Index: sample-control-container.c
===================================================================
RCS file: sample-control-container.c
diff -N sample-control-container.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sample-control-container.c	28 Jun 2004 08:29:41 -0000
@@ -0,0 +1,90 @@
+/*
+ * sample-control-container.c
+ * 
+ * Authors:
+ *   Nat Friedman  (nat@helixcode.com)
+ *   Michael Meeks (michael@helixcode.com)
+ *
+ * Copyright 1999, 2000 Helix Code, Inc.
+ */
+#include <config.h>
+#include <string.h>
+#include <libbonoboui.h>
+#include <libgnomecanvas/gnome-canvas-widget.h>
+
+
+Bonobo_PropertyBag pb = CORBA_OBJECT_NIL;
+
+static guint
+container_create (void)
+{
+	GtkWidget       *control;
+	GtkWidget       *proplist;
+	GtkWidget       *box;
+	GtkWidget       *button;
+	GtkWidget       *clock_button;
+	BonoboUIContainer *uic;
+	BonoboControlFrame *cf;
+	GtkWindow       *window;
+	GtkWidget       *app;
+
+	app = bonobo_window_new ("sample-control-container",
+			      "Sample Bonobo Control Container");
+
+	window = GTK_WINDOW (app);
+	
+	box = gtk_vbox_new (FALSE, 0);
+	bonobo_window_set_contents (BONOBO_WINDOW (app), box);
+
+	GtkWidget * label = NULL;
+	label = gtk_label_new_with_mnemonic ("_activate test");
+	button = gtk_button_new();
+	
+	gtk_container_add (button, label);
+	control = bonobo_widget_new_control ("OAFIID:Bonobo_Sample_Entry",
+					     BONOBO_OBJREF (uic));
+	gtk_label_set_mnemonic_widget (label, control);
+
+	if (control)
+		gtk_box_pack_start (GTK_BOX (box), control, TRUE, TRUE, 0);
+
+	gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
+
+	gtk_widget_show_all (GTK_WIDGET (window));
+
+	return FALSE;
+}
+
+int
+main (int argc, char **argv)
+{
+        GnomeProgram *program;
+        poptContext popt_context;
+                                                                                                                             
+        static gboolean use_gtk_window = FALSE;
+        static struct poptOption options[] = {
+                {"gtk", 'g', POPT_ARG_NONE, &use_gtk_window, 0,
+                 "Use GtkWindow instead of BonoboWindow (default)", NULL},
+                POPT_AUTOHELP POPT_TABLEEND
+        };
+
+
+       program = gnome_program_init ( "control-test", "1.0",
+                                       LIBBONOBOUI_MODULE,
+                                       argc, argv,
+                                       GNOME_PARAM_POPT_TABLE, options,
+                                       GNOME_PARAM_NONE );
+                                                                                                                             
+        g_object_get ( program, GNOME_PARAM_POPT_CONTEXT, &popt_context,
+                       NULL );
+
+	/*
+	 * We can't make any CORBA calls unless we're in the main
+	 * loop.  So we delay creating the container here.
+	 */
+	gtk_idle_add ((GtkFunction) container_create, NULL);
+
+	bonobo_main ();
+
+	return 0;
+}
