[gnome-bluetooth/wip/hadess/use-alias: 5/6] settings-widget: Simplify row_inserted_cb() by using g_auto
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/use-alias: 5/6] settings-widget: Simplify row_inserted_cb() by using g_auto
- Date: Thu, 10 Dec 2020 20:07:48 +0000 (UTC)
commit ea85c5c6699044b1d98f885fe970eb2814010d07
Author: Bastien Nocera <hadess hadess net>
Date: Wed Dec 9 15:22:47 2020 +0100
settings-widget: Simplify row_inserted_cb() by using g_auto
lib/bluetooth-settings-widget.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index 6d224114..60f75b9d 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -1624,8 +1624,9 @@ row_inserted_cb (GtkTreeModel *tree_model,
{
BluetoothSettingsWidget *self = user_data;
BluetoothSettingsWidgetPrivate *priv = BLUETOOTH_SETTINGS_WIDGET_GET_PRIVATE (user_data);
- GDBusProxy *proxy;
- char *name, *bdaddr;
+ g_autoptr(GDBusProxy) proxy = NULL;
+ g_autofree char *name = NULL;
+ g_autofree char *bdaddr = NULL;
BluetoothType type;
gboolean paired, trusted, connected, legacy_pairing;
GtkWidget *row;
@@ -1635,7 +1636,6 @@ row_inserted_cb (GtkTreeModel *tree_model,
BLUETOOTH_COLUMN_NAME, &name,
-1);
g_debug ("Not adding device '%s'", name);
- g_free (name);
return;
}
@@ -1669,10 +1669,6 @@ row_inserted_cb (GtkTreeModel *tree_model,
gtk_container_add (GTK_CONTAINER (priv->device_list), row);
gtk_size_group_add_widget (priv->row_sizegroup, row);
- g_object_unref (proxy);
- g_free (name);
- g_free (bdaddr);
-
gtk_stack_set_transition_type (GTK_STACK (priv->device_stack),
GTK_STACK_TRANSITION_TYPE_SLIDE_DOWN);
gtk_container_child_set (GTK_CONTAINER (WID ("vbox_bluetooth")),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]