mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-14 21:18:11 -04:00
auth: Add helpers dbus helpers for sending webflow signals
This commit is contained in:
committed by
Alexander Larsson
parent
dd71bf720e
commit
9a8bf2be31
@@ -42,24 +42,29 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoFlatpakAuthenticator, g_object_unref)
|
||||
typedef FlatpakAuthenticatorRequest AutoFlatpakAuthenticatorRequest;
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoFlatpakAuthenticatorRequest, g_object_unref)
|
||||
|
||||
FlatpakAuthenticator * flatpak_auth_new_for_remote (FlatpakDir *dir,
|
||||
const char *remote,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FlatpakAuthenticatorRequest *flatpak_auth_create_request (FlatpakAuthenticator *authenticator,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean flatpak_auth_request_ref_tokens (FlatpakAuthenticator *authenticator,
|
||||
FlatpakAuthenticatorRequest *request,
|
||||
const char **refs,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * flatpak_auth_create_request_path (const char *peer,
|
||||
const char *token,
|
||||
GError **error);
|
||||
void flatpak_auth_request_emit_response (FlatpakAuthenticatorRequest *request,
|
||||
const gchar *destination_bus_name,
|
||||
guint arg_response,
|
||||
GVariant *arg_results);
|
||||
FlatpakAuthenticator * flatpak_auth_new_for_remote (FlatpakDir *dir,
|
||||
const char *remote,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FlatpakAuthenticatorRequest *flatpak_auth_create_request (FlatpakAuthenticator *authenticator,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean flatpak_auth_request_ref_tokens (FlatpakAuthenticator *authenticator,
|
||||
FlatpakAuthenticatorRequest *request,
|
||||
const char **refs,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * flatpak_auth_create_request_path (const char *peer,
|
||||
const char *token,
|
||||
GError **error);
|
||||
void flatpak_auth_request_emit_response (FlatpakAuthenticatorRequest *request,
|
||||
const gchar *destination_bus_name,
|
||||
guint arg_response,
|
||||
GVariant *arg_results);
|
||||
void flatpak_auth_request_emit_webflow (FlatpakAuthenticatorRequest *request,
|
||||
const gchar *destination_bus_name,
|
||||
const char *arg_uri);
|
||||
void flatpak_auth_request_emit_webflow_done (FlatpakAuthenticatorRequest *request,
|
||||
const gchar *destination_bus_name);
|
||||
|
||||
#endif /* __FLATPAK_AUTH_H__ */
|
||||
|
||||
@@ -178,3 +178,46 @@ flatpak_auth_request_emit_response (FlatpakAuthenticatorRequest *request,
|
||||
}
|
||||
g_list_free_full (connections, g_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
flatpak_auth_request_emit_webflow (FlatpakAuthenticatorRequest *request,
|
||||
const gchar *destination_bus_name,
|
||||
const char *arg_uri)
|
||||
{
|
||||
FlatpakAuthenticatorRequestSkeleton *skeleton = FLATPAK_AUTHENTICATOR_REQUEST_SKELETON (request);
|
||||
GList *connections, *l;
|
||||
g_autoptr(GVariant) signal_variant = NULL;
|
||||
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
|
||||
|
||||
signal_variant = g_variant_ref_sink (g_variant_new ("(s)", arg_uri));
|
||||
for (l = connections; l != NULL; l = l->next)
|
||||
{
|
||||
GDBusConnection *connection = l->data;
|
||||
g_dbus_connection_emit_signal (connection, destination_bus_name,
|
||||
g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
|
||||
"org.freedesktop.Flatpak.AuthenticatorRequest", "Webflow",
|
||||
signal_variant, NULL);
|
||||
}
|
||||
g_list_free_full (connections, g_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
flatpak_auth_request_emit_webflow_done (FlatpakAuthenticatorRequest *request,
|
||||
const gchar *destination_bus_name)
|
||||
{
|
||||
FlatpakAuthenticatorRequestSkeleton *skeleton = FLATPAK_AUTHENTICATOR_REQUEST_SKELETON (request);
|
||||
GList *connections, *l;
|
||||
g_autoptr(GVariant) signal_variant = NULL;
|
||||
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
|
||||
|
||||
signal_variant = g_variant_ref_sink (g_variant_new ("()"));
|
||||
for (l = connections; l != NULL; l = l->next)
|
||||
{
|
||||
GDBusConnection *connection = l->data;
|
||||
g_dbus_connection_emit_signal (connection, destination_bus_name,
|
||||
g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
|
||||
"org.freedesktop.Flatpak.AuthenticatorRequest", "WebflowDone",
|
||||
signal_variant, NULL);
|
||||
}
|
||||
g_list_free_full (connections, g_object_unref);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user