[gnome-disk-utility] Don't force file types when selecting a folder
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Don't force file types when selecting a folder
- Date: Sun, 29 Jul 2012 17:31:58 +0000 (UTC)
commit 006847a0446fe2d9a3d722ea01d0e4d8744520fb
Author: David Zeuthen <zeuthen gmail com>
Date: Sun Jul 29 10:36:21 2012 -0400
Don't force file types when selecting a folder
It actually won't work (e.g. it's impossible to select a folder) if
doing this.
Signed-off-by: David Zeuthen <zeuthen gmail com>
src/disks/gducreatediskimagedialog.c | 2 +-
src/disks/gdurestorediskimagedialog.c | 2 +-
src/disks/gduutils.c | 26 +++++++++++++++-----------
src/disks/gduutils.h | 3 ++-
src/disks/gduwindow.c | 2 +-
5 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/src/disks/gducreatediskimagedialog.c b/src/disks/gducreatediskimagedialog.c
index f5a893d..18bfc42 100644
--- a/src/disks/gducreatediskimagedialog.c
+++ b/src/disks/gducreatediskimagedialog.c
@@ -218,7 +218,7 @@ create_disk_image_populate (CreateDiskImageData *data)
g_time_zone_unref (tz);
g_free (now_string);
- gdu_utils_configure_file_chooser_for_disk_images (GTK_FILE_CHOOSER (data->destination_name_fcbutton));
+ gdu_utils_configure_file_chooser_for_disk_images (GTK_FILE_CHOOSER (data->destination_name_fcbutton), FALSE);
}
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/disks/gdurestorediskimagedialog.c b/src/disks/gdurestorediskimagedialog.c
index c359193..c298d48 100644
--- a/src/disks/gdurestorediskimagedialog.c
+++ b/src/disks/gdurestorediskimagedialog.c
@@ -268,7 +268,7 @@ on_notify (GObject *object,
static void
restore_disk_image_populate (RestoreDiskImageData *data)
{
- gdu_utils_configure_file_chooser_for_disk_images (GTK_FILE_CHOOSER (data->source_file_fcbutton));
+ gdu_utils_configure_file_chooser_for_disk_images (GTK_FILE_CHOOSER (data->source_file_fcbutton), TRUE);
}
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/disks/gduutils.c b/src/disks/gduutils.c
index bff85a6..961da3c 100644
--- a/src/disks/gduutils.c
+++ b/src/disks/gduutils.c
@@ -72,7 +72,8 @@ gdu_utils_has_configuration (UDisksBlock *block,
}
void
-gdu_utils_configure_file_chooser_for_disk_images (GtkFileChooser *file_chooser)
+gdu_utils_configure_file_chooser_for_disk_images (GtkFileChooser *file_chooser,
+ gboolean set_file_types)
{
GtkFileFilter *filter;
gchar *folder;
@@ -94,16 +95,19 @@ gdu_utils_configure_file_chooser_for_disk_images (GtkFileChooser *file_chooser)
gtk_file_chooser_set_current_folder (file_chooser, folder);
/* TODO: define proper mime-types */
- filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("All Files"));
- gtk_file_filter_add_pattern (filter, "*");
- gtk_file_chooser_add_filter (file_chooser, filter); /* adopts filter */
- filter = gtk_file_filter_new ();
- gtk_file_filter_set_name (filter, _("Disk Images (*.img, *.iso)"));
- gtk_file_filter_add_pattern (filter, "*.img");
- gtk_file_filter_add_pattern (filter, "*.iso");
- gtk_file_chooser_add_filter (file_chooser, filter); /* adopts filter */
- gtk_file_chooser_set_filter (file_chooser, filter);
+ if (set_file_types)
+ {
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("All Files"));
+ gtk_file_filter_add_pattern (filter, "*");
+ gtk_file_chooser_add_filter (file_chooser, filter); /* adopts filter */
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Disk Images (*.img, *.iso)"));
+ gtk_file_filter_add_pattern (filter, "*.img");
+ gtk_file_filter_add_pattern (filter, "*.iso");
+ gtk_file_chooser_add_filter (file_chooser, filter); /* adopts filter */
+ gtk_file_chooser_set_filter (file_chooser, filter);
+ }
g_clear_object (&settings);
g_free (folder);
diff --git a/src/disks/gduutils.h b/src/disks/gduutils.h
index 6e96bc5..5f7c744 100644
--- a/src/disks/gduutils.h
+++ b/src/disks/gduutils.h
@@ -32,7 +32,8 @@ gboolean gdu_utils_has_configuration (UDisksBlock *block,
const gchar *type,
gboolean *out_has_passphrase);
-void gdu_utils_configure_file_chooser_for_disk_images (GtkFileChooser *file_chooser);
+void gdu_utils_configure_file_chooser_for_disk_images (GtkFileChooser *file_chooser,
+ gboolean set_file_types);
void gdu_utils_file_chooser_for_disk_images_update_settings (GtkFileChooser *file_chooser);
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index 482db64..4991b37 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -740,7 +740,7 @@ gdu_window_show_attach_disk_image (GduWindow *window)
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Attach"), GTK_RESPONSE_ACCEPT,
NULL);
- gdu_utils_configure_file_chooser_for_disk_images (GTK_FILE_CHOOSER (dialog));
+ gdu_utils_configure_file_chooser_for_disk_images (GTK_FILE_CHOOSER (dialog), TRUE);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
/* Add a RO check button that defaults to RO */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]