[gnome-network-displays] meta-sink: Fix prioritization logic



commit 8d5e0e04369736c53aad846a37cb60ea6ebd73af
Author: Christian Glombek <lorbus fedoraproject org>
Date:   Fri Jan 28 11:33:34 2022 +0100

    meta-sink: Fix prioritization logic

 src/nd-meta-sink.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/nd-meta-sink.c b/src/nd-meta-sink.c
index 0817184..b413d59 100644
--- a/src/nd-meta-sink.c
+++ b/src/nd-meta-sink.c
@@ -76,10 +76,13 @@ nd_meta_sink_update (NdMetaSink *meta_sink)
 
       g_object_get (sink, "priority", &priority, NULL);
       if (priority == best_priority)
-        g_debug ("MetaSink: Found two sinks with identical priority! Prefered order is undefined.\n");
+        g_debug ("MetaSink: Found two sinks with identical priority! Preferred order is undefined. Priority: 
%i", priority);
 
       if (priority > best_priority)
-        best_sink = sink;
+        {
+          best_sink = sink;
+          best_priority = priority;
+        }
     }
 
   /* Nothing has changed */
@@ -98,6 +101,7 @@ nd_meta_sink_update (NdMetaSink *meta_sink)
       g_signal_connect_object (meta_sink->current_sink,
                                "notify", (GCallback) nd_meta_sink_notify_sink_cb,
                                meta_sink, G_CONNECT_SWAPPED);
+      g_debug ("MetaSink: Priority sink updated. Priority: %i", best_priority);
     }
   else
     {


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