diff options
author | Bastien Nocera <hadess@hadess.net> | 2020-12-09 15:37:42 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2020-12-10 21:07:43 +0100 |
commit | c9adad450f744270b9815e5ce6e5ba422230eb4f (patch) | |
tree | 5e10c5ab0fc982281916625775ed64024f708048 | |
parent | ea85c5c6699044b1d98f885fe970eb2814010d07 (diff) | |
download | gnome-bluetooth-c9adad450f744270b9815e5ce6e5ba422230eb4f.tar.gz |
settings-widget: Use device alias instead of device name
Use the device alias for user-visible strings, making it possible for
end-users to change the name of Bluetooth devices on the command-line
when they have 2 of the same device for example.
-rw-r--r-- | lib/bluetooth-settings-widget.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c index 60f75b9d..36e0761a 100644 --- a/lib/bluetooth-settings-widget.c +++ b/lib/bluetooth-settings-widget.c @@ -1114,7 +1114,7 @@ update_properties (BluetoothSettingsWidget *self, gboolean ret; BluetoothType type; gboolean connected, paired; - char **uuids, *bdaddr, *name, *icon; + char **uuids, *bdaddr, *alias, *icon; guint i; model = bluetooth_client_get_device_model (priv->client); @@ -1144,7 +1144,7 @@ update_properties (BluetoothSettingsWidget *self, gtk_tree_model_get (model, &iter, BLUETOOTH_COLUMN_ADDRESS, &bdaddr, - BLUETOOTH_COLUMN_NAME, &name, + BLUETOOTH_COLUMN_ALIAS, &alias, BLUETOOTH_COLUMN_ICON, &icon, BLUETOOTH_COLUMN_PAIRED, &paired, BLUETOOTH_COLUMN_CONNECTED, &connected, @@ -1165,9 +1165,9 @@ update_properties (BluetoothSettingsWidget *self, gtk_widget_hide (WID ("send_button")); /* Name */ - gtk_window_set_title (GTK_WINDOW (priv->properties_dialog), name); + gtk_window_set_title (GTK_WINDOW (priv->properties_dialog), alias); g_free (priv->selected_name); - priv->selected_name = name; + priv->selected_name = alias; /* Icon */ gtk_image_set_from_icon_name (GTK_IMAGE (WID ("image")), icon, GTK_ICON_SIZE_DIALOG); @@ -1627,6 +1627,7 @@ row_inserted_cb (GtkTreeModel *tree_model, g_autoptr(GDBusProxy) proxy = NULL; g_autofree char *name = NULL; g_autofree char *bdaddr = NULL; + g_autofree char *alias = NULL; BluetoothType type; gboolean paired, trusted, connected, legacy_pairing; GtkWidget *row; @@ -1642,6 +1643,7 @@ row_inserted_cb (GtkTreeModel *tree_model, gtk_tree_model_get (tree_model, iter, BLUETOOTH_COLUMN_PROXY, &proxy, BLUETOOTH_COLUMN_NAME, &name, + BLUETOOTH_COLUMN_ALIAS, &alias, BLUETOOTH_COLUMN_PAIRED, &paired, BLUETOOTH_COLUMN_TRUSTED, &trusted, BLUETOOTH_COLUMN_CONNECTED, &connected, @@ -1661,6 +1663,7 @@ row_inserted_cb (GtkTreeModel *tree_model, "type", type, "connected", connected, "name", name, + "alias", alias, "address", bdaddr, "legacy-pairing", legacy_pairing, NULL); @@ -1711,12 +1714,14 @@ row_changed_cb (GtkTreeModel *tree_model, path = g_object_get_data (G_OBJECT (l->data), "object-path"); if (g_str_equal (object_path, path)) { g_autofree char *name = NULL; + g_autofree char *alias = NULL; g_autofree char *bdaddr = NULL; BluetoothType type; gboolean paired, trusted, connected, legacy_pairing; gtk_tree_model_get (tree_model, iter, BLUETOOTH_COLUMN_NAME, &name, + BLUETOOTH_COLUMN_ALIAS, &alias, BLUETOOTH_COLUMN_PAIRED, &paired, BLUETOOTH_COLUMN_TRUSTED, &trusted, BLUETOOTH_COLUMN_CONNECTED, &connected, @@ -1733,6 +1738,7 @@ row_changed_cb (GtkTreeModel *tree_model, "type", type, "connected", connected, "name", name, + "alias", alias, "legacy-pairing", legacy_pairing, NULL); |