[PolicyKit-gnome] Avoid deprecated polkit_authority_get() function
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [PolicyKit-gnome] Avoid deprecated polkit_authority_get() function
- Date: Mon, 9 Aug 2010 21:55:49 +0000 (UTC)
commit 22e9a00cc0bf7db1aa7687e0f3eeead85c59395e
Author: David Zeuthen <davidz redhat com>
Date: Mon Aug 9 16:46:17 2010 -0400
Avoid deprecated polkit_authority_get() function
Signed-off-by: David Zeuthen <davidz redhat com>
NEWS | 3 ++-
polkitgtk/polkitlockbutton.c | 10 +++++++++-
src/main.c | 9 ++++++++-
src/polkitgnomeauthenticator.c | 11 ++++++++++-
4 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index eab23a8..b3a2761 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,7 @@ Changes since 0.96:
Andre Klapper (1):
Compile with -DGSEAL_ENABLE. Fixes bug 616386.
-David Zeuthen (7):
+David Zeuthen (8):
Fix build
Remove lock down functionality
Require polkit 0.97
@@ -22,6 +22,7 @@ David Zeuthen (7):
Post-release version bump to 0.97
Port from dbus-glib to gdbus
Silence the build
+ Avoid deprecated polkit_authority_get() function
Martin Pitt (1):
Hide the agent autostart desktop file
diff --git a/polkitgtk/polkitlockbutton.c b/polkitgtk/polkitlockbutton.c
index 3e7ac63..6d98df5 100644
--- a/polkitgtk/polkitlockbutton.c
+++ b/polkitgtk/polkitlockbutton.c
@@ -377,10 +377,18 @@ static void
polkit_lock_button_constructed (GObject *object)
{
PolkitLockButton *button = POLKIT_LOCK_BUTTON (object);
+ GError *error;
gtk_box_set_spacing (GTK_BOX (button), 2);
- button->priv->authority = polkit_authority_get ();
+ /* TODO: should be async+failable (e.g. GAsyncInitable) instead of this */
+ error = NULL;
+ button->priv->authority = polkit_authority_get_sync (NULL /* GCancellable* */, &error);
+ if (button->priv->authority == NULL)
+ {
+ g_critical ("Error getting authority: %s", error->message);
+ g_error_free (error);
+ }
g_signal_connect (button->priv->authority,
"changed",
G_CALLBACK (on_authority_changed),
diff --git a/src/main.c b/src/main.c
index a8970df..7da11e9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -223,7 +223,14 @@ main (int argc, char **argv)
loop = g_main_loop_new (NULL, FALSE);
- authority = polkit_authority_get ();
+ error = NULL;
+ authority = polkit_authority_get_sync (NULL /* GCancellable* */, &error);
+ if (authority == NULL)
+ {
+ g_warning ("Error getting authority: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
g_signal_connect (authority,
"changed",
G_CALLBACK (on_authority_changed),
diff --git a/src/polkitgnomeauthenticator.c b/src/polkitgnomeauthenticator.c
index 92381ba..02b2547 100644
--- a/src/polkitgnomeauthenticator.c
+++ b/src/polkitgnomeauthenticator.c
@@ -209,10 +209,19 @@ polkit_gnome_authenticator_new (const gchar *action_id,
PolkitGnomeAuthenticator *authenticator;
GList *l;
guint n;
+ GError *error;
authenticator = POLKIT_GNOME_AUTHENTICATOR (g_object_new (POLKIT_GNOME_TYPE_AUTHENTICATOR, NULL));
- authenticator->authority = polkit_authority_get ();
+ error = NULL;
+ authenticator->authority = polkit_authority_get_sync (NULL /* GCancellable* */, &error);
+ if (authenticator->authority == NULL)
+ {
+ g_critical ("Error getting authority: %s", error->message);
+ g_error_free (error);
+ goto error;
+ }
+
authenticator->action_id = g_strdup (action_id);
authenticator->message = g_strdup (message);
authenticator->icon_name = g_strdup (icon_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]