summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorAurélien Lefebvre <alefebvre@mandriva.com>2009-09-08 14:50:06 +0000
committerAurélien Lefebvre <alefebvre@mandriva.com>2009-09-08 14:50:06 +0000
commita60497f7b9ee606074f157dd071d86cbdea1ba97 (patch)
treef5514758a216d3c135ed5695973c240543915912 /perl-install
parent4f9fdea0d8456f93ecdc3ff76b9706996c80324a (diff)
downloaddrakx-a60497f7b9ee606074f157dd071d86cbdea1ba97.tar
drakx-a60497f7b9ee606074f157dd071d86cbdea1ba97.tar.gz
drakx-a60497f7b9ee606074f157dd071d86cbdea1ba97.tar.bz2
drakx-a60497f7b9ee606074f157dd071d86cbdea1ba97.tar.xz
drakx-a60497f7b9ee606074f157dd071d86cbdea1ba97.zip
- mygtk2:
o created 'WeaknessCheckEntry' widget - adduserdrake: o now use 'WeaknessCheckEntry' widget
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS3
-rw-r--r--perl-install/install/NEWS3
-rw-r--r--perl-install/interactive/gtk.pm41
-rw-r--r--perl-install/mygtk2.pm41
4 files changed, 54 insertions, 34 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 50ac914d7..d51139a63 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,5 +1,8 @@
+- mygtk2:
+ o created 'WeaknessCheckEntry' widget
- adduserdrake:
o added tooltip text to weakness icon
+ o now use 'WeaknessCheckEntry' widget
Version 12.48 - 7 September 2009
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index b5f0b0812..b5d5ec82c 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,5 +1,8 @@
+- mygtk2:
+ o created 'WeaknessCheckEntry' widget
- adduserdrake:
o added tooltip text to weakness icon
+ o now use 'WeaknessCheckEntry' widget
Version 12.48 - 7 September 2009
diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm
index ecdccad69..a4f13a4b7 100644
--- a/perl-install/interactive/gtk.pm
+++ b/perl-install/interactive/gtk.pm
@@ -549,16 +549,13 @@ sub create_widget {
}
};
} else {
- $w = Gtk2::Entry->new;
- $w->signal_connect(changed => $onchange->(sub {
- if ($e->{weakness_check}) {
- require authentication;
- my $password_weakness = authentication::compute_password_weakness($w->get_text);
- $w->set_icon_from_pixbuf('GTK_ENTRY_ICON_SECONDARY', get_weakness_icon($password_weakness));
- $w->set_icon_tooltip_text('GTK_ENTRY_ICON_SECONDARY', get_weakness_tooltip($password_weakness));
- }
- $w->get_text;
- }));
+ if ($e->{weakness_check}) {
+ $w = gtknew('WeaknessCheckEntry');
+ }
+ else {
+ $w = Gtk2::Entry->new;
+ }
+ $w->signal_connect(changed => $onchange->(sub { $w->get_text }));
$w->signal_connect(focus_in_event => sub { $w->select_region(0, -1) });
$w->signal_connect(focus_out_event => sub { $w->select_region(0, 0) });
$set = sub { $w->set_text($_[0]) if $_[0] ne $w->get_text };
@@ -971,28 +968,4 @@ sub kill {
@tempory::objects = ();
}
-sub get_weakness_icon {
- my ($password_weakness) = @_;
- my %weakness_icon = (
- 1 => gtknew('Pixbuf', file => 'security-low'),
- 2 => gtknew('Pixbuf', file => 'security-low'),
- 3 => gtknew('Pixbuf', file => 'security-medium'),
- 4 => gtknew('Pixbuf', file => 'security-strong'),
- 5 => gtknew('Pixbuf', file => 'security-strong'));
- my $weakness_icon = $weakness_icon{$password_weakness} || return undef;
- $weakness_icon;
-}
-
-sub get_weakness_tooltip {
- my ($password_weakness) = @_;
- my %weakness_tooltip = (
- 1 => N("Password is trivial to guess"),
- 2 => N("Password is trivial to guess"),
- 3 => N("Password should resist to basic attacks"),
- 4 => N("Password seems secure"),
- 5 => N("Password seems secure"));
- my $weakness_tooltip = $weakness_tooltip{$password_weakness} || return undef;
- return $weakness_tooltip;
-}
-
1;
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm
index 93026fa48..419861ae0 100644
--- a/perl-install/mygtk2.pm
+++ b/perl-install/mygtk2.pm
@@ -550,6 +550,23 @@ sub _gtk__Entry {
$w;
}
+sub _gtk__WeaknessCheckEntry {
+ my ($w, $opts) = @_;
+
+ if (!$w) {
+ $w = _gtk__Entry($w, $opts);
+ }
+
+ $w->signal_connect('changed' => sub {
+ require authentication;
+ my $password_weakness = authentication::compute_password_weakness($w->get_text);
+ $w->set_icon_from_pixbuf('GTK_ENTRY_ICON_SECONDARY', _get_weakness_icon($password_weakness));
+ $w->set_icon_tooltip_text('GTK_ENTRY_ICON_SECONDARY', _get_weakness_tooltip($password_weakness));
+ });
+
+ $w;
+}
+
sub _gtk__TextView {
my ($w, $opts, $_class, $action) = @_;
@@ -1503,6 +1520,30 @@ sub text_direction_rtl() {
Gtk2::Widget->get_default_direction() eq 'rtl';
}
+sub _get_weakness_icon {
+ my ($password_weakness) = @_;
+ my %weakness_icon = (
+ 1 => gtknew('Pixbuf', file => 'security-low'),
+ 2 => gtknew('Pixbuf', file => 'security-low'),
+ 3 => gtknew('Pixbuf', file => 'security-medium'),
+ 4 => gtknew('Pixbuf', file => 'security-strong'),
+ 5 => gtknew('Pixbuf', file => 'security-strong'));
+ my $weakness_icon = $weakness_icon{$password_weakness} || return undef;
+ $weakness_icon;
+}
+
+sub _get_weakness_tooltip {
+ my ($password_weakness) = @_;
+ my %weakness_tooltip = (
+ 1 => N("Password is trivial to guess"),
+ 2 => N("Password is trivial to guess"),
+ 3 => N("Password should resist to basic attacks"),
+ 4 => N("Password seems secure"),
+ 5 => N("Password seems secure"));
+ my $weakness_tooltip = $weakness_tooltip{$password_weakness} || return undef;
+ return $weakness_tooltip;
+}
+
package Gtk2::MDV_Notebook; # helper functions for installer & mcc
our @ISA = qw(Gtk2::Widget);