diff options
author | David Zeuthen <davidz@redhat.com> | 2009-05-19 12:08:12 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2009-05-19 12:08:12 -0400 |
commit | 028e1aa51e4df5655f7cf57824dcc5f20823e19f (patch) | |
tree | 966515de3769844516624a08662042d1b139e23e /src/programs/pkexec.c | |
parent | 6bc9c8ff48fc4f7f9cbea8e4bfbe5a182852adf9 (diff) | |
download | polkit-028e1aa51e4df5655f7cf57824dcc5f20823e19f.tar.gz |
Use an object, not a GHashTable when passing details around
This is because bindable GObject APIs should never return or accept a
GHashTable, see http://bugzilla.gnome.org/show_bug.cgi?id=581686#c6
for details.
Diffstat (limited to 'src/programs/pkexec.c')
-rw-r--r-- | src/programs/pkexec.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c index 86f70a5..10329dd 100644 --- a/src/programs/pkexec.c +++ b/src/programs/pkexec.c @@ -115,7 +115,7 @@ main (int argc, char *argv[]) PolkitAuthority *authority; PolkitAuthorizationResult *result; PolkitSubject *subject; - GHashTable *details; + PolkitDetails *details; GError *error; gchar *action_id; gchar *command_line; @@ -319,14 +319,16 @@ main (int argc, char *argv[]) authority = polkit_authority_get (); subject = polkit_unix_process_new (pid_of_caller); - details = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); + details = polkit_details_new (); - g_hash_table_insert (details, "command-line", g_strdup (command_line)); + polkit_details_insert (details, "command-line", command_line); s = g_strdup_printf ("%s (%s)", pw->pw_gecos, pw->pw_name); - g_hash_table_insert (details, "user", s); + polkit_details_insert (details, "user", s); + g_free (s); s = g_strdup_printf ("%d", (gint) pw->pw_uid); - g_hash_table_insert (details, "uid", s); - g_hash_table_insert (details, "program", g_strdup (path)); + polkit_details_insert (details, "uid", s); + g_free (s); + polkit_details_insert (details, "program", path); action_id = find_action_for_path (authority, path); g_assert (action_id != NULL); @@ -450,7 +452,7 @@ main (int argc, char *argv[]) g_free (action_id); if (details != NULL) - g_hash_table_unref (details); + g_object_unref (details); if (subject != NULL) g_object_unref (subject); |