summaryrefslogtreecommitdiffstats
path: root/src/format-window-operation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format-window-operation.c')
-rw-r--r--src/format-window-operation.c111
1 files changed, 51 insertions, 60 deletions
diff --git a/src/format-window-operation.c b/src/format-window-operation.c
index 40ea754..0d0a8f1 100644
--- a/src/format-window-operation.c
+++ b/src/format-window-operation.c
@@ -36,6 +36,7 @@
+/* TODO: find a better way for this */
#define DEVICE_SETTLE_TIMEOUT 3000
@@ -58,7 +59,7 @@ device_needs_partition_table (GduDevice *device)
}
}
// g_strfreev (media_compat); /* so, is this const then? */
- g_print ("device_needs_partition_table = %d\n", needs);
+ g_debug ("device_needs_partition_table = %d", needs);
return needs;
}
@@ -71,7 +72,7 @@ job_progress_pulse_timeout_handler (gpointer user_data)
g_return_val_if_fail (data != NULL, TRUE);
- g_print ("job_progress_pulse_timeout_handler\n");
+/* g_print ("job_progress_pulse_timeout_handler\n"); */
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data->priv->progress_bar));
return TRUE;
@@ -87,7 +88,7 @@ do_progress_bar_update (FormatProcessData *data, const char *label, double perce
gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (data->priv->progress_bar), 2.0 / 50);
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data->priv->progress_bar));
if (data->job_progress_pulse_timer_id == 0) {
- g_print ("activating progress bounce...\n");
+/* g_print ("activating progress bounce...\n"); */
data->job_progress_pulse_timer_id = g_timeout_add (
1000 / 50,
job_progress_pulse_timeout_handler,
@@ -119,8 +120,6 @@ presentable_job_changed (GduPresentable *presentable, gpointer user_data)
char *task_description;
double percentage;
- g_print ("presentable_job_changed\n");
-
g_return_if_fail (data != NULL);
if (data->device != NULL && gdu_device_job_in_progress (data->device)) {
@@ -165,8 +164,6 @@ update_ui_progress (FormatDialogPrivate *priv,
{
g_return_if_fail (priv != NULL);
-// g_print ("update_ui_progress\n");
-
priv->job_running = working;
if (working) {
@@ -252,14 +249,10 @@ free_format_action_data (FormatProcessData *data)
g_object_unref (data->presentable);
if (data->device != NULL)
g_object_unref (data->device);
- if (data->encrypt_passphrase != NULL)
- g_free (data->encrypt_passphrase);
- if (data->fstype != NULL)
- g_free (data->fstype);
- if (data->fslabel != NULL)
- g_free (data->fslabel);
- if (data->secure_erase != NULL)
- g_free (data->secure_erase);
+ g_free (data->encrypt_passphrase);
+ g_free (data->fstype);
+ g_free (data->fslabel);
+ g_free (data->secure_erase);
g_free (data);
}
}
@@ -273,7 +266,7 @@ action_finished (FormatProcessData *data, char *new_device_path)
GduDevice *new_device;
GduPresentable *new_presentable = NULL;
- /* we don't want to destroy objects at this point, don't pass data */
+ /* we don't want to destroy objects at this point, don't pass data in */
update_ui_progress (data->priv, NULL, FALSE);
/* change to the new device */
@@ -285,10 +278,10 @@ action_finished (FormatProcessData *data, char *new_device_path)
new_presentable = gdu_pool_get_volume_by_device (data->priv->pool, new_device);
if (new_presentable) {
/* switch to new presentable */
- g_print ("setting new presentable...\n");
+ g_debug ("setting new presentable...");
}
} else {
- g_warning ("action_finished: cannot find device for the %s device path\n", new_device_path);
+ g_warning ("action_finished: cannot find device for the %s device path", new_device_path);
}
g_free (new_device_path);
}
@@ -346,8 +339,8 @@ nautilus_gdu_show_error (GtkWidget *parent_window,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
gtk_window_set_title (GTK_WINDOW (dialog), window_title);
- // TODO: no support for GIcon in GtkWindow
- //gtk_window_set_icon_name (GTK_WINDOW (dialog), window_icon_name);
+ /* TODO: no support for GIcon in GtkWindow */
+ /* gtk_window_set_icon_name (GTK_WINDOW (dialog), window_icon_name); */
g_signal_connect_swapped (dialog,
"response",
@@ -370,7 +363,7 @@ modify_partition_completed (GduDevice *device,
{
FormatProcessData *data = user_data;
- g_print ("modify_partition_completed\n");
+ g_debug ("modify_partition_completed");
g_return_if_fail (data != NULL);
if (error != NULL) {
@@ -396,7 +389,7 @@ part_modify_action_callback (GtkAction *action, gpointer user_data)
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("part_modify_action_callback\n");
+ g_debug ("part_modify_action_callback");
if (data->priv->job_cancelled)
return;
@@ -413,7 +406,7 @@ part_modify_auth_end_callback (PolKitGnomeAction *action,
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("part_modify_auth_end_callback\n");
+ g_debug ("part_modify_auth_end_callback");
if (! gained_privilege) {
/* cancel the whole operation */
@@ -436,7 +429,7 @@ format_action_completed (GduDevice *device,
GduPresentable *toplevel_presentable;
GduDevice *toplevel_device;
- g_print ("format_action_completed\n");
+ g_debug ("format_action_completed");
g_return_if_fail (data != NULL);
if (error != NULL) {
@@ -465,11 +458,11 @@ format_action_completed (GduDevice *device,
if (! data->priv->job_cancelled && data->scheme && strlen (data->scheme) > 0) {
part_type = gdu_device_partition_get_type (device);
data->recommended_part_type = gdu_util_get_default_part_type_for_scheme_and_fstype (data->scheme, data->fstype, gdu_device_partition_get_size (device));
- g_print ("format_action_completed: part_type = %s, recommended_part_type = %s\n", part_type, data->recommended_part_type);
+ g_debug ("format_action_completed: part_type = %s, recommended_part_type = %s", part_type, data->recommended_part_type);
/* Change partition type if necessary */
if (strcasecmp (part_type, data->recommended_part_type) != 0)
{
- g_print ("changing part type to %s, device = %s\n", data->recommended_part_type, gdu_device_get_device_file (device));
+ g_debug ("changing part type to %s, device = %s", data->recommended_part_type, gdu_device_get_device_file (device));
gtk_action_activate (GTK_ACTION (data->part_modify_action));
return; /* don't change the UI yet */
}
@@ -487,7 +480,7 @@ format_action_callback (GtkAction *action, gpointer user_data)
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("format_action_callback\n");
+ g_debug ("format_action_callback");
if (data->priv->job_cancelled)
return;
@@ -510,7 +503,7 @@ format_auth_end_callback (PolKitGnomeAction *action,
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("format_auth_end_callback\n");
+ g_debug ("format_auth_end_callback");
if (! gained_privilege) {
/* cancel the whole operation */
@@ -552,7 +545,7 @@ unmount_action_completed (GduDevice *device,
g_return_if_fail (data != NULL);
- g_print ("unmount_action_completed\n");
+ g_debug ("unmount_action_completed");
update_ui_controls (data->priv);
if (error != NULL) {
@@ -573,7 +566,7 @@ unmount_action_completed (GduDevice *device,
else
{
/* TODO: maybe perform a refresh? */
- g_print (" formatting...\n");
+ g_debug (" formatting...");
if (data->priv->job_cancelled)
return;
gtk_action_activate (GTK_ACTION (data->format_action));
@@ -586,7 +579,7 @@ unmount_action_callback (GtkAction *action, gpointer user_data)
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("unmount_action_callback\n");
+ g_debug ("unmount_action_callback");
if (data->priv->job_cancelled)
return;
@@ -602,7 +595,7 @@ unmount_auth_end_callback (PolKitGnomeAction *action,
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("unmount_auth_end_callback\n");
+ g_debug ("unmount_auth_end_callback");
if (! gained_privilege) {
/* cancel the whole operation */
@@ -621,7 +614,7 @@ part_table_new_timeout_handler (gpointer user_data)
FormatProcessData *data = user_data;
g_return_val_if_fail (data != NULL, FALSE);
- g_print ("part_table_new_timeout_handler\n");
+ g_debug ("part_table_new_timeout_handler");
gtk_action_activate (GTK_ACTION (data->part_new_action));
@@ -638,7 +631,7 @@ part_table_new_completed (GduDevice *device,
/* BUG: callback shouldn't be spawned until all changes are reflected in pool */
g_return_if_fail (data != NULL);
- g_print ("part_table_new_completed\n");
+ g_debug ("part_table_new_completed");
update_ui_controls (data->priv);
if (error != NULL) {
@@ -651,13 +644,13 @@ part_table_new_completed (GduDevice *device,
}
else
{
- g_print (" creating partition...\n");
+ g_debug (" creating partition...");
if (data->priv->job_cancelled)
return;
/* TODO: we should wait here for proper refresh */
g_timeout_add (DEVICE_SETTLE_TIMEOUT, part_table_new_timeout_handler, data);
do_progress_bar_update (data, _("Waiting for device to settle..."), -1, TRUE);
-// gtk_action_activate (GTK_ACTION (data->part_new_action));
+ /* gtk_action_activate (GTK_ACTION (data->part_new_action)); -- disabled */
}
}
@@ -667,7 +660,7 @@ part_table_new_action_callback (GtkAction *action, gpointer user_data)
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("part_table_new_action_callback\n");
+ g_debug ("part_table_new_action_callback");
if (data->priv->job_cancelled)
return;
@@ -686,7 +679,7 @@ part_table_new_auth_end_callback (PolKitGnomeAction *action,
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("part_table_new_auth_end_callback\n");
+ g_debug ("part_table_new_auth_end_callback");
if (! gained_privilege) {
/* cancel the whole operation */
@@ -710,7 +703,7 @@ part_new_completed (GduDevice *device,
/* BUG: callback shouldn't be spawned until all changes are reflected in pool */
g_return_if_fail (data != NULL);
- g_print ("part_new_completed, created_device_object_path = %s\n", error == NULL ? created_device_object_path : NULL);
+ g_debug ("part_new_completed, created_device_object_path = %s", error == NULL ? created_device_object_path : NULL);
if (error != NULL) {
nautilus_gdu_show_error (GTK_WIDGET (data->priv->dialog),
@@ -737,7 +730,7 @@ part_new_action_callback (GtkAction *action, gpointer user_data)
char *type;
g_return_if_fail (data != NULL);
- g_print ("part_new_action_callback, device = %s\n", gdu_device_get_device_file (data->device));
+ g_debug ("part_new_action_callback, device = %s", gdu_device_get_device_file (data->device));
if (data->priv->job_cancelled)
return;
@@ -752,7 +745,7 @@ part_new_action_callback (GtkAction *action, gpointer user_data)
type = gdu_util_get_default_part_type_for_scheme_and_fstype (data->scheme, data->fstype, size);
- g_print ("creating new partition, offset = %lu, size = %lu, scheme = %s, type = %s\n", offset, size, data->scheme, type);
+ g_debug ("creating new partition, offset = %lu, size = %lu, scheme = %s, type = %s", offset, size, data->scheme, type);
gdu_device_op_partition_create (data->device, offset, size, type, NULL, NULL,
data->fstype, data->fslabel, data->secure_erase, data->encrypt_passphrase, data->take_ownership,
@@ -768,7 +761,7 @@ part_new_auth_end_callback (PolKitGnomeAction *action,
FormatProcessData *data = user_data;
g_return_if_fail (data != NULL);
- g_print ("part_new_auth_end_callback\n");
+ g_debug ("part_new_auth_end_callback");
if (! gained_privilege) {
/* cancel the whole operation */
@@ -810,13 +803,13 @@ do_format (FormatDialogPrivate *priv)
data->presentable = g_object_ref (priv->presentable);
toplevel_presentable = gdu_presentable_get_toplevel (data->presentable);
if (toplevel_presentable == NULL) {
- g_warning ("%s: no toplevel presentable", __FUNCTION__);
+ g_warning ("%s: no toplevel presentable", __FUNCTION__);
}
toplevel_device = gdu_presentable_get_device (toplevel_presentable);
if (toplevel_device == NULL) {
- g_warning ("%s: no device for toplevel presentable", __FUNCTION__);
- free_format_action_data (data);
- goto out;
+ g_warning ("%s: no device for toplevel presentable", __FUNCTION__);
+ free_format_action_data (data);
+ goto out;
}
data->device = gdu_presentable_get_device (data->presentable);
@@ -825,33 +818,33 @@ do_format (FormatDialogPrivate *priv)
data->device = g_object_ref (toplevel_device);
create_new_part_table = FALSE;
create_new_partition = TRUE;
- g_print ("Partition table exists but has no partition for the selected device.\n");
+ g_debug ("Partition table exists but has no partition for the selected device.");
} else
if (toplevel_device != NULL && ! gdu_device_is_partition_table (toplevel_device)) {
/* no partition table on the device, create partition table first. */
/* also empty (zeroed) device */
create_new_part_table = TRUE;
create_new_partition = TRUE;
- g_print ("Device is known but doesn't have partition table, we need to create it first.\n");
+ g_debug ("Device is known but doesn't have partition table, we need to create it first.");
} else
if (toplevel_device != NULL && data->device != NULL && toplevel_device == data->device && device_needs_partition_table (data->device)) {
/* device is toplevel, check if we need new partitions */
create_new_partition = TRUE;
- g_print ("Device is known but requires partitioning, we'll create new one.\n");
+ g_debug ("Device is known but requires partitioning, we'll create new one.");
}
if (data->device == NULL) {
- g_warning ("%s: device is not supposed to be NULL", __FUNCTION__);
- free_format_action_data (data);
- goto out;
+ g_warning ("%s: device is not supposed to be NULL", __FUNCTION__);
+ free_format_action_data (data);
+ goto out;
}
drive_name = gdu_presentable_get_name (toplevel_presentable);
data->fstype = gdu_util_fstype_combo_box_get_selected (priv->part_type_combo_box);
if (data->fstype == NULL) {
- g_warning ("%s: no valid filesystem type specified", __FUNCTION__);
- free_format_action_data (data);
- goto out;
+ g_warning ("%s: no valid filesystem type specified", __FUNCTION__);
+ free_format_action_data (data);
+ goto out;
}
data->fslabel = g_strdup (GTK_WIDGET_IS_SENSITIVE (priv->label_entry) ?
gtk_entry_get_text (GTK_ENTRY (priv->label_entry)) : "");
@@ -859,10 +852,9 @@ do_format (FormatDialogPrivate *priv)
data->take_ownership = FALSE;
kfs = gdu_pool_get_known_filesystem_by_id (priv->pool, data->fstype);
if (kfs != NULL) {
- if (gdu_known_filesystem_get_supports_unix_owners (kfs) && gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON (priv->take_ownership_of_fs_check_button)))
- data->take_ownership = TRUE;
- g_object_unref (kfs);
+ if (gdu_known_filesystem_get_supports_unix_owners (kfs) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->take_ownership_of_fs_check_button)))
+ data->take_ownership = TRUE;
+ g_object_unref (kfs);
}
primary = g_strdup (_("<b><big>Are you sure you want to create a new file system, deleting existing data?</big></b>"));
@@ -897,7 +889,6 @@ do_format (FormatDialogPrivate *priv)
}
}
-
update_ui_progress (priv, data, TRUE);
data->secure_erase = gdu_util_delete_confirmation_dialog (GTK_WIDGET (priv->dialog),