diff options
| author | David Zeuthen <davidz@redhat.com> | 2009-04-02 17:30:09 -0400 |
|---|---|---|
| committer | David Zeuthen <davidz@redhat.com> | 2009-04-02 17:30:09 -0400 |
| commit | 12cdfc1bf3bdc4c8b17a3906b29d4532da1053fc (patch) | |
| tree | 8643285bcd5d1763c2a4c71cb15282caa5666718 /src/gdu | |
| parent | 2a176c8800ca98f85ff61929fba71d1b0fe2395a (diff) | |
| download | gnome-disk-utility-12cdfc1bf3bdc4c8b17a3906b29d4532da1053fc.tar.gz gnome-disk-utility-12cdfc1bf3bdc4c8b17a3906b29d4532da1053fc.tar.xz gnome-disk-utility-12cdfc1bf3bdc4c8b17a3906b29d4532da1053fc.zip | |
update to latest DKD API where erase= and tasks within jobs has been removed
Diffstat (limited to 'src/gdu')
| -rw-r--r-- | src/gdu/gdu-device.c | 69 | ||||
| -rw-r--r-- | src/gdu/gdu-device.h | 10 | ||||
| -rw-r--r-- | src/gdu/gdu-marshal.list | 4 | ||||
| -rw-r--r-- | src/gdu/gdu-pool.c | 18 | ||||
| -rw-r--r-- | src/gdu/gdu-private.h | 5 | ||||
| -rw-r--r-- | src/gdu/gdu-util.c | 70 | ||||
| -rw-r--r-- | src/gdu/gdu-util.h | 3 |
7 files changed, 25 insertions, 154 deletions
diff --git a/src/gdu/gdu-device.c b/src/gdu/gdu-device.c index b5debf4..2bca4d4 100644 --- a/src/gdu/gdu-device.c +++ b/src/gdu/gdu-device.c @@ -79,10 +79,7 @@ typedef struct char *job_id; uid_t job_initiated_by_uid; gboolean job_is_cancellable; - int job_num_tasks; - int job_cur_task; - char *job_cur_task_id; - double job_cur_task_percentage; + double job_percentage; char *id_usage; char *id_type; @@ -243,14 +240,8 @@ collect_props (const char *key, const GValue *value, DeviceProperties *props) props->job_initiated_by_uid = g_value_get_uint (value); else if (strcmp (key, "job-is-cancellable") == 0) props->job_is_cancellable = g_value_get_boolean (value); - else if (strcmp (key, "job-num-tasks") == 0) - props->job_num_tasks = g_value_get_int (value); - else if (strcmp (key, "job-cur-task") == 0) - props->job_cur_task = g_value_get_int (value); - else if (strcmp (key, "job-cur-task-id") == 0) - props->job_cur_task_id = g_strdup (g_value_get_string (value)); - else if (strcmp (key, "job-cur-task-percentage") == 0) - props->job_cur_task_percentage = g_value_get_double (value); + else if (strcmp (key, "job-percentage") == 0) + props->job_percentage = g_value_get_double (value); else if (strcmp (key, "id-usage") == 0) props->id_usage = g_strdup (g_value_get_string (value)); @@ -440,7 +431,6 @@ device_properties_free (DeviceProperties *props) g_free (props->device_presentation_name); g_free (props->device_presentation_icon_name); g_free (props->job_id); - g_free (props->job_cur_task_id); g_free (props->id_usage); g_free (props->id_type); g_free (props->id_version); @@ -694,10 +684,7 @@ _gdu_device_job_changed (GduDevice *device, const char *job_id, uid_t job_initiated_by_uid, gboolean job_is_cancellable, - int job_num_tasks, - int job_cur_task, - const char *job_cur_task_id, - double job_cur_task_percentage) + double job_percentage) { g_print ("%s: %s: %s\n", __FUNCTION__, device->priv->props->device_file, job_id); @@ -706,11 +693,7 @@ _gdu_device_job_changed (GduDevice *device, device->priv->props->job_id = g_strdup (job_id); device->priv->props->job_initiated_by_uid = job_initiated_by_uid; device->priv->props->job_is_cancellable = job_is_cancellable; - device->priv->props->job_num_tasks = job_num_tasks; - device->priv->props->job_cur_task = job_cur_task; - g_free (device->priv->props->job_cur_task_id); - device->priv->props->job_cur_task_id = g_strdup (job_cur_task_id); - device->priv->props->job_cur_task_percentage = job_cur_task_percentage; + device->priv->props->job_percentage = job_percentage; g_signal_emit (device, signals[JOB_CHANGED], 0); } @@ -1426,28 +1409,10 @@ gdu_device_job_is_cancellable (GduDevice *device) return device->priv->props->job_is_cancellable; } -int -gdu_device_job_get_num_tasks (GduDevice *device) -{ - return device->priv->props->job_num_tasks; -} - -int -gdu_device_job_get_cur_task (GduDevice *device) -{ - return device->priv->props->job_cur_task; -} - -const char * -gdu_device_job_get_cur_task_id (GduDevice *device) -{ - return device->priv->props->job_cur_task_id; -} - double -gdu_device_job_get_cur_task_percentage (GduDevice *device) +gdu_device_job_get_percentage (GduDevice *device) { - return device->priv->props->job_cur_task_percentage; + return device->priv->props->job_percentage; } /* -------------------------------------------------------------------------------- */ @@ -1472,7 +1437,6 @@ void gdu_device_op_filesystem_create (GduDevice *device, const char *fstype, const char *fslabel, - const char *fserase, const char *encrypt_passphrase, gboolean fs_take_ownership, GduDeviceFilesystemCreateCompletedFunc callback, @@ -1491,9 +1455,6 @@ gdu_device_op_filesystem_create (GduDevice *device, if (fslabel != NULL && strlen (fslabel) > 0) { options[n++] = g_strdup_printf ("label=%s", fslabel); } - if (fserase != NULL && strlen (fserase) > 0) { - options[n++] = g_strdup_printf ("erase=%s", fserase); - } if (encrypt_passphrase != NULL && strlen (encrypt_passphrase) > 0) { options[n++] = g_strdup_printf ("luks_encrypt=%s", encrypt_passphrase); } @@ -1654,7 +1615,6 @@ op_partition_delete_cb (DBusGProxy *proxy, GError *error, gpointer user_data) void gdu_device_op_partition_delete (GduDevice *device, - const char *secure_erase, GduDevicePartitionDeleteCompletedFunc callback, gpointer user_data) { @@ -1668,9 +1628,6 @@ gdu_device_op_partition_delete (GduDevice *device, data->user_data = user_data; n = 0; - if (secure_erase != NULL && strlen (secure_erase) > 0) { - options[n++] = g_strdup_printf ("erase=%s", secure_erase); - } options[n] = NULL; org_freedesktop_DeviceKit_Disks_Device_partition_delete_async (device->priv->proxy, @@ -1710,7 +1667,6 @@ gdu_device_op_partition_create (GduDevice *device, char **flags, const char *fstype, const char *fslabel, - const char *fserase, const char *encrypt_passphrase, gboolean fs_take_ownership, GduDevicePartitionCreateCompletedFunc callback, @@ -1732,9 +1688,6 @@ gdu_device_op_partition_create (GduDevice *device, if (fslabel != NULL && strlen (fslabel) > 0) { fsoptions[n++] = g_strdup_printf ("label=%s", fslabel); } - if (fserase != NULL && strlen (fserase) > 0) { - fsoptions[n++] = g_strdup_printf ("erase=%s", fserase); - } if (encrypt_passphrase != NULL && strlen (encrypt_passphrase) > 0) { fsoptions[n++] = g_strdup_printf ("luks_encrypt=%s", encrypt_passphrase); } @@ -1824,7 +1777,6 @@ op_create_partition_table_cb (DBusGProxy *proxy, GError *error, gpointer user_da void gdu_device_op_partition_table_create (GduDevice *device, const char *scheme, - const char *secure_erase, GduDevicePartitionTableCreateCompletedFunc callback, gpointer user_data) { @@ -1838,9 +1790,6 @@ gdu_device_op_partition_table_create (GduDevice data->user_data = user_data; n = 0; - if (secure_erase != NULL && strlen (secure_erase) > 0) { - options[n++] = g_strdup_printf ("erase=%s", secure_erase); - } options[n] = NULL; org_freedesktop_DeviceKit_Disks_Device_partition_table_create_async (device->priv->proxy, @@ -2273,7 +2222,6 @@ op_remove_component_from_linux_md_array_cb (DBusGProxy *proxy, GError *error, gp void gdu_device_op_linux_md_remove_component (GduDevice *device, const char *component_objpath, - const char *secure_erase, GduDeviceLinuxMdRemoveComponentCompletedFunc callback, gpointer user_data) { @@ -2287,9 +2235,6 @@ gdu_device_op_linux_md_remove_component (GduDevice data->user_data = user_data; n = 0; - if (secure_erase != NULL && strlen (secure_erase) > 0) { - options[n++] = g_strdup_printf ("erase=%s", secure_erase); - } options[n] = NULL; org_freedesktop_DeviceKit_Disks_Device_linux_md_remove_component_async ( diff --git a/src/gdu/gdu-device.h b/src/gdu/gdu-device.h index 14a55bb..f4f655d 100644 --- a/src/gdu/gdu-device.h +++ b/src/gdu/gdu-device.h @@ -98,10 +98,7 @@ gboolean gdu_device_job_in_progress (GduDevice *device); const char *gdu_device_job_get_id (GduDevice *device); uid_t gdu_device_job_get_initiated_by_uid (GduDevice *device); gboolean gdu_device_job_is_cancellable (GduDevice *device); -int gdu_device_job_get_num_tasks (GduDevice *device); -int gdu_device_job_get_cur_task (GduDevice *device); -const char *gdu_device_job_get_cur_task_id (GduDevice *device); -double gdu_device_job_get_cur_task_percentage (GduDevice *device); +double gdu_device_job_get_percentage (GduDevice *device); const char *gdu_device_id_get_usage (GduDevice *device); const char *gdu_device_id_get_type (GduDevice *device); @@ -233,7 +230,6 @@ void gdu_device_op_filesystem_check (GduDevice /* ---------------------------------------------------------------------------------------------------- */ void gdu_device_op_partition_delete (GduDevice *device, - const char *secure_erase, GduDevicePartitionDeleteCompletedFunc callback, gpointer user_data); @@ -250,7 +246,6 @@ void gdu_device_op_partition_modify (GduDevice void gdu_device_op_partition_table_create (GduDevice *device, const char *scheme, - const char *secure_erase, GduDevicePartitionTableCreateCompletedFunc callback, gpointer user_data); @@ -312,7 +307,6 @@ void gdu_device_op_linux_md_add_component (GduDevice void gdu_device_op_linux_md_remove_component (GduDevice *device, const char *component_objpath, - const char *secure_erase, GduDeviceLinuxMdRemoveComponentCompletedFunc callback, gpointer user_data); @@ -321,7 +315,6 @@ void gdu_device_op_linux_md_remove_component (GduDevice void gdu_device_op_filesystem_create (GduDevice *device, const char *fstype, const char *fslabel, - const char *fserase, const char *encrypt_passphrase, gboolean fs_take_ownership, GduDeviceFilesystemCreateCompletedFunc callback, @@ -337,7 +330,6 @@ void gdu_device_op_partition_create (GduDevice *device, char **flags, const char *fstype, const char *fslabel, - const char *fserase, const char *encrypt_passphrase, gboolean fs_take_ownership, GduDevicePartitionCreateCompletedFunc callback, diff --git a/src/gdu/gdu-marshal.list b/src/gdu/gdu-marshal.list index 4cf9a00..8767880 100644 --- a/src/gdu/gdu-marshal.list +++ b/src/gdu/gdu-marshal.list @@ -1,2 +1,2 @@ -VOID:BOOLEAN,STRING,UINT,BOOLEAN,INT,INT,STRING,DOUBLE -VOID:STRING,BOOLEAN,STRING,UINT,BOOLEAN,INT,INT,STRING,DOUBLE +VOID:BOOLEAN,STRING,UINT,BOOLEAN,DOUBLE +VOID:STRING,BOOLEAN,STRING,UINT,BOOLEAN,DOUBLE diff --git a/src/gdu/gdu-pool.c b/src/gdu/gdu-pool.c index 623cddc..9fde7dd 100644 --- a/src/gdu/gdu-pool.c +++ b/src/gdu/gdu-pool.c @@ -930,10 +930,7 @@ device_job_changed_signal_handler (DBusGProxy *proxy, const char *job_id, guint32 job_initiated_by_uid, gboolean job_is_cancellable, - int job_num_tasks, - int job_cur_task, - const char *job_cur_task_id, - double job_cur_task_percentage, + double job_percentage, gpointer user_data) { GduPool *pool = GDU_POOL (user_data); @@ -945,10 +942,7 @@ device_job_changed_signal_handler (DBusGProxy *proxy, job_id, job_initiated_by_uid, job_is_cancellable, - job_num_tasks, - job_cur_task, - job_cur_task_id, - job_cur_task_percentage); + job_percentage); g_signal_emit_by_name (pool, "device-job-changed", device); g_object_unref (device); } else { @@ -1050,16 +1044,13 @@ gdu_pool_new (void) } dbus_g_object_register_marshaller ( - gdu_marshal_VOID__STRING_BOOLEAN_STRING_UINT_BOOLEAN_INT_INT_STRING_DOUBLE, + gdu_marshal_VOID__STRING_BOOLEAN_STRING_UINT_BOOLEAN_DOUBLE, G_TYPE_NONE, DBUS_TYPE_G_OBJECT_PATH, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_BOOLEAN, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_INVALID); @@ -1077,9 +1068,6 @@ gdu_pool_new (void) G_TYPE_STRING, G_TYPE_UINT, G_TYPE_BOOLEAN, - G_TYPE_INT, - G_TYPE_INT, - G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_INVALID); diff --git a/src/gdu/gdu-private.h b/src/gdu/gdu-private.h index 6c5e45b..fe94862 100644 --- a/src/gdu/gdu-private.h +++ b/src/gdu/gdu-private.h @@ -106,10 +106,7 @@ void _gdu_device_job_changed (GduDevice *device, const char *job_id, uid_t job_initiated_by_uid, gboolean job_is_cancellable, - int job_num_tasks, - int job_cur_task, - const char *job_cur_task_id, - double job_cur_task_percentage); + double job_percentage); void _gdu_volume_rewrite_enclosing_presentable (GduVolume *volume); void _gdu_volume_hole_rewrite_enclosing_presentable (GduVolumeHole *volume_hole); diff --git a/src/gdu/gdu-util.c b/src/gdu/gdu-util.c index 153d5f2..3542c21 100644 --- a/src/gdu/gdu-util.c +++ b/src/gdu/gdu-util.c @@ -290,11 +290,11 @@ gdu_get_job_description (const char *job_id) } else if (strcmp (job_id, "FilesystemCheck") == 0) { s = g_strdup (_("Checking File System")); } else if (strcmp (job_id, "LuksFormat") == 0) { - s = g_strdup (_("Creating Encrypted LUKS Device")); + s = g_strdup (_("Creating LUKS Device")); } else if (strcmp (job_id, "LuksUnlock") == 0) { - s = g_strdup (_("Unlocking Encrypted LUKS Device")); + s = g_strdup (_("Unlocking LUKS Device")); } else if (strcmp (job_id, "LuksLock") == 0) { - s = g_strdup (_("Locking Encrypted LUKS Device")); + s = g_strdup (_("Locking LUKS Device")); } else if (strcmp (job_id, "PartitionTableCreate") == 0) { s = g_strdup (_("Creating Partition Table")); } else if (strcmp (job_id, "PartitionDelete") == 0) { @@ -313,30 +313,19 @@ gdu_get_job_description (const char *job_id) s = g_strdup (_("Removing Component from RAID Array")); } else if (strcmp (job_id, "LinuxMdStop") == 0) { s = g_strdup (_("Stopping RAID Array")); - } else if (strcmp (job_id, "DriveSmartInitiateSelftest") == 0) { + } else if (strcmp (job_id, "LinuxMdStart") == 0) { + s = g_strdup (_("Starting RAID Array")); + } else if (strcmp (job_id, "DriveAtaSmartInitiateSelftest") == 0) { s = g_strdup (_("Running S.M.A.R.T. Self Test")); } else if (strcmp (job_id, "DriveEject") == 0) { s = g_strdup (_("Ejecting Media")); + } else if (strcmp (job_id, "ForceUnmount") == 0) { + s = g_strdup (_("Forcibly Unmounting Filesystem")); + } else if (strcmp (job_id, "ForceLuksTeardown") == 0) { + s = g_strdup (_("Forcibly Locking LUKS device")); } else { s = g_strdup_printf ("%s", job_id); - } - return s; -} - -char * -gdu_get_task_description (const char *task_id) -{ - char *s; - if (strcmp (task_id, "zeroing") == 0) { - s = g_strdup (_("Zeroing data")); - } else if (strcmp (task_id, "sync") == 0) { - s = g_strdup (_("Flushing data to disk")); - } else if (strcmp (task_id, "mkfs") == 0) { - s = g_strdup (_("Creating File System")); - } else if (strlen (task_id) == 0) { - s = g_strdup (""); - } else { - s = g_strdup_printf ("%s", task_id); + g_warning ("No friendly string for job with id '%s'", job_id); } return s; } @@ -512,43 +501,6 @@ gdu_util_part_table_type_get_description (char *part_type) /* ---------------------------------------------------------------------------------------------------- */ char * -gdu_util_secure_erase_get_description (char *secure_erase_type) -{ - g_return_val_if_fail (secure_erase_type != NULL, NULL); - - if (strcmp (secure_erase_type, "none") == 0) - return g_strdup (_("Data on the disk won't be erased. This option doesn't add any time to the " - "requested operation but can pose a security threat since some data " - "may be recovered.")); - - else if (strcmp (secure_erase_type, "full") == 0) - return g_strdup (_("All data on the disk will by overwritten by zeroes providing some " - "security against data recovery. This operation may take a long time " - "depending on the size and speed of the disk.")); - - else if (strcmp (secure_erase_type, "full3pass") == 0) - return g_strdup (_("Random data is written to the disk three times. This operation may " - "take some time depending on the size and speed of the disk but " - "provides good security against data recovery.")); - - else if (strcmp (secure_erase_type, "full7pass") == 0) - return g_strdup (_("Random data is written to the disk seven times. This operation may " - "take a very long time depending on the size and speed of the disk " - "but provides excellent security against data recovery.")); - - else if (strcmp (secure_erase_type, "full35pass") == 0) - return g_strdup (_("Random data is written to the disk 35 times before starting the " - "operation. This operation may take extremely long time depending on the " - "size and speed of the disk but provides the most effective " - "security against data recovery.")); - - else - return NULL; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -char * gdu_util_get_default_part_type_for_scheme_and_fstype (const char *scheme, const char *fstype, guint64 size) { const char *type; diff --git a/src/gdu/gdu-util.h b/src/gdu/gdu-util.h index 488d01c..1ad6602 100644 --- a/src/gdu/gdu-util.h +++ b/src/gdu/gdu-util.h @@ -37,8 +37,6 @@ char *gdu_util_fstype_get_description (char *fstype); char *gdu_util_part_table_type_get_description (char *part_type); -char *gdu_util_secure_erase_get_description (char *secure_erase_type); - char *gdu_util_get_speed_for_display (guint64 size); char *gdu_util_get_connection_for_display (const char *connection_interface, guint64 connection_speed); @@ -46,7 +44,6 @@ char *gdu_util_get_connection_for_display (const char *connection_interface, gui char *gdu_util_get_desc_for_part_type (const char *part_scheme, const char *part_type); char *gdu_get_job_description (const char *job_id); -char *gdu_get_task_description (const char *task_id); char *gdu_linux_md_get_raid_level_for_display (const gchar *linux_md_raid_level); |
