BluetoothChooser

BluetoothChooser — a Bluetooth chooser widget

Stability Level

Stable, unless otherwise indicated

Properties

BluetoothCategory device-category-filter Read / Write / Construct
gchar * device-selected Read / Write
gchar * device-service-filter Write
gint device-type-filter Read / Write / Construct
gboolean has-internal-device-filter Read / Write / Construct Only
gboolean show-connected Read / Write
gboolean show-device-category Read / Write / Construct
gboolean show-device-type Read / Write / Construct
gboolean show-device-type-column Read / Write / Construct
gboolean show-pairing Read / Write
gboolean show-searching Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBox
                    ╰── BluetoothChooser

Implemented Interfaces

BluetoothChooser implements AtkImplementorIface, GtkBuildable and GtkOrientable.

Includes

#include <bluetooth-chooser.h>

Description

A tree-like widget used to select Bluetooth devices.

Functions

bluetooth_chooser_dump_selected_device ()

void
bluetooth_chooser_dump_selected_device
                               (BluetoothChooser *self);

Prints all the known attributes for the currently selected device on the standard output. Useful for debugging.

Parameters

self

A BluetoothChooser widget.

 

bluetooth_chooser_get_scrolled_window ()

GtkWidget *
bluetooth_chooser_get_scrolled_window (BluetoothChooser *self);

Returns the GtkScrolledWindow object for the BluetoothChooser. This is useful to set a minimum height to the chooser using gtk_scrolled_window_set_min_content_height() or to join the chooser with a toolbar.

Parameters

self

A BluetoothChooser widget.

 

Returns

a GtkScrolledWindow object.

[transfer none]


bluetooth_chooser_get_selected_device ()

char *
bluetooth_chooser_get_selected_device (BluetoothChooser *self);

Returns the Bluetooth address for the currently selected device.

Parameters

self

a BluetoothChooser widget.

 

Returns

the Bluetooth address for the currently selected device, or NULL.


bluetooth_chooser_get_selected_device_icon ()

char *
bluetooth_chooser_get_selected_device_icon
                               (BluetoothChooser *self);

Returns the icon name to use to represent the currently selected device.

Parameters

self

a BluetoothChooser widget.

 

Returns

the icon name to use to represent the currently selected device, or NULL.


bluetooth_chooser_get_selected_device_info ()

gboolean
bluetooth_chooser_get_selected_device_info
                               (BluetoothChooser *self,
                                const char *field,
                                GValue *value);

Returns whether the value has been set.

Parameters

self

A BluetoothChooser widget.

 

field

The identifier for the field to get data for.

 

value

An empty GValue to set.

 

Returns

TRUE if the value has been set.


bluetooth_chooser_get_selected_device_is_connected ()

gboolean
bluetooth_chooser_get_selected_device_is_connected
                               (BluetoothChooser *self);

Returns whether the selected device is connected to this computer.

Parameters

self

a BluetoothChooser widget.

 

Returns

whether the selected device is connected to this computer, will always be FALSE if no devices are selected.


bluetooth_chooser_get_selected_device_name ()

char *
bluetooth_chooser_get_selected_device_name
                               (BluetoothChooser *self);

Returns the name for the currently selected device.

Parameters

self

a BluetoothChooser widget.

 

Returns

the name for the currently selected device, or NULL.


bluetooth_chooser_get_selected_device_type ()

BluetoothType
bluetooth_chooser_get_selected_device_type
                               (BluetoothChooser *self);

Returns the BluetoothType of the device selected.

Parameters

self

a BluetoothChooser widget.

 

Returns

the BluetoothType of the device selected, or '0' if unknown.


bluetooth_chooser_new ()

GtkWidget *
bluetooth_chooser_new (void);

Returns a new BluetoothChooser widget.

Returns

A BluetoothChooser widget


bluetooth_chooser_start_discovery ()

void
bluetooth_chooser_start_discovery (BluetoothChooser *self);

Starts a discovery on the default Bluetooth adapter. Note that this will only work if the Search label is visible, as otherwise the user has no visual feedback that the process is on-going.

See also: “show-searching”

Parameters

self

a BluetoothChooser widget.

 

bluetooth_chooser_stop_discovery ()

void
bluetooth_chooser_stop_discovery (BluetoothChooser *self);

Stops a discovery started with bluetooth_chooser_start_discovery.

Parameters

self

a BluetoothChooser widget.

 

Types and Values

struct BluetoothChooser

struct BluetoothChooser;

The BluetoothChooser struct contains only private fields and should not be directly accessed.

Property Details

The “device-category-filter” property

  “device-category-filter”   BluetoothCategory

The #BluetoothCategory to show.

Flags: Read / Write / Construct

Default value: BLUETOOTH_CATEGORY_ALL


The “device-selected” property

  “device-selected”          gchar *

The Bluetooth address for the currently selected device, or %NULL.

Flags: Read / Write

Default value: NULL


The “device-service-filter” property

  “device-service-filter”    gchar *

A string representing the service to filter for.

Flags: Write

Default value: NULL


The “device-type-filter” property

  “device-type-filter”       gint

A bitmask of #BluetoothType to show.

Flags: Read / Write / Construct

Allowed values: [1,1048575]

Default value: 1


The “has-internal-device-filter” property

  “has-internal-device-filter” gboolean

Whether the #BluetoothChooser should be constructed with a visible #BluetoothFilterWidget.

Flags: Read / Write / Construct Only

Default value: TRUE


The “show-connected” property

  “show-connected”           gboolean

Whether to show the connected column in the tree.

Flags: Read / Write

Default value: FALSE


The “show-device-category” property

  “show-device-category”     gboolean

Whether to show the device category filter.

Flags: Read / Write / Construct

Default value: TRUE


The “show-device-type” property

  “show-device-type”         gboolean

Whether to show the device type filter.

Flags: Read / Write / Construct

Default value: TRUE


The “show-device-type-column” property

  “show-device-type-column”  gboolean

Whether to show the device type column.

Flags: Read / Write / Construct

Default value: TRUE


The “show-pairing” property

  “show-pairing”             gboolean

Whether to show the pairing column in the tree.

Flags: Read / Write

Default value: FALSE


The “show-searching” property

  “show-searching”           gboolean

Whether to show the Searching label , this is necessary if you want to programmatically start a discovery, using bluetooth_chooser_start_discovery().

Flags: Read / Write

Default value: FALSE

Signal Details

The “selected-device-activated” signal

void
user_function (BluetoothChooser *chooser,
               gchar            *address,
               gpointer          user_data)

The “selected-device-activated” signal is launched when a device is double-clicked in the chooser.

Parameters

chooser

a BluetoothChooser widget which received the signal

 

address

the Bluetooth address for the currently selected device, or NULL

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “selected-device-changed” signal

void
user_function (BluetoothChooser *chooser,
               gchar            *address,
               gpointer          user_data)

The “selected-device-changed” signal is launched when the selected device is changed, it will be NULL if a device was unselected.

Parameters

chooser

a BluetoothChooser widget which received the signal

 

address

the Bluetooth address for the currently selected device, or NULL

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last