Blame SOURCES/Revert-freedesktop-dbus-Defer-D-Bus-property-setting.patch

00ef58
From 7de08188d8d012d9aa8f49fe27b7992d081a7307 Mon Sep 17 00:00:00 2001
00ef58
From: Ondrej Holy <oholy@redhat.com>
00ef58
Date: Wed, 11 Jan 2023 09:44:25 +0100
00ef58
Subject: [PATCH] Revert "freedesktop-dbus: Defer D-Bus property setting"
00ef58
00ef58
This reverts commit 3014f69485a120bedf0eec5af441346a95fe27f7 and part of
00ef58
the commit a1751d3d870c6cdc092f893755623c4ff20e1ef3. This extra handling
00ef58
was needed because `NautilusFreedesktopDBus` methods might be called before
00ef58
establishing its own D-Bus connection. The follow-up commit is going to use
00ef58
the already established connection from the `dbus_register` vfunc. It
00ef58
should be ensured that the `dbus_register` vfunc is called before the
00ef58
`window_added`, `window_removed`, or `startup` vfunc. Consequently, this
00ef58
extra handling is going to be redundant. Let's remove it as a preparation
00ef58
for the next commit.
00ef58
---
00ef58
 src/nautilus-freedesktop-dbus.c | 79 ++-------------------------------
00ef58
 1 file changed, 3 insertions(+), 76 deletions(-)
00ef58
00ef58
diff --git a/src/nautilus-freedesktop-dbus.c b/src/nautilus-freedesktop-dbus.c
00ef58
index 5cbbbad01..c75678399 100644
00ef58
--- a/src/nautilus-freedesktop-dbus.c
00ef58
+++ b/src/nautilus-freedesktop-dbus.c
00ef58
@@ -40,11 +40,6 @@ struct _NautilusFreedesktopDBus
00ef58
 
00ef58
     /* Our DBus implementation skeleton */
00ef58
     NautilusFreedesktopFileManager1 *skeleton;
00ef58
-
00ef58
-    GStrv pending_open_locations;
00ef58
-    GVariant *pending_open_windows_with_locations;
00ef58
-
00ef58
-    gboolean name_lost;
00ef58
 };
00ef58
 
00ef58
 G_DEFINE_TYPE (NautilusFreedesktopDBus, nautilus_freedesktop_dbus, G_TYPE_OBJECT);
00ef58
@@ -162,24 +157,6 @@ bus_acquired_cb (GDBusConnection *conn,
00ef58
                       G_CALLBACK (skeleton_handle_show_item_properties_cb), fdb);
00ef58
 
00ef58
     g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (fdb->skeleton), conn, NAUTILUS_FDO_DBUS_PATH, NULL);
00ef58
-
00ef58
-    if (G_UNLIKELY (fdb->pending_open_locations != NULL))
00ef58
-    {
00ef58
-        g_auto (GStrv) locations = NULL;
00ef58
-
00ef58
-        locations = g_steal_pointer (&fdb->pending_open_locations);
00ef58
-
00ef58
-        nautilus_freedesktop_dbus_set_open_locations (fdb, (const gchar **) locations);
00ef58
-    }
00ef58
-
00ef58
-    if (G_UNLIKELY (fdb->pending_open_windows_with_locations != NULL))
00ef58
-    {
00ef58
-        g_autoptr (GVariant) locations = NULL;
00ef58
-
00ef58
-        locations = g_steal_pointer (&fdb->pending_open_windows_with_locations);
00ef58
-
00ef58
-        nautilus_freedesktop_dbus_set_open_windows_with_locations (fdb, locations);
00ef58
-    }
00ef58
 }
00ef58
 
00ef58
 static void
00ef58
@@ -195,13 +172,7 @@ name_lost_cb (GDBusConnection *connection,
00ef58
               const gchar     *name,
00ef58
               gpointer         user_data)
00ef58
 {
00ef58
-    NautilusFreedesktopDBus *fdb;
00ef58
-
00ef58
     DEBUG ("Lost (or failed to acquire) the name %s on the session message bus\n", name);
00ef58
-
00ef58
-    fdb = NAUTILUS_FREEDESKTOP_DBUS (user_data);
00ef58
-
00ef58
-    fdb->name_lost = TRUE;
00ef58
 }
00ef58
 
00ef58
 static void
00ef58
@@ -225,24 +196,12 @@ nautilus_freedesktop_dbus_dispose (GObject *object)
00ef58
     G_OBJECT_CLASS (nautilus_freedesktop_dbus_parent_class)->dispose (object);
00ef58
 }
00ef58
 
00ef58
-static void
00ef58
-nautilus_freedesktop_dbus_finalize (GObject *object)
00ef58
-{
00ef58
-    NautilusFreedesktopDBus *fdb;
00ef58
-
00ef58
-    fdb = NAUTILUS_FREEDESKTOP_DBUS (object);
00ef58
-
00ef58
-    g_clear_pointer (&fdb->pending_open_locations, g_strfreev);
00ef58
-    g_clear_pointer (&fdb->pending_open_windows_with_locations, g_variant_unref);
00ef58
-}
00ef58
-
00ef58
 static void
00ef58
 nautilus_freedesktop_dbus_class_init (NautilusFreedesktopDBusClass *klass)
00ef58
 {
00ef58
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
00ef58
 
00ef58
     object_class->dispose = nautilus_freedesktop_dbus_dispose;
00ef58
-    object_class->finalize = nautilus_freedesktop_dbus_finalize;
00ef58
 }
00ef58
 
00ef58
 static void
00ef58
@@ -256,10 +215,6 @@ nautilus_freedesktop_dbus_init (NautilusFreedesktopDBus *fdb)
00ef58
                                     name_lost_cb,
00ef58
                                     fdb,
00ef58
                                     NULL);
00ef58
-    fdb->skeleton = NULL;
00ef58
-    fdb->pending_open_locations = NULL;
00ef58
-    fdb->pending_open_windows_with_locations = NULL;
00ef58
-    fdb->name_lost = FALSE;
00ef58
 }
00ef58
 
00ef58
 void
00ef58
@@ -268,21 +223,7 @@ nautilus_freedesktop_dbus_set_open_locations (NautilusFreedesktopDBus  *fdb,
00ef58
 {
00ef58
     g_return_if_fail (NAUTILUS_IS_FREEDESKTOP_DBUS (fdb));
00ef58
 
00ef58
-    if (G_UNLIKELY (fdb->skeleton == NULL))
00ef58
-    {
00ef58
-        if (G_LIKELY (fdb->name_lost))
00ef58
-        {
00ef58
-            return;
00ef58
-        }
00ef58
-
00ef58
-        g_clear_pointer (&fdb->pending_open_locations, g_strfreev);
00ef58
-
00ef58
-        fdb->pending_open_locations = g_strdupv ((gchar **) locations);
00ef58
-    }
00ef58
-    else
00ef58
-    {
00ef58
-        nautilus_freedesktop_file_manager1_set_open_locations (fdb->skeleton, locations);
00ef58
-    }
00ef58
+    nautilus_freedesktop_file_manager1_set_open_locations (fdb->skeleton, locations);
00ef58
 }
00ef58
 
00ef58
 /**
00ef58
@@ -301,22 +242,8 @@ nautilus_freedesktop_dbus_set_open_windows_with_locations (NautilusFreedesktopDB
00ef58
 {
00ef58
     g_return_if_fail (NAUTILUS_IS_FREEDESKTOP_DBUS (fdb));
00ef58
 
00ef58
-    if (G_UNLIKELY (fdb->skeleton == NULL))
00ef58
-    {
00ef58
-        if (G_LIKELY (fdb->name_lost))
00ef58
-        {
00ef58
-            return;
00ef58
-        }
00ef58
-
00ef58
-        g_clear_pointer (&fdb->pending_open_windows_with_locations, g_variant_unref);
00ef58
-
00ef58
-        fdb->pending_open_windows_with_locations = g_variant_ref (locations);
00ef58
-    }
00ef58
-    else
00ef58
-    {
00ef58
-        nautilus_freedesktop_file_manager1_set_open_windows_with_locations (fdb->skeleton,
00ef58
-                                                                            locations);
00ef58
-    }
00ef58
+    nautilus_freedesktop_file_manager1_set_open_windows_with_locations (fdb->skeleton,
00ef58
+                                                                        locations);
00ef58
 }
00ef58
 
00ef58
 /* Tries to own the org.freedesktop.FileManager1 service name */
00ef58
-- 
00ef58
2.38.1
00ef58