Merge lp:~seb128/unity-control-center/bluetooth-better-icons into lp:unity-control-center

Proposed by Sebastien Bacher on 2015-10-20
Status: Merged
Approved by: Sebastien Bacher on 2015-10-26
Approved revision: 12833
Merged at revision: 12834
Proposed branch: lp:~seb128/unity-control-center/bluetooth-better-icons
Merge into: lp:unity-control-center
Diff against target: 80 lines (+39/-7)
1 file modified
panels/bluetooth/gnome-bluetooth/lib/bluetooth-client.c (+39/-7)
To merge this branch: bzr merge lp:~seb128/unity-control-center/bluetooth-better-icons
Reviewer Review Type Date Requested Status
Daniel Holbach 2015-10-20 Approve on 2015-10-26
Review via email: mp+274991@code.launchpad.net

Commit message

backport upstream change from gnome-bluetooth

"lib: Override default icon for audio devices

"audio-card" is fugly, low-res and represents something that
nobody's seen for 10 years: a stand-alone sound card.

Instead, we'll show headset, headphones, and speakers to represent
generic audio devices."

Description of the change

backport upstream change from gnome-bluetooth

"lib: Override default icon for audio devices

"audio-card" is fugly, low-res and represents something that
nobody's seen for 10 years: a stand-alone sound card.

Instead, we'll show headset, headphones, and speakers to represent
generic audio devices."

To post a comment you must log in.
Daniel Holbach (dholbach) wrote :

Thanks. Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panels/bluetooth/gnome-bluetooth/lib/bluetooth-client.c'
2--- panels/bluetooth/gnome-bluetooth/lib/bluetooth-client.c 2015-03-03 11:08:17 +0000
3+++ panels/bluetooth/gnome-bluetooth/lib/bluetooth-client.c 2015-10-20 09:32:06 +0000
4@@ -248,6 +248,22 @@
5 return FALSE;
6 }
7
8+static const char *
9+audio_icon_override (BluetoothType type)
10+{
11+ /* audio-card, you're ugly */
12+ switch (type) {
13+ case BLUETOOTH_TYPE_HEADSET:
14+ return "audio-headset";
15+ case BLUETOOTH_TYPE_HEADPHONES:
16+ return "audio-headphones";
17+ case BLUETOOTH_TYPE_OTHER_AUDIO:
18+ return "audio-speakers";
19+ default:
20+ return NULL;
21+ }
22+}
23+
24 static void
25 device_g_properties_changed (GDBusProxy *device,
26 GVariant *changed_p,
27@@ -279,8 +295,11 @@
28 } else if (g_str_equal (property, "Icon") == TRUE) {
29 const gchar *icon = g_variant_get_string (v, NULL);
30
31- gtk_tree_store_set (priv->store, &iter,
32- BLUETOOTH_COLUMN_ICON, icon, -1);
33+ /* See "Class" handling below */
34+ if (g_strcmp0 (icon, "audio-card") != 0) {
35+ gtk_tree_store_set (priv->store, &iter,
36+ BLUETOOTH_COLUMN_ICON, icon, -1);
37+ }
38 } else if (g_str_equal (property, "Paired") == TRUE) {
39 gboolean paired = g_variant_get_boolean (v);
40
41@@ -312,11 +331,21 @@
42 -1);
43 } else if (g_str_equal (property, "Class") == TRUE) {
44 BluetoothType type;
45+ const char *icon = NULL;
46
47 type = v ? bluetooth_class_to_type (g_variant_get_uint32 (v)) : BLUETOOTH_TYPE_ANY;
48- gtk_tree_store_set (priv->store, &iter,
49- BLUETOOTH_COLUMN_TYPE, type,
50- -1);
51+ icon = audio_icon_override (type);
52+
53+ if (icon) {
54+ gtk_tree_store_set (priv->store, &iter,
55+ BLUETOOTH_COLUMN_TYPE, type,
56+ BLUETOOTH_COLUMN_ICON, icon,
57+ -1);
58+ } else {
59+ gtk_tree_store_set (priv->store, &iter,
60+ BLUETOOTH_COLUMN_TYPE, type,
61+ -1);
62+ }
63 } else {
64 g_debug ("Unhandled property: %s", property);
65 }
66@@ -376,9 +405,12 @@
67
68 v = g_variant_lookup_value (dict, "Class", G_VARIANT_TYPE_UINT32);
69 type = v ? bluetooth_class_to_type (g_variant_get_uint32 (v)) : BLUETOOTH_TYPE_ANY;
70+ icon = audio_icon_override (type);
71
72- v = g_variant_lookup_value (dict, "Icon", G_VARIANT_TYPE_STRING);
73- icon = v ? g_variant_get_string (v, NULL) : "bluetooth";
74+ if (icon == NULL) {
75+ v = g_variant_lookup_value (dict, "Icon", G_VARIANT_TYPE_STRING);
76+ icon = v ? g_variant_get_string (v, NULL) : "bluetooth";
77+ }
78
79 v = g_variant_lookup_value (dict, "Paired", G_VARIANT_TYPE_BOOLEAN);
80 paired = v ? g_variant_get_boolean (v) : FALSE;

Subscribers

People subscribed via source and target branches