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