mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 23:00:08 +00:00
file chooser portal: use request path utilities
Less code duplication, more sticky toffee!
This commit is contained in:
parent
d6945d81f0
commit
04c02e9aec
@ -296,23 +296,13 @@ show_portal_file_chooser (GtkFileChooserNative *self,
|
|||||||
gboolean multiple;
|
gboolean multiple;
|
||||||
const char *title;
|
const char *title;
|
||||||
char *token;
|
char *token;
|
||||||
char *sender;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
message = g_dbus_message_new_method_call (PORTAL_BUS_NAME,
|
message = g_dbus_message_new_method_call (PORTAL_BUS_NAME,
|
||||||
PORTAL_OBJECT_PATH,
|
PORTAL_OBJECT_PATH,
|
||||||
PORTAL_FILECHOOSER_INTERFACE,
|
PORTAL_FILECHOOSER_INTERFACE,
|
||||||
data->method_name);
|
data->method_name);
|
||||||
|
|
||||||
token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT));
|
data->portal_handle = gtk_get_portal_request_path (data->connection, &token);
|
||||||
sender = g_strdup (g_dbus_connection_get_unique_name (data->connection) + 1);
|
|
||||||
for (i = 0; sender[i]; i++)
|
|
||||||
if (sender[i] == '.')
|
|
||||||
sender[i] = '_';
|
|
||||||
|
|
||||||
data->portal_handle = g_strconcat (PORTAL_OBJECT_PATH "/request/", sender, "/", token, NULL);
|
|
||||||
g_free (sender);
|
|
||||||
|
|
||||||
data->portal_response_signal_id =
|
data->portal_response_signal_id =
|
||||||
g_dbus_connection_signal_subscribe (data->connection,
|
g_dbus_connection_signal_subscribe (data->connection,
|
||||||
PORTAL_BUS_NAME,
|
PORTAL_BUS_NAME,
|
||||||
|
Loading…
Reference in New Issue
Block a user