From b778c1a356438b7c5729f8f0e1b01c5d4b857132 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 16 2023 06:21:37 +0000 Subject: import nautilus-3.28.1-23.el8 --- diff --git a/SOURCES/Revert-application-add-common-startup-code.patch b/SOURCES/Revert-application-add-common-startup-code.patch new file mode 100644 index 0000000..a7751e5 --- /dev/null +++ b/SOURCES/Revert-application-add-common-startup-code.patch @@ -0,0 +1,93 @@ +From 5b40335c34a3b920348633274a03d073d1338a09 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Mon, 9 Jan 2023 13:12:17 +0100 +Subject: [PATCH] Revert "application: add common startup code" + +This reverts commit 23ae53870a39afe43548111b6432db39511a6e97. This +change was needed for split of desktop-related functionality, but it +seems no more needed to me. Let's revert those changes to make the +code a bit easier as a preparation for the next commits. +--- + src/nautilus-application.c | 31 ++++++------------------------- + src/nautilus-application.h | 1 - + 2 files changed, 6 insertions(+), 26 deletions(-) + +diff --git a/src/nautilus-application.c b/src/nautilus-application.c +index 22a01ad..829faa3 100644 +--- a/src/nautilus-application.c ++++ b/src/nautilus-application.c +@@ -1250,9 +1250,10 @@ on_application_shutdown (GApplication *application, + nautilus_icon_info_clear_caches (); + } + +-void +-nautilus_application_startup_common (NautilusApplication *self) ++static void ++nautilus_application_startup (GApplication *app) + { ++ NautilusApplication *self = NAUTILUS_APPLICATION (app); + NautilusApplicationPrivate *priv; + + nautilus_profile_start (NULL); +@@ -1269,6 +1270,9 @@ nautilus_application_startup_common (NautilusApplication *self) + + setup_theme_extensions (); + ++ /* create DBus manager */ ++ priv->fdb_manager = nautilus_freedesktop_dbus_new (); ++ + /* initialize preferences and create the global GSettings objects */ + nautilus_global_preferences_init (); + +@@ -1295,22 +1299,6 @@ nautilus_application_startup_common (NautilusApplication *self) + g_signal_connect (self, "shutdown", G_CALLBACK (on_application_shutdown), NULL); + } + +-static void +-nautilus_application_startup (GApplication *app) +-{ +- NautilusApplication *self = NAUTILUS_APPLICATION (app); +- NautilusApplicationPrivate *priv; +- +- nautilus_profile_start (NULL); +- priv = nautilus_application_get_instance_private (self); +- +- /* create DBus manager */ +- priv->fdb_manager = nautilus_freedesktop_dbus_new (); +- nautilus_application_startup_common (self); +- +- nautilus_profile_end (NULL); +-} +- + static gboolean + nautilus_application_dbus_register (GApplication *app, + GDBusConnection *connection, +@@ -1374,13 +1362,6 @@ update_dbus_opened_locations (NautilusApplication *self) + + priv = nautilus_application_get_instance_private (self); + +- /* Children of nautilus application could not handle the dbus, so don't +- * do anything in that case */ +- if (!priv->fdb_manager) +- { +- return; +- } +- + for (l = priv->windows; l != NULL; l = l->next) + { + window = l->data; +diff --git a/src/nautilus-application.h b/src/nautilus-application.h +index 197a276..5f15f06 100644 +--- a/src/nautilus-application.h ++++ b/src/nautilus-application.h +@@ -88,7 +88,6 @@ GtkWidget * nautilus_application_connect_server (NautilusApplication *applicatio + void nautilus_application_search (NautilusApplication *application, + const gchar *uri, + const gchar *text); +-void nautilus_application_startup_common (NautilusApplication *application); + G_END_DECLS + + #endif /* __NAUTILUS_APPLICATION_H__ */ +-- +2.38.1 + diff --git a/SOURCES/application-Export-FileManager1-iface-from-dbus_regi.patch b/SOURCES/application-Export-FileManager1-iface-from-dbus_regi.patch new file mode 100644 index 0000000..7cb136b --- /dev/null +++ b/SOURCES/application-Export-FileManager1-iface-from-dbus_regi.patch @@ -0,0 +1,304 @@ +From 1fa3039c67671fe53416b2575f3c305029ef4854 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Wed, 11 Jan 2023 09:55:41 +0100 +Subject: [PATCH] application: Export FileManager1 iface from dbus_register + vfunc + +The `org/freedesktop/FileManager1` interface is not currently exported +from the `dbus_register` vfunc. This causes issues for projects (e.g. +desktop-icons extension) that want to use all the Nautilus intefaces +over the `org.gnome.Nautilus` connection. Let's use the already established +connection and export the `FileManager1` interface from the `dbus_register` +vfunc. + +https://bugzilla.redhat.com/show_bug.cgi?id=2150894 +--- + src/nautilus-application.c | 17 ++-- + src/nautilus-freedesktop-dbus.c | 150 +++++++++++++++++++++++++------- + src/nautilus-freedesktop-dbus.h | 6 +- + 3 files changed, 136 insertions(+), 37 deletions(-) + +diff --git a/src/nautilus-application.c b/src/nautilus-application.c +index 829faa3..3bb3da1 100644 +--- a/src/nautilus-application.c ++++ b/src/nautilus-application.c +@@ -608,8 +608,6 @@ nautilus_application_finalize (GObject *object) + g_clear_object (&priv->progress_handler); + g_clear_object (&priv->bookmark_list); + +- g_clear_object (&priv->fdb_manager); +- + g_list_free (priv->windows); + + g_hash_table_destroy (priv->notifications); +@@ -1270,9 +1268,6 @@ nautilus_application_startup (GApplication *app) + + setup_theme_extensions (); + +- /* create DBus manager */ +- priv->fdb_manager = nautilus_freedesktop_dbus_new (); +- + /* initialize preferences and create the global GSettings objects */ + nautilus_global_preferences_init (); + +@@ -1315,6 +1310,12 @@ nautilus_application_dbus_register (GApplication *app, + return FALSE; + } + ++ priv->fdb_manager = nautilus_freedesktop_dbus_new (connection); ++ if (!nautilus_freedesktop_dbus_register (priv->fdb_manager, error)) ++ { ++ return FALSE; ++ } ++ + priv->search_provider = nautilus_shell_search_provider_new (); + if (!nautilus_shell_search_provider_register (priv->search_provider, connection, error)) + { +@@ -1339,6 +1340,12 @@ nautilus_application_dbus_unregister (GApplication *app, + g_clear_object (&priv->dbus_manager); + } + ++ if (priv->fdb_manager) ++ { ++ nautilus_freedesktop_dbus_unregister (priv->fdb_manager); ++ g_clear_object (&priv->fdb_manager); ++ } ++ + if (priv->search_provider) + { + nautilus_shell_search_provider_unregister (priv->search_provider); +diff --git a/src/nautilus-freedesktop-dbus.c b/src/nautilus-freedesktop-dbus.c +index b888099..d013e20 100644 +--- a/src/nautilus-freedesktop-dbus.c ++++ b/src/nautilus-freedesktop-dbus.c +@@ -41,6 +41,14 @@ struct _NautilusFreedesktopDBus + + /* Our DBus implementation skeleton */ + NautilusFreedesktopFileManager1 *skeleton; ++ ++ GDBusConnection *connection; ++}; ++ ++enum ++{ ++ PROP_0, ++ PROP_CONNECTION, + }; + + struct _NautilusFreedesktopDBusClass +@@ -149,27 +157,6 @@ skeleton_handle_show_item_properties_cb (NautilusFreedesktopFileManager1 *object + return TRUE; + } + +-static void +-bus_acquired_cb (GDBusConnection *conn, +- const gchar *name, +- gpointer user_data) +-{ +- NautilusFreedesktopDBus *fdb = user_data; +- +- DEBUG ("Bus acquired at %s", name); +- +- fdb->skeleton = nautilus_freedesktop_file_manager1_skeleton_new (); +- +- g_signal_connect (fdb->skeleton, "handle-show-items", +- G_CALLBACK (skeleton_handle_show_items_cb), fdb); +- g_signal_connect (fdb->skeleton, "handle-show-folders", +- G_CALLBACK (skeleton_handle_show_folders_cb), fdb); +- g_signal_connect (fdb->skeleton, "handle-show-item-properties", +- 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); +-} +- + static void + name_acquired_cb (GDBusConnection *connection, + const gchar *name, +@@ -186,6 +173,20 @@ name_lost_cb (GDBusConnection *connection, + DEBUG ("Lost (or failed to acquire) the name %s on the session message bus\n", name); + } + ++static void ++nautilus_freedesktop_dbus_constructed (GObject *object) ++{ ++ NautilusFreedesktopDBus *fdb = NAUTILUS_FREEDESKTOP_DBUS (object); ++ ++ fdb->owner_id = g_bus_own_name_on_connection (fdb->connection, ++ NAUTILUS_FDO_DBUS_NAME, ++ G_BUS_NAME_OWNER_FLAGS_NONE, ++ name_acquired_cb, ++ name_lost_cb, ++ fdb, ++ NULL); ++} ++ + static void + nautilus_freedesktop_dbus_dispose (GObject *object) + { +@@ -199,33 +200,87 @@ nautilus_freedesktop_dbus_dispose (GObject *object) + + if (fdb->skeleton != NULL) + { +- g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (fdb->skeleton)); + g_object_unref (fdb->skeleton); + fdb->skeleton = NULL; + } + ++ g_clear_object (&fdb->connection); ++ + G_OBJECT_CLASS (nautilus_freedesktop_dbus_parent_class)->dispose (object); + } + ++static void ++nautilus_freedesktop_dbus_set_property (GObject *object, ++ guint prop_id, ++ const GValue *value, ++ GParamSpec *pspec) ++{ ++ NautilusFreedesktopDBus *fdb = NAUTILUS_FREEDESKTOP_DBUS (object); ++ ++ switch (prop_id) ++ { ++ case PROP_CONNECTION: ++ { ++ g_set_object (&fdb->connection, g_value_get_object (value)); ++ } ++ break; ++ ++ default: ++ { ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); ++ } ++ break; ++ } ++} ++ ++static void ++nautilus_freedesktop_dbus_get_property (GObject *object, ++ guint prop_id, ++ GValue *value, ++ GParamSpec *pspec) ++{ ++ NautilusFreedesktopDBus *fdb = NAUTILUS_FREEDESKTOP_DBUS (object); ++ ++ switch (prop_id) ++ { ++ case PROP_CONNECTION: ++ { ++ g_value_set_object (value, fdb->connection); ++ } ++ break; ++ ++ default: ++ { ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); ++ } ++ break; ++ } ++} ++ + 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->constructed = nautilus_freedesktop_dbus_constructed; ++ object_class->get_property = nautilus_freedesktop_dbus_get_property; ++ object_class->set_property = nautilus_freedesktop_dbus_set_property; ++ ++ g_object_class_install_property (object_class, ++ PROP_CONNECTION, ++ g_param_spec_object ("connection", ++ "Connection", ++ "GDBus connection property", ++ G_TYPE_DBUS_CONNECTION, ++ G_PARAM_CONSTRUCT_ONLY | ++ G_PARAM_READWRITE)); + } + + static void + nautilus_freedesktop_dbus_init (NautilusFreedesktopDBus *fdb) + { +- fdb->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, +- NAUTILUS_FDO_DBUS_NAME, +- G_BUS_NAME_OWNER_FLAGS_NONE, +- bus_acquired_cb, +- name_acquired_cb, +- name_lost_cb, +- fdb, +- NULL); ++ fdb->skeleton = nautilus_freedesktop_file_manager1_skeleton_new (); + } + + void +@@ -239,8 +294,41 @@ nautilus_freedesktop_dbus_set_open_locations (NautilusFreedesktopDBus *fdb, + + /* Tries to own the org.freedesktop.FileManager1 service name */ + NautilusFreedesktopDBus * +-nautilus_freedesktop_dbus_new (void) ++nautilus_freedesktop_dbus_new (GDBusConnection *connection) + { + return g_object_new (nautilus_freedesktop_dbus_get_type (), ++ "connection", connection, + NULL); + } ++ ++gboolean ++nautilus_freedesktop_dbus_register (NautilusFreedesktopDBus *fdb, ++ GError **error) ++{ ++ gboolean success; ++ ++ success = g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (fdb->skeleton), ++ fdb->connection, ++ NAUTILUS_FDO_DBUS_PATH, ++ error); ++ ++ if (success) ++ { ++ g_signal_connect (fdb->skeleton, "handle-show-items", ++ G_CALLBACK (skeleton_handle_show_items_cb), fdb); ++ g_signal_connect (fdb->skeleton, "handle-show-folders", ++ G_CALLBACK (skeleton_handle_show_folders_cb), fdb); ++ g_signal_connect (fdb->skeleton, "handle-show-item-properties", ++ G_CALLBACK (skeleton_handle_show_item_properties_cb), fdb); ++ } ++ ++ return success; ++} ++ ++void ++nautilus_freedesktop_dbus_unregister (NautilusFreedesktopDBus *fdb) ++{ ++ g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (fdb->skeleton)); ++ ++ g_signal_handlers_disconnect_by_data (fdb->skeleton, fdb); ++} +diff --git a/src/nautilus-freedesktop-dbus.h b/src/nautilus-freedesktop-dbus.h +index 410c420..ee2ced5 100644 +--- a/src/nautilus-freedesktop-dbus.h ++++ b/src/nautilus-freedesktop-dbus.h +@@ -23,6 +23,7 @@ + #define __NAUTILUS_FREEDESKTOP_DBUS_H__ + + #include ++#include + + #define NAUTILUS_FDO_DBUS_IFACE "org.freedesktop.FileManager1" + #define NAUTILUS_FDO_DBUS_NAME "org.freedesktop.FileManager1" +@@ -44,7 +45,10 @@ typedef struct _NautilusFreedesktopDBus NautilusFreedesktopDBus; + typedef struct _NautilusFreedesktopDBusClass NautilusFreedesktopDBusClass; + + GType nautilus_freedesktop_dbus_get_type (void); +-NautilusFreedesktopDBus * nautilus_freedesktop_dbus_new (void); ++NautilusFreedesktopDBus * nautilus_freedesktop_dbus_new (GDBusConnection *connection); ++ ++gboolean nautilus_freedesktop_dbus_register (NautilusFreedesktopDBus *fdb, GError **error); ++void nautilus_freedesktop_dbus_unregister (NautilusFreedesktopDBus *fdb); + + void nautilus_freedesktop_dbus_set_open_locations (NautilusFreedesktopDBus *fdb, const gchar **locations); + +-- +2.38.1 + diff --git a/SOURCES/freedesktop-dbus-Try-to-own-the-name-until-after-exp.patch b/SOURCES/freedesktop-dbus-Try-to-own-the-name-until-after-exp.patch new file mode 100644 index 0000000..6d0fe2c --- /dev/null +++ b/SOURCES/freedesktop-dbus-Try-to-own-the-name-until-after-exp.patch @@ -0,0 +1,96 @@ +From ba878013689114bf199ba2260f9282ae82b352c4 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Wed, 22 Feb 2023 16:22:43 +0100 +Subject: [PATCH] freedesktop-dbus: Try to own the name until after exporting + skeleton + +Currently, the `g_bus_own_name_on_connection` function is called for the +`org.freedesktop.FileManager1` name before exporting the +`/org/freedesktop/FileManager1` skeleton. This seemingly works fine in most +cases, but occasionally the name is acquired too early and D-Bus clients +can get `No such interface` error. This is regression caused by the commit +2293e813d3cd1cc47b2b8750f7140647aa066fc8. Let's try to own the nam until +after exporting the skeleton to avoid this error. +--- + src/nautilus-freedesktop-dbus.c | 31 +++++++++++++++---------------- + 1 file changed, 15 insertions(+), 16 deletions(-) + +diff --git a/src/nautilus-freedesktop-dbus.c b/src/nautilus-freedesktop-dbus.c +index c253cfaba..c20166abb 100644 +--- a/src/nautilus-freedesktop-dbus.c ++++ b/src/nautilus-freedesktop-dbus.c +@@ -162,20 +162,6 @@ name_lost_cb (GDBusConnection *connection, + DEBUG ("Lost (or failed to acquire) the name %s on the session message bus\n", name); + } + +-static void +-nautilus_freedesktop_dbus_constructed (GObject *object) +-{ +- NautilusFreedesktopDBus *fdb = NAUTILUS_FREEDESKTOP_DBUS (object); +- +- fdb->owner_id = g_bus_own_name_on_connection (fdb->connection, +- NAUTILUS_FDO_DBUS_NAME, +- G_BUS_NAME_OWNER_FLAGS_NONE, +- name_acquired_cb, +- name_lost_cb, +- fdb, +- NULL); +-} +- + static void + nautilus_freedesktop_dbus_dispose (GObject *object) + { +@@ -252,7 +238,6 @@ nautilus_freedesktop_dbus_class_init (NautilusFreedesktopDBusClass *klass) + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = nautilus_freedesktop_dbus_dispose; +- object_class->constructed = nautilus_freedesktop_dbus_constructed; + object_class->get_property = nautilus_freedesktop_dbus_get_property; + object_class->set_property = nautilus_freedesktop_dbus_set_property; + +@@ -301,7 +286,6 @@ nautilus_freedesktop_dbus_set_open_locations (NautilusFreedesktopDB + nautilus_freedesktop_file_manager1_set_open_locations (fdb->skeleton, locations); + } + +-/* Tries to own the org.freedesktop.FileManager1 service name */ + NautilusFreedesktopDBus * + nautilus_freedesktop_dbus_new (GDBusConnection *connection) + { +@@ -310,6 +294,7 @@ nautilus_freedesktop_dbus_new (GDBusConnection *connection) + NULL); + } + ++/* Tries to own the org.freedesktop.FileManager1 service name */ + gboolean + nautilus_freedesktop_dbus_register (NautilusFreedesktopDBus *fdb, + GError **error) +@@ -331,12 +316,26 @@ nautilus_freedesktop_dbus_register (NautilusFreedesktopDBus *fdb, + G_CALLBACK (skeleton_handle_show_item_properties_cb), fdb); + } + ++ fdb->owner_id = g_bus_own_name_on_connection (fdb->connection, ++ NAUTILUS_FDO_DBUS_NAME, ++ G_BUS_NAME_OWNER_FLAGS_NONE, ++ name_acquired_cb, ++ name_lost_cb, ++ fdb, ++ NULL); ++ + return success; + } + + void + nautilus_freedesktop_dbus_unregister (NautilusFreedesktopDBus *fdb) + { ++ if (fdb->owner_id != 0) ++ { ++ g_bus_unown_name (fdb->owner_id); ++ fdb->owner_id = 0; ++ } ++ + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (fdb->skeleton)); + + g_signal_handlers_disconnect_by_data (fdb->skeleton, fdb); +-- +2.39.1 + diff --git a/SPECS/nautilus.spec b/SPECS/nautilus.spec index cd7a083..5d868e7 100644 --- a/SPECS/nautilus.spec +++ b/SPECS/nautilus.spec @@ -8,7 +8,7 @@ Name: nautilus Version: 3.28.1 -Release: 21%{?dist} +Release: 23%{?dist} Summary: File manager for GNOME License: GPLv3+ @@ -84,6 +84,11 @@ Patch40: files-view-Backport-translations.patch # https://bugzilla.redhat.com/show_bug.cgi?id=2106241 Patch41: nautilus-canvas-container-Remove-the-include-visible.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2150894 +Patch42: Revert-application-add-common-startup-code.patch +Patch43: application-Export-FileManager1-iface-from-dbus_regi.patch +Patch44: freedesktop-dbus-Try-to-own-the-name-until-after-exp.patch + BuildRequires: gtk-doc BuildRequires: meson BuildRequires: gcc @@ -196,6 +201,12 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop %{_datadir}/gir-1.0/*.gir %changelog +* Thu Feb 23 2023 Ondrej Holy - 3.28.1-23 +- Try to own the name until after exporting skeleton (#2150894) + +* Wed Feb 01 2023 Ondrej Holy - 3.28.1-22 +- Export FileManager1 iface from dbus_register vfunc (#2150894) + * Thu Sep 22 2022 Ondrej Holy - 3.28.1-21 - Backport "_Copy Location" translations (#2099981)