[gnome-disk-utility] Don't default to NTFS unless the mkntfs(8) command exists
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Don't default to NTFS unless the mkntfs(8) command exists
- Date: Tue, 31 Jul 2012 19:51:51 +0000 (UTC)
commit b95d91907c049da6303b292e52509507175f0668
Author: David Zeuthen <zeuthen gmail com>
Date: Tue Jul 31 15:49:55 2012 -0400
Don't default to NTFS unless the mkntfs(8) command exists
... default to FAT instead in this case. Why this change? Because some
operating systems may not ship ntfsprogs.
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/disks/gducreatefilesystemwidget.c | 5 ++++-
src/libgdu/gduutils.c | 20 ++++++++++++++++++++
src/libgdu/gduutils.h | 2 ++
3 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/src/disks/gducreatefilesystemwidget.c b/src/disks/gducreatefilesystemwidget.c
index 1b4f646..cfda868 100644
--- a/src/disks/gducreatefilesystemwidget.c
+++ b/src/disks/gducreatefilesystemwidget.c
@@ -448,7 +448,10 @@ populate (GduCreateFilesystemWidget *widget)
}
else
{
- gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget->type_combobox), "ntfs");
+ if (gdu_utils_is_ntfs_available ())
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget->type_combobox), "ntfs");
+ else
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget->type_combobox), "vfat");
}
}
else
diff --git a/src/libgdu/gduutils.c b/src/libgdu/gduutils.c
index 0336e19..a2f74c3 100644
--- a/src/libgdu/gduutils.c
+++ b/src/libgdu/gduutils.c
@@ -655,3 +655,23 @@ gdu_utils_show_confirmation (GtkWindow *parent_window,
}
/* ---------------------------------------------------------------------------------------------------- */
+
+gboolean
+gdu_utils_is_ntfs_available (void)
+{
+ static gsize once = 0;
+ static gboolean available = FALSE;
+
+ if (g_once_init_enter (&once))
+ {
+ gchar *path;
+ path = g_find_program_in_path ("mkntfs");
+ if (path != NULL)
+ available = TRUE;
+ g_free (path);
+ g_once_init_leave (&once, (gsize) 1);
+ }
+ return available;
+}
+
+
diff --git a/src/libgdu/gduutils.h b/src/libgdu/gduutils.h
index 1e88fe3..898f099 100644
--- a/src/libgdu/gduutils.h
+++ b/src/libgdu/gduutils.h
@@ -68,6 +68,8 @@ gboolean gdu_utils_show_confirmation (GtkWindow *parent_window,
const gchar *secondary_message,
const gchar *affirmative_verb);
+gboolean gdu_utils_is_ntfs_available (void);
+
G_END_DECLS
#endif /* __GDU_UTILS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]