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