… | |
… | |
82 | $table->attach_defaults (Gtk2::Label->new ($desc), 0, 1, $idx, $idx + 1); |
82 | $table->attach_defaults (Gtk2::Label->new ($desc), 0, 1, $idx, $idx + 1); |
83 | $table->attach_defaults (my $chk = Gtk2::CheckButton->new, 1, 2, $idx, $idx + 1); |
83 | $table->attach_defaults (my $chk = Gtk2::CheckButton->new, 1, 2, $idx, $idx + 1); |
84 | $chk->set_active ($self->{edit_hash}{$key}); |
84 | $chk->set_active ($self->{edit_hash}{$key}); |
85 | $chk->signal_connect (toggled => sub { |
85 | $chk->signal_connect (toggled => sub { |
86 | my ($lbl) = @_; |
86 | my ($lbl) = @_; |
87 | $self->{edit_hash}{$key} = $lbl->get_active * 1; |
87 | $self->{edit_hash}{$key} = $lbl->get_active ? 1 : undef; |
88 | }); |
88 | }); |
89 | |
89 | |
90 | } elsif ($type eq 'sep') { |
90 | } elsif ($type eq 'sep') { |
91 | $table->attach_defaults (Gtk2::HSeparator->new, 0, 2, $idx, $idx + 1); |
91 | $table->attach_defaults (Gtk2::HSeparator->new, 0, 2, $idx, $idx + 1); |
92 | |
92 | |
… | |
… | |
103 | if ($self->{save_cb}) { |
103 | if ($self->{save_cb}) { |
104 | $self->{save_cb}->($self->{edit_hash}); |
104 | $self->{save_cb}->($self->{edit_hash}); |
105 | } |
105 | } |
106 | |
106 | |
107 | for (@{$self->{hash_keys}}) { |
107 | for (@{$self->{hash_keys}}) { |
|
|
108 | if ((defined $self->{edit_hash}->{$_}) && $self->{edit_hash}->{$_} ne "") { |
108 | $self->{ref_hash}->{$_} = $self->{edit_hash}->{$_}; |
109 | $self->{ref_hash}->{$_} = $self->{edit_hash}->{$_} |
|
|
110 | } else { |
|
|
111 | delete $self->{ref_hash}->{$_}; |
|
|
112 | } |
109 | } |
113 | } |
110 | } |
114 | } |
111 | |
115 | |
112 | sub reset { |
116 | sub reset { |
113 | my ($self) = @_; |
117 | my ($self) = @_; |
… | |
… | |
164 | |
168 | |
165 | $self->build_table; |
169 | $self->build_table; |
166 | |
170 | |
167 | $save_btn->signal_connect (clicked => sub { |
171 | $save_btn->signal_connect (clicked => sub { |
168 | $self->save; |
172 | $self->save; |
|
|
173 | $self->destroy if $self->{close_on_save}; |
169 | }); |
174 | }); |
170 | |
175 | |
171 | $reset_btn->signal_connect (clicked => sub { |
176 | $reset_btn->signal_connect (clicked => sub { |
172 | $self->reset; |
177 | $self->reset; |
173 | $self->build_table; |
178 | $self->build_table; |