menu.popup(nil, nil, event.button, event.time)
end
+def delete_current_subalbum
+ $xmldir.elements.each { |e|
+ if e.name == 'image' || e.name == 'video'
+ e.add_attribute('deleted', 'true')
+ end
+ }
+ #- branch if we have a non deleted subalbum
+ if $xmldir.child_byname_notattr('dir', 'deleted')
+ $xmldir.delete_attribute('thumbnails-caption')
+ $xmldir.delete_attribute('thumbnails-captionfile')
+ else
+ $xmldir.add_attribute('deleted', 'true')
+ moveup = $xmldir
+ while moveup.parent.name == 'dir'
+ moveup = moveup.parent
+ if !moveup.child_byname_notattr('dir', 'deleted') && !moveup.child_byname_notattr('image', 'deleted') && !moveup.child_byname_notattr('video', 'deleted')
+ moveup.add_attribute('deleted', 'true')
+ else
+ break
+ end
+ end
+ end
+ save_changes('forced')
+ populate_subalbums_treeview
+end
+
def add_thumbnail(autotable, filename, type, thumbnail_img, caption)
img = nil
}
delete = Proc.new { |isacut|
- if autotable.current_order.size > 1 || show_popup($main_window, utf8(_("Do you confirm this subalbum needs to be completely removed?")), { :okcancel => true })
+ if autotable.current_order.size > 1 || show_popup($main_window, utf8(_("Do you confirm this subalbum needs to be completely removed? This operation cannot be undone.")), { :okcancel => true })
$modified = true
after = nil
perform_delete = Proc.new {
perform_delete.call
if !after
- if $xmldir.child_byname_notattr('dir', 'deleted')
- $xmldir.delete_attribute('thumbnails-caption')
- $xmldir.delete_attribute('thumbnails-captionfile')
- else
- $xmldir.add_attribute('deleted', 'true')
- moveup = $xmldir
- while moveup.parent.name == 'dir'
- moveup = moveup.parent
- if !moveup.child_byname_notattr('dir', 'deleted') && !moveup.child_byname_notattr('image', 'deleted') && !moveup.child_byname_notattr('video', 'deleted')
- moveup.add_attribute('deleted', 'true')
- else
- break
- end
- end
- end
- save_changes('forced')
- populate_subalbums_treeview
+ delete_current_subalbum
else
save_undo(_("delete"),
Proc.new { |pos|
menu.append(passprotect = Gtk::ImageMenuItem.new(utf8(_("Password protect"))))
passprotect.image = Gtk::Image.new("#{$FPATH}/images/galeon-secure.png")
passprotect.signal_connect('activate') { ask_password_protect }
+ menu.append(Gtk::SeparatorMenuItem.new)
+ menu.append(delete = Gtk::ImageMenuItem.new(Gtk::Stock::DELETE))
+ delete.signal_connect('activate') {
+ if show_popup($main_window, utf8(_("Do you confirm this subalbum needs to be completely removed? This operation cannot be undone.")), { :okcancel => true })
+ delete_current_subalbum
+ end
+ }
menu.show_all
menu.popup(nil, nil, event.button, event.time)
end