diff options
author | Bastien Nocera <hadess@hadess.net> | 2016-11-29 11:54:47 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2016-11-29 11:56:57 +0100 |
commit | 282ff9319d2e9aa3df0562013f80bf006f9c18b5 (patch) | |
tree | 0e081be9c6208949769f114abb359b06cc549615 | |
parent | 3f9fb482b4cc39ac95dcd92a66493461ca2748b4 (diff) | |
download | gnome-bluetooth-282ff9319d2e9aa3df0562013f80bf006f9c18b5.tar.gz |
lib: Add new function to display device types in filters
So that we can use this in situations where the device type is not known
yet.
-rw-r--r-- | lib/bluetooth-utils.c | 25 | ||||
-rw-r--r-- | lib/bluetooth-utils.h | 9 | ||||
-rw-r--r-- | lib/gnome-bluetooth.symbols | 1 |
3 files changed, 29 insertions, 6 deletions
diff --git a/lib/bluetooth-utils.c b/lib/bluetooth-utils.c index 5e78d16b..fa7f41a2 100644 --- a/lib/bluetooth-utils.c +++ b/lib/bluetooth-utils.c @@ -55,8 +55,6 @@ const gchar * bluetooth_type_to_string (BluetoothType type) { switch (type) { - case BLUETOOTH_TYPE_ANY: - return _("All types"); case BLUETOOTH_TYPE_PHONE: return _("Phone"); case BLUETOOTH_TYPE_MODEM: @@ -102,6 +100,29 @@ bluetooth_type_to_string (BluetoothType type) } /** + * bluetooth_type_to_filter_string: + * @type: a #BluetoothType + * + * Returns a human-readable string representation of @type usable for display to users, + * when type filters are displayed. Do not free the return value. + * The returned string is already translated with gettext(). + * + * Return value: a string. + **/ +const gchar * +bluetooth_type_to_filter_string (BluetoothType type) +{ + switch (type) { + case BLUETOOTH_TYPE_ANY: + return _("All types"); + default: + return bluetooth_type_to_string (type); + } + + g_assert_not_reached (); +} + +/** * bluetooth_verify_address: * @bdaddr: a string representing a Bluetooth address * diff --git a/lib/bluetooth-utils.h b/lib/bluetooth-utils.h index c27e1090..f78b950a 100644 --- a/lib/bluetooth-utils.h +++ b/lib/bluetooth-utils.h @@ -60,10 +60,11 @@ G_BEGIN_DECLS #define BLUETOOTH_UUID_GENERIC_NET 0x1201 #define BLUETOOTH_UUID_VDP_SOURCE 0x1303 -BluetoothType bluetooth_class_to_type (guint32 class); -const gchar *bluetooth_type_to_string (guint type); -gboolean bluetooth_verify_address (const char *bdaddr); -const char *bluetooth_uuid_to_string (const char *uuid); +BluetoothType bluetooth_class_to_type (guint32 class); +const gchar *bluetooth_type_to_string (guint type); +const gchar *bluetooth_type_to_filter_string (guint type); +gboolean bluetooth_verify_address (const char *bdaddr); +const char *bluetooth_uuid_to_string (const char *uuid); void bluetooth_send_to_address (const char *address, const char *alias); diff --git a/lib/gnome-bluetooth.symbols b/lib/gnome-bluetooth.symbols index 68409795..21f99e21 100644 --- a/lib/gnome-bluetooth.symbols +++ b/lib/gnome-bluetooth.symbols @@ -31,6 +31,7 @@ bluetooth_client_set_trusted bluetooth_client_get_device bluetooth_class_to_type bluetooth_type_to_string +bluetooth_type_to_filter_string bluetooth_verify_address bluetooth_uuid_to_string bluetooth_send_to_address |