[gnome-control-center/wip/cdavis/network-list-fixups] net-device-bluetooth: Use AdwActionRow and .boxed-list




commit 3ee642e42185ffd6f23b1fa313129a11826902c8
Author: Christopher Davis <christopherdavis gnome org>
Date:   Mon Dec 20 13:07:54 2021 -0800

    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.

 panels/network/net-device-bluetooth.c |  7 ++--
 panels/network/network-bluetooth.ui   | 69 ++++++++++++-----------------------
 2 files changed, 28 insertions(+), 48 deletions(-)
---
diff --git a/panels/network/net-device-bluetooth.c b/panels/network/net-device-bluetooth.c
index 74dfb0e9a..350d8b8f9 100644
--- a/panels/network/net-device-bluetooth.c
+++ b/panels/network/net-device-bluetooth.c
@@ -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);
 }
diff --git a/panels/network/network-bluetooth.ui b/panels/network/network-bluetooth.ui
index 14ec590fc..216c95c8d 100644
--- a/panels/network/network-bluetooth.ui
+++ b/panels/network/network-bluetooth.ui
@@ -12,55 +12,34 @@
       <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="GtkSwitch" id="device_off_switch">
-                    <property name="valign">center</property>
-                    <signal name="notify::active" handler="device_off_switch_changed_cb" 
object="NetDeviceBluetooth" swapped="yes"/>
-                    <accessibility>
-                      <property name="label" translatable="yes">Turn device off</property>
-                    </accessibility>
-                  </object>
-                </child>
-                <child>
-                  <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>
-                    <accessibility>
-                      <property name="label" translatable="yes">Options…</property>
-                    </accessibility>
-                  </object>
-                </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"/>
+                <accessibility>
+                  <property name="label" translatable="yes">Turn device off</property>
+                </accessibility>
+              </object>
+            </child>
+            <child type="suffix">
+              <object class="GtkButton" id="options_button">
+                <property name="valign">center</property>
+                <property name="use_underline">True</property>
+                <property name="icon_name">emblem-system-symbolic</property>
+                <signal name="clicked" handler="options_button_clicked_cb" object="NetDeviceBluetooth" 
swapped="yes"/>
+                <accessibility>
+                  <property name="label" translatable="yes">Options…</property>
+                </accessibility>
               </object>
             </child>
           </object>
         </child>
+        <style>
+          <class name="boxed-list"/>
+        </style>
       </object>
     </child>
   </template>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]