core: use GDBusMethodInvocation in the auth API
This commit is contained in:
@@ -55,7 +55,7 @@ static MMAuthRequest *
|
|||||||
real_create_request (MMAuthProvider *provider,
|
real_create_request (MMAuthProvider *provider,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify)
|
GDestroyNotify notify)
|
||||||
@@ -171,4 +171,3 @@ mm_auth_provider_polkit_class_init (MMAuthProviderPolkitClass *class)
|
|||||||
/* Properties */
|
/* Properties */
|
||||||
g_object_class_override_property (object_class, PROP_NAME, MM_AUTH_PROVIDER_NAME);
|
g_object_class_override_property (object_class, PROP_NAME, MM_AUTH_PROVIDER_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -105,12 +105,12 @@ static MMAuthRequest *
|
|||||||
real_create_request (MMAuthProvider *provider,
|
real_create_request (MMAuthProvider *provider,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify)
|
GDestroyNotify notify)
|
||||||
{
|
{
|
||||||
return (MMAuthRequest *) mm_auth_request_new (0,
|
return (MMAuthRequest *) mm_auth_request_new (0,
|
||||||
authorization,
|
authorization,
|
||||||
owner,
|
owner,
|
||||||
context,
|
context,
|
||||||
@@ -165,7 +165,7 @@ MMAuthRequest *
|
|||||||
mm_auth_provider_request_auth (MMAuthProvider *self,
|
mm_auth_provider_request_auth (MMAuthProvider *self,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify,
|
GDestroyNotify notify,
|
||||||
@@ -297,4 +297,3 @@ mm_auth_provider_class_init (MMAuthProviderClass *class)
|
|||||||
NULL_PROVIDER,
|
NULL_PROVIDER,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,8 +16,7 @@
|
|||||||
#ifndef MM_AUTH_PROVIDER_H
|
#ifndef MM_AUTH_PROVIDER_H
|
||||||
#define MM_AUTH_PROVIDER_H
|
#define MM_AUTH_PROVIDER_H
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <gio/gio.h>
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
|
|
||||||
#include "mm-auth-request.h"
|
#include "mm-auth-request.h"
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ typedef struct {
|
|||||||
MMAuthRequest * (*create_request) (MMAuthProvider *provider,
|
MMAuthRequest * (*create_request) (MMAuthProvider *provider,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify);
|
GDestroyNotify notify);
|
||||||
@@ -64,7 +63,7 @@ GType mm_auth_provider_get_type (void);
|
|||||||
MMAuthRequest *mm_auth_provider_request_auth (MMAuthProvider *provider,
|
MMAuthRequest *mm_auth_provider_request_auth (MMAuthProvider *provider,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify,
|
GDestroyNotify notify,
|
||||||
@@ -86,4 +85,3 @@ void mm_auth_provider_finish_request (MMAuthProvider *provider,
|
|||||||
void mm_auth_provider_cancel_request (MMAuthProvider *provider, MMAuthRequest *req);
|
void mm_auth_provider_cancel_request (MMAuthProvider *provider, MMAuthRequest *req);
|
||||||
|
|
||||||
#endif /* MM_AUTH_PROVIDER_H */
|
#endif /* MM_AUTH_PROVIDER_H */
|
||||||
|
|
||||||
|
@@ -34,14 +34,13 @@ GObject *
|
|||||||
mm_auth_request_polkit_new (PolkitAuthority *authority,
|
mm_auth_request_polkit_new (PolkitAuthority *authority,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify)
|
GDestroyNotify notify)
|
||||||
{
|
{
|
||||||
GObject *obj;
|
GObject *obj;
|
||||||
MMAuthRequestPolkitPrivate *priv;
|
MMAuthRequestPolkitPrivate *priv;
|
||||||
char *sender;
|
|
||||||
|
|
||||||
g_return_val_if_fail (authorization != NULL, NULL);
|
g_return_val_if_fail (authorization != NULL, NULL);
|
||||||
g_return_val_if_fail (owner != NULL, NULL);
|
g_return_val_if_fail (owner != NULL, NULL);
|
||||||
@@ -56,13 +55,14 @@ mm_auth_request_polkit_new (PolkitAuthority *authority,
|
|||||||
callback_data,
|
callback_data,
|
||||||
notify);
|
notify);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
const gchar *sender;
|
||||||
|
|
||||||
priv = MM_AUTH_REQUEST_POLKIT_GET_PRIVATE (obj);
|
priv = MM_AUTH_REQUEST_POLKIT_GET_PRIVATE (obj);
|
||||||
priv->authority = authority;
|
priv->authority = authority;
|
||||||
priv->cancellable = g_cancellable_new ();
|
priv->cancellable = g_cancellable_new ();
|
||||||
|
|
||||||
sender = dbus_g_method_get_sender (context);
|
sender = g_dbus_method_invocation_get_sender (context);
|
||||||
priv->subject = polkit_system_bus_name_new (sender);
|
priv->subject = polkit_system_bus_name_new (sender);
|
||||||
g_free (sender);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@@ -101,7 +101,7 @@ pk_auth_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||||||
|
|
||||||
g_signal_emit_by_name (self, "result");
|
g_signal_emit_by_name (self, "result");
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (self);
|
g_object_unref (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,4 +172,3 @@ mm_auth_request_polkit_class_init (MMAuthRequestPolkitClass *class)
|
|||||||
ar_class->authenticate = real_authenticate;
|
ar_class->authenticate = real_authenticate;
|
||||||
ar_class->dispose = real_dispose;
|
ar_class->dispose = real_dispose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,9 +16,8 @@
|
|||||||
#ifndef MM_AUTH_REQUEST_POLKIT_H
|
#ifndef MM_AUTH_REQUEST_POLKIT_H
|
||||||
#define MM_AUTH_REQUEST_POLKIT_H
|
#define MM_AUTH_REQUEST_POLKIT_H
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <gio/gio.h>
|
||||||
#include <polkit/polkit.h>
|
#include <polkit/polkit.h>
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
|
|
||||||
#include "mm-auth-request.h"
|
#include "mm-auth-request.h"
|
||||||
|
|
||||||
@@ -42,7 +41,7 @@ GType mm_auth_request_polkit_get_type (void);
|
|||||||
GObject *mm_auth_request_polkit_new (PolkitAuthority *authority,
|
GObject *mm_auth_request_polkit_new (PolkitAuthority *authority,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify);
|
GDestroyNotify notify);
|
||||||
@@ -50,4 +49,3 @@ GObject *mm_auth_request_polkit_new (PolkitAuthority *authority,
|
|||||||
void mm_auth_request_polkit_cancel (MMAuthRequestPolkit *self);
|
void mm_auth_request_polkit_cancel (MMAuthRequestPolkit *self);
|
||||||
|
|
||||||
#endif /* MM_AUTH_REQUEST_POLKIT_H */
|
#endif /* MM_AUTH_REQUEST_POLKIT_H */
|
||||||
|
|
||||||
|
@@ -22,7 +22,8 @@ G_DEFINE_TYPE (MMAuthRequest, mm_auth_request, G_TYPE_OBJECT)
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
GObject *owner;
|
GObject *owner;
|
||||||
char *auth;
|
char *auth;
|
||||||
DBusGMethodInvocation *context;
|
|
||||||
|
GDBusMethodInvocation *context;
|
||||||
MMAuthRequestCb callback;
|
MMAuthRequestCb callback;
|
||||||
gpointer callback_data;
|
gpointer callback_data;
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ GObject *
|
|||||||
mm_auth_request_new (GType atype,
|
mm_auth_request_new (GType atype,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify)
|
GDestroyNotify notify)
|
||||||
@@ -179,4 +180,3 @@ mm_auth_request_class_init (MMAuthRequestClass *class)
|
|||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0, G_TYPE_NONE);
|
G_TYPE_NONE, 0, G_TYPE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,8 +16,7 @@
|
|||||||
#ifndef MM_AUTH_REQUEST_H
|
#ifndef MM_AUTH_REQUEST_H
|
||||||
#define MM_AUTH_REQUEST_H
|
#define MM_AUTH_REQUEST_H
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <gio/gio.h>
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
|
|
||||||
#define MM_TYPE_AUTH_REQUEST (mm_auth_request_get_type ())
|
#define MM_TYPE_AUTH_REQUEST (mm_auth_request_get_type ())
|
||||||
#define MM_AUTH_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_AUTH_REQUEST, MMAuthRequest))
|
#define MM_AUTH_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_AUTH_REQUEST, MMAuthRequest))
|
||||||
@@ -49,13 +48,13 @@ GType mm_auth_request_get_type (void);
|
|||||||
|
|
||||||
typedef void (*MMAuthRequestCb) (MMAuthRequest *req,
|
typedef void (*MMAuthRequestCb) (MMAuthRequest *req,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
GObject *mm_auth_request_new (GType atype,
|
GObject *mm_auth_request_new (GType atype,
|
||||||
const char *authorization,
|
const char *authorization,
|
||||||
GObject *owner,
|
GObject *owner,
|
||||||
DBusGMethodInvocation *context,
|
GDBusMethodInvocation *context,
|
||||||
MMAuthRequestCb callback,
|
MMAuthRequestCb callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GDestroyNotify notify);
|
GDestroyNotify notify);
|
||||||
@@ -69,4 +68,3 @@ void mm_auth_request_callback (MMAuthRequest *req);
|
|||||||
void mm_auth_request_dispose (MMAuthRequest *req);
|
void mm_auth_request_dispose (MMAuthRequest *req);
|
||||||
|
|
||||||
#endif /* MM_AUTH_REQUEST_H */
|
#endif /* MM_AUTH_REQUEST_H */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user