graphically show password protection
authorgc <gc>
Thu, 3 Nov 2005 19:32:23 +0000 (19:32 +0000)
committergc <gc>
Thu, 3 Nov 2005 19:32:23 +0000 (19:32 +0000)
bin/booh

index 36899466cf6508c1d501c5d2997bd625d31ca95e..0d1bafd9ff689c4099b87926602087e0ea1b491b 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -2211,9 +2211,34 @@ def theme_choose(current)
     return nil
 end
 
+def show_password_protections
+    examine_dir_elem = Proc.new { |parent_iter, xmldir, already_protected|
+        child_iter = $albums_iters[xmldir.attributes['path']]
+        if xmldir.attributes['password-protect']
+            child_iter[2] = pixbuf_or_nil("#{$FPATH}/images/galeon-secure.png")
+            already_protected = true
+        elsif already_protected
+            pix = pixbuf_or_nil("#{$FPATH}/images/galeon-secure-shadow.png")
+            if pix
+                pix = pix.saturate_and_pixelate(1, true)
+            end
+            child_iter[2] = pix
+        else
+            child_iter[2] = nil
+        end
+        xmldir.elements.each('dir') { |elem|
+            if !elem.attributes['deleted']
+                examine_dir_elem.call(child_iter, elem, already_protected)
+            end
+        }
+    }
+    examine_dir_elem.call(nil, $xmldoc.elements['//dir'], false)
+end
+
 def populate_subalbums_treeview
     $albums_ts.clear
     $autotable.clear
+    $albums_iters = {}
     $subalbums_vb.children.each { |chld|
         $subalbums_vb.remove(chld)
     }
@@ -2231,6 +2256,7 @@ def populate_subalbums_treeview
         child_iter = $albums_ts.append(parent_iter)
         child_iter[0] = File.basename(xmldir.attributes['path'])
         child_iter[1] = xmldir.attributes['path']
+        $albums_iters[xmldir.attributes['path']] = child_iter
         msg 3, "puttin location: #{xmldir.attributes['path']}"
         xmldir.elements.each('dir') { |elem|
             if !elem.attributes['deleted']
@@ -2239,6 +2265,7 @@ def populate_subalbums_treeview
         }
     }
     append_dir_elem.call(nil, xmldir)
+    show_password_protections
 
     $albums_tv.expand_all
     $albums_tv.selection.select_iter($albums_ts.iter_first)
@@ -3654,6 +3681,7 @@ below the Document Root), and specify this location in the password protect dial
                               end
                           }
                       })
+            show_password_protections
         end
     }
 end
@@ -3664,9 +3692,9 @@ def create_main_window
 
     $albums_tv = Gtk::TreeView.new
     $albums_tv.set_size_request(120, -1)
-    renderer = Gtk::CellRendererText.new
-    column = Gtk::TreeViewColumn.new('', renderer, { :text => 0 })
-    $albums_tv.append_column(column)
+    $albums_tv.append_column(Gtk::TreeViewColumn.new('', Gtk::CellRendererPixbuf.new, { :pixbuf => 2 }))
+    $albums_tv.append_column(tcol = Gtk::TreeViewColumn.new('', Gtk::CellRendererText.new, { :text => 0 }))
+    $albums_tv.expander_column = tcol
     $albums_tv.set_headers_visible(false)
     $albums_tv.selection.signal_connect('changed') { |w|
         push_mousecursor_wait
@@ -3691,7 +3719,7 @@ def create_main_window
         end
     }
 
-    $albums_ts = Gtk::TreeStore.new(String, String)
+    $albums_ts = Gtk::TreeStore.new(String, String, Gdk::Pixbuf)
     $albums_tv.set_model($albums_ts)
     $albums_tv.signal_connect('realize') { $albums_tv.grab_focus }