[gnome-builder/wip/chergert/dspy] dspy: don't remove activatable names, instead clear pid



commit be4874fe2d015c01c6414b4d366038a5b0b215e1
Author: Christian Hergert <chergert redhat com>
Date:   Fri Apr 12 01:50:04 2019 -0700

    dspy: don't remove activatable names, instead clear pid

 src/plugins/dspy/dspy-connection-model.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/dspy/dspy-connection-model.c b/src/plugins/dspy/dspy-connection-model.c
index 72a5f5412..c89dedbe7 100644
--- a/src/plugins/dspy/dspy-connection-model.c
+++ b/src/plugins/dspy/dspy-connection-model.c
@@ -311,16 +311,29 @@ dspy_connection_model_name_owner_changed_cb (GDBusConnection *connection,
                            (GCompareDataFunc) dspy_name_compare,
                            NULL);
 
-  if (seq == NULL && vnew_name[0])
+  if (seq == NULL)
     {
-      const gchar *names[] = { vname, NULL };
-      dspy_connection_model_add_names (self, names, FALSE);
+      if (vnew_name[0])
+        {
+          const gchar *names[] = { vname, NULL };
+          dspy_connection_model_add_names (self, names, FALSE);
+        }
     }
   else if (!vnew_name[0])
     {
-      guint position = g_sequence_iter_get_position (seq);
-      g_sequence_remove (seq);
-      g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 0);
+      DspyName *item = g_sequence_get (seq);
+
+      if (dspy_name_get_activatable (item) &&
+          dspy_name_get_name (item)[0] != ':')
+        {
+          dspy_name_set_pid (item, 0);
+        }
+      else
+        {
+          guint position = g_sequence_iter_get_position (seq);
+          g_sequence_remove (seq);
+          g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 0);
+        }
     }
 
 #if 0


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