summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2023-01-11 09:44:25 +0100
committerAntónio Fernandes <antoniof@gnome.org>2023-01-13 09:50:24 +0000
commitbf615805d2179708bb6311e5939f91ce80471535 (patch)
tree668f8b5113858936df933c9b6adc1a747e5b29d5
parent1c43d859ad0ca52e5b4a82169929f38ee9dd0f69 (diff)
downloadnautilus-bf615805d2179708bb6311e5939f91ce80471535.tar.gz
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.
-rw-r--r--src/nautilus-freedesktop-dbus.c81
1 files changed, 3 insertions, 78 deletions
diff --git a/src/nautilus-freedesktop-dbus.c b/src/nautilus-freedesktop-dbus.c
index 2eaebcc29..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
@@ -226,25 +197,11 @@ nautilus_freedesktop_dbus_dispose (GObject *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);
-
- G_OBJECT_CLASS (nautilus_freedesktop_dbus_parent_class)->finalize (object);
-}
-
-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
@@ -258,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
@@ -270,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);
}
/**
@@ -303,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 */