… | |
… | |
203 | |
203 | |
204 | sub numentry { |
204 | sub numentry { |
205 | my ($ref, $width, $cb) = @_; |
205 | my ($ref, $width, $cb) = @_; |
206 | |
206 | |
207 | my $widget = new Gtk2::Entry; |
207 | my $widget = new Gtk2::Entry; |
208 | $widget->set (text => $$ref, width_chars => $width); |
208 | $widget->set (text => $$ref, width_chars => $width, xalign => 1); |
209 | eval { $widget->set (xalign => 1) }; # workaround für 2.2 |
|
|
210 | $widget->signal_connect (changed => sub { |
209 | $widget->signal_connect (changed => sub { |
211 | $$ref = $_[0]->get_text; |
210 | $$ref = $_[0]->get_text; |
212 | $cb->($$ref) if $cb; |
211 | $cb->($$ref) if $cb; |
213 | }); |
212 | }); |
214 | |
213 | |
… | |
… | |
217 | |
216 | |
218 | sub timeentry { |
217 | sub timeentry { |
219 | my ($ref, $width, $cb) = @_; |
218 | my ($ref, $width, $cb) = @_; |
220 | |
219 | |
221 | my $widget = new Gtk2::Entry; |
220 | my $widget = new Gtk2::Entry; |
222 | $widget->set (text => util::format_time $$ref, width_chars => $width); |
221 | $widget->set (text => util::format_time $$ref, width_chars => $width, xalign => 1); |
223 | eval { $widget->set (xalign => 1) }; # workaround für 2.2 |
|
|
224 | $widget->signal_connect (changed => sub { |
222 | $widget->signal_connect (changed => sub { |
225 | $$ref = util::parse_time $_[0]->get_text; |
223 | $$ref = util::parse_time $_[0]->get_text; |
226 | $cb->($$ref) if $cb; |
224 | $cb->($$ref) if $cb; |
227 | }); |
225 | }); |
228 | |
226 | |