aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-auth-provider-polkit.c29
-rw-r--r--src/mm-auth-provider.c4
-rw-r--r--src/mm-auth-provider.h4
-rw-r--r--src/mm-auth-request-polkit.c9
-rw-r--r--src/mm-auth-request-polkit.h3
-rw-r--r--src/mm-auth-request.c4
-rw-r--r--src/mm-auth-request.h7
-rw-r--r--src/mm-modem-cdma.c2
-rw-r--r--src/mm-modem-firmware.c6
-rw-r--r--src/mm-modem-gsm-card.c16
-rw-r--r--src/mm-modem-gsm-network.c2
-rw-r--r--src/mm-modem-gsm-sms.c16
-rw-r--r--src/mm-modem-gsm-ussd.c6
-rw-r--r--src/mm-modem-location.c4
-rw-r--r--src/mm-modem.c4
15 files changed, 51 insertions, 65 deletions
diff --git a/src/mm-auth-provider-polkit.c b/src/mm-auth-provider-polkit.c
index 58550f5b..2cd4a8ab 100644
--- a/src/mm-auth-provider-polkit.c
+++ b/src/mm-auth-provider-polkit.c
@@ -55,33 +55,20 @@ static MMAuthRequest *
real_create_request (MMAuthProvider *provider,
const char *authorization,
GObject *owner,
- gpointer context,
+ DBusGMethodInvocation *context,
MMAuthRequestCb callback,
gpointer callback_data,
GDestroyNotify notify)
{
MMAuthProviderPolkitPrivate *priv = MM_AUTH_PROVIDER_POLKIT_GET_PRIVATE (provider);
- MMAuthRequest *auth_request;
- gchar *sender;
- /* Ugly temporary hack... */
- if (G_IS_DBUS_METHOD_INVOCATION (context)) {
- sender = g_strdup (g_dbus_method_invocation_get_sender (context));
- } else {
- sender = dbus_g_method_get_sender (context);
- }
-
- auth_request = (MMAuthRequest *)mm_auth_request_polkit_new (priv->authority,
- authorization,
- owner,
- context,
- sender,
- callback,
- callback_data,
- notify);
- g_free (sender);
-
- return auth_request;
+ return (MMAuthRequest *) mm_auth_request_polkit_new (priv->authority,
+ authorization,
+ owner,
+ context,
+ callback,
+ callback_data,
+ notify);
}
/*****************************************************************************/
diff --git a/src/mm-auth-provider.c b/src/mm-auth-provider.c
index d78c3be1..ceff9adf 100644
--- a/src/mm-auth-provider.c
+++ b/src/mm-auth-provider.c
@@ -105,7 +105,7 @@ static MMAuthRequest *
real_create_request (MMAuthProvider *provider,
const char *authorization,
GObject *owner,
- gpointer context,
+ DBusGMethodInvocation *context,
MMAuthRequestCb callback,
gpointer callback_data,
GDestroyNotify notify)
@@ -165,7 +165,7 @@ MMAuthRequest *
mm_auth_provider_request_auth (MMAuthProvider *self,
const char *authorization,
GObject *owner,
- gpointer context,
+ DBusGMethodInvocation *context,
MMAuthRequestCb callback,
gpointer callback_data,
GDestroyNotify notify,
diff --git a/src/mm-auth-provider.h b/src/mm-auth-provider.h
index beb79455..07ccfa8b 100644
--- a/src/mm-auth-provider.h
+++ b/src/mm-auth-provider.h
@@ -52,7 +52,7 @@ typedef struct {
MMAuthRequest * (*create_request) (MMAuthProvider *provider,
const char *authorization,
GObject *owner,
- gpointer context,
+ DBusGMethodInvocation *context,
MMAuthRequestCb callback,
gpointer callback_data,
GDestroyNotify notify);
@@ -64,7 +64,7 @@ GType mm_auth_provider_get_type (void);
MMAuthRequest *mm_auth_provider_request_auth (MMAuthProvider *provider,
const char *authorization,
GObject *owner,
- gpointer context,
+ DBusGMethodInvocation *context,
MMAuthRequestCb callback,
gpointer callback_data,
GDestroyNotify notify,
diff --git a/src/mm-auth-request-polkit.c b/src/mm-auth-request-polkit.c
index 4e7a07ca..2a96bfec 100644
--- a/src/mm-auth-request-polkit.c
+++ b/src/mm-auth-request-polkit.c
@@ -34,14 +34,14 @@ GObject *
mm_auth_request_polkit_new (PolkitAuthority *authority,
const char *authorization,
GObject *owner,
- gpointer context,
- const gchar *sender,
+ DBusGMethodInvocation *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);
@@ -59,7 +59,10 @@ mm_auth_request_polkit_new (PolkitAuthority *authority,
priv = MM_AUTH_REQUEST_POLKIT_GET_PRIVATE (obj);
priv->authority = authority;
priv->cancellable = g_cancellable_new ();
+
+ sender = dbus_g_method_get_sender (context);
priv->subject = polkit_system_bus_name_new (sender);
+ g_free (sender);
}
return obj;
@@ -98,7 +101,7 @@ pk_auth_cb (GObject *object, GAsyncResult *result, gpointer user_data)
g_signal_emit_by_name (self, "result");
}
-
+
g_object_unref (self);
}
diff --git a/src/mm-auth-request-polkit.h b/src/mm-auth-request-polkit.h
index a2c79753..384ace85 100644
--- a/src/mm-auth-request-polkit.h
+++ b/src/mm-auth-request-polkit.h
@@ -42,8 +42,7 @@ GType mm_auth_request_polkit_get_type (void);
GObject *mm_auth_request_polkit_new (PolkitAuthority *authority,
const char *authorization,
GObject *owner,
- gpointer context,
- const gchar *sender,
+ DBusGMethodInvocation *context,
MMAuthRequestCb callback,
gpointer callback_data,
GDestroyNotify notify);
diff --git a/src/mm-auth-request.c b/src/mm-auth-request.c
index 03de3a6d..79f0d421 100644
--- a/src/mm-auth-request.c
+++ b/src/mm-auth-request.c
@@ -22,7 +22,7 @@ G_DEFINE_TYPE (MMAuthRequest, mm_auth_request, G_TYPE_OBJECT)
typedef struct {
GObject *owner;
char *auth;
- gpointer context;
+ DBusGMethodInvocation *context;
MMAuthRequestCb callback;
gpointer callback_data;
@@ -35,7 +35,7 @@ GObject *
mm_auth_request_new (GType atype,
const char *authorization,
GObject *owner,
- gpointer context,
+ DBusGMethodInvocation *context,
MMAuthRequestCb callback,
gpointer callback_data,
GDestroyNotify notify)
diff --git a/src/mm-auth-request.h b/src/mm-auth-request.h
index 9660cef6..e22f0a23 100644
--- a/src/mm-auth-request.h
+++ b/src/mm-auth-request.h
@@ -47,18 +47,15 @@ typedef struct {
GType mm_auth_request_get_type (void);
-/* TODO: Change the context gpointer to be a GDBusMethodInvocation when
- * fully ported to GDBus, and remove all (MMAuthRequestCb) casts */
-
typedef void (*MMAuthRequestCb) (MMAuthRequest *req,
GObject *owner,
- gpointer context,
+ DBusGMethodInvocation *context,
gpointer user_data);
GObject *mm_auth_request_new (GType atype,
const char *authorization,
GObject *owner,
- gpointer context,
+ DBusGMethodInvocation *context,
MMAuthRequestCb callback,
gpointer callback_data,
GDestroyNotify notify);
diff --git a/src/mm-modem-cdma.c b/src/mm-modem-cdma.c
index dc3f1242..7583760e 100644
--- a/src/mm-modem-cdma.c
+++ b/src/mm-modem-cdma.c
@@ -219,7 +219,7 @@ impl_modem_cdma_get_esn (MMModemCdma *self, DBusGMethodInvocation *context)
if (!mm_modem_auth_request (MM_MODEM (self),
MM_AUTHORIZATION_DEVICE_INFO,
context,
- (MMAuthRequestCb)esn_auth_cb,
+ esn_auth_cb,
NULL,
NULL,
&error)) {
diff --git a/src/mm-modem-firmware.c b/src/mm-modem-firmware.c
index dbf083c4..74440fda 100644
--- a/src/mm-modem-firmware.c
+++ b/src/mm-modem-firmware.c
@@ -195,7 +195,7 @@ impl_modem_firmware_list (MMModemFirmware *modem, DBusGMethodInvocation *context
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_FIRMWARE,
context,
- (MMAuthRequestCb)firmware_list_auth_cb,
+ firmware_list_auth_cb,
NULL,
NULL,
&error)) {
@@ -235,7 +235,7 @@ impl_modem_firmware_select (MMModemFirmware *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_FIRMWARE,
context,
- (MMAuthRequestCb)firmware_select_auth_cb,
+ firmware_select_auth_cb,
info,
firmware_auth_info_destroy,
&error)) {
@@ -277,7 +277,7 @@ impl_modem_firmware_install (MMModemFirmware *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_FIRMWARE,
context,
- (MMAuthRequestCb)firmware_install_auth_cb,
+ firmware_install_auth_cb,
info,
firmware_auth_info_destroy,
&error)) {
diff --git a/src/mm-modem-gsm-card.c b/src/mm-modem-gsm-card.c
index e5c79927..abf642af 100644
--- a/src/mm-modem-gsm-card.c
+++ b/src/mm-modem-gsm-card.c
@@ -288,7 +288,7 @@ impl_gsm_modem_get_imei (MMModemGsmCard *modem, DBusGMethodInvocation *context)
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_INFO,
context,
- (MMAuthRequestCb)imei_auth_cb,
+ imei_auth_cb,
NULL,
NULL,
&error)) {
@@ -325,7 +325,7 @@ impl_gsm_modem_get_imsi (MMModemGsmCard *modem, DBusGMethodInvocation *context)
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_INFO,
context,
- (MMAuthRequestCb)imsi_auth_cb,
+ imsi_auth_cb,
NULL,
NULL,
&error)) {
@@ -362,7 +362,7 @@ impl_gsm_modem_get_spn (MMModemGsmCard *modem, DBusGMethodInvocation *context)
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_INFO,
context,
- (MMAuthRequestCb)spn_auth_cb,
+ spn_auth_cb,
NULL,
NULL,
&error)) {
@@ -399,7 +399,7 @@ impl_gsm_modem_get_operator_id (MMModemGsmCard *modem, DBusGMethodInvocation *co
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_INFO,
context,
- (MMAuthRequestCb)operator_id_auth_cb,
+ operator_id_auth_cb,
NULL,
NULL,
&error)) {
@@ -480,7 +480,7 @@ impl_gsm_modem_send_puk (MMModemGsmCard *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_CONTROL,
context,
- (MMAuthRequestCb)send_puk_auth_cb,
+ send_puk_auth_cb,
info,
send_pin_puk_info_destroy,
&error)) {
@@ -523,7 +523,7 @@ impl_gsm_modem_send_pin (MMModemGsmCard *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_CONTROL,
context,
- (MMAuthRequestCb)send_pin_auth_cb,
+ send_pin_auth_cb,
info,
send_pin_puk_info_destroy,
&error)) {
@@ -567,7 +567,7 @@ impl_gsm_modem_enable_pin (MMModemGsmCard *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_CONTROL,
context,
- (MMAuthRequestCb)enable_pin_auth_cb,
+ enable_pin_auth_cb,
info,
send_pin_puk_info_destroy,
&error)) {
@@ -611,7 +611,7 @@ impl_gsm_modem_change_pin (MMModemGsmCard *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_CONTROL,
context,
- (MMAuthRequestCb)change_pin_auth_cb,
+ change_pin_auth_cb,
info,
send_pin_puk_info_destroy,
&error)) {
diff --git a/src/mm-modem-gsm-network.c b/src/mm-modem-gsm-network.c
index d536ef4b..2863aafd 100644
--- a/src/mm-modem-gsm-network.c
+++ b/src/mm-modem-gsm-network.c
@@ -452,7 +452,7 @@ impl_gsm_modem_scan (MMModemGsmNetwork *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_CONTROL,
context,
- (MMAuthRequestCb)scan_auth_cb,
+ scan_auth_cb,
NULL,
NULL,
&error)) {
diff --git a/src/mm-modem-gsm-sms.c b/src/mm-modem-gsm-sms.c
index acd3bbf7..22c42d00 100644
--- a/src/mm-modem-gsm-sms.c
+++ b/src/mm-modem-gsm-sms.c
@@ -389,7 +389,7 @@ impl_gsm_modem_sms_delete (MMModemGsmSms *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_SMS,
context,
- (MMAuthRequestCb)sms_delete_auth_cb,
+ sms_delete_auth_cb,
info,
sms_auth_info_destroy,
&error)) {
@@ -435,7 +435,7 @@ impl_gsm_modem_sms_get (MMModemGsmSms *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_SMS,
context,
- (MMAuthRequestCb)sms_get_auth_cb,
+ sms_get_auth_cb,
info,
sms_auth_info_destroy,
&error)) {
@@ -501,7 +501,7 @@ impl_gsm_modem_sms_set_smsc (MMModemGsmSms *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_SMS,
context,
- (MMAuthRequestCb)sms_set_smsc_auth_cb,
+ sms_set_smsc_auth_cb,
info,
sms_auth_info_destroy,
&error)) {
@@ -539,7 +539,7 @@ impl_gsm_modem_sms_list (MMModemGsmSms *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_SMS,
context,
- (MMAuthRequestCb)sms_list_auth_cb,
+ sms_list_auth_cb,
NULL,
NULL,
&error)) {
@@ -581,7 +581,7 @@ impl_gsm_modem_sms_save (MMModemGsmSms *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_SMS,
context,
- (MMAuthRequestCb)sms_save_auth_cb,
+ sms_save_auth_cb,
info,
sms_auth_info_destroy,
&error)) {
@@ -676,7 +676,7 @@ impl_gsm_modem_sms_send (MMModemGsmSms *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_SMS,
context,
- (MMAuthRequestCb)sms_send_auth_cb,
+ sms_send_auth_cb,
info,
sms_auth_info_destroy,
&error)) {
@@ -718,7 +718,7 @@ impl_gsm_modem_sms_send_from_storage (MMModemGsmSms *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_SMS,
context,
- (MMAuthRequestCb)sms_send_from_storage_auth_cb,
+ sms_send_from_storage_auth_cb,
info,
sms_auth_info_destroy,
&error)) {
@@ -764,7 +764,7 @@ impl_gsm_modem_sms_set_indication (MMModemGsmSms *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_SMS,
context,
- (MMAuthRequestCb)sms_set_indication_auth_cb,
+ sms_set_indication_auth_cb,
info,
sms_auth_info_destroy,
&error)) {
diff --git a/src/mm-modem-gsm-ussd.c b/src/mm-modem-gsm-ussd.c
index 23d3d478..614999cb 100644
--- a/src/mm-modem-gsm-ussd.c
+++ b/src/mm-modem-gsm-ussd.c
@@ -232,7 +232,7 @@ impl_modem_gsm_ussd_initiate (MMModemGsmUssd *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_USSD,
context,
- (MMAuthRequestCb)ussd_initiate_auth_cb,
+ ussd_initiate_auth_cb,
info,
ussd_auth_info_destroy,
&error)) {
@@ -282,7 +282,7 @@ impl_modem_gsm_ussd_respond (MMModemGsmUssd *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_USSD,
context,
- (MMAuthRequestCb)ussd_respond_auth_cb,
+ ussd_respond_auth_cb,
info,
ussd_auth_info_destroy,
&error)) {
@@ -323,7 +323,7 @@ impl_modem_gsm_ussd_cancel (MMModemGsmUssd *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_USSD,
context,
- (MMAuthRequestCb)ussd_cancel_auth_cb,
+ ussd_cancel_auth_cb,
info,
ussd_auth_info_destroy,
&error)) {
diff --git a/src/mm-modem-location.c b/src/mm-modem-location.c
index 130425ef..2dadd4ed 100644
--- a/src/mm-modem-location.c
+++ b/src/mm-modem-location.c
@@ -137,7 +137,7 @@ impl_modem_location_enable (MMModemLocation *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_LOCATION,
context,
- (MMAuthRequestCb)loc_enable_auth_cb,
+ loc_enable_auth_cb,
info,
loc_auth_info_destroy,
&error)) {
@@ -232,7 +232,7 @@ impl_modem_location_get_location (MMModemLocation *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_LOCATION,
context,
- (MMAuthRequestCb)loc_get_auth_cb,
+ loc_get_auth_cb,
info,
loc_auth_info_destroy,
&error)) {
diff --git a/src/mm-modem.c b/src/mm-modem.c
index 27c55c80..012e3203 100644
--- a/src/mm-modem.c
+++ b/src/mm-modem.c
@@ -491,7 +491,7 @@ impl_modem_reset (MMModem *modem, DBusGMethodInvocation *context)
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_CONTROL,
context,
- (MMAuthRequestCb)reset_auth_cb,
+ reset_auth_cb,
NULL, NULL,
&error)) {
dbus_g_method_return_error (context, error);
@@ -544,7 +544,7 @@ impl_modem_factory_reset (MMModem *modem,
if (!mm_modem_auth_request (MM_MODEM (modem),
MM_AUTHORIZATION_DEVICE_CONTROL,
context,
- (MMAuthRequestCb)factory_reset_auth_cb,
+ factory_reset_auth_cb,
g_strdup (code),
g_free,
&error)) {