--- deliantra/Deliantra-Client/DC.pm 2006/08/13 03:20:53 1.112 +++ deliantra/Deliantra-Client/DC.pm 2006/09/20 16:01:07 1.120 @@ -15,7 +15,7 @@ package CFPlus; BEGIN { - $VERSION = '0.2'; + $VERSION = '0.52'; use XSLoader; XSLoader::load "CFPlus", $VERSION; @@ -71,7 +71,12 @@ sub put($$$) { my ($db, $key, $data) = @_; - $DB_SYNC{$db} = AnyEvent->timer (after => 5, cb => sub { $db->db_sync }); + my $hkey = $db + 0; + Scalar::Util::weaken $db; + $DB_SYNC{$hkey} ||= AnyEvent->timer (after => 5, cb => sub { + delete $DB_SYNC{$hkey}; + $db->db_sync if $db; + }); $db->db_put ($key => $data) } @@ -211,7 +216,7 @@ sub do_n_dialog { my ($cb) = @_; - my $w = new CFPlus::UI::FancyFrame + my $w = new CFPlus::UI::Toplevel on_delete => sub { $_[0]->destroy; 1 }, has_close_button => 1, ; @@ -285,6 +290,16 @@ }); } ], + ["rename", # first try of an easier use of flint&steel + sub { + &::open_string_query ("Rename item to:", sub { + my ($entry, $txt) = @_; + $::CONN->send ("mark ". pack "N", $self->{tag}); + $::CONN->send ("command rename to <$txt>"); + }, $self->{name}, + "If you input no name or erase the current custom name, the custom name will be unset"); + } + ], ["apply", sub { $::CONN->send ("apply $self->{tag}") }], ( $self->{flags} & F_LOCKED