Merge branch 'fm-showitems' into 'main'

filelauncher: Use ShowItems to show in File Manager

Closes #5842

See merge request GNOME/gtk!5997
This commit is contained in:
Matthias Clasen 2023-05-21 23:22:57 +00:00
commit 5edf9fc449

View File

@ -229,9 +229,9 @@ open_done (GObject *source,
#endif #endif
static void static void
show_folder_done (GObject *source, show_item_done (GObject *source,
GAsyncResult *result, GAsyncResult *result,
gpointer data) gpointer data)
{ {
GDBusConnection *bus = G_DBUS_CONNECTION (source); GDBusConnection *bus = G_DBUS_CONNECTION (source);
GTask *task = G_TASK (data); GTask *task = G_TASK (data);
@ -261,11 +261,10 @@ show_folder_done (GObject *source,
#define FILE_MANAGER_DBUS_PATH "/org/freedesktop/FileManager1" #define FILE_MANAGER_DBUS_PATH "/org/freedesktop/FileManager1"
static void static void
show_folder (GtkWindow *parent, show_item (GtkWindow *parent,
const char *uri, const char *uri,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GTask *task)
gpointer user_data)
{ {
GDBusConnection *bus; GDBusConnection *bus;
GVariantBuilder uris_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY); GVariantBuilder uris_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_STRING_ARRAY);
@ -274,10 +273,10 @@ show_folder (GtkWindow *parent,
if (!bus) if (!bus)
{ {
g_task_return_new_error (G_TASK (user_data), g_task_return_new_error (task,
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
"Session bus not available"); "Session bus not available");
g_object_unref (G_TASK (user_data)); g_object_unref (task);
return; return;
} }
@ -287,14 +286,14 @@ show_folder (GtkWindow *parent,
FILE_MANAGER_DBUS_NAME, FILE_MANAGER_DBUS_NAME,
FILE_MANAGER_DBUS_PATH, FILE_MANAGER_DBUS_PATH,
FILE_MANAGER_DBUS_IFACE, FILE_MANAGER_DBUS_IFACE,
"ShowFolders", "ShowItems",
g_variant_new ("(ass)", &uris_builder, ""), g_variant_new ("(ass)", &uris_builder, ""),
NULL, /* ignore returned type */ NULL, /* ignore returned type */
G_DBUS_CALL_FLAGS_NONE, G_DBUS_CALL_FLAGS_NONE,
-1, -1,
cancellable, cancellable,
show_folder_done, show_item_done,
user_data); task);
} }
G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS
@ -470,7 +469,7 @@ gtk_file_launcher_open_containing_folder (GtkFileLauncher *self,
{ {
char *uri = g_file_get_uri (self->file); char *uri = g_file_get_uri (self->file);
show_folder (parent, uri, cancellable, show_folder_done, task); show_item (parent, uri, cancellable, task);
g_free (uri); g_free (uri);
} }