Bonobo API Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# BonoboSelector

## Name

BonoboSelector -- a component selector widget

## Synopsis

    typedef     BonoboSelector;
    typedef     BonoboSelectorClass;
    GtkWidget*  bonobo_selector_new             (const gchar *title,
                                                 const gchar **interfaces_required);
    GtkWidget*  bonobo_selector_construct       (BonoboSelector *sel,
                                                 const gchar *title,
                                                 BonoboSelectorWidget *selector);
    gchar*      bonobo_selector_get_selected_id (BonoboSelector *sel);
    gchar*      bonobo_selector_get_selected_name
                                                (BonoboSelector *sel);
    gchar*      bonobo_selector_get_selected_description
                                                (BonoboSelector *sel);
    gchar*      bonobo_selector_select_id       (const gchar *title,
                                                 const gchar **interfaces_required);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkContainer
                   +----GtkBin
                         +----GtkWindow
                               +----GnomeDialog
                                     +----BonoboSelector

## Signal Prototypes

    "ok"        void        user_function      (BonoboSelector *bonoboselector,
                                                gpointer user_data);
    "cancel"    void        user_function      (BonoboSelector *bonoboselector,
                                                gpointer user_data);

## Description

This GnomeDialog allows the user to select a component implementing a set of interfaces. The easiest way to do this in your code is by using:

Example 1. Simple Bonobo/Control selection

    {
    	char *interfaces [] = { "IDL:Bonobo/Control:1.0", NULL };
    	char *oaf_iid;

    	oaf_iid = bonobo_selector_select_id (
    		_("Please select a Control"), interfaces);

    	g_warning ("You selected 's'", oaf_iid);

    	g_free (oaf_iid);
    }

This will throw up a dialog containing all the available components implementing the IDL:Bonobo/Control:1.0 interface and list them for the user to select.

## Details

### BonoboSelector

    typedef struct {
    	GnomeDialog dialog;

    	BonoboSelectorPrivate *priv;
    } BonoboSelector;

### BonoboSelectorClass

    typedef struct {
    	GnomeDialogClass parent_class;

    	void (* ok)	(BonoboSelector *sel);
    	void (* cancel)	(BonoboSelector *sel);
    } BonoboSelectorClass;

### bonobo_selector_new ()

    GtkWidget*  bonobo_selector_new             (const gchar *title,
                                                 const gchar **interfaces_required);

Creates a new BonoboSelector widget. The title of the dialog is set to `title`, and the list of selectable servers is populated with those servers which support the interfaces specified in `interfaces_required`.

`title` : | A string which should go in the title of the BonoboSelector window.
`interfaces_required` : | A NULL_terminated array of interfaces which a server must support in order to be listed in the selector. Defaults to "IDL:Bonobo/Embeddable:1.0" if no interfaces are listed.
Returns : | A pointer to the newly-created BonoboSelector widget.

### bonobo_selector_construct ()

    GtkWidget*  bonobo_selector_construct       (BonoboSelector *sel,
                                                 const gchar *title,
                                                 BonoboSelectorWidget *selector);

Constructs the innards of a bonobo selector window.

`sel` : | the selector to construct
`title` : | the title for the window
`selector` : | the component view widget to put inside it.
Returns : | the constructed widget.

### bonobo_selector_get_selected_id ()

    gchar*      bonobo_selector_get_selected_id (BonoboSelector *sel);

`sel` : | A BonoboSelector widget.
Returns : | A newly-allocated string containing the ID of the currently-selected CORBA server (i.e., the corba server whose name is highlighted in the list). The user of this function is responsible for freeing this. It will give an oaf iid back.

### bonobo_selector_get_selected_name ()

    gchar*      bonobo_selector_get_selected_name
                                                (BonoboSelector *sel);

`sel` : | A BonoboSelector widget.
Returns : | A newly-allocated string containing the name of the currently-selected CORBA server (i.e., the corba server whose name is highlighted in the list). The user of this function is responsible for freeing this.

### bonobo_selector_get_selected_description ()

    gchar*      bonobo_selector_get_selected_description
                                                (BonoboSelector *sel);

`sel` : | A BonoboSelector widget.
Returns : | A newly-allocated string containing the description of the currently-selected CORBA server (i.e., the corba server whose name is highlighted in the list). The user of this function is responsible for freeing this.

### bonobo_selector_select_id ()

    gchar*      bonobo_selector_select_id       (const gchar *title,
                                                 const gchar **interfaces_required);

Calls bonobo_selector_new() to create a new BonoboSelector widget with the specified paramters, `title` and `interfaces_required`. Then runs the dialog modally and allows the user to make a selection.

`title` : | The title to be used for the dialog.
`interfaces_required` : | A list of required interfaces. See bonobo_selector_new().
Returns : | The Oaf IID of the selected server, or NULL if no server is selected. The ID string has been allocated with g_strdup.

## Signals

### The "ok" signal

    void        user_function                  (BonoboSelector *bonoboselector,
                                                gpointer user_data);

`bonoboselector` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The "cancel" signal

    void        user_function                  (BonoboSelector *bonoboselector,
                                                gpointer user_data);

`bonoboselector` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

<<< Previous Page | Home | Up | Next Page >>>
BonoboWrapper | bonobo-async