diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2009-03-18 16:49:17 +0100 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2009-03-18 16:49:17 +0100 |
commit | e660a0207dbdc5cc389c74e39f1229ad70e019ee (patch) | |
tree | 19fdb88804f09422183af460f73f8aaf3c777167 /src/format-window.c | |
parent | acf6257fd280266c8a4618b3830c9bfbd974d74f (diff) | |
download | nautilus-gdu-master.tar.gz nautilus-gdu-master.tar.xz nautilus-gdu-master.zip |
Diffstat (limited to 'src/format-window.c')
-rw-r--r-- | src/format-window.c | 121 |
1 files changed, 9 insertions, 112 deletions
diff --git a/src/format-window.c b/src/format-window.c index f652afb..1f227a5 100644 --- a/src/format-window.c +++ b/src/format-window.c @@ -41,21 +41,6 @@ static void set_new_presentable (FormatDialogPrivate *priv, GduPresentable *pres /* ---------------------------------------------------------------------------------------------------- */ -/* taken from palimpsest/gdu-section-partition.c */ -static gboolean -has_flag (char **flags, const char *flag) -{ - int n = 0; - while (flags != NULL && flags[n] != NULL) { - if (strcmp (flags[n], flag) == 0) - return TRUE; - n++; - } - return FALSE; -} - -/* ---------------------------------------------------------------------------------------------------- */ - /* taken from palimpsest/gdu-section-unrecognized.c */ static void type_combo_box_changed (GtkWidget *combo_box, FormatDialogPrivate *priv) @@ -63,28 +48,23 @@ type_combo_box_changed (GtkWidget *combo_box, FormatDialogPrivate *priv) char *fstype; GduKnownFilesystem *kfs; gboolean label_entry_sensitive; -// gboolean can_erase; gboolean have_owners; int max_label_len; fstype = NULL; label_entry_sensitive = FALSE; -// can_erase = FALSE; max_label_len = 0; have_owners = FALSE; fstype = gdu_util_fstype_combo_box_get_selected (combo_box); - g_print ("type_combo_box_changed: fstype = '%s'\n", fstype); if (fstype != NULL && priv->presentable) { kfs = gdu_pool_get_known_filesystem_by_id (priv->pool, fstype); if (kfs != NULL) { - g_print (" kfs ID = '%s', name = %s\n", gdu_known_filesystem_get_id (kfs), gdu_known_filesystem_get_name (kfs)); max_label_len = gdu_known_filesystem_get_max_label_len (kfs); have_owners = gdu_known_filesystem_get_supports_unix_owners (kfs); g_object_unref (kfs); } -// can_erase = TRUE; } if (max_label_len > 0) @@ -92,7 +72,6 @@ type_combo_box_changed (GtkWidget *combo_box, FormatDialogPrivate *priv) gtk_entry_set_max_length (GTK_ENTRY (priv->label_entry), max_label_len); gtk_widget_set_sensitive (priv->label_entry, label_entry_sensitive); -// polkit_gnome_action_set_sensitive (priv->erase_action, can_erase); if (have_owners) gtk_widget_show (priv->take_ownership_of_fs_check_button); @@ -144,8 +123,6 @@ update_ui_controls (FormatDialogPrivate *priv) if (priv->volume_selector) gtk_widget_set_sensitive (priv->volume_selector, ! priv->job_running); gtk_dialog_set_response_sensitive (priv->dialog, GTK_RESPONSE_OK, sensitive && gtk_combo_box_get_active (GTK_COMBO_BOX (priv->part_type_combo_box)) >= 0); -/* gtk_dialog_set_response_sensitive (priv->dialog, GTK_RESPONSE_REJECT, sensitive); - gtk_dialog_set_response_sensitive (priv->dialog, GTK_RESPONSE_CLOSE, sensitive); */ if (device != NULL) g_object_unref (device); @@ -169,12 +146,7 @@ update_ui (FormatDialogPrivate *priv) GduDevice *device = NULL; GduPresentable *toplevel_presentable = NULL; GduDevice *toplevel_device = NULL; - gboolean show_flag_boot; - gboolean show_flag_required; -// gboolean can_edit_part_label; gboolean known_fs; - const char *scheme; - char **flags; GPtrArray *details; guint n; @@ -402,13 +374,11 @@ update_ui (FormatDialogPrivate *priv) if (device) - g_print ("gdu_device_id_get_type (device) = '%s', gdu_device_partition_get_type (device) = '%s'\n", + g_debug ("gdu_device_id_get_type = '%s', gdu_device_partition_get_type = '%s'", gdu_device_id_get_type (device), gdu_device_partition_get_type (device)); - if (name) - g_free (name); - if (strsize_long) - g_free (strsize_long); + g_free (name); + g_free (strsize_long); for (n = 0; n < 4; n++) { @@ -460,54 +430,6 @@ update_ui (FormatDialogPrivate *priv) gtk_widget_show (priv->encrypted_check_button); } - - - /* TODO: is this really valid for a formatter? -- disabled */ - scheme = device ? gdu_device_partition_get_scheme (device) : NULL; -// can_edit_part_label = FALSE; - show_flag_boot = FALSE; - show_flag_required = FALSE; - -#if 0 /* -- disabled */ - if (strcmp (scheme, "mbr") == 0) { -// can_edit_part_label = TRUE; - show_flag_boot = TRUE; - } - - if (strcmp (scheme, "gpt") == 0) { -// can_edit_part_label = TRUE; - show_flag_required = TRUE; - } - - if (strcmp (scheme, "apm") == 0) { -// can_edit_part_label = TRUE; - show_flag_boot = TRUE; - } -#endif - - if (show_flag_boot) - gtk_widget_show (priv->part_flag_boot_check_button); - else - gtk_widget_hide (priv->part_flag_boot_check_button); - - if (show_flag_required) - gtk_widget_show (priv->part_flag_required_check_button); - else - gtk_widget_hide (priv->part_flag_required_check_button); - - flags = device ? gdu_device_partition_get_flags (device) : NULL; - if (! priv->job_running) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->part_flag_boot_check_button), - has_flag (flags, "boot")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->part_flag_required_check_button), - has_flag (flags, "required")); - } - -/* - gtk_widget_set_sensitive (priv->label_entry, can_edit_part_label); - gtk_entry_set_text (GTK_ENTRY (priv->label_entry), - gdu_device_partition_get_label (device)); -*/ /* Volume label */ if (! priv->job_running) { gtk_entry_set_text (GTK_ENTRY (priv->label_entry), device ? gdu_device_id_get_label (device) : ""); @@ -546,7 +468,6 @@ nautilus_gdu_destroy (FormatDialogPrivate *priv) gboolean standalone; g_return_if_fail (priv != NULL); -// g_print ("...destroying...\n"); standalone = priv->standalone_mode; /* disconnect our handlers, since the presentable (resp. the pool) refence counter doesn't really need to be zero */ @@ -566,7 +487,7 @@ static void presentable_removed (GduPresentable *presentable, FormatDialogPrivate *priv) { g_return_if_fail (priv != NULL); - g_warning ("Presentable removed event.\n"); + g_warning ("Presentable removed event."); if (priv->standalone_mode) { /* we want to clear the UI, selecting another presentable might lead to accident */ @@ -582,7 +503,7 @@ static void presentable_changed (GduPresentable *presentable, FormatDialogPrivate *priv) { g_return_if_fail (priv != NULL); - g_warning ("Presentable changed event.\n"); + g_warning ("Presentable changed event."); /* TODO: shall we preserve label or any other settings? */ update_ui (priv); @@ -609,14 +530,14 @@ set_new_presentable (FormatDialogPrivate *priv, GduPresentable *presentable) if (priv->presentable) { /* first of all, disconnect handlers from the old presentable */ g_signal_handlers_disconnect_matched (priv->presentable, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, priv); - g_print ("before unreffing presentable, count = %d [%p]\n", ((GObject*)priv->presentable)->ref_count, priv->presentable); +/* g_debug ("before unreffing presentable, count = %d [%p]", ((GObject*)priv->presentable)->ref_count, priv->presentable); */ g_object_unref (priv->presentable); priv->presentable = NULL; } if (presentable) { priv->presentable = g_object_ref (presentable); - g_print ("set_new_presentable: after reffing presentable, count = %d [%p]\n", ((GObject*)priv->presentable)->ref_count, priv->presentable); +/* g_debug ("set_new_presentable: after reffing presentable, count = %d [%p]", ((GObject*)priv->presentable)->ref_count, priv->presentable); */ /* catch Presentable events */ g_signal_connect (G_OBJECT (priv->presentable), "removed", @@ -633,7 +554,7 @@ pool_presentable_changed (GduPool *pool, GduPresentable *presentable, FormatDial g_return_if_fail (priv->volume_selector != NULL); if (! priv->job_running) { - g_warning ("Pool presentable changed event.\n"); + g_warning ("Pool presentable changed event."); gdu_util_presentable_combo_box_rebuild (priv->volume_selector, pool); } } @@ -668,7 +589,7 @@ cancel_operation (FormatDialogPrivate *priv) g_return_if_fail (priv->job_running == TRUE); /* TODO: check for valid device */ g_return_if_fail (priv->presentable != NULL); - g_warning ("Cancelling...\n"); + g_warning ("Cancelling..."); priv->job_cancelled = TRUE; device = gdu_presentable_get_device (priv->presentable); @@ -699,11 +620,6 @@ format_dialog_got_response (GtkDialog *dialog, if (response_id == GTK_RESPONSE_OK) { do_format (priv); } - else - if (response_id == GTK_RESPONSE_REJECT) { - /* revert changes */ - update_ui (priv); - } else { if (priv->job_running) { cancel_operation (priv); @@ -753,12 +669,10 @@ nautilus_gdu_spawn_dialog (GduPresentable *presentable, gtk_dialog_add_buttons (dialog, _("_Format"), GTK_RESPONSE_OK, -/* _("_Revert"), GTK_RESPONSE_REJECT, */ NULL); priv->close_button = gtk_dialog_add_button (dialog, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); gtk_dialog_set_default_response (dialog, GTK_RESPONSE_CLOSE); -// gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); gtk_container_set_border_width (GTK_CONTAINER (content_area), 10); @@ -893,20 +807,6 @@ nautilus_gdu_spawn_dialog (GduPresentable *presentable, gdu_util_fstype_combo_box_set_desc_label (combo_box, label); row++; - /* flags: used by mbr, apm */ - check_button = gtk_check_button_new_with_mnemonic (_("_Bootable")); - gtk_table_attach (GTK_TABLE (table), check_button, 1, 2, row, row +1, - GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); - priv->part_flag_boot_check_button = check_button; - row++; - - /* flags: used by gpt */ - check_button = gtk_check_button_new_with_mnemonic (_("Required / Firm_ware")); - gtk_table_attach (GTK_TABLE (table), check_button, 1, 2, row, row +1, - GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2); - priv->part_flag_required_check_button = check_button; - row++; - /* whether to chown fs root for user */ check_button = gtk_check_button_new_with_mnemonic (_("T_ake ownership of file system")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); @@ -952,7 +852,6 @@ nautilus_gdu_spawn_dialog (GduPresentable *presentable, image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0); label = gtk_label_new (_("The volume is currently mounted. Please make sure to close all open files before formatting.")); -// gtk_label_set_width_chars (GTK_LABEL (label), 50); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); @@ -988,8 +887,6 @@ nautilus_gdu_spawn_dialog (GduPresentable *presentable, gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); - // gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, FALSE); - g_signal_connect (priv->dialog, "delete-event", G_CALLBACK (window_delete_event), priv); /* update sensivity and length of fs label + entry */ |