require 'booh/booh-lib'
include Booh
require 'booh/UndoHandler'
+require 'booh/Synchronizator'
#- options
$subalbums = Gtk::Table.new(0, 0, true)
current_y_sub_albums = 0
- $xmldir = $xmldoc.elements["//dir[@path='#{$current_path}']"]
+ $xmldir = Synchronizator.new($xmldoc.elements["//dir[@path='#{$current_path}']"])
$subalbums_edits = {}
subalbums_counter = 0
subalbums_edits_bypos = {}
--- /dev/null
+# * BOOH *
+#
+# A.k.a `Best web-album Of the world, Or your money back, Humerus'.
+#
+# The acronyn sucks, however this is a tribute to Dragon Ball by
+# Akira Toriyama, where the last enemy beaten by heroes of Dragon
+# Ball is named "Boo". But there was already a free software project
+# called Boo, so this one will be it "Booh". Or whatever.
+#
+#
+# Copyright (c) 2004 Guillaume Cottenceau <gc3 at bluewin.ch>
+#
+# This software may be freely redistributed under the terms of the GNU
+# public license version 2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#
+# Any method call to the wrapped object will be synchronized on a unique
+# monitor. Recursive calls are possible.
+#
+
+require 'monitor'
+
+class ObjectWrapper
+ def initialize(wrapped_object)
+ @wrapped_object = wrapped_object
+ end
+ def method_missing(id, *args, &block)
+ wrap(id, *args, &block)
+ end
+ def wrap(id, *args, &block)
+ if block.nil?
+ return @wrapped_object.__send__(id, *args)
+ else
+ return @wrapped_object.__send__(id, *args) { |*args2| block.call(*args2) }
+ end
+ end
+end
+
+class Synchronizator < ObjectWrapper
+ def initialize(wrapped_object)
+ super
+ @wrapped_object.extend(MonitorMixin)
+ end
+ def wrap(id, *args, &block)
+ @wrapped_object.synchronize {
+ super(id, *args, &block)
+ }
+ end
+end