diff options
-rwxr-xr-x | perl-install/standalone/drakbackup | 207 |
1 files changed, 115 insertions, 92 deletions
diff --git a/perl-install/standalone/drakbackup b/perl-install/standalone/drakbackup index f13bf6517..bc138027c 100755 --- a/perl-install/standalone/drakbackup +++ b/perl-install/standalone/drakbackup @@ -77,6 +77,7 @@ my $option_replace = 0; my $option_update = 0; my $windows = 0; my $central_widget; +my $central_widget_save; my $interactive; my $up_box; my $box; @@ -111,78 +112,6 @@ sub debug { } -my @xpm_data = ( "16 16 4 1", - " c None s None", - ". c black", - "X c #808080", - "o c white", - " ", - " .. ", - " .Xo. ... ", - " .Xoo. ..oo. ", - " .Xooo.Xooo... ", - " .Xooo.oooo.X. ", - " .Xooo.Xooo.X. ", - " .Xooo.oooo.X. ", - " .Xooo.Xooo.X. ", - " .Xooo.oooo.X. ", - " .Xoo.Xoo..X. ", - " .Xo.o..ooX. ", - " .X..XXXXX. ", - " ..X....... ", - " .. ", - " "); - -my @book_open_xpm = ( -"16 16 4 1", -" c None s None", -". c black", -"X c #808080", -"o c white", -" ", -" .. ", -" .Xo. ... ", -" .Xoo. ..oo. ", -" .Xooo.Xooo... ", -" .Xooo.oooo.X. ", -" .Xooo.Xooo.X. ", -" .Xooo.oooo.X. ", -" .Xooo.Xooo.X. ", -" .Xooo.oooo.X. ", -" .Xoo.Xoo..X. ", -" .Xo.o..ooX. ", -" .X..XXXXX. ", -" ..X....... ", -" .. ", -" "); - -my @book_closed_xpm = ( -"16 16 6 1", -" c None s None", -". c black", -"X c red", -"o c yellow", -"O c #808080", -"# c white", -" ", -" .. ", -" ..XX. ", -" ..XXXXX. ", -" ..XXXXXXXX. ", -".ooXXXXXXXXX. ", -"..ooXXXXXXXXX. ", -".X.ooXXXXXXXXX. ", -".XX.ooXXXXXX.. ", -" .XX.ooXXX..#O ", -" .XX.oo..##OO. ", -" .XX..##OO.. ", -" .X.#OO.. ", -" ..O.. ", -" .. ", -" "); - - - sub read_conf_file { foreach (cat_("$cfg_file")) { @@ -247,7 +176,7 @@ sub interactive_mode { my $style; my $box; init Gtk; - + my $text2 = new Gtk::Text(undef, undef); my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel; $window1->signal_connect (delete_event => sub { Gtk->exit(0) }); $window1->set_position(1); @@ -256,16 +185,24 @@ sub interactive_mode { my ($pix_u_map, $pix_u_mask) = gtkcreate_png("pixmaps/backup_title.png"); my ($pix_l_map, $pix_l_mask) = gtkcreate_png("pixmaps/backup_left.png"); my ($pix_r_map, $pix_r_mask) = gtkcreate_png("pixmaps/backup_bot.png"); + my ($pix_hd_map, $pix_hd_mask) = gtkcreate_png("pixmaps/backup_hd.png"); my $box2 = new Gtk::VBox( 0, 10 ); + my $label3 = gtkpack(new Gtk::HBox(0,10), + new Gtk::Pixmap($pix_hd_map, $pix_hd_mask), + _("Backup Wizard") + ); + my $radio1 = new Gtk::RadioButton( "Backup Wizard"); $box2->add( $radio1); $radio1->set_active(1); my $radio2 = new Gtk::RadioButton( "Backup Advanced", $radio1); $box2->add( $radio2); - my $radio3 = new Gtk::RadioButton( "Build Backup now", $radio1); + my $radio3 = new Gtk::RadioButton( "Build Backup now", $radio2); $box2->add( $radio3); + my $radio4 = new Gtk::RadioButton( "Restore Backup", $radio3); + $box2->add( $radio4); gtksignal_connect( $radio1, clicked => sub { $backup_choice = 0 }); gtksignal_connect( $radio2, clicked => sub { $backup_choice = 1 }); gtksignal_connect( $radio3, clicked => sub { $backup_choice = 2 }); @@ -277,17 +214,18 @@ sub interactive_mode { gtkpack_(new Gtk::HBox(0,0), 0, new Gtk::Pixmap($pix_l_map, $pix_l_mask), 1, gtkpack($up_box = new Gtk::VBox(0,5), - $box = gtkpack(new Gtk::VBox(0,0), - _("Please choose the method to configure your system backup."), - gtkpack(new Gtk::HBox(0,20), + $box = gtkpack_(new Gtk::VBox(0,0), + 0, _("Please choose the method to configure your system backup."), + 1, gtkpack(new Gtk::HBox(0,20), gtkpack(new Gtk::VBox(0,10), new Gtk::HBox(0,15), $box2, new Gtk::HBox(0,5), ), - ), - _("Drakbackup allow you to build a backup of your system. With Drakbackup \n you will be able to save your backups on your Hard-disk or on CD, across the network\n with mandrake-online or other place, it accept ftp, sftp, scp, rsync, nfs. "), - gtkadd(gtkset_layout(new Gtk::HButtonBox, -end), + ), + 1, gtkadd(gtkset_layout(new Gtk::HButtonBox, -end), + gtksignal_connect(new Gtk::Button(_("Help")), clicked => sub { + ${$central_widget}->destroy(); help() }), gtksignal_connect(new Gtk::Button(_("Next")), clicked => sub { ${$central_widget}->destroy(); $backup_choice == 0 and print "Wizard\n"; @@ -301,9 +239,9 @@ sub interactive_mode { new Gtk::Pixmap($pix_r_map, $pix_r_mask), gtkadd(gtkset_layout(new Gtk::HButtonBox, -end), gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { Gtk->main_quit() }), - gtksignal_connect(new Gtk::Button(_("About")), clicked => sub { + gtksignal_connect(new Gtk::Button(_("About")), clicked => sub { $central_widget_save = $central_widget; ${$central_widget}->destroy(); about() }), - gtksignal_connect(new Gtk::Button(_(" Help ")), clicked => sub { + gtksignal_connect(new Gtk::Button(_(" Help ")), clicked => sub { ${$central_widget}->destroy(); help() }), ), ), @@ -318,6 +256,15 @@ sub interactive_mode { Gtk->exit(0); } + +sub retore_window { + my $restore_box; + gtkpack($up_box, + $restore_box = $central_widget_save, + ); + $up_box->show_all(); +} + sub about { my $text = new Gtk::Text(undef, undef); my $about_box; @@ -346,7 +293,7 @@ sub about { ), 0, gtkadd(gtkset_layout(new Gtk::HButtonBox, -spread), gtksignal_connect(new Gtk::Button(_("OK")), clicked => - sub { ${$central_widget}->destroy(); }), + sub { ${$central_widget}->destroy(); retore_window }), ), ) ); @@ -425,6 +372,10 @@ sub wizard { sub advanced { my $notebook; + my $notebook_what; + my $notebook_when; + my $notebook_where; + my $notebook_options; my $about_box; my $book_open; my $book_open_mask; @@ -438,34 +389,95 @@ sub advanced { my ($pix_net_map, $pix_net_mask) = gtkcreate_png("pixmaps/backup_net.png"); my ($pix_hd_map, $pix_hd_mask) = gtkcreate_png("pixmaps/backup_hd.png"); my ($pix_time_map, $pix_time_mask) = gtkcreate_png("pixmaps/backup_time.png"); - ($book_open, $book_open_mask) = Gtk::Gdk::Pixmap->create_from_xpm_d($up_box->window, $transparent, @book_open_xpm); - ($book_closed, $book_closed_mask) = Gtk::Gdk::Pixmap->create_from_xpm_d($up_box->window, $transparent, @book_closed_xpm); + my ($pix_user_map, $pix_user_mask) = gtkcreate_png("../pixmaps/user.png"); + my ($pix_sys_map, $pix_sys_mask) = gtkcreate_png("../pixmaps/bootloader.png"); + my ($pix_other_map, $pix_other_mask) = gtkcreate_png("../pixmaps/net_u.png"); + my ($pix_options_map, $pix_options_mask) = gtkcreate_png("pixmaps/backup_options.png"); - my $label1 = gtkpack(new Gtk::HBox(0,10), +# ($book_open, $book_open_mask) = Gtk::Gdk::Pixmap->create_from_xpm_d($up_box->window, $transparent, @book_open_xpm); +# ($book_closed, $book_closed_mask) = Gtk::Gdk::Pixmap->create_from_xpm_d($up_box->window, $transparent, @book_closed_xpm); + + my $label_what = gtkpack(new Gtk::VBox(0,10), new Gtk::Pixmap($pix_hd_map, $pix_hd_mask), _("What backup.") ); - my $label2 = gtkpack(new Gtk::HBox(0,10), + my $label_where = gtkpack(new Gtk::VBox(0,10), new Gtk::Pixmap($pix_net_map, $pix_net_mask), _("Where backup.") ); - my $label3 = gtkpack(new Gtk::HBox(0,10), + my $label_when = gtkpack(new Gtk::VBox(0,10), new Gtk::Pixmap($pix_time_map, $pix_time_mask), _("When backup.") ); + + my $label_options = gtkpack(new Gtk::VBox(0,10), + new Gtk::Pixmap($pix_options_map, $pix_options_mask), + _("Options") + ); + + my $label_what_sys = gtkpack(new Gtk::HBox(0,10), + new Gtk::Pixmap($pix_sys_map, $pix_sys_mask), + _("System ") + ); + my $label_what_user = gtkpack(new Gtk::HBox(0,10), + new Gtk::Pixmap($pix_user_map, $pix_user_mask), + _("Users ") + ); + + my $label_what_other = gtkpack(new Gtk::HBox(0,10), + new Gtk::Pixmap($pix_other_map, $pix_other_mask), + _("Other ") + ); + + + + my $box_what_sys = gtkpack(new Gtk::VBox(0,1), + new Gtk::Pixmap($pix_time_map, $pix_time_mask), + _("When backup.") + ); + + my $box_what_user = gtkpack(new Gtk::VBox(0,1), + new Gtk::Pixmap($pix_time_map, $pix_time_mask), + _("When backup.") + ); + + my $box_what = gtkpack(new Gtk::VBox(0,1), + $notebook_what = new Gtk::Notebook, + $notebook_what->insert_page( $box_what_sys, $label_what_sys, 0 ), + $notebook_what->insert_page( $box_what_user, $label_what_user, 1 ), + $notebook_what->insert_page( $box_what_user, $label_what_other, 1 ), + $notebook_what->set_scrollable( 1), + ); + + my $box_where = gtkpack(new Gtk::VBox(0,1), + $notebook_where = new Gtk::Notebook, + $notebook_where->insert_page( _("toto") , "titi", 0 ), + ); + my $box_when = gtkpack(new Gtk::VBox(0,1), + $notebook_when = new Gtk::Notebook, + $notebook_when->insert_page( _("toto") , "titi", 0 ), + ); + my $box_options = gtkpack(new Gtk::VBox(0,1), + $notebook_options = new Gtk::Notebook, + $notebook_options->insert_page( _("toto") , "titi", 0 ), + ); + + gtkpack($up_box, $about_box = gtkpack_(new Gtk::VBox(0,10), 1, gtkpack(new Gtk::HBox(0,0), gtkpack(my $notebook_box = new Gtk::VBox(0,5), $notebook = new Gtk::Notebook, - $notebook->insert_page( $checkbutton, $label1, 2 ), - $notebook->insert_page( $checkbutton, $label2, 2 ), - $notebook->insert_page( $checkbutton, $label3, 2 ) + $notebook->insert_page( $box_what, $label_what, 0), + $notebook->insert_page( $box_where, $label_where, 1), + $notebook->insert_page( $box_when, $label_when, 2), + $notebook->insert_page( $box_options, $label_options, 3), + $notebook->set_scrollable( 1 ) ), ), 0, gtkadd(new Gtk::HButtonBox, gtksignal_connect(new Gtk::Button(_("Previous")), clicked => sub { Gtk->main_quit() }), - gtksignal_connect(new Gtk::Button(_("Next")), clicked => sub { + gtksignal_connect(new Gtk::Button(_("Save and Next")), clicked => sub { ${$central_widget}->destroy(); $backup_choice == 0 and print "Wizard\n"; $backup_choice == 1 and advanced(); @@ -474,6 +486,16 @@ sub advanced { ), ), ), + + my %rotate = ( + top => "right", + right => "bottom", + bottom => "left", + left => "top" + ); + + $notebook->set_tab_pos( $rotate{ $notebook->tab_pos } ); + $central_widget = \$about_box; $up_box->show_all(); } @@ -487,6 +509,7 @@ sub advanced { +# 0, gtktext_insert(gtkset_editable($text2, 0), _("Drakbackup allow you to build a backup of your system. With Drakbackup you will be able to save your backups on your Hard-disk or on CD, across the network with mandrake-online or other place, it accept ftp, sftp, scp, rsync, nfs. "), |