summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/draksec
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-07-18 12:46:10 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-07-18 12:46:10 +0000
commitde4be8479d33276e6ba3d0eb952ac24f5d9badb1 (patch)
tree2611f574471ced15c13093b9ba65d1f9a70e3e6b /perl-install/standalone/draksec
parent46070411593741ca25832398f93688c78521a537 (diff)
downloaddrakx-de4be8479d33276e6ba3d0eb952ac24f5d9badb1.tar
drakx-de4be8479d33276e6ba3d0eb952ac24f5d9badb1.tar.gz
drakx-de4be8479d33276e6ba3d0eb952ac24f5d9badb1.tar.bz2
drakx-de4be8479d33276e6ba3d0eb952ac24f5d9badb1.tar.xz
drakx-de4be8479d33276e6ba3d0eb952ac24f5d9badb1.zip
fix preferences loading & saving
Diffstat (limited to 'perl-install/standalone/draksec')
-rwxr-xr-xperl-install/standalone/draksec8
1 files changed, 4 insertions, 4 deletions
diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec
index e05e6552a..81b42fd93 100755
--- a/perl-install/standalone/draksec
+++ b/perl-install/standalone/draksec
@@ -84,7 +84,7 @@ sub new_nonedit_combo {
sub new_wrapped_label {
my ($label) = @_;
- my $w = Gtk2::Label->new($label);
+ my $w = gtkset_justify(Gtk2::Label->new($label), 'left');
$w->set_line_wrap(1);
$w;
}
@@ -106,7 +106,7 @@ my %inv_translations = map { translate($_) => $_ } N_("ALL"), N_("LOCAL"), N_("N
my %translations = reverse %inv_translations;
sub to_i18n { map { $translations{$_} || $_ } @_ }
-sub from_i18n { $inv_translations{$_->[0]} }
+sub from_i18n { $inv_translations{$_[0]} || $_[0] }
############################ MAIN WINDOW ###################################
# Set different options to Gtk2::Window
@@ -177,7 +177,7 @@ foreach ([ 'network', N("Network Options") ], [ 'system', N("System Options") ])
$values{$i} = new Gtk2::Entry();
$entry = $values{$i};
}
- $entry->set_text($msec->get_function_value($i));
+ $entry->set_text(to_i18n($msec->get_function_value($i)));
set_help_tip($entry, $default, $i);
[ new_wrapped_label($fields{$i} || $i), $values{$i} ];
} sort $msec->list_functions($domain))))),
@@ -237,7 +237,7 @@ my $bok = gtksignal_connect(Gtk2::Button->new_from_stock('gtk-ok'),
log::explanations("Setting msec functions related to $domain");
foreach my $key (keys %{$options_values{$domain}}) {
my $opt = $options_values{$domain}{$key};
- $msec->set_function($key, from_i18n($opt =~ /Combo/ ? $opt->entry->get_text : $opt->get_text));
+ $msec->set_function($key, from_i18n($opt->get_text));
}
}
$msec->apply_functions;
ass="hl kwd">/-o (.+)/; $file ||= "themes-mdk.rc"; $file2 ||= $file; my $window1 = new Gtk2::Window -toplevel; $window1->signal_connect ( delete_event => sub { Gtk2->exit(0); }); $window1->set_title(N("Theme editor")); $window1->set_border_width(5); gtkadd($window1, my $vb = new Gtk2::VBox(0,5)); $window1->show_all; $window1->realize; my $f; my $vb2; my $hb; my $style; my $ref = 0; my %color; my $cpt = 0; my $do_style; foreach (cat_($file)) { chomp; if(/style "(.*)"/) { $style = $1; print " -- $style \n"; $do_style = 1; } if(/(\w+)\[(\w+)\]\s*=\s*\{\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*\}/) { my ($a1, $a2) = ($1, $2); my $style2 = $style; if ($do_style) { $cpt == 0 and gtkpack__($vb, $hb = new Gtk2::HBox(0,5)); $cpt++; $cpt == 4 and $cpt = 0; gtkpack__($hb, gtkadd(gtkset_shadow_type($f = new Gtk2::Frame(" $style "), 'etched_out'), $vb2 = gtkset_border_width(new Gtk2::VBox(0,5),5) ) ); $do_style = 0; } my $c =ugtk2::gtkcolor($3*65535, $4*65535, $5*65535); $color{$style}{$1}{$2} = $c; my $gc = new Gtk2::Gdk::GC($window1->window); $gc->set_foreground($c); gtkpack__($vb2, gtkpack_(new Gtk2::HBox(0,0), 1, gtkpack__(new Gtk2::HBox(0,0),"$1 [$2] : "), 0, gtksignal_connect(gtkset_relief(my $b = new Gtk2::Button(), 'none'), clicked => sub { $c = change_color($c); $gc->set_foreground($c); $color{$style2}{$a1}{$a2} = $c; $_[0]->queue_draw; }) ) ); $b->add(gtksignal_connect(gtksize(gtkset_size_request(new Gtk2::DrawingArea(), 60, 20), 60, 20), expose_event => sub{ $_[0]->window->draw_rectangle ($gc, 1, 0, 0, 60, 20)} )); } /\{/ and $ref++; if (/\}/) { $ref--; $ref == 0 and undef $style } } gtkpack__($vb, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'end'), gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub { doit(); Gtk2->main_quit() }), gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { Gtk2->main_quit() }), ) ); $window1->set_position('center'); $window1->show_all; Gtk2->main; Gtk2->exit(0); sub doit { system("rm -f /tmp/plop"); foreach (cat_($file)) { my $output; chomp; if(/style "(.*)"/) { $style = $1; $do_style = 1; } if(/(\w+)\[(\w+)\]\s*=\s*\{\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*\}/) { # print " - $_ - \n" foreach ($1, $2, $3, $4, $5); my ($a1, $a2) = ($1, $2); my $c = $color{$style}{$1}{$2}; $output = $1 . "[" . $2 . "] = { " . round($c->red()/65535*100)/100 . ", " . round($c->green()/65535*100)/100 . ", " . round($c->blue()/65535*100)/100 . " }"; } /\{/ and $ref++; if (/\}/) { $ref--; $ref == 0 and undef $style } $output ||= $_; $output =~ s/ 1 / 1.0 /; $output =~ s/ 1, / 1.0, /; $output =~ s/ 1, / 1.0, /; system("echo '$output' >> /tmp/plop"); } system("mv -f /tmp/plop $file2"); } sub change_color { my ($color) = @_; my $window = new Gtk2::Window -toplevel; my $doit; $window->signal_connect ( delete_event => sub { Gtk2->main_quit() }); $window->set_position('center'); $window->set_title(N("Color configuration")); $window->set_border_width(5); gtkadd(gtkset_modal($window,1), gtkpack_(new Gtk2::VBox(0,5), 1, my $colorsel = new Gtk2::ColorSelection, 0, gtkadd(gtkset_layout(new Gtk2::HButtonBox, 'end'), gtksignal_connect(new Gtk2::Button(N("OK")), clicked => sub { $doit=1; Gtk2->main_quit() }), gtksignal_connect(new Gtk2::Button(N("Cancel")), clicked => sub { Gtk2->main_quit() }), ) ) ); $colorsel->set_current_color($color); $window->show_all(); Gtk2->main; $window->destroy(); $doit or return $color; my (@color) = $colorsel->get_current_color(); ugtk2::gtkcolor($color[0]*65535, $color[1]*65535, $color[2]*65535); }