seems that filename from filechooser may be null (nil)
authorGuillaume Cottenceau <gcottenc@gmail.com>
Tue, 26 Jul 2011 12:46:29 +0000 (14:46 +0200)
committerGuillaume Cottenceau <gcottenc@gmail.com>
Tue, 26 Jul 2011 12:46:29 +0000 (14:46 +0200)
bin/booh
bin/booh-classifier

index 05e90a6..4843b9d 100644 (file)
--- a/bin/booh
+++ b/bin/booh
@@ -3098,7 +3098,7 @@ def open_file_popup
     }
     ok = false
     while !ok
-        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT
+        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT && fc.filename
             push_mousecursor_wait(fc)
             msg = open_file_user(fc.filename)
             pop_mousecursor(fc)
@@ -3425,7 +3425,7 @@ def new_album
                                         nil,
                                         [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT], [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL])
         fc.transient_for = $main_window
-        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT
+        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT && fc.filename
             src.text = utf8(fc.filename)
             process_src_nb.call
             conf.text = File.expand_path("~/.booh/#{File.basename(src.text)}")
@@ -3440,7 +3440,7 @@ def new_album
                                         nil,
                                         [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT], [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL])
         fc.transient_for = $main_window
-        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT
+        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT && fc.filename
             dest.text = utf8(fc.filename)
         end
         fc.destroy
@@ -3455,7 +3455,7 @@ def new_album
         fc.transient_for = $main_window
         fc.add_shortcut_folder(File.expand_path("~/.booh"))
         fc.set_current_folder(File.expand_path("~/.booh"))
-        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT
+        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT && fc.filename
             conf.text = utf8(fc.filename)
         end
         fc.destroy
@@ -3906,7 +3906,7 @@ def save_as_do
     fc.add_shortcut_folder(File.expand_path("~/.booh"))
     fc.set_current_folder(File.expand_path("~/.booh"))
     fc.filename = $orig_filename
-    if fc.run == Gtk::Dialog::RESPONSE_ACCEPT
+    if fc.run == Gtk::Dialog::RESPONSE_ACCEPT && fc.filename
         $orig_filename = fc.filename
         if ! save_current_file_user
             fc.destroy
index 8267b82..b80241e 100644 (file)
@@ -1403,7 +1403,7 @@ def open_dir_popup
     ok = false
     load = false
     while !ok
-        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT
+        if fc.run == Gtk::Dialog::RESPONSE_ACCEPT && fc.filename
             msg = open_dir(fc.filename)
             if msg
                 show_popup(fc, msg)
@@ -1517,7 +1517,7 @@ def execute
                 if lastpath
                     fc.current_folder = lastpath
                 end
-                if fc.run == Gtk::Dialog::RESPONSE_ACCEPT
+                if fc.run == Gtk::Dialog::RESPONSE_ACCEPT && fc.filename
                     pathlabel.text = fc.filename
                     pathlabel.set_alignment(0, 0.5)
                 end