[gnome-network-displays] Rename NdWFDP2PRegistry to NdNMDeviceRegistry



commit 17e1f8434bc1e8fe6eb71e0dbba64d59a6838171
Author: Christian Glombek <lorbus fedoraproject org>
Date:   Mon Jun 20 14:26:38 2022 +0200

    Rename NdWFDP2PRegistry to NdNMDeviceRegistry
    
    This is a preparatory change for the addition of further device types, as it is intended to re-use the 
registry for those as well.
    
    This commit contains no functional changes.

 README.md                                          |  4 +-
 src/meson.build                                    |  2 +-
 ...-wfd-p2p-registry.c => nd-nm-device-registry.c} | 72 +++++++++++-----------
 ...-wfd-p2p-registry.h => nd-nm-device-registry.h} |  8 +--
 src/nd-window.c                                    |  8 +--
 5 files changed, 47 insertions(+), 47 deletions(-)
---
diff --git a/README.md b/README.md
index 26dd5d3..8f37f34 100644
--- a/README.md
+++ b/README.md
@@ -79,9 +79,9 @@ ensuring that support exists:
    a lot more information. Theoretically it may be that we see the device, but
    think that it is not WiFi Display capable (e.g. because the `wpa_supplicant`
    support is missing, see further below). Look out for the following messages:
-   * `WFDP2PRegistry: Got NMClient`:
+   * `NdNMDeviceRegistry: Got NMClient`:
       The connection to NetworkManager works.
-   * `WFDP2PRegistry: Found a new device, creating provider`:
+   * `NdNMDeviceRegistry: Found a new device, creating provider`:
       This means that we have a seemingly usable P2P device installed.
    * `WFDP2PProvider: Ignoring peer "XX:XX:XX:XX:XX" (Y) as it has no WFDIEs set`:
       This means there is a P2P device, but it does not seem to support WiFi
diff --git a/src/meson.build b/src/meson.build
index 4328593..7e913b1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -14,7 +14,7 @@ gnome_nd_sources = [
   'nd-meta-provider.c',
   'nd-wfd-p2p-sink.c',
   'nd-wfd-p2p-provider.c',
-  'nd-wfd-p2p-registry.c',
+  'nd-nm-device-registry.c',
   'nd-dummy-provider.c',
   'nd-dummy-wfd-sink.c',
   'nd-screencast-portal.c',
diff --git a/src/nd-wfd-p2p-registry.c b/src/nd-nm-device-registry.c
similarity index 71%
rename from src/nd-wfd-p2p-registry.c
rename to src/nd-nm-device-registry.c
index 13bf1fe..25152c0 100644
--- a/src/nd-wfd-p2p-registry.c
+++ b/src/nd-nm-device-registry.c
@@ -1,4 +1,4 @@
-/* nd-wfd-p2p-registry.c
+/* nd-nm-device-registry.c
  *
  * Copyright 2018 Benjamin Berg <bberg redhat com>
  *
@@ -18,10 +18,10 @@
 
 #include "gnome-network-displays-config.h"
 #include "NetworkManager.h"
-#include "nd-wfd-p2p-registry.h"
+#include "nd-nm-device-registry.h"
 #include "nd-wfd-p2p-provider.h"
 
-struct _NdWFDP2PRegistry
+struct _NdNMDeviceRegistry
 {
   GObject         parent_instance;
 
@@ -37,19 +37,19 @@ enum {
   PROP_LAST,
 };
 
-G_DEFINE_TYPE (NdWFDP2PRegistry, nd_wfd_p2p_registry, G_TYPE_OBJECT)
+G_DEFINE_TYPE (NdNMDeviceRegistry, nd_nm_device_registry, G_TYPE_OBJECT)
 
 static GParamSpec * props[PROP_LAST] = { NULL, };
 
 static void
-device_added_cb (NdWFDP2PRegistry *registry, NMDevice *device, NMClient *client)
+device_added_cb (NdNMDeviceRegistry *registry, NMDevice *device, NMClient *client)
 {
   g_autoptr(NdWFDP2PProvider) provider = NULL;
 
   if (!NM_IS_DEVICE_WIFI_P2P (device))
     return;
 
-  g_debug ("WFDP2PRegistry: Found a new device, creating provider");
+  g_debug ("NdNMDeviceRegistry: Found a new device, creating provider");
 
   provider = nd_wfd_p2p_provider_new (client, device);
 
@@ -59,12 +59,12 @@ device_added_cb (NdWFDP2PRegistry *registry, NMDevice *device, NMClient *client)
 }
 
 static void
-device_removed_cb (NdWFDP2PRegistry *registry, NMDevice *device, NMClient *client)
+device_removed_cb (NdNMDeviceRegistry *registry, NMDevice *device, NMClient *client)
 {
   if (!NM_IS_DEVICE_WIFI_P2P (device))
     return;
 
-  g_debug ("WFDP2PRegistry: Lost a device, removing provider");
+  g_debug ("NdNMDeviceRegistry: Lost a device, removing provider");
 
   for (gint i = 0; i < registry->providers->len; i++)
     {
@@ -80,12 +80,12 @@ device_removed_cb (NdWFDP2PRegistry *registry, NMDevice *device, NMClient *clien
 }
 
 static void
-nd_wfd_p2p_registry_get_property (GObject    *object,
-                                  guint       prop_id,
-                                  GValue     *value,
-                                  GParamSpec *pspec)
+nd_nm_device_registry_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
 {
-  NdWFDP2PRegistry *registry = ND_WFD_P2P_REGISTRY (object);
+  NdNMDeviceRegistry *registry = ND_NM_DEVICE_REGISTRY (object);
 
   switch (prop_id)
     {
@@ -100,12 +100,12 @@ nd_wfd_p2p_registry_get_property (GObject    *object,
 }
 
 static void
-nd_wfd_p2p_registry_set_property (GObject      *object,
-                                  guint         prop_id,
-                                  const GValue *value,
-                                  GParamSpec   *pspec)
+nd_nm_device_registry_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
 {
-  NdWFDP2PRegistry *registry = ND_WFD_P2P_REGISTRY (object);
+  NdNMDeviceRegistry *registry = ND_NM_DEVICE_REGISTRY (object);
 
   switch (prop_id)
     {
@@ -125,7 +125,7 @@ nd_wfd_p2p_registry_set_property (GObject      *object,
 static void
 client_init_async_finished (GObject *source, GAsyncResult *res, gpointer user_data)
 {
-  NdWFDP2PRegistry *registry = NULL;
+  NdNMDeviceRegistry *registry = NULL;
 
   g_autoptr(GError) error = NULL;
 
@@ -135,23 +135,23 @@ client_init_async_finished (GObject *source, GAsyncResult *res, gpointer user_da
       if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
         return;
 
-      registry = ND_WFD_P2P_REGISTRY (user_data);
+      registry = ND_NM_DEVICE_REGISTRY (user_data);
       g_clear_object (&registry->nm_client);
       g_warning ("Error initialising NMClient: %s", error->message);
     }
 
-  g_debug ("WFDP2PRegistry: Got NMClient");
+  g_debug ("NdNMDeviceRegistry: Got NMClient");
 
-  registry = ND_WFD_P2P_REGISTRY (user_data);
+  registry = ND_NM_DEVICE_REGISTRY (user_data);
 
   /* Everything good, we already connected and possibly received
    * the device-added/device-removed signals. */
 }
 
 static void
-nd_wfd_p2p_registry_constructed (GObject *object)
+nd_nm_device_registry_constructed (GObject *object)
 {
-  NdWFDP2PRegistry *registry = ND_WFD_P2P_REGISTRY (object);
+  NdNMDeviceRegistry *registry = ND_NM_DEVICE_REGISTRY (object);
 
   registry->cancellable = g_cancellable_new ();
   registry->nm_client = g_object_new (NM_TYPE_CLIENT, NULL);
@@ -176,9 +176,9 @@ nd_wfd_p2p_registry_constructed (GObject *object)
 }
 
 static void
-nd_wfd_p2p_registry_finalize (GObject *object)
+nd_nm_device_registry_finalize (GObject *object)
 {
-  NdWFDP2PRegistry *registry = ND_WFD_P2P_REGISTRY (object);
+  NdNMDeviceRegistry *registry = ND_NM_DEVICE_REGISTRY (object);
 
   while (registry->providers->len)
     {
@@ -192,18 +192,18 @@ nd_wfd_p2p_registry_finalize (GObject *object)
   g_clear_object (&registry->meta_provider);
   g_clear_pointer (&registry->providers, g_ptr_array_unref);
 
-  G_OBJECT_CLASS (nd_wfd_p2p_registry_parent_class)->finalize (object);
+  G_OBJECT_CLASS (nd_nm_device_registry_parent_class)->finalize (object);
 }
 
 static void
-nd_wfd_p2p_registry_class_init (NdWFDP2PRegistryClass *klass)
+nd_nm_device_registry_class_init (NdNMDeviceRegistryClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  object_class->get_property = nd_wfd_p2p_registry_get_property;
-  object_class->set_property = nd_wfd_p2p_registry_set_property;
-  object_class->constructed = nd_wfd_p2p_registry_constructed;
-  object_class->finalize = nd_wfd_p2p_registry_finalize;
+  object_class->get_property = nd_nm_device_registry_get_property;
+  object_class->set_property = nd_nm_device_registry_set_property;
+  object_class->constructed = nd_nm_device_registry_constructed;
+  object_class->finalize = nd_nm_device_registry_finalize;
 
   props[PROP_META_PROVIDER] =
     g_param_spec_object ("meta-provider", "MetaProvider",
@@ -215,15 +215,15 @@ nd_wfd_p2p_registry_class_init (NdWFDP2PRegistryClass *klass)
 }
 
 static void
-nd_wfd_p2p_registry_init (NdWFDP2PRegistry *registry)
+nd_nm_device_registry_init (NdNMDeviceRegistry *registry)
 {
   registry->providers = g_ptr_array_new_with_free_func (g_object_unref);
 }
 
-NdWFDP2PRegistry *
-nd_wfd_p2p_registry_new (NdMetaProvider *meta_provider)
+NdNMDeviceRegistry *
+nd_nm_device_registry_new (NdMetaProvider *meta_provider)
 {
-  return g_object_new (ND_TYPE_WFD_P2P_REGISTRY,
+  return g_object_new (ND_TYPE_NM_DEVICE_REGISTRY,
                        "meta-provider", meta_provider,
                        NULL);
 }
diff --git a/src/nd-wfd-p2p-registry.h b/src/nd-nm-device-registry.h
similarity index 73%
rename from src/nd-wfd-p2p-registry.h
rename to src/nd-nm-device-registry.h
index 1cc9c55..86db02e 100644
--- a/src/nd-wfd-p2p-registry.h
+++ b/src/nd-nm-device-registry.h
@@ -1,4 +1,4 @@
-/* nd-wfd-p2p-registry.h
+/* nd-nm-device-registry.h
  *
  * Copyright 2018 Benjamin Berg <bberg redhat com>
  *
@@ -22,9 +22,9 @@
 
 G_BEGIN_DECLS
 
-#define ND_TYPE_WFD_P2P_REGISTRY (nd_wfd_p2p_registry_get_type ())
-G_DECLARE_FINAL_TYPE (NdWFDP2PRegistry, nd_wfd_p2p_registry, ND, WFD_P2P_REGISTRY, GObject)
+#define ND_TYPE_NM_DEVICE_REGISTRY (nd_nm_device_registry_get_type ())
+G_DECLARE_FINAL_TYPE (NdNMDeviceRegistry, nd_nm_device_registry, ND, NM_DEVICE_REGISTRY, GObject)
 
-NdWFDP2PRegistry * nd_wfd_p2p_registry_new (NdMetaProvider * meta_provider);
+NdNMDeviceRegistry * nd_nm_device_registry_new (NdMetaProvider * meta_provider);
 
 G_END_DECLS
diff --git a/src/nd-window.c b/src/nd-window.c
index 0a34a81..e42da88 100644
--- a/src/nd-window.c
+++ b/src/nd-window.c
@@ -23,7 +23,7 @@
 #include "nd-sink-row.h"
 #include "nd-codec-install.h"
 #include "nd-meta-provider.h"
-#include "nd-wfd-p2p-registry.h"
+#include "nd-nm-device-registry.h"
 #include "nd-dummy-provider.h"
 
 #include <gst/gst.h>
@@ -36,7 +36,7 @@ struct _NdWindow
   GtkApplicationWindow parent_instance;
 
   NdMetaProvider      *meta_provider;
-  NdWFDP2PRegistry    *wfd_p2p_registry;
+  NdNMDeviceRegistry  *nm_device_registry;
 
   NdScreencastPortal  *portal;
   gboolean             use_x11;
@@ -329,7 +329,7 @@ gnome_nd_window_finalize (GObject *obj)
   g_clear_object (&self->stream_sink);
 
   g_clear_object (&self->meta_provider);
-  g_clear_object (&self->wfd_p2p_registry);
+  g_clear_object (&self->nm_device_registry);
 
   g_clear_pointer (&self->sink_property_bindings, g_ptr_array_unref);
 
@@ -459,7 +459,7 @@ gnome_nd_window_init (NdWindow *self)
                            self,
                            G_CONNECT_SWAPPED);
 
-  self->wfd_p2p_registry = nd_wfd_p2p_registry_new (self->meta_provider);
+  self->nm_device_registry = nd_nm_device_registry_new (self->meta_provider);
   nd_sink_list_set_provider (self->find_sink_list, ND_PROVIDER (self->meta_provider));
 
   if (g_strcmp0 (g_getenv ("NETWORK_DISPLAYS_DUMMY"), "1") == 0)


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