summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-08-30 13:12:18 -0400
committerMatthias Clasen <mclasen@redhat.com>2018-08-30 22:53:36 -0400
commitd6945d81f0a5bebfd384576cbdeb24924e864a91 (patch)
treef22a3848e216bdff267d469f3abf40399d2c901a
parent6d6559f982998c469aed211c2803d9639e0cdd86 (diff)
downloadgtk+-d6945d81f0a5bebfd384576cbdeb24924e864a91.tar.gz
print portal: use request path utilities
Less code duplication, more cookies!
-rw-r--r--gtk/gtkprintoperation-portal.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/gtk/gtkprintoperation-portal.c b/gtk/gtkprintoperation-portal.c
index ded550262b..fa4a058efd 100644
--- a/gtk/gtkprintoperation-portal.c
+++ b/gtk/gtkprintoperation-portal.c
@@ -561,17 +561,9 @@ call_prepare_print (GtkPrintOperation *op,
GtkPrintOperationPrivate *priv = op->priv;
GVariantBuilder opt_builder;
char *token;
- char *sender;
- int i;
- token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT));
- sender = g_strdup (g_dbus_connection_get_unique_name (g_dbus_proxy_get_connection (portal->proxy)) + 1);
- for (i = 0; sender[i]; i++)
- if (sender[i] == '.')
- sender[i] = '_';
-
- portal->prepare_print_handle = g_strconcat (PORTAL_OBJECT_PATH "/request/", sender, "/", token, NULL);
- g_free (sender);
+ portal->prepare_print_handle =
+ gtk_get_portal_request_path (g_dbus_proxy_get_connection (portal->proxy), &token);
portal->response_signal_id =
g_dbus_connection_signal_subscribe (g_dbus_proxy_get_connection (G_DBUS_PROXY (portal->proxy)),