aboutsummaryrefslogtreecommitdiff
path: root/src/mm-auth-provider.h
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-01-10 14:47:40 +0100
committerDan Williams <dcbw@redhat.com>2020-01-23 11:50:23 +0000
commit20ab6550fbf88b6e89d7243c08fe1ba12bf44fdf (patch)
tree521a742ab2aeff3140abe1078a89b9c9a9dc37ac /src/mm-auth-provider.h
parenta6a3db21846248979f7cd1062a2551aac6f9ad3c (diff)
auth-provider: refactor and simplify
The auth provider setup is a bit over-engineered. Simplify it by making a single MMAuthProvider object that may or may not use polkit, depending on configure options. This object is also setup as a singleton object using the helper MM_DEFINE_SINGLETON_GETTER().
Diffstat (limited to 'src/mm-auth-provider.h')
-rw-r--r--src/mm-auth-provider.h53
1 files changed, 17 insertions, 36 deletions
diff --git a/src/mm-auth-provider.h b/src/mm-auth-provider.h
index 0f1270ce..c33e42ce 100644
--- a/src/mm-auth-provider.h
+++ b/src/mm-auth-provider.h
@@ -17,6 +17,7 @@
#ifndef MM_AUTH_PROVIDER_H
#define MM_AUTH_PROVIDER_H
+#include <config.h>
#include <gio/gio.h>
#define MM_TYPE_AUTH_PROVIDER (mm_auth_provider_get_type ())
@@ -37,41 +38,21 @@
#define MM_AUTHORIZATION_TIME "org.freedesktop.ModemManager1.Time"
#define MM_AUTHORIZATION_FIRMWARE "org.freedesktop.ModemManager1.Firmware"
-typedef struct _MMAuthProvider MMAuthProvider;
-typedef struct _MMAuthProviderClass MMAuthProviderClass;
-
-struct _MMAuthProvider {
- GObject parent;
-};
-
-struct _MMAuthProviderClass {
- GObjectClass parent;
-
- /* Perform authorization checks in this request (async).
- * Returns TRUE if authorized, FALSE if error is set. */
- void (* authorize) (MMAuthProvider *self,
- GDBusMethodInvocation *invocation,
- const gchar *authorization,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
- gboolean (* authorize_finish) (MMAuthProvider *self,
- GAsyncResult *res,
- GError **error);
-};
-
-GType mm_auth_provider_get_type (void);
-
-MMAuthProvider *mm_auth_provider_new (void);
-
-void mm_auth_provider_authorize (MMAuthProvider *self,
- GDBusMethodInvocation *invocation,
- const gchar *authorization,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean mm_auth_provider_authorize_finish (MMAuthProvider *self,
- GAsyncResult *res,
- GError **error);
+typedef struct _MMAuthProvider MMAuthProvider;
+typedef struct _MMAuthProviderClass MMAuthProviderClass;
+typedef struct _MMAuthProviderPrivate MMAuthProviderPrivate;
+
+GType mm_auth_provider_get_type (void);
+MMAuthProvider *mm_auth_provider_get (void);
+
+void mm_auth_provider_authorize (MMAuthProvider *self,
+ GDBusMethodInvocation *invocation,
+ const gchar *authorization,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_auth_provider_authorize_finish (MMAuthProvider *self,
+ GAsyncResult *res,
+ GError **error);
#endif /* MM_AUTH_PROVIDER_H */