summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2009-04-30 17:00:01 +0200
committerTomas Bzatek <tbzatek@redhat.com>2009-04-30 17:00:01 +0200
commit7d0f6149f877d2454e7f58f9a58a160847ec724b (patch)
treef3855a29ff349b475d66c2d6f837b704f992beb0
parent9ceea791bba7f107a198f024c4ca0ac1ad0d3a2a (diff)
downloadgnome-disk-utility-nautilus-gdu.tar.gz
gnome-disk-utility-nautilus-gdu.tar.xz
gnome-disk-utility-nautilus-gdu.zip
limit volume label entry length according to chosen fsHEADnautilus-gdu
Also changed the default volume label format to "Data YYYYMMDD"
-rw-r--r--src/gdu-format-tool/format-window.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/gdu-format-tool/format-window.c b/src/gdu-format-tool/format-window.c
index 7f7f254..ffaa167 100644
--- a/src/gdu-format-tool/format-window.c
+++ b/src/gdu-format-tool/format-window.c
@@ -67,6 +67,32 @@ populate_type_combo (FormatDialogPrivate *priv)
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->part_type_combo_box), 0);
}
+static void
+type_combo_box_changed (GtkWidget *combo_box, FormatDialogPrivate *priv)
+{
+ const char *fstype;
+ GduKnownFilesystem *kfs;
+ int max_label_len;
+ int part_combo_item_index;
+
+ fstype = NULL;
+
+ max_label_len = 0;
+
+ part_combo_item_index = gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box));
+ if (part_combo_item_index < 0 || part_combo_item_index >= (int) G_N_ELEMENTS (filesystem_combo_items))
+ return;
+ fstype = filesystem_combo_items[part_combo_item_index].fstype;
+
+ kfs = gdu_pool_get_known_filesystem_by_id (priv->pool, fstype);
+ if (kfs != NULL) {
+ max_label_len = gdu_known_filesystem_get_max_label_len (kfs);
+ g_object_unref (kfs);
+ }
+
+ gtk_entry_set_max_length (GTK_ENTRY (priv->label_entry), max_label_len);
+}
+
void
update_ui_controls (FormatDialogPrivate *priv)
{
@@ -101,6 +127,9 @@ update_ui_controls (FormatDialogPrivate *priv)
if (device)
sensitive = sensitive && ! gdu_device_is_read_only (device) && gdu_device_is_media_available (device);
+ /* volume label max length */
+ type_combo_box_changed (priv->part_type_combo_box, priv);
+
gtk_widget_set_sensitive (priv->controls_box, sensitive);
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_ACCEPT, ! priv->job_running);
@@ -324,7 +353,7 @@ set_default_volume_label (FormatDialogPrivate *priv)
date = g_date_new ();
g_date_set_time_t (date, time (NULL));
- s = g_strdup_printf (_("%s's data %d%.2d%.2d"), g_get_user_name (), g_date_get_year (date), g_date_get_month (date), g_date_get_day (date));
+ s = g_strdup_printf (_("Data %d%.2d%.2d"), g_date_get_year (date), g_date_get_month (date), g_date_get_day (date));
gtk_entry_set_text (GTK_ENTRY (priv->label_entry), s);
g_free (s);
g_date_free (date);
@@ -520,6 +549,8 @@ nautilus_gdu_spawn_dialog (GduPresentable *presentable)
g_signal_connect (priv->dialog, "delete-event",
G_CALLBACK (window_delete_event), priv);
+ g_signal_connect (priv->part_type_combo_box, "changed",
+ G_CALLBACK (type_combo_box_changed), priv);
/* update sensivity and length of fs label + entry */
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (format_dialog_got_response), priv);