Skip to content

Commit

Permalink
notification: Get the activation-token form ActionInvoked when using …
Browse files Browse the repository at this point in the history
…portal

Since [1] the xdg-desktop-portal-gtk adds the activation-token to the
ActionInvoked signal. We can store it and let apps use it like the
activation-token we get from FDO.

[1] flatpak/xdg-desktop-portal-gtk#468
  • Loading branch information
jsparber committed Mar 3, 2024
1 parent 150af91 commit 6c83f4b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions libnotify/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,29 @@ proxy_g_signal_cb (GDBusProxy *proxy,
const char *id;
const char *action;
GVariant *parameter;
int i;

g_variant_get (parameters, "(&s&s@av)", &id, &action, &parameter);

for (i = 0; i < g_variant_n_children (parameter); i++) {
g_autoptr (GVariant) data = NULL;
g_variant_get_child (parameter, i, "v", &data);

if (g_variant_is_of_type (data, G_VARIANT_TYPE_VARDICT)) {
const char *key = NULL;
g_autoptr (GVariant) pdata = NULL;

g_variant_get (data, "{&sv}", &key, &pdata);

if (strcmp (key, "activation-token") == 0 &&
g_variant_is_of_type (data, G_VARIANT_TYPE_STRING)) {
g_free (notification->priv->activation_token);
notification->priv->activation_token = g_variant_dup_string (pdata, NULL);
break;
}
}
}

g_variant_unref (parameter);

notification_id = get_portal_notification_id (notification);
Expand Down

0 comments on commit 6c83f4b

Please sign in to comment.