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

Proposed by Sebastien Bacher
Status: Merged
Approved by: Sebastien Bacher
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 (community) Approve
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.
Revision history for this message
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
=== modified file 'panels/bluetooth/gnome-bluetooth/lib/bluetooth-client.c'
--- panels/bluetooth/gnome-bluetooth/lib/bluetooth-client.c 2015-03-03 11:08:17 +0000
+++ panels/bluetooth/gnome-bluetooth/lib/bluetooth-client.c 2015-10-20 09:32:06 +0000
@@ -248,6 +248,22 @@
248 return FALSE;248 return FALSE;
249}249}
250250
251static const char *
252audio_icon_override (BluetoothType type)
253{
254 /* audio-card, you're ugly */
255 switch (type) {
256 case BLUETOOTH_TYPE_HEADSET:
257 return "audio-headset";
258 case BLUETOOTH_TYPE_HEADPHONES:
259 return "audio-headphones";
260 case BLUETOOTH_TYPE_OTHER_AUDIO:
261 return "audio-speakers";
262 default:
263 return NULL;
264 }
265}
266
251static void267static void
252device_g_properties_changed (GDBusProxy *device,268device_g_properties_changed (GDBusProxy *device,
253 GVariant *changed_p,269 GVariant *changed_p,
@@ -279,8 +295,11 @@
279 } else if (g_str_equal (property, "Icon") == TRUE) {295 } else if (g_str_equal (property, "Icon") == TRUE) {
280 const gchar *icon = g_variant_get_string (v, NULL);296 const gchar *icon = g_variant_get_string (v, NULL);
281297
282 gtk_tree_store_set (priv->store, &iter,298 /* See "Class" handling below */
283 BLUETOOTH_COLUMN_ICON, icon, -1);299 if (g_strcmp0 (icon, "audio-card") != 0) {
300 gtk_tree_store_set (priv->store, &iter,
301 BLUETOOTH_COLUMN_ICON, icon, -1);
302 }
284 } else if (g_str_equal (property, "Paired") == TRUE) {303 } else if (g_str_equal (property, "Paired") == TRUE) {
285 gboolean paired = g_variant_get_boolean (v);304 gboolean paired = g_variant_get_boolean (v);
286305
@@ -312,11 +331,21 @@
312 -1);331 -1);
313 } else if (g_str_equal (property, "Class") == TRUE) {332 } else if (g_str_equal (property, "Class") == TRUE) {
314 BluetoothType type;333 BluetoothType type;
334 const char *icon = NULL;
315335
316 type = v ? bluetooth_class_to_type (g_variant_get_uint32 (v)) : BLUETOOTH_TYPE_ANY;336 type = v ? bluetooth_class_to_type (g_variant_get_uint32 (v)) : BLUETOOTH_TYPE_ANY;
317 gtk_tree_store_set (priv->store, &iter,337 icon = audio_icon_override (type);
318 BLUETOOTH_COLUMN_TYPE, type,338
319 -1);339 if (icon) {
340 gtk_tree_store_set (priv->store, &iter,
341 BLUETOOTH_COLUMN_TYPE, type,
342 BLUETOOTH_COLUMN_ICON, icon,
343 -1);
344 } else {
345 gtk_tree_store_set (priv->store, &iter,
346 BLUETOOTH_COLUMN_TYPE, type,
347 -1);
348 }
320 } else {349 } else {
321 g_debug ("Unhandled property: %s", property);350 g_debug ("Unhandled property: %s", property);
322 }351 }
@@ -376,9 +405,12 @@
376405
377 v = g_variant_lookup_value (dict, "Class", G_VARIANT_TYPE_UINT32);406 v = g_variant_lookup_value (dict, "Class", G_VARIANT_TYPE_UINT32);
378 type = v ? bluetooth_class_to_type (g_variant_get_uint32 (v)) : BLUETOOTH_TYPE_ANY;407 type = v ? bluetooth_class_to_type (g_variant_get_uint32 (v)) : BLUETOOTH_TYPE_ANY;
408 icon = audio_icon_override (type);
379409
380 v = g_variant_lookup_value (dict, "Icon", G_VARIANT_TYPE_STRING);410 if (icon == NULL) {
381 icon = v ? g_variant_get_string (v, NULL) : "bluetooth";411 v = g_variant_lookup_value (dict, "Icon", G_VARIANT_TYPE_STRING);
412 icon = v ? g_variant_get_string (v, NULL) : "bluetooth";
413 }
382414
383 v = g_variant_lookup_value (dict, "Paired", G_VARIANT_TYPE_BOOLEAN);415 v = g_variant_lookup_value (dict, "Paired", G_VARIANT_TYPE_BOOLEAN);
384 paired = v ? g_variant_get_boolean (v) : FALSE;416 paired = v ? g_variant_get_boolean (v) : FALSE;

Subscribers

People subscribed via source and target branches