Use PolkitDetails, not GHashTable to pass details to PolicyKit
authorDavid Zeuthen <davidz@redhat.com>
Tue, 26 May 2009 20:33:09 +0000 (16:33 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Tue, 26 May 2009 20:33:09 +0000 (16:33 -0400)
src/devkit-disks-daemon.c

index 26ea014..4c44e07 100644 (file)
@@ -1386,42 +1386,42 @@ devkit_disks_daemon_local_check_auth (DevkitDisksDaemon            *daemon,
 
         if (action_id != NULL) {
                 PolkitSubject *subject;
-                GHashTable *details;
+                PolkitDetails *details;
                 gchar partition_number_buf[32];
 
                 /* Set details - see devkit-disks-polkit-action-lookup.c for where
                  * these key/value pairs are used
                  */
-                details = g_hash_table_new (g_str_hash, g_str_equal);
+                details = polkit_details_new ();
                 if (operation != NULL) {
-                        g_hash_table_insert (details,
+                        polkit_details_insert (details,
                                              "operation",
                                              (gpointer) operation);
                 }
                 if (device != NULL) {
                         DevkitDisksDevice *drive;
 
-                        g_hash_table_insert (details,
+                        polkit_details_insert (details,
                                              "unix-device",
                                              device->priv->device_file);
                         if (device->priv->device_file_by_id->len > 0)
-                                g_hash_table_insert (details,
+                                polkit_details_insert (details,
                                                      "unix-device-by-id",
                                                      device->priv->device_file_by_id->pdata[0]);
                         if (device->priv->device_file_by_path->len > 0)
-                                g_hash_table_insert (details,
+                                polkit_details_insert (details,
                                                      "unix-device-by-path",
                                                      device->priv->device_file_by_path->pdata[0]);
 
                         if (device->priv->device_is_drive) {
                                 drive = device;
                         } else if (device->priv->device_is_partition) {
-                                g_hash_table_insert (details, "is-partition", "1");
+                                polkit_details_insert (details, "is-partition", "1");
                                 g_snprintf (partition_number_buf,
                                             sizeof partition_number_buf,
                                             "%d",
                                             device->priv->partition_number);
-                                g_hash_table_insert (details, "partition-number", partition_number_buf);
+                                polkit_details_insert (details, "partition-number", partition_number_buf);
                                 drive = devkit_disks_daemon_local_find_by_object_path (device->priv->daemon,
                                                                                        device->priv->partition_slave);
                         } else {
@@ -1429,30 +1429,30 @@ devkit_disks_daemon_local_check_auth (DevkitDisksDaemon            *daemon,
                         }
 
                         if (drive != NULL) {
-                                g_hash_table_insert (details,
+                                polkit_details_insert (details,
                                                      "drive-unix-device",
                                                      drive->priv->device_file);
                                 if (drive->priv->device_file_by_id->len > 0)
-                                        g_hash_table_insert (details,
+                                        polkit_details_insert (details,
                                                              "drive-unix-device-by-id",
                                                              drive->priv->device_file_by_id->pdata[0]);
                                 if (drive->priv->device_file_by_path->len > 0)
-                                        g_hash_table_insert (details,
+                                        polkit_details_insert (details,
                                                              "drive-unix-device-by-path",
                                                              drive->priv->device_file_by_path->pdata[0]);
-                                g_hash_table_insert (details,
+                                polkit_details_insert (details,
                                                      "drive-vendor",
                                                      drive->priv->drive_vendor);
-                                g_hash_table_insert (details,
+                                polkit_details_insert (details,
                                                      "drive-model",
                                                      drive->priv->drive_model);
-                                g_hash_table_insert (details,
+                                polkit_details_insert (details,
                                                      "drive-revision",
                                                      drive->priv->drive_revision);
-                                g_hash_table_insert (details,
+                                polkit_details_insert (details,
                                                      "drive-serial",
                                                      drive->priv->drive_serial);
-                                g_hash_table_insert (details,
+                                polkit_details_insert (details,
                                                      "drive-connection-interface",
                                                      drive->priv->drive_connection_interface);
                         }
@@ -1476,7 +1476,7 @@ devkit_disks_daemon_local_check_auth (DevkitDisksDaemon            *daemon,
                                                       data);
 
                 g_object_unref (subject);
-                g_hash_table_unref (details);
+                g_object_unref (details);
         } else {
                 data->check_auth_callback (data->daemon,
                                            data->device,