allow to generate the webalbum from the gui
authorgc <gc>
Sun, 17 Apr 2005 17:50:54 +0000 (17:50 +0000)
committergc <gc>
Sun, 17 Apr 2005 17:50:54 +0000 (17:50 +0000)
bin/booh-gui
data/booh/images/stock-web-16.png [new file with mode: 0644]

index b2745dc8267506d497d79c8e9fd3ace821b76d0c..139fd476ebccecaceeb483fd460078678be496d6 100755 (executable)
@@ -1215,7 +1215,7 @@ def open_file(filename)
 
     $config['last-opens'] ||= []
     $config['last-opens'] << filename
-    $save.sensitive = $save_as.sensitive = true
+    $save.sensitive = $save_as.sensitive = $generate.sensitive = true
     return nil
 end
 
@@ -1247,6 +1247,14 @@ def open_file_popup
     fc.destroy
 end
 
+def additional_booh_options
+    options = ''
+    if $config['mproc']
+        options += "--mproc #{$config['mproc'].to_i} "
+    end
+    return options
+end
+
 def new_album
     dialog = Gtk::Dialog.new(utf8(_("Create a new album")),
                              $main_window,
@@ -1375,10 +1383,8 @@ def new_album
     if ok
         button, w8 = wait_message($main_window, utf8(_("Please wait while scanning source directory...")))
         backend = Thread.new {
-            cmd = "booh --source #{srcdir} --destination #{destdir} --config-skel #{configskel} --for-gui --verbose-level #{$verbose_level} --theme #{theme}"
-            if $config['mproc']
-                cmd += " --mproc #{$config['mproc'].to_i}"
-            end
+            cmd = "booh --source #{srcdir} --destination #{destdir} --config-skel #{configskel} --for-gui " +
+                  "--verbose-level #{$verbose_level} --theme #{theme} #{additional_booh_options}"
             msg 2, cmd
             system(cmd)
             w8.destroy
@@ -1460,13 +1466,16 @@ def create_menu_and_toolbar
 
     filemenu = Gtk::MenuItem.new(utf8(_("_File")))
     filesubmenu = Gtk::Menu.new
-    filesubmenu.append(new      = Gtk::ImageMenuItem.new(Gtk::Stock::NEW))
-    filesubmenu.append(open     = Gtk::ImageMenuItem.new(Gtk::Stock::OPEN))
-    filesubmenu.append(           Gtk::SeparatorMenuItem.new)
-    filesubmenu.append($save    = Gtk::ImageMenuItem.new(Gtk::Stock::SAVE).set_sensitive(false))
-    filesubmenu.append($save_as = Gtk::ImageMenuItem.new(Gtk::Stock::SAVE_AS).set_sensitive(false))
-    filesubmenu.append(           Gtk::SeparatorMenuItem.new)
-    filesubmenu.append(quit     = Gtk::ImageMenuItem.new(Gtk::Stock::QUIT))
+    filesubmenu.append(new       = Gtk::ImageMenuItem.new(Gtk::Stock::NEW))
+    filesubmenu.append(open      = Gtk::ImageMenuItem.new(Gtk::Stock::OPEN))
+    filesubmenu.append(            Gtk::SeparatorMenuItem.new)
+    filesubmenu.append($save     = Gtk::ImageMenuItem.new(Gtk::Stock::SAVE).set_sensitive(false))
+    filesubmenu.append($save_as  = Gtk::ImageMenuItem.new(Gtk::Stock::SAVE_AS).set_sensitive(false))
+    filesubmenu.append(            Gtk::SeparatorMenuItem.new)
+    filesubmenu.append($generate = Gtk::ImageMenuItem.new(utf8(_("Generate web-album"))).set_sensitive(false))
+    $generate.image = Gtk::Image.new("#{$FPATH}/images/stock-web-16.png")
+    filesubmenu.append(            Gtk::SeparatorMenuItem.new)
+    filesubmenu.append(quit      = Gtk::ImageMenuItem.new(Gtk::Stock::QUIT))
     filemenu.set_submenu(filesubmenu)
     mb.append(filemenu)
 
@@ -1474,6 +1483,21 @@ def create_menu_and_toolbar
     open.signal_connect('activate') { open_file_popup }
     $save.signal_connect('activate') { save_current_file }
     $save_as.signal_connect('activate') { save_as_do }
+    $generate.signal_connect('activate') {
+        button, w8 = wait_message($main_window, utf8(_("Please wait while generating web-album...\nThis may take a while, please be patient.")))
+        backend = Thread.new {
+            save_current_file
+            cmd = "booh --config #{$filename} --verbose-level #{$verbose_level} #{additional_booh_options}"
+            msg 2, cmd
+            system(cmd)
+            w8.destroy
+            show_popup($main_window, utf8(_("Your web-album is now ready in directory `%s'.") % current_dest_dir ))
+        }
+        button.signal_connect('clicked') {
+            Thread.kill(backend)
+        }
+    }
+
     quit.signal_connect('activate') { try_quit }
 
     editmenu = Gtk::MenuItem.new(utf8(_("_Edit")))
diff --git a/data/booh/images/stock-web-16.png b/data/booh/images/stock-web-16.png
new file mode 100644 (file)
index 0000000..699ac21
Binary files /dev/null and b/data/booh/images/stock-web-16.png differ