summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2001-10-24 17:38:58 +0000
committerdamien <damien@mandriva.com>2001-10-24 17:38:58 +0000
commitfb9a0d895f90481021a5f9a0bafacbb3af0c7eea (patch)
tree8c1d7b825666e788d957e02123edb432a7dd6ca8
parentc51dc962fe42d9d740eabf3aca43fb518f3f7430 (diff)
downloaddrakx-fb9a0d895f90481021a5f9a0bafacbb3af0c7eea.tar
drakx-fb9a0d895f90481021a5f9a0bafacbb3af0c7eea.tar.gz
drakx-fb9a0d895f90481021a5f9a0bafacbb3af0c7eea.tar.bz2
drakx-fb9a0d895f90481021a5f9a0bafacbb3af0c7eea.tar.xz
drakx-fb9a0d895f90481021a5f9a0bafacbb3af0c7eea.zip
updated, lot of bugs.
-rwxr-xr-xperl-install/standalone/drakfont160
1 files changed, 95 insertions, 65 deletions
diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont
index d63fc73d2..3d5324b97 100755
--- a/perl-install/standalone/drakfont
+++ b/perl-install/standalone/drakfont
@@ -149,7 +149,7 @@ my $pbar1;
my $pbar2;
my $pbar3;
my $font_box;
-my $table;
+my $central_widget;
sub list_fontpath {
foreach (grep { /\d+:\s/ } `$chkfontpath -l`) {
@@ -182,12 +182,17 @@ sub search_windows_font {
my $nb_dir = @list_fonts_win + @list_fonts_winnt;
if(!@list_fonts_win && !@list_fonts_winnt) {
print "drakfont:: could not find any font in $win_dir/win*/fonts \n";
+ $interactive and display_error(_("could not find any font in %s/win*/fonts", $win_dir));
return 0;
}
foreach $_ ([\@list_fonts_win, "windows"], [\@list_fonts_winnt, "winnt"]) {
foreach my $i (@{$_->[0]}) {
- $interactive && $nb_dir and progress($pbar, 100/$nb_dir);
-# $interactive && !$nb_dir and sub { $table->destroy(); gtkpack($font_box, _("no fonts found")) }; #fixme msg
+ if($interactive) {
+ if($nb_dir) { progress($pbar, 100/$nb_dir) } else {
+ display_error(_("no fonts found"));
+ return 0;
+ }
+ }
!$replace && grep(/$i/, @installed_fonts) and next;
grep ( /$i$/, @font_list) or push @font_list, "$win_dir/$_->[1]/fonts/$i";
}
@@ -353,7 +358,7 @@ sub remove_fonts {
-e "/usr/share/ghostscript" and rm_rf("$drakfont_dir/remove");
}
-sub lisence_msg {
+sub license_msg {
print _("Before installing any fonts, be sure that you have the right to use and install them on your system.\n\n-You can install the fonts using the normal way. In rare cases, bogus fonts may hang up your X Server.\n-You can install the fonts with strong verification. In this case, bogus fonts won't be installed, but some useable fonts won't be too.\n\nIf you have many fonts, or exotic fonts, I recommend strong verification mode.")."\n";
}
@@ -364,7 +369,7 @@ sub backend_mod {
system ("xlsfonts");
}
if ($windows) {
- lisence_msg();
+ license_msg();
print "........Windows fonts Installation........\n\n";
search_installed_fonts();
if(search_windows_font()) {
@@ -375,7 +380,7 @@ sub backend_mod {
}
if (@install) {
- lisence_msg();
+ license_msg();
print ".......Install Specifics Fonts...........\n\n";
search_installed_fonts();
search_dir_font $_ foreach (@install);
@@ -386,7 +391,7 @@ sub backend_mod {
}
if (@uninstall) {
- lisence_msg();
+ license_msg();
print "........Uninstall Specifics Fonts........\n\n";
search_installed_fonts_full_path();
search_dir_font_uninstall $_ foreach (@uninstall);
@@ -404,53 +409,68 @@ my $check1;
my $check2;
my $check3;
+sub create_fontsel {
+ my $font_sel;
+ gtkpack($font_box,
+ $font_sel = new Gtk::FontSelection,
+ );
+ $central_widget = \$font_sel;
+}
+
+sub display_error {
+ my $message = @_;
+ ${$central_widget}->destroy();
+ gtkpack($font_box, $message);
+}
+
sub interactive_mode {
-$interactive = 1;
-
-init Gtk;
-
-
-my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
-$window1->signal_connect (delete_event => sub { Gtk->exit(0) });
-$window1->set_position(1);
-$window1->set_title(_("Fonts Importation"));
-$window1->set_border_width(5);
-
-my $font_sel;
-gtkadd($window1,
- gtkpack_(new Gtk::HBox(0,2),
- 1, gtkpack_(new Gtk::VBox(0,0),
- 1, new Gtk::VBox(0,0),
- 0, gtkpack($font_box = new Gtk::VBox(0,5),
- $font_sel = new Gtk::FontSelection,
- ),
- 1, new Gtk::VBox(0,0)
- ),
- 0, gtkpack_(new Gtk::VBox(0,5),
- 0, _("DrakFont"),
- 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Windows Importation")), clicked =>
- sub { gtkdestroy($font_sel); $windows = 1; backend_mod(); lisence(); }),
- gtksignal_connect(new Gtk::Button(_("Advanced Importation")), clicked =>
- sub { }),
- gtksignal_connect(new Gtk::Button(_("Uninstall Fonts")), clicked => sub { Gtk->main_quit() }),
- ),
- 1, new Gtk::VBox(0,0),
- 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- gtksignal_connect(new Gtk::Button(_("Help")), clicked => sub { print _("Help\n") }),
- gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { Gtk->main_quit() }),
- ),
- )
- ),
- );
-$window1->show_all;
-$window1->realize;
-$window1->show_all();
-#}
-# import_status();
-#main_gi;
-Gtk->main;
-Gtk->exit(0);
+ my $font_sel;
+ $interactive = 1;
+
+ init Gtk;
+
+
+ my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
+ $window1->signal_connect (delete_event => sub { Gtk->exit(0) });
+ $window1->set_position(1);
+ $window1->set_title(_("Fonts Importation"));
+ $window1->set_border_width(5);
+
+ gtkadd($window1,
+ gtkpack_(new Gtk::HBox(0,2),
+ 1, gtkpack_(new Gtk::VBox(0,0),
+ 1, new Gtk::VBox(0,0),
+ 1, gtkpack($font_box = new Gtk::VBox(0,5),
+ $font_sel = new Gtk::FontSelection,
+ ),
+ 1, new Gtk::VBox(0,0)
+ ),
+ 0, gtkpack_(new Gtk::VBox(0,5),
+ 0, _("DrakFont"),
+ 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
+ gtksignal_connect(new Gtk::Button(_("Windows Importation")), clicked =>
+ sub { gtkdestroy($central_widget); $windows = 1; license() }),
+ gtksignal_connect(new Gtk::Button(_("Advanced Importation")), clicked =>
+ sub { }),
+ gtksignal_connect(new Gtk::Button(_("Uninstall Fonts")), clicked => sub { Gtk->main_quit() }),
+ ),
+ 1, new Gtk::VBox(0,0),
+ 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
+ gtksignal_connect(new Gtk::Button(_("Help")), clicked => sub { print _("Help\n") }),
+ gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { Gtk->main_quit() }),
+ ),
+ )
+ ),
+ );
+ $central_widget = $font_sel;
+ $window1->show_all;
+ $window1->realize;
+ $window1->show_all();
+ #}
+ # import_status();
+ #main_gi;
+ Gtk->main;
+ Gtk->exit(0);
}
@@ -458,16 +478,24 @@ my $text;
my $vscrollbar;
-sub lisence {
- gtkpack($font_box,
- $text = new Gtk::Text( undef, undef ),
- $text->set_editable( 0 ),
- $text->show(),
- $vscrollbar = new Gtk::VScrollbar( $text->vadj ),
- $vscrollbar->show(),
- $text->insert( undef, $text->style->black, undef, "Before installing any fonts, be sure that you have the right to use and install them on your system.\n\n-You can install the fonts using the normal way. In rare cases, bogus fonts may hang up your X Server.\n-You can install the fonts with strong verification. In this case, bogus fonts won't be installed, but some useable fonts won't be too.\n\nIf you have many fonts, or exotic fonts, I recommend strong verification mode. " ),
- );
+# $vscrollbar = new Gtk::VScrollbar( $text->vadj ),
+sub license {
+ my $text = new Gtk::Text(undef, undef);
+ my $license_box;
+ gtkpack($font_box,
+ $license_box = gtkpack_(new Gtk::VBox(0,0),
+ 1, gtkpack_(new Gtk::HBox(0,0),
+ 1, gtktext_insert(gtkset_editable($text, 1), "Before installing any fonts, be sure that you have the right to use and install them on your system.\n\n-You can install the fonts using the normal way. In rare cases, bogus fonts may hang up your X Server.\n-You can install the fonts with strong verification. In this case, bogus fonts won't be installed, but some useable fonts won't be too.\n\nIf you have many fonts, or exotic fonts, I recommend strong verification mode."),
+ 0, new Gtk::VScrollbar($text->vadj),
+ ),
+ 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -end),
+ gtksignal_connect(new Gtk::Button(_("OK")), clicked => sub { ${$central_widget}->destroy(); import_status() }),
+ gtksignal_connect(new Gtk::Button(_("Cancel")), clicked => sub { ${$central_widget}->destroy(); create_fontsel() }),
+ ),
+ )
+ );
+ $central_widget = \$license_box;
$font_box->show_all();
}
@@ -496,20 +524,22 @@ sub import_status {
my $adj1 = new Gtk::Adjustment( 0, 1, 100, 0, 0, 0 );
my $adj2 = new Gtk::Adjustment( 0, 1, 100, 0, 0, 0 );
my $adj3 = new Gtk::Adjustment( 0, 1, 100, 0, 0, 0 );
+ my $table;
gtkpack($font_box,
$table = create_packtable({ col_spacings => 30, row_spacings => 20},
- [_("Search Fonts on your System"), $pbar = new_with_adjustment Gtk::ProgressBar($adj), gtkset_sensitive($check1 = new Gtk::CheckButton(), 0)],
+ if_($windows, [_("Search Fonts on your System"), $pbar = new_with_adjustment Gtk::ProgressBar($adj), gtkset_sensitive($check1 = new Gtk::CheckButton(), 0)]),
["Supress Doublons ", $pbar1 = new_with_adjustment Gtk::ProgressBar($adj1), gtkset_sensitive($check2 = new Gtk::CheckButton(), 0)],
["Install Fonts ", $pbar2 = new_with_adjustment Gtk::ProgressBar($adj2), gtkset_sensitive($check3 = new Gtk::CheckButton(), 0)],
["Post Install Fonts ", $pbar3 = new_with_adjustment Gtk::ProgressBar($adj3), gtkset_sensitive($check4 = new Gtk::CheckButton(), 0)],
),
);
- $font_box->show_all();
+ $central_widget = \$table;
+# $font_box->show_all();
# my $timer = Gtk->timeout_add( 5, \&progress_timeout );
# my $timer1 = Gtk->timeout_add( 10, \&progress_timeout1 );
# my $timer2 = Gtk->timeout_add( 15, \&progress_timeout2 );
# my $timer3 = Gtk->timeout_add( 20, \&progress_timeout3 );
- my $timer4 = Gtk->timeout_add( 5000, sub { $table->destroy(); gtkpack($font_box, "c fini") });
+ backend_mod();
}
sub progress {