[totem] main: Add an "Add Directory" button to Open dialogue



commit fa19695a0b4c46093d18165f4e7d2e980852600a
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Apr 18 19:09:40 2012 +0100

    main: Add an "Add Directory" button to Open dialogue
    
    https://bugzilla.gnome.org/show_bug.cgi?id=634998

 src/totem-uri.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/totem-uri.c b/src/totem-uri.c
index 2c93b52..a95f9e8 100644
--- a/src/totem-uri.c
+++ b/src/totem-uri.c
@@ -643,6 +643,8 @@ totem_add_subtitle (GtkWindow *parent, const char *uri)
 	return subtitle;
 }
 
+#define OPEN_DIRECTORY_RESPONSE 1
+
 GSList *
 totem_add_files (GtkWindow *parent, const char *path)
 {
@@ -654,11 +656,12 @@ totem_add_files (GtkWindow *parent, const char *path)
 	gboolean set_folder;
 
 	fs = gtk_file_chooser_dialog_new (_("Select Movies or Playlists"),
-			parent,
-			GTK_FILE_CHOOSER_ACTION_OPEN,
-			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
-			NULL);
+					  parent,
+					  GTK_FILE_CHOOSER_ACTION_OPEN,
+					  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+					  _("Add Directory"), OPEN_DIRECTORY_RESPONSE,
+					  GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
+					  NULL);
 	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (fs), filter_all);
 	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (fs), filter_supported);
 	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (fs), filter_audio);
@@ -691,13 +694,12 @@ totem_add_files (GtkWindow *parent, const char *path)
 
 	response = gtk_dialog_run (GTK_DIALOG (fs));
 
-	if (response != GTK_RESPONSE_ACCEPT) {
-		gtk_widget_destroy (fs);
-		g_object_unref (settings);
-		return NULL;
+	filenames = NULL;
+	if (response == OPEN_DIRECTORY_RESPONSE ||
+	    response == GTK_RESPONSE_ACCEPT) {
+		filenames = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (fs));
 	}
 
-	filenames = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (fs));
 	if (filenames == NULL) {
 		gtk_widget_destroy (fs);
 		g_object_unref (settings);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]