[gnome-control-center] network: Rename NetDeviceSimple to NetDeviceBluetooth



commit a7e3f314e6ddaa6df0b6181c4446d4cb0575d3a0
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Oct 23 11:15:00 2019 +1300

    network: Rename NetDeviceSimple to NetDeviceBluetooth
    
    It's only being used for bluetooth connections.

 panels/network/cc-network-panel.c                  | 47 +++++++-------
 panels/network/cc-network-panel.ui                 |  4 +-
 panels/network/meson.build                         |  4 +-
 ...{net-device-simple.c => net-device-bluetooth.c} | 75 +++++++++++-----------
 ...{net-device-simple.h => net-device-bluetooth.h} | 18 +++---
 .../{network-simple.ui => network-bluetooth.ui}    |  0
 panels/network/network.gresource.xml               |  2 +-
 po/POTFILES.in                                     |  2 +-
 8 files changed, 76 insertions(+), 76 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 6354b3456..b54ac3c27 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -31,10 +31,10 @@
 #include <NetworkManager.h>
 
 #include "net-device.h"
+#include "net-device-bluetooth.h"
+#include "net-device-ethernet.h"
 #include "net-device-mobile.h"
-#include "net-device-simple.h"
 #include "net-device-wifi.h"
-#include "net-device-ethernet.h"
 #include "net-object.h"
 #include "net-proxy.h"
 #include "net-vpn.h"
@@ -65,11 +65,11 @@ struct _CcNetworkPanel
         gboolean          updating_device;
 
         /* widgets */
+        GtkWidget        *box_bluetooth;
         GtkWidget        *box_proxy;
-        GtkWidget        *box_simple;
         GtkWidget        *box_vpn;
         GtkWidget        *box_wired;
-        GtkWidget        *container_simple;
+        GtkWidget        *container_bluetooth;
         GtkWidget        *empty_listbox;
 
         /* wireless dialog stuff */
@@ -414,22 +414,21 @@ update_vpn_section (CcNetworkPanel *self)
 }
 
 static void
-update_simple_section (CcNetworkPanel *self)
+update_bluetooth_section (CcNetworkPanel *self)
 {
-        guint i, n_simple;
+        guint i, n_bluetooth;
 
-        for (i = 0, n_simple = 0; i < self->devices->len; i++) {
+        for (i = 0, n_bluetooth = 0; i < self->devices->len; i++) {
                 NetObject *net_object = g_ptr_array_index (self->devices, i);
 
-                /* NetDeviceSimple but none of the subclasses */
-                if (G_OBJECT_TYPE (net_object) != NET_TYPE_DEVICE_SIMPLE)
+                if (!NET_IS_DEVICE_BLUETOOTH (net_object))
                         continue;
 
-                net_device_simple_set_show_separator (NET_DEVICE_SIMPLE (net_object), n_simple > 0);
-                n_simple++;
+                net_device_bluetooth_set_show_separator (NET_DEVICE_BLUETOOTH (net_object), n_bluetooth > 0);
+                n_bluetooth++;
         }
 
-        gtk_widget_set_visible (self->container_simple, n_simple > 0);
+        gtk_widget_set_visible (self->container_bluetooth, n_bluetooth > 0);
 }
 
 static GtkWidget *
@@ -485,11 +484,11 @@ panel_add_device (CcNetworkPanel *self, NMDevice *device)
                                                                 nm_device_get_udi (device)));
                 break;
         case NM_DEVICE_TYPE_BT:
-                net_device = NET_DEVICE (net_device_simple_new (CC_PANEL (self),
-                                                                self->cancellable,
-                                                                self->client,
-                                                                device,
-                                                                nm_device_get_udi (device)));
+                net_device = NET_DEVICE (net_device_bluetooth_new (CC_PANEL (self),
+                                                                   self->cancellable,
+                                                                   self->client,
+                                                                   device,
+                                                                   nm_device_get_udi (device)));
                 break;
 
         /* For Wi-Fi and VPN we handle connections separately; we correctly manage
@@ -528,18 +527,18 @@ panel_add_device (CcNetworkPanel *self, NMDevice *device)
 
         stack = add_device_stack (self, NET_OBJECT (net_device));
         if (type == NM_DEVICE_TYPE_BT)
-                gtk_container_add (GTK_CONTAINER (self->box_simple), stack);
+                gtk_container_add (GTK_CONTAINER (self->box_bluetooth), stack);
         else
                 gtk_container_add (GTK_CONTAINER (self->box_wired), stack);
 
         /* Add to the devices array */
         g_ptr_array_add (self->devices, net_device);
 
-        /* Update the device_simple section if we're adding a simple
+        /* Update the device_bluetooth section if we're adding a bluetooth
          * device. This is a temporary solution though, for these will
          * be handled by the future Mobile Broadband panel */
         if (type == NM_DEVICE_TYPE_BT)
-                update_simple_section (self);
+                update_bluetooth_section (self);
 
         g_signal_connect_object (net_device, "removed",
                                  G_CALLBACK (object_removed_cb), self, G_CONNECT_SWAPPED);
@@ -563,8 +562,8 @@ panel_remove_device (CcNetworkPanel *self, NMDevice *device)
         /* update vpn widgets */
         update_vpn_section (self);
 
-        /* update device_simple widgets */
-        update_simple_section (self);
+        /* update device_bluetooth widgets */
+        update_bluetooth_section (self);
 }
 
 static void
@@ -827,11 +826,11 @@ cc_network_panel_class_init (CcNetworkPanelClass *klass)
 
         gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/network/cc-network-panel.ui");
 
+        gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_bluetooth);
         gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_proxy);
-        gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_simple);
         gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_vpn);
         gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, box_wired);
-        gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, container_simple);
+        gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, container_bluetooth);
         gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, empty_listbox);
         gtk_widget_class_bind_template_child (widget_class, CcNetworkPanel, sizegroup);
 
diff --git a/panels/network/cc-network-panel.ui b/panels/network/cc-network-panel.ui
index 0f2c9e068..c81e0b11c 100644
--- a/panels/network/cc-network-panel.ui
+++ b/panels/network/cc-network-panel.ui
@@ -49,7 +49,7 @@
                           </object>
                         </child>
                         <child>
-                          <object class="GtkBox" id="container_simple">
+                          <object class="GtkBox" id="container_bluetooth">
                             <property name="can_focus">False</property>
                             <property name="orientation">vertical</property>
                             <property name="spacing">12</property>
@@ -78,7 +78,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <child>
-                                  <object class="GtkBox" id="box_simple">
+                                  <object class="GtkBox" id="box_bluetooth">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="orientation">vertical</property>
diff --git a/panels/network/meson.build b/panels/network/meson.build
index 18582f6c3..553db62d5 100644
--- a/panels/network/meson.build
+++ b/panels/network/meson.build
@@ -40,9 +40,9 @@ sources = files(
   'cc-wifi-panel.c',
   'cc-wifi-hotspot-dialog.c',
   'net-device.c',
+  'net-device-bluetooth.c',
   'net-device-ethernet.c',
   'net-device-mobile.c',
-  'net-device-simple.c',
   'net-device-wifi.c',
   'net-object.c',
   'net-proxy.c',
@@ -56,10 +56,10 @@ resource_data = files(
   'cc-wifi-connection-row.ui',
   'cc-wifi-panel.ui',
   'cc-wifi-hotspot-dialog.ui',
+  'network-bluetooth.ui',
   'network-ethernet.ui',
   'network-mobile.ui',
   'network-proxy.ui',
-  'network-simple.ui',
   'network-vpn.ui',
   'network-wifi.ui',
 )
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-bluetooth.c
similarity index 78%
rename from panels/network/net-device-simple.c
rename to panels/network/net-device-bluetooth.c
index fa4e46288..3ef3d17cb 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-bluetooth.c
@@ -29,10 +29,12 @@
 
 #include "panel-common.h"
 
-#include "net-device-simple.h"
+#include "net-device-bluetooth.h"
 
-struct _NetDeviceSimple
+struct _NetDeviceBluetooth
 {
+        NetDevice     parent;
+
         GtkBuilder   *builder;
         GtkBox       *box;
         GtkLabel     *device_label;
@@ -43,22 +45,22 @@ struct _NetDeviceSimple
         gboolean    updating_device;
 };
 
-G_DEFINE_TYPE (NetDeviceSimple, net_device_simple, NET_TYPE_DEVICE)
+G_DEFINE_TYPE (NetDeviceBluetooth, net_device_bluetooth, NET_TYPE_DEVICE)
 
 void
-net_device_simple_set_show_separator (NetDeviceSimple *self,
-                                      gboolean         show_separator)
+net_device_bluetooth_set_show_separator (NetDeviceBluetooth *self,
+                                         gboolean            show_separator)
 {
         /* add widgets to size group */
         gtk_widget_set_visible (GTK_WIDGET (self->separator), show_separator);
 }
 
 static GtkWidget *
-device_simple_proxy_add_to_stack (NetObject    *object,
-                                  GtkStack     *stack,
-                                  GtkSizeGroup *heading_size_group)
+device_bluetooth_add_to_stack (NetObject    *object,
+                               GtkStack     *stack,
+                               GtkSizeGroup *heading_size_group)
 {
-        NetDeviceSimple *self = NET_DEVICE_SIMPLE (object);
+        NetDeviceBluetooth *self = NET_DEVICE_BLUETOOTH (object);
 
         /* add widgets to size group */
         gtk_stack_add_named (stack, GTK_WIDGET (self->box), net_object_get_id (object));
@@ -68,7 +70,7 @@ device_simple_proxy_add_to_stack (NetObject    *object,
 static void
 update_off_switch_from_device_state (GtkSwitch *sw,
                                      NMDeviceState state,
-                                     NetDeviceSimple *self)
+                                     NetDeviceBluetooth *self)
 {
         self->updating_device = TRUE;
         switch (state) {
@@ -87,7 +89,7 @@ update_off_switch_from_device_state (GtkSwitch *sw,
 }
 
 static void
-nm_device_simple_refresh_ui (NetDeviceSimple *self)
+nm_device_bluetooth_refresh_ui (NetDeviceBluetooth *self)
 {
         NMDevice *nm_device;
         NMDeviceState state;
@@ -109,14 +111,14 @@ nm_device_simple_refresh_ui (NetDeviceSimple *self)
 }
 
 static void
-device_simple_refresh (NetObject *object)
+device_bluetooth_refresh (NetObject *object)
 {
-        NetDeviceSimple *self = NET_DEVICE_SIMPLE (object);
-        nm_device_simple_refresh_ui (self);
+        NetDeviceBluetooth *self = NET_DEVICE_BLUETOOTH (object);
+        nm_device_bluetooth_refresh_ui (self);
 }
 
 static void
-device_off_toggled (NetDeviceSimple *self)
+device_off_toggled (NetDeviceBluetooth *self)
 {
         const GPtrArray *acs;
         gboolean active;
@@ -158,7 +160,7 @@ device_off_toggled (NetDeviceSimple *self)
 }
 
 static void
-edit_connection (NetDeviceSimple *self)
+edit_connection (NetDeviceBluetooth *self)
 {
         const gchar *uuid;
         g_autofree gchar *cmdline = NULL;
@@ -174,45 +176,45 @@ edit_connection (NetDeviceSimple *self)
 }
 
 static void
-net_device_simple_constructed (GObject *object)
+net_device_bluetooth_constructed (GObject *object)
 {
-        NetDeviceSimple *self = NET_DEVICE_SIMPLE (object);
+        NetDeviceBluetooth *self = NET_DEVICE_BLUETOOTH (object);
 
-        G_OBJECT_CLASS (net_device_simple_parent_class)->constructed (object);
+        G_OBJECT_CLASS (net_device_bluetooth_parent_class)->constructed (object);
 
         net_object_refresh (NET_OBJECT (self));
 }
 
 static void
-net_device_simple_finalize (GObject *object)
+net_device_bluetooth_finalize (GObject *object)
 {
-        NetDeviceSimple *self = NET_DEVICE_SIMPLE (object);
+        NetDeviceBluetooth *self = NET_DEVICE_BLUETOOTH (object);
 
         g_clear_object (&self->builder);
 
-        G_OBJECT_CLASS (net_device_simple_parent_class)->finalize (object);
+        G_OBJECT_CLASS (net_device_bluetooth_parent_class)->finalize (object);
 }
 
 static void
-net_device_simple_class_init (NetDeviceSimpleClass *klass)
+net_device_bluetooth_class_init (NetDeviceBluetoothClass *klass)
 {
         GObjectClass *object_class = G_OBJECT_CLASS (klass);
         NetObjectClass *parent_class = NET_OBJECT_CLASS (klass);
 
-        object_class->finalize = net_device_simple_finalize;
-        object_class->constructed = net_device_simple_constructed;
-        parent_class->add_to_stack = device_simple_proxy_add_to_stack;
-        parent_class->refresh = device_simple_refresh;
+        object_class->finalize = net_device_bluetooth_finalize;
+        object_class->constructed = net_device_bluetooth_constructed;
+        parent_class->add_to_stack = device_bluetooth_add_to_stack;
+        parent_class->refresh = device_bluetooth_refresh;
 }
 
 static void
-net_device_simple_init (NetDeviceSimple *self)
+net_device_bluetooth_init (NetDeviceBluetooth *self)
 {
         g_autoptr(GError) error = NULL;
 
         self->builder = gtk_builder_new ();
         gtk_builder_add_from_resource (self->builder,
-                                       "/org/gnome/control-center/network/network-simple.ui",
+                                       "/org/gnome/control-center/network/network-bluetooth.ui",
                                        &error);
         if (error != NULL) {
                 g_warning ("Could not load interface file: %s", error->message);
@@ -225,7 +227,6 @@ net_device_simple_init (NetDeviceSimple *self)
         self->options_button = GTK_BUTTON (gtk_builder_get_object (self->builder, "options_button"));
         self->separator = GTK_SEPARATOR (gtk_builder_get_object (self->builder, "separator"));
 
-        /* setup simple combobox model */
         g_signal_connect_swapped (self->device_off_switch, "notify::active",
                                   G_CALLBACK (device_off_toggled), self);
 
@@ -234,14 +235,14 @@ net_device_simple_init (NetDeviceSimple *self)
         gtk_widget_set_visible (GTK_WIDGET (self->options_button), g_find_program_in_path 
("nm-connection-editor") != NULL);
 }
 
-NetDeviceSimple *
-net_device_simple_new (CcPanel      *panel,
-                       GCancellable *cancellable,
-                       NMClient     *client,
-                       NMDevice     *device,
-                       const gchar  *id)
+NetDeviceBluetooth *
+net_device_bluetooth_new (CcPanel      *panel,
+                          GCancellable *cancellable,
+                          NMClient     *client,
+                          NMDevice     *device,
+                          const gchar  *id)
 {
-        return g_object_new (NET_TYPE_DEVICE_SIMPLE,
+        return g_object_new (NET_TYPE_DEVICE_BLUETOOTH,
                              "panel", panel,
                              "cancellable", cancellable,
                              "client", client,
diff --git a/panels/network/net-device-simple.h b/panels/network/net-device-bluetooth.h
similarity index 56%
rename from panels/network/net-device-simple.h
rename to panels/network/net-device-bluetooth.h
index c4d9017a0..91d61c920 100644
--- a/panels/network/net-device-simple.h
+++ b/panels/network/net-device-bluetooth.h
@@ -28,16 +28,16 @@
 
 G_BEGIN_DECLS
 
-#define NET_TYPE_DEVICE_SIMPLE (net_device_simple_get_type ())
-G_DECLARE_FINAL_TYPE (NetDeviceSimple, net_device_simple, NET, DEVICE_SIMPLE, NetDevice)
+#define NET_TYPE_DEVICE_BLUETOOTH (net_device_bluetooth_get_type ())
+G_DECLARE_FINAL_TYPE (NetDeviceBluetooth, net_device_bluetooth, NET, DEVICE_BLUETOOTH, NetDevice)
 
-NetDeviceSimple *net_device_simple_new                (CcPanel      *panel,
-                                                       GCancellable *cancellable,
-                                                       NMClient     *client,
-                                                       NMDevice     *device,
-                                                       const gchar  *id);
+NetDeviceBluetooth *net_device_bluetooth_new                (CcPanel            *panel,
+                                                             GCancellable       *cancellable,
+                                                             NMClient           *client,
+                                                             NMDevice           *device,
+                                                             const gchar        *id);
 
-void             net_device_simple_set_show_separator (NetDeviceSimple *device_simple,
-                                                       gboolean         show_separator);
+void                net_device_bluetooth_set_show_separator (NetDeviceBluetooth *device_bluetooth,
+                                                             gboolean            show_separator);
 
 G_END_DECLS
diff --git a/panels/network/network-simple.ui b/panels/network/network-bluetooth.ui
similarity index 100%
rename from panels/network/network-simple.ui
rename to panels/network/network-bluetooth.ui
diff --git a/panels/network/network.gresource.xml b/panels/network/network.gresource.xml
index 0fc1651e1..9feae08f1 100644
--- a/panels/network/network.gresource.xml
+++ b/panels/network/network.gresource.xml
@@ -5,10 +5,10 @@
     <file preprocess="xml-stripblanks">cc-network-panel.ui</file>
     <file preprocess="xml-stripblanks">cc-wifi-connection-row.ui</file>
     <file preprocess="xml-stripblanks">cc-wifi-hotspot-dialog.ui</file>
+    <file preprocess="xml-stripblanks">network-bluetooth.ui</file>
     <file preprocess="xml-stripblanks">network-proxy.ui</file>
     <file preprocess="xml-stripblanks">network-vpn.ui</file>
     <file preprocess="xml-stripblanks">network-wifi.ui</file>
-    <file preprocess="xml-stripblanks">network-simple.ui</file>
     <file preprocess="xml-stripblanks">network-mobile.ui</file>
     <file preprocess="xml-stripblanks">network-ethernet.ui</file>
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4f951fa56..10583f042 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -99,10 +99,10 @@ panels/network/net-device-mobile.c
 panels/network/net-device-wifi.c
 panels/network/net-proxy.c
 panels/network/net-vpn.c
+panels/network/network-bluetooth.ui
 panels/network/network-ethernet.ui
 panels/network/network-mobile.ui
 panels/network/network-proxy.ui
-panels/network/network-simple.ui
 panels/network/network-vpn.ui
 panels/network/network-wifi.ui
 panels/network/panel-common.c


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