File: bonobo-widget.c

package info (click to toggle)
bonobo 1.0.22-2.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,412 kB
  • ctags: 5,445
  • sloc: ansic: 51,714; sh: 7,733; makefile: 1,425; yacc: 318; xml: 266; sed: 16
file content (709 lines) | stat: -rw-r--r-- 19,302 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
 * bonobo-widget.c: BonoboWidget object.
 *
 * Authors:
 *   Nat Friedman    (nat@helixcode.com)
 *
 * Copyright 1999 Helix Code, Inc.
 * 
 * Bonobo component embedding for hydrocephalic imbeciles.
 *
 * Pure cane sugar.
 *
 * This purpose of BonoboWidget is to make container-side use of
 * Bonobo as easy as pie.  This widget has two functions:
 *
 *   1. Provide a simple wrapper for embedding a single-view
 *      subdocument.  In this case, BonoboWidget handles creating
 *      the embeddable, binding it to a local BonoboClientSite,
 *      creating a view for it, and displaying the view.  You can use
 *      the accessor functions (bonobo_widget_get_view_frame,
 *      etc) to get at the actual Bonobo objects which underlie the
 *      whole process.
 *
 *      In order to do this, just call:
 * 
 *        bw = bonobo_widget_new_subdoc ("moniker of subdoc embddable",
 *                                        top_level_uicontainer);
 * 
 *      And then insert the 'bw' widget into the widget tree of your
 *      application like so:
 *
 *        gtk_container_add (some_container, bw);
 *
 *      You are free to make the UIContainer argument to
 *      bonobo_widget_new_subdoc() be CORBA_OBJECT_NIL.
 *
 *   2. Provide a simple wrapper for embedding Controls.  Embedding
 *      controls is already really easy, but BonoboWidget reduces
 *      the work from about 5 lines to 1.  To embed a given control,
 *      just do:
 *
 *        bw = bonobo_widget_new_control ("moniker for control");
 *        gtk_container_add (some_container, bw);
 *
 *      Ta da!
 *
 *      NB. A simple moniker might look like 'file:/tmp/a.jpeg' or
 *      OAFIID:GNOME_Evolution_Calendar_Control
 */

#include <config.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkmarshal.h>
#include <bonobo/Bonobo.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>

struct _BonoboWidgetPrivate {

	BonoboObjectClient *server;

	/*
	 * Control stuff.
	 */
	BonoboControlFrame *control_frame;
	
	/*
	 * Subdocument (Embeddable/View) things.
	 */
	BonoboItemContainer *container;
	BonoboClientSite    *client_site;
	BonoboViewFrame     *view_frame;
	Bonobo_UIContainer   uic;
};

static BonoboWrapperClass *bonobo_widget_parent_class;

static BonoboObjectClient *
bonobo_widget_launch_component (const char *moniker,
				const char *if_name)
{
	Bonobo_Unknown corba_ref;
	BonoboObjectClient *server;
	CORBA_Environment ev;

	CORBA_exception_init (&ev);
	corba_ref = bonobo_get_object (moniker, if_name, &ev);

	if (BONOBO_EX (&ev)) {
		char *txt;
		g_warning ("Activation exception '%s'",
			   (txt = bonobo_exception_get_text (&ev)));
		g_free (txt);
		server = CORBA_OBJECT_NIL;
	}

	CORBA_exception_free (&ev);

	if (corba_ref == CORBA_OBJECT_NIL)
		return NULL;

	return bonobo_object_client_from_corba (corba_ref);
}


/*
 *
 * Control support for BonoboWidget.
 *
 */
/**
 * bonobo_widget_construct_control_from_objref:
 * @bw: A BonoboWidget to construct
 * @control: A CORBA Object reference to an IDL:Bonobo/Control:1.0
 * @uic: Bonobo_UIContainer for the launched object.
 *
 * This is a constructor function.  Only usable for wrapping and
 * derivation of new objects.  For normal use, please refer to
 * #bonobo_widget_new_control_from_objref.
 *
 * Returns: A #BonoboWidget (the @bw)
 */
BonoboWidget *
bonobo_widget_construct_control_from_objref (BonoboWidget      *bw,
					     Bonobo_Control     control,
					     Bonobo_UIContainer uic)
{
	GtkWidget    *control_frame_widget;

	/*
	 * Create a local ControlFrame for it.
	 */
	bw->priv->control_frame = bonobo_control_frame_new (uic);

	bonobo_control_frame_bind_to_control (bw->priv->control_frame, control);

	/*
	 * People that pass us controls get them sunk.
	 */
	bonobo_object_release_unref (control, NULL);

	bonobo_control_frame_set_autoactivate (bw->priv->control_frame, TRUE);

	/*
	 * Grab the actual widget which visually contains the remote
	 * Control.  This is a GtkSocket, in reality.
	 */
	control_frame_widget = bonobo_control_frame_get_widget (bw->priv->control_frame);

	/*
	 * Now stick it into this BonoboWidget.
	 */
	gtk_container_add (GTK_CONTAINER (bw),
			   control_frame_widget);
	gtk_widget_show (control_frame_widget);

	if (uic != CORBA_OBJECT_NIL)
		bw->priv->uic = bonobo_object_dup_ref (uic, NULL);

	return bw;
}

/**
 * bonobo_widget_construct_control:
 * @bw: A BonoboWidget to construct
 * @moniker: A Moniker describing the object to be activated 
 * @uic: Bonobo_UIContainer for the launched object.
 *
 * This is a constructor function.  Only usable for wrapping and
 * derivation of new objects.  For normal use, please refer to
 * #bonobo_widget_new_control.
 *
 * This function will unref the passed in @bw in case it cannot launch
 * the component and return %NULL in such a case.  Otherwise it returns
 * the @bw itself.
 *
 * Returns: A #BonoboWidget or %NULL
 */
BonoboWidget *
bonobo_widget_construct_control (BonoboWidget      *bw,
				 const char        *moniker,
				 Bonobo_UIContainer uic)
{
	Bonobo_Control control;

	/*
	 * Create the remote Control object.
	 */
	bw->priv->server = bonobo_widget_launch_component (
		moniker, "IDL:Bonobo/Control:1.0");
	if (bw->priv->server == NULL) {
		gtk_object_unref (GTK_OBJECT (bw));
		return NULL;
	}

	control = BONOBO_OBJREF (bw->priv->server);

	return bonobo_widget_construct_control_from_objref (bw, control, uic);
}

/**
 * bonobo_widget_new_control_from_objref:
 * @control: A CORBA Object reference to an IDL:Bonobo/Control:1.0
 * @uic: Bonobo_UIContainer for the launched object.
 *
 * This function is a simple wrapper for easily embedding controls
 * into applications.  This function is used when you have already
 * a CORBA object reference to an IDL:Bonobo/Control:1.0 (the
 * @control) argument. 
 *
 * Returns: the @control wrapped as a #GtkWidget.
 */
GtkWidget *
bonobo_widget_new_control_from_objref (Bonobo_Control     control,
				       Bonobo_UIContainer uic)
{
	BonoboWidget *bw;

	g_return_val_if_fail (control != CORBA_OBJECT_NIL, NULL);

	bw = gtk_type_new (BONOBO_WIDGET_TYPE);

	bw = bonobo_widget_construct_control_from_objref (bw, control, uic);

	if (bw == NULL)
		return NULL;

	return GTK_WIDGET (bw);
}

/**
 * bonobo_widget_new_control:
 * @moniker: A Moniker describing the object to be activated 
 * @uic: Bonobo_UIContainer for the launched object.
 *
 * This function is a simple wrapper for easily embedding controls
 * into applications.  It will launch the component identified by @id
 * and will return it as a GtkWidget.
 *
 * Returns: A #GtkWidget that is bound to the Bonobo Control. 
 */
GtkWidget *
bonobo_widget_new_control (const char        *moniker,
			   Bonobo_UIContainer uic)
{
	BonoboWidget *bw;

	g_return_val_if_fail (moniker != NULL, NULL);

	bw = gtk_type_new (BONOBO_WIDGET_TYPE);

	bw = bonobo_widget_construct_control (bw, moniker, uic);

	if (bw == NULL)
		return NULL;
	else
		return GTK_WIDGET (bw);
}

/**
 * bonobo_widget_get_control_frame:
 * @bonobo_widget: a Bonobo Widget returned by one of the bonobo_widget_new() functions.
 *
 * Every IDL:Bonobo/Control:1.0 needs to be placed inside an
 * IDL:Bonobo/ControlFrame:1.0.  This returns the BonoboControlFrame
 * object that wraps the Control in the @bonobo_widget. 
 * 
 * Returns: The BonoboControlFrame associated with the @bonobo_widget
 */
BonoboControlFrame *
bonobo_widget_get_control_frame (BonoboWidget *bonobo_widget)
{
	g_return_val_if_fail (bonobo_widget != NULL, NULL);
	g_return_val_if_fail (BONOBO_IS_WIDGET (bonobo_widget), NULL);

	return bonobo_widget->priv->control_frame;
}


/*
 *
 * Subdocument support for BonoboWidget.
 *
 */
static BonoboWidget *
bonobo_widget_create_subdoc_object (BonoboWidget      *bw,
				    const char        *moniker,
				    Bonobo_UIContainer uic)
{
	GtkWidget *view_widget;
	
	/*
	 * Create the BonoboContainer.  This will contain
	 * just one BonoboClientSite.
	 */
	bw->priv->container = bonobo_item_container_new ();

	bw->priv->server = bonobo_widget_launch_component (
		moniker, "IDL:Bonobo/Embeddable:1.0");
	if (bw->priv->server == NULL)
		return NULL;
	
	/*
	 * Create the client site.  This is the container-side point
	 * of contact for the remote component.
	 */
	bw->priv->client_site = bonobo_client_site_new (bw->priv->container);

	/*
	 * Bind the local ClientSite object to the remote Embeddable
	 * component.
	 */
	if (!bonobo_client_site_bind_embeddable (bw->priv->client_site, bw->priv->server))
		return NULL;

	/*
	 * Now create a new view for the remote object.
	 */
	bw->priv->view_frame = bonobo_client_site_new_view (bw->priv->client_site, uic);

	/*
	 * Add the view frame.
	 */
	view_widget = bonobo_view_frame_get_wrapper (bw->priv->view_frame);
	gtk_container_add (GTK_CONTAINER (bw), view_widget);
	gtk_widget_show (view_widget);

	if (uic != CORBA_OBJECT_NIL)
		bw->priv->uic = bonobo_object_dup_ref (uic, NULL);
	
	return bw;
}

/**
 * bonobo_widget_new_subdoc:
 * @moniker: A moniker description of the Object to be activated.
 * @uic: Bonobo_UIContainer for the launched object.
 *
 * This function is a simple wrapper for easily embedding documents
 * into applications.  It will launch the component identified by @id
 * and will return it as a GtkWidget.
 *
 * This will launch a single view of the embeddable activated by @moniker.
 *
 * FIXME: this function should really be using bonobo_get_object() instead
 * of bonobo_activate_object() to launch the object.
 *
 * Returns: A #GtkWidget that is bound to the Bonobo Control. 
 */
GtkWidget *
bonobo_widget_new_subdoc (const char        *moniker,
			  Bonobo_UIContainer uic)
{
	BonoboWidget *bw;

	g_return_val_if_fail (moniker != NULL, NULL);

	bw = gtk_type_new (BONOBO_WIDGET_TYPE);

	if (bw == NULL)
		return NULL;

	if (!bonobo_widget_create_subdoc_object (bw, moniker, uic)) {
		gtk_object_destroy (GTK_OBJECT (bw));
		return NULL;
	}
 
	bonobo_view_frame_set_covered (bw->priv->view_frame, FALSE);

	return GTK_WIDGET (bw);
}

/**
 * bonobo_widget_get_container
 * @bonobo_widget: the #BonoboWidget to query.
 *
 * This operation is only valid for BonoboWidgets that were created
 * by the bonobo_widget_new_subdoc(). 
 *
 * Returns: the BonoboItemContainer associated with this @bonobo_widget
 */
BonoboItemContainer *
bonobo_widget_get_container (BonoboWidget *bonobo_widget)
{
	g_return_val_if_fail (bonobo_widget != NULL, NULL);
	g_return_val_if_fail (BONOBO_IS_WIDGET (bonobo_widget), NULL);

	return bonobo_widget->priv->container;
}

/**
 * bonobo_widget_get_client_site:
 * @bonobo_widget: the #BonoboWidget to query.
 *
 * This operation is only valid for BonoboWidgets that were created
 * by the bonobo_widget_new_subdoc(). 
 *
 * Returns: the #BonoboClientSite associated with this @bonobo_widget
 */
BonoboClientSite *
bonobo_widget_get_client_site (BonoboWidget *bonobo_widget)
{
	g_return_val_if_fail (bonobo_widget != NULL, NULL);
	g_return_val_if_fail (BONOBO_IS_WIDGET (bonobo_widget), NULL);

	return bonobo_widget->priv->client_site;
}

/**
 * bonobo_widget_get_view_frame:
 * @bonobo_widget: the #BonoboWidget to query.
 *
 * This operation is only valid for BonoboWidgets that were created
 * by the bonobo_widget_new_subdoc(). 
 *
 * Returns: The #BonoboViewFrame associated with this @bonobo_widget.
 */
BonoboViewFrame *
bonobo_widget_get_view_frame (BonoboWidget *bonobo_widget)
{
	g_return_val_if_fail (bonobo_widget != NULL, NULL);
	g_return_val_if_fail (BONOBO_IS_WIDGET (bonobo_widget), NULL);

	return bonobo_widget->priv->view_frame;
}

/**
 * bonobo_widget_get_uih:
 * @bonobo_widget: the #BonoboWidget to query.
 *
 * Returns: the CORBA object reference to the Bonobo_UIContainer
 * associated with the @bonobo_widget.
 */
Bonobo_UIContainer
bonobo_widget_get_uih (BonoboWidget *bonobo_widget)
{
	g_return_val_if_fail (bonobo_widget != NULL, NULL);
	g_return_val_if_fail (BONOBO_IS_WIDGET (bonobo_widget), NULL);

	return bonobo_widget->priv->uic;
}



/*
 *
 * Generic (non-control/subdoc specific) BonoboWidget stuff.
 *
 */

/**
 * bonobo_widget_get_server:
 * @bonobo_widget: the #BonoboWidget to query.
 *
 * Returns: The BonoboObjectClient (a wrapper for the CORBA object
 * reference) to the object that this BonoboWidget is wrapping. 
 */ 
BonoboObjectClient *
bonobo_widget_get_server (BonoboWidget *bonobo_widget)
{
	g_return_val_if_fail (bonobo_widget != NULL, NULL);
	g_return_val_if_fail (BONOBO_IS_WIDGET (bonobo_widget), NULL);

	return bonobo_widget->priv->server;
}

Bonobo_Unknown
bonobo_widget_get_objref (BonoboWidget *bonobo_widget)
{
	g_return_val_if_fail (bonobo_widget != NULL, NULL);
	g_return_val_if_fail (BONOBO_IS_WIDGET (bonobo_widget), NULL);

	return BONOBO_OBJREF (bonobo_widget->priv->server);
}

static void
bonobo_widget_destroy (GtkObject *object)
{
	BonoboWidget *bw = BONOBO_WIDGET (object);
	BonoboWidgetPrivate *priv = bw->priv;
	
	if (priv->control_frame)
		bonobo_object_unref (BONOBO_OBJECT (priv->control_frame));
	if (priv->container)
		bonobo_object_unref (BONOBO_OBJECT (priv->container));
	if (priv->client_site)
		bonobo_object_unref (BONOBO_OBJECT (priv->client_site));
	if (priv->view_frame)
		bonobo_object_unref (BONOBO_OBJECT (priv->view_frame));
	if (priv->uic != CORBA_OBJECT_NIL)
		bonobo_object_release_unref (priv->uic, NULL);

	g_free (priv);
	GTK_OBJECT_CLASS (bonobo_widget_parent_class)->destroy (object);
}

static void
bonobo_widget_size_request (GtkWidget *widget,
			    GtkRequisition *requisition)
{
	GtkBin *bin;

	g_return_if_fail (widget != NULL);
	g_return_if_fail (BONOBO_IS_WIDGET (widget));
	g_return_if_fail (requisition != NULL);

	bin = GTK_BIN (widget);

	if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
		GtkRequisition child_requisition;
      
		gtk_widget_size_request (bin->child, &child_requisition);

		requisition->width = child_requisition.width;
		requisition->height = child_requisition.height;
	}
}

static void
bonobo_widget_size_allocate (GtkWidget *widget,
			     GtkAllocation *allocation)
{
	GtkBin *bin;
	GtkAllocation child_allocation;

	g_return_if_fail (widget != NULL);
	g_return_if_fail (BONOBO_IS_WIDGET (widget));
	g_return_if_fail (allocation != NULL);

	widget->allocation = *allocation;
	bin = GTK_BIN (widget);

	child_allocation.x = allocation->x;
	child_allocation.y = allocation->y;
	child_allocation.width = allocation->width;
	child_allocation.height = allocation->height;

	if (bin->child) {
		gtk_widget_size_allocate (bin->child, &child_allocation);
	}
}

static void
bonobo_widget_class_init (BonoboWidgetClass *klass)
{
	GtkObjectClass *object_class = (GtkObjectClass *) klass;
	GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;

	bonobo_widget_parent_class = gtk_type_class (GTK_TYPE_BIN);

	widget_class->size_request = bonobo_widget_size_request;
	widget_class->size_allocate = bonobo_widget_size_allocate;

	object_class->destroy = bonobo_widget_destroy;
}

static void
bonobo_widget_init (BonoboWidget *bw)
{
	bw->priv = g_new0 (BonoboWidgetPrivate, 1);
}

GtkType
bonobo_widget_get_type (void)
{
	static GtkType type = 0;

	if (! type) {
		static const GtkTypeInfo info = {
			"BonoboWidget",
			sizeof (BonoboWidget),
			sizeof (BonoboWidgetClass),
			(GtkClassInitFunc) bonobo_widget_class_init,
			(GtkObjectInitFunc) bonobo_widget_init,
			NULL, /* reserved_1 */
			NULL, /* reserved_2 */
			(GtkClassInitFunc) NULL
		};

		type = gtk_type_unique (gtk_bin_get_type (), &info);
	}

	return type;
}

/**
 * bonobo_widget_set_property:
 * @control: A #BonoboWidget that represents an IDL:Bonobo/Control:1.0
 * @first_prop: first property name to set.
 *
 * This is a utility function used to set a number of properties
 * in the Bonobo Control in @control.
 *
 * This function takes a variable list of arguments that must be NULL
 * terminated.  Arguments come in tuples: a string (for the argument
 * name) and the data type that is to be transfered.  The
 * implementation of the actual setting of the PropertyBag values is
 * done by the bonobo_property_bag_client_setv() function).
 *
 * FIXME: This function is error prone because it depends on the
 * client and the server to agree on the data types to be sent.  If
 * the server arguments change the data type, this routine will not
 * be able to cope gracefully with this condition.
 *
 * This only works for BonoboWidgets that represent controls (ie,
 * that were returned by bonobo_widget_new_control_from_objref() or
 * bonobo_widget_new_control().
 */
void
bonobo_widget_set_property (BonoboWidget      *control,
			    const char        *first_prop, ...)
{
	Bonobo_PropertyBag pb;
	CORBA_Environment  ev;

	va_list args;
	va_start (args, first_prop);

	g_return_if_fail (control != NULL);
	g_return_if_fail (first_prop != NULL);
	g_return_if_fail (control->priv != NULL);
	g_return_if_fail (BONOBO_IS_WIDGET (control));

	CORBA_exception_init (&ev);
	
	pb = bonobo_control_frame_get_control_property_bag (
		control->priv->control_frame, &ev);

	if (BONOBO_EX (&ev))
		g_warning ("Error getting property bag from control");
	else {
		/* FIXME: this should use ev */
		char *err = bonobo_property_bag_client_setv (pb, &ev, first_prop, args);

		if (err)
			g_warning ("Error '%s'", err);
	}

	bonobo_object_release_unref (pb, &ev);

	CORBA_exception_free (&ev);

	va_end (args);
}


/**
 * bonobo_widget_get_property:
 * @control: A #BonoboWidget that represents an IDL:Bonobo/Control:1.0
 * @first_prop: first property name to set.
 *
 * This is a utility function used to get a number of properties
 * in the Bonobo Control in @control.
 *
 * This function takes a variable list of arguments that must be NULL
 * terminated.  Arguments come in tuples: a string (for the argument
 * name) and a pointer where the data will be stored.  The
 * implementation of the actual setting of the PropertyBag values is
 * done by the bonobo_property_bag_client_setv() function).
 *
 * FIXME: This function is error prone because it depends on the
 * client and the server to agree on the data types to be sent.  If
 * the server arguments change the data type, this routine will not
 * be able to cope gracefully with this condition.
 *
 * This only works for BonoboWidgets that represent controls (ie,
 * that were returned by bonobo_widget_new_control_from_objref() or
 * bonobo_widget_new_control().
 */
void
bonobo_widget_get_property (BonoboWidget      *control,
			    const char        *first_prop, ...)
{
	Bonobo_PropertyBag pb;
	CORBA_Environment  ev;

	va_list args;
	va_start (args, first_prop);

	g_return_if_fail (control != NULL);
	g_return_if_fail (first_prop != NULL);
	g_return_if_fail (control->priv != NULL);
	g_return_if_fail (BONOBO_IS_WIDGET (control));

	CORBA_exception_init (&ev);
	
	pb = bonobo_control_frame_get_control_property_bag (
		control->priv->control_frame, &ev);

	if (BONOBO_EX (&ev))
		g_warning ("Error getting property bag from control");
	else {
		/* FIXME: this should use ev */
		char *err = bonobo_property_bag_client_getv (pb, &ev, first_prop, args);

		if (err)
			g_warning ("Error '%s'", err);
	}

	bonobo_object_release_unref (pb, &ev);

	CORBA_exception_free (&ev);

	va_end (args);
}