forked from AuroraMiddleware/gtk
file chooser portal: use request path utilities
Less code duplication, more sticky toffee!
This commit is contained in:
parent
c3077467d0
commit
f734c3d3b0
@ -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 ("org.freedesktop.portal.Desktop",
|
message = g_dbus_message_new_method_call ("org.freedesktop.portal.Desktop",
|
||||||
"/org/freedesktop/portal/desktop",
|
"/org/freedesktop/portal/desktop",
|
||||||
"org.freedesktop.portal.FileChooser",
|
"org.freedesktop.portal.FileChooser",
|
||||||
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_strdup_printf ("/org/fredesktop/portal/desktop/request/%s/%s", sender, token);
|
|
||||||
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,
|
||||||
"org.freedesktop.portal.Desktop",
|
"org.freedesktop.portal.Desktop",
|
||||||
|
Loading…
Reference in New Issue
Block a user