[PolicyKit-gnome] Catch up with latest polkit API changes
- From: David Zeuthen <davidz src gnome org>
- To: svn-commits-list gnome org
- Subject: [PolicyKit-gnome] Catch up with latest polkit API changes
- Date: Tue, 19 May 2009 12:11:59 -0400 (EDT)
commit f266e11f3a264d890a85748598f9a23ba2bc8492
Author: David Zeuthen <davidz redhat com>
Date: Tue May 19 12:09:26 2009 -0400
Catch up with latest polkit API changes
---
src/polkitgnomeauthenticationdialog.c | 83 ++++++++++++++++++---------------
src/polkitgnomeauthenticationdialog.h | 15 +++---
src/polkitgnomeauthenticator.c | 20 ++++----
src/polkitgnomeauthenticator.h | 12 ++--
src/polkitgnomelistener.c | 4 +-
5 files changed, 72 insertions(+), 62 deletions(-)
diff --git a/src/polkitgnomeauthenticationdialog.c b/src/polkitgnomeauthenticationdialog.c
index c0942ac..aa2315c 100644
--- a/src/polkitgnomeauthenticationdialog.c
+++ b/src/polkitgnomeauthenticationdialog.c
@@ -56,7 +56,7 @@ struct _PolkitGnomeAuthenticationDialogPrivate
gchar *vendor;
gchar *vendor_url;
gchar *icon_name;
- GHashTable *details;
+ PolkitDetails *details;
gchar **users;
gchar *selected_user;
@@ -327,7 +327,7 @@ polkit_gnome_authentication_dialog_set_property (GObject *object,
switch (prop_id)
{
case PROP_DETAILS:
- dialog->priv->details = g_value_dup_boxed (value);
+ dialog->priv->details = g_value_dup_object (value);
break;
case PROP_ACTION_ID:
@@ -479,7 +479,8 @@ polkit_gnome_authentication_dialog_finalize (GObject *object)
g_free (dialog->priv->vendor);
g_free (dialog->priv->vendor_url);
g_free (dialog->priv->icon_name);
- g_hash_table_unref (dialog->priv->details);
+ if (dialog->priv->details != NULL)
+ g_object_unref (dialog->priv->details);
g_strfreev (dialog->priv->users);
g_free (dialog->priv->selected_user);
@@ -506,7 +507,6 @@ polkit_gnome_authentication_dialog_constructed (GObject *object)
GtkWidget *image;
gboolean have_user_combobox;
gchar *s;
- GList *keys, *l;
guint rows;
dialog = POLKIT_GNOME_AUTHENTICATION_DIALOG (object);
@@ -626,27 +626,34 @@ polkit_gnome_authentication_dialog_constructed (GObject *object)
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_container_add (GTK_CONTAINER (table_alignment), table);
+ /* TODO: sort keys? */
rows = 0;
- keys = g_hash_table_get_keys (dialog->priv->details);
- keys = g_list_sort (keys, (GCompareFunc) g_strcmp0);
- for (l = keys; l != NULL; l = l->next)
+ if (dialog->priv->details != NULL)
{
- const gchar *key = l->data;
- const gchar *value;
-
- value = g_hash_table_lookup (dialog->priv->details, key);
-
- label = gtk_label_new (NULL);
- s = g_strdup_printf ("<small>%s</small>", value);
- gtk_label_set_markup (GTK_LABEL (label), s);
- g_free (s);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 1.0);
- s = g_strdup_printf ("<small><b>%s:</b></small>", key);
- add_row (table, rows++, s, label);
- g_free (s);
- }
- g_list_free (keys);
+ guint n;
+ gchar **keys;
+
+ keys = polkit_details_get_keys (dialog->priv->details);
+ for (n = 0; keys[n] != NULL; n++)
+ {
+ const gchar *key = keys[n];
+ const gchar *value;
+ value = polkit_details_lookup (dialog->priv->details, key);
+
+ label = gtk_label_new (NULL);
+ s = g_strdup_printf ("<small>%s</small>", value);
+ gtk_label_set_markup (GTK_LABEL (label), s);
+ g_free (s);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 1.0);
+ s = g_strdup_printf ("<small><b>%s:</b></small>", key);
+ add_row (table, rows, s, label);
+ g_free (s);
+
+ rows++;
+ }
+ g_strfreev (keys);
+ }
/* --- */
@@ -707,15 +714,15 @@ polkit_gnome_authentication_dialog_class_init (PolkitGnomeAuthenticationDialogCl
g_object_class_install_property (gobject_class,
PROP_DETAILS,
- g_param_spec_boxed ("details",
- NULL,
- NULL,
- G_TYPE_HASH_TABLE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ g_param_spec_object ("details",
+ NULL,
+ NULL,
+ POLKIT_TYPE_DETAILS,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
g_object_class_install_property (gobject_class,
PROP_ACTION_ID,
@@ -810,13 +817,13 @@ polkit_gnome_authentication_dialog_class_init (PolkitGnomeAuthenticationDialogCl
* Returns: A new password dialog.
**/
GtkWidget *
-polkit_gnome_authentication_dialog_new (const gchar *action_id,
- const gchar *vendor,
- const gchar *vendor_url,
- const gchar *icon_name,
- const gchar *message_markup,
- GHashTable *details,
- gchar **users)
+polkit_gnome_authentication_dialog_new (const gchar *action_id,
+ const gchar *vendor,
+ const gchar *vendor_url,
+ const gchar *icon_name,
+ const gchar *message_markup,
+ PolkitDetails *details,
+ gchar **users)
{
PolkitGnomeAuthenticationDialog *dialog;
GtkWindow *window;
diff --git a/src/polkitgnomeauthenticationdialog.h b/src/polkitgnomeauthenticationdialog.h
index 18c6db6..c4bcf13 100644
--- a/src/polkitgnomeauthenticationdialog.h
+++ b/src/polkitgnomeauthenticationdialog.h
@@ -23,6 +23,7 @@
#define __POLKIT_GNOME_AUTHENTICATION_DIALOG_H
#include <gtk/gtk.h>
+#include <polkit/polkit.h>
G_BEGIN_DECLS
@@ -48,13 +49,13 @@ struct _PolkitGnomeAuthenticationDialogClass
};
GType polkit_gnome_authentication_dialog_get_type (void);
-GtkWidget *polkit_gnome_authentication_dialog_new (const gchar *action_id,
- const gchar *vendor,
- const gchar *vendor_url,
- const gchar *icon_name,
- const gchar *message_markup,
- GHashTable *details,
- gchar **users);
+GtkWidget *polkit_gnome_authentication_dialog_new (const gchar *action_id,
+ const gchar *vendor,
+ const gchar *vendor_url,
+ const gchar *icon_name,
+ const gchar *message_markup,
+ PolkitDetails *details,
+ gchar **users);
gchar *polkit_gnome_authentication_dialog_get_selected_user (PolkitGnomeAuthenticationDialog *dialog);
gboolean polkit_gnome_authentication_dialog_run_until_user_is_selected (PolkitGnomeAuthenticationDialog *dialog);
gchar *polkit_gnome_authentication_dialog_run_until_response_for_prompt (PolkitGnomeAuthenticationDialog *dialog,
diff --git a/src/polkitgnomeauthenticator.c b/src/polkitgnomeauthenticator.c
index ee9d5a4..b346668 100644
--- a/src/polkitgnomeauthenticator.c
+++ b/src/polkitgnomeauthenticator.c
@@ -41,7 +41,7 @@ struct _PolkitGnomeAuthenticator
gchar *action_id;
gchar *message;
gchar *icon_name;
- GHashTable *details;
+ PolkitDetails *details;
gchar *cookie;
GList *identities;
@@ -91,7 +91,8 @@ polkit_gnome_authenticator_finalize (GObject *object)
g_free (authenticator->action_id);
g_free (authenticator->message);
g_free (authenticator->icon_name);
- g_hash_table_unref (authenticator->details);
+ if (authenticator->details != NULL)
+ g_object_unref (authenticator->details);
g_free (authenticator->cookie);
g_list_foreach (authenticator->identities, (GFunc) g_object_unref, NULL);
g_list_free (authenticator->identities);
@@ -174,12 +175,12 @@ get_desc_for_action (PolkitAuthority *authority,
}
PolkitGnomeAuthenticator *
-polkit_gnome_authenticator_new (const gchar *action_id,
- const gchar *message,
- const gchar *icon_name,
- GHashTable *details,
- const gchar *cookie,
- GList *identities)
+polkit_gnome_authenticator_new (const gchar *action_id,
+ const gchar *message,
+ const gchar *icon_name,
+ PolkitDetails *details,
+ const gchar *cookie,
+ GList *identities)
{
PolkitGnomeAuthenticator *authenticator;
GList *l;
@@ -191,7 +192,8 @@ polkit_gnome_authenticator_new (const gchar *action_id,
authenticator->action_id = g_strdup (action_id);
authenticator->message = g_strdup (message);
authenticator->icon_name = g_strdup (icon_name);
- authenticator->details = g_hash_table_ref (details);
+ if (details != NULL)
+ authenticator->details = g_object_ref (details);
authenticator->cookie = g_strdup (cookie);
authenticator->identities = g_list_copy (identities);
g_list_foreach (authenticator->identities, (GFunc) g_object_ref, NULL);
diff --git a/src/polkitgnomeauthenticator.h b/src/polkitgnomeauthenticator.h
index d04ccfe..8101224 100644
--- a/src/polkitgnomeauthenticator.h
+++ b/src/polkitgnomeauthenticator.h
@@ -37,12 +37,12 @@ typedef struct _PolkitGnomeAuthenticator PolkitGnomeAuthenticator;
typedef struct _PolkitGnomeAuthenticatorClass PolkitGnomeAuthenticatorClass;
GType polkit_gnome_authenticator_get_type (void) G_GNUC_CONST;
-PolkitGnomeAuthenticator *polkit_gnome_authenticator_new (const gchar *action_id,
- const gchar *message,
- const gchar *icon_name,
- GHashTable *details,
- const gchar *cookie,
- GList *identities);
+PolkitGnomeAuthenticator *polkit_gnome_authenticator_new (const gchar *action_id,
+ const gchar *message,
+ const gchar *icon_name,
+ PolkitDetails *details,
+ const gchar *cookie,
+ GList *identities);
void polkit_gnome_authenticator_initiate (PolkitGnomeAuthenticator *authenticator);
void polkit_gnome_authenticator_cancel (PolkitGnomeAuthenticator *authenticator);
const gchar *polkit_gnome_authenticator_get_cookie (PolkitGnomeAuthenticator *authenticator);
diff --git a/src/polkitgnomelistener.c b/src/polkitgnomelistener.c
index d8a6390..9d009dd 100644
--- a/src/polkitgnomelistener.c
+++ b/src/polkitgnomelistener.c
@@ -44,7 +44,7 @@ static void polkit_gnome_listener_initiate_authentication (PolkitAgentListener
const gchar *action_id,
const gchar *message,
const gchar *icon_name,
- GHashTable *details,
+ PolkitDetails *details,
const gchar *cookie,
GList *identities,
GCancellable *cancellable,
@@ -160,7 +160,7 @@ polkit_gnome_listener_initiate_authentication (PolkitAgentListener *agent_liste
const gchar *action_id,
const gchar *message,
const gchar *icon_name,
- GHashTable *details,
+ PolkitDetails *details,
const gchar *cookie,
GList *identities,
GCancellable *cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]