file chooser portal: use request path utilities

Less code duplication, more sticky toffee!
This commit is contained in:
Matthias Clasen 2018-08-30 13:13:45 -04:00
parent d6945d81f0
commit 04c02e9aec

View File

@ -296,23 +296,13 @@ show_portal_file_chooser (GtkFileChooserNative *self,
gboolean multiple;
const char *title;
char *token;
char *sender;
int i;
message = g_dbus_message_new_method_call (PORTAL_BUS_NAME,
PORTAL_OBJECT_PATH,
PORTAL_FILECHOOSER_INTERFACE,
data->method_name);
token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT));
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_handle = gtk_get_portal_request_path (data->connection, &token);
data->portal_response_signal_id =
g_dbus_connection_signal_subscribe (data->connection,
PORTAL_BUS_NAME,