net-device-bluetooth: Use AdwActionRow and .boxed-list

This makes both the row and the list fit in better
with the rest of the page.
This commit is contained in:
Christopher Davis 2021-12-20 13:07:54 -08:00
parent 1b45b633ae
commit 3ee642e421
2 changed files with 28 additions and 48 deletions

View file

@ -24,6 +24,7 @@
#include <glib-object.h>
#include <glib/gi18n.h>
#include <adwaita.h>
#include <NetworkManager.h>
@ -35,7 +36,7 @@ struct _NetDeviceBluetooth
{
GtkBox parent;
GtkLabel *device_label;
AdwActionRow *row;
GtkSwitch *device_off_switch;
GtkButton *options_button;
GtkSeparator *separator;
@ -168,7 +169,7 @@ net_device_bluetooth_class_init (NetDeviceBluetoothClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/network-bluetooth.ui");
gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, device_label);
gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, row);
gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, device_off_switch);
gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, options_button);
gtk_widget_class_bind_template_child (widget_class, NetDeviceBluetooth, separator);
@ -216,5 +217,5 @@ void
net_device_bluetooth_set_title (NetDeviceBluetooth *self, const gchar *title)
{
g_return_if_fail (NET_IS_DEVICE_BLUETOOTH (self));
gtk_label_set_label (self->device_label, title);
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self->row), title);
}

View file

@ -12,24 +12,10 @@
<object class="GtkListBox">
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow">
<property name="activatable">False</property>
<child>
<object class="GtkBox">
<property name="margin_top">8</property>
<property name="margin_bottom">8</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="device_label">
<property name="hexpand">True</property>
<property name="xalign">0.0</property>
<property name="label" translatable="yes">Wired</property>
<property name="ellipsize">end</property>
</object>
</child>
<child>
<object class="AdwActionRow" id="row">
<property name="activatable_widget">device_off_switch</property>
<property name="title" translatable="yes">Wired</property>
<child type="suffix">
<object class="GtkSwitch" id="device_off_switch">
<property name="valign">center</property>
<signal name="notify::active" handler="device_off_switch_changed_cb" object="NetDeviceBluetooth" swapped="yes"/>
@ -38,20 +24,12 @@
</accessibility>
</object>
</child>
<child>
<child type="suffix">
<object class="GtkButton" id="options_button">
<property name="valign">center</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="options_button_clicked_cb" object="NetDeviceBluetooth" swapped="yes"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
<property name="icon_name">emblem-system-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
<signal name="clicked" handler="options_button_clicked_cb" object="NetDeviceBluetooth" swapped="yes"/>
<accessibility>
<property name="label" translatable="yes">Options…</property>
</accessibility>
@ -59,8 +37,9 @@
</child>
</object>
</child>
</object>
</child>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</template>