diff options
-rwxr-xr-x | control-center | 100 |
1 files changed, 40 insertions, 60 deletions
diff --git a/control-center b/control-center index 6634181a..b2251369 100755 --- a/control-center +++ b/control-center @@ -590,7 +590,7 @@ my %options = ( my $mdk_rel = common::mandrake_release(); -my ($notebook_global); +my ($steps, $view); my $release = mandrake_release_info(); @@ -661,8 +661,13 @@ sub get_path { join('', map { my $i = $_; $i =~ s/_//g; $i } @_) } $_ => $factory->get_widget("<main>" . get_path(@{$options{$_}})); } ('show_log', if_(0 && $isWiz, "wiz_expert")); +my @buttons; +my $offset = 15; +$view = Gtk2::WebKit::WebView->new; +# so that it exists when building steps: my $banner_notebook = Gtk2::Notebook->new; +build_list(); gtkadd($window_global, gtkpack_(Gtk2::VBox->new(0, 0), @@ -671,7 +676,16 @@ gtkadd($window_global, 0, Gtk2::HSeparator->new, # 0, gtkset_size_request(Gtk2::VBox->new(10, 10), -1, 2), 1, gtkpack_(Gtk2::HBox->new(0, 0), - 1, $notebook_global = gtkset_name(Gtk2::Notebook->new, 'mcc'), + 1, $steps = gtknew('MDV_Notebook', parent_window => $window_global, children => [ #Layout Fixed + # 145 is the vertical offset in order to be below the actual logo: + [ gtknew('VBox', spacing => 6, width => (192 - $offset), + children_tight => [ map { + gtknew('HBox', spacing => 0, children => [ + 1, $_, + 0, gtknew('Alignment', width => 12), + ]) + } @buttons ]), 0, 100 ], + ], right_child => $view), 1, gtkpack(my $emb_box = Gtk2::VBox->new(0, 0), my $wait_darea = gtkset_size_request(Gtk2::DrawingArea->new, -1, -1), ), @@ -689,25 +703,8 @@ gtkadd($window_global, ) ); -sub notebook_set_background { - my ($w) = @_; - return if !$w->realized; - my $color = $window_global->get_style->base('normal'); - Gtk2::Rc->parse_string(join('', qq(style "mcc" - -{ - bg[NORMAL] = { ), join(' ,', $color->red, $color->green, $color->blue), qq( } - bg_pixmap[NORMAL] = "<none>" -} - -widget "*mcc*" style "mcc" - -))); - $notebook_global->reset_rc_styles; -} +$view->set_size_request(-1, -1); -$notebook_global->signal_connect(realize => \¬ebook_set_background); -$window_global->signal_connect("style-set" => sub { notebook_set_background($notebook_global) }); $window_global->signal_connect(delete_event => \&quit_global); use POSIX qw(:sys_utsname_h :math_h :sys_wait_h :unistd_h); @@ -719,8 +716,6 @@ foreach my $notebook ($banner_notebook) { $notebook->set_property('show-border', 0); $notebook->set_property('show-tabs', 0); } -$notebook_global->set_property('tab-pos', 'left'); -$notebook_global->set_scrollable(1); # banner : @@ -781,7 +776,8 @@ foreach (@tree) { # Skip empty classes: next if !@subtrees; - my $_my_index = $index++; + + my $my_index = $index++; my $string = join("\n", qq(<HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> @@ -806,9 +802,7 @@ foreach (@tree) { </HEAD> <BODY> )); - my $view = Gtk2::WebKit::WebView->new; - $view->signal_connect('navigation-requested' => \&navigation_handler); # Create right notebook pages : @@ -864,28 +858,26 @@ foreach (@tree) { $string .= qq(</BODY></HTML>); - $view->load_html_string($string, '/'); $labels[$index-1]{text} = $text; $labels[$index-1]{help} = $help; - gtkappend_page($notebook_global, - my $_w_ret = create_scrolled_window(gtkset_border_width($view, 5), - [ 'never', 'automatic' ], # 'none', - ), - gtkpack__(Gtk2::HBox->new, - eval { Gtk2::Image->new_from_pixbuf(::scale(gtkcreate_pixbuf($icon), -16)) }, - $labels[$index-1]{widget} = Gtk2::WrappedLabel->new($text), - ), + push @buttons, gtknew('Button', relief => 'none', child => + gtknew('Label_Right', text_markup => $text, + ), + clicked => sub { + $view->load_html_string($string, '/'); + $steps->move_selection($_[0]->child->allocation->y); + $banner_notebook->set_current_page($my_index); + $help_on_context = $help; + }, ); - $labels[$index-1]{widget}->set_use_markup(1); -# $w_ret->vscrollbar->set_size_request(19, undef); add2notebook($banner_notebook, "", Gtk2::Banner->new($icon, $text)); } } -build_list(); -sub navigation_handler { +$view->signal_connect('navigation-requested' => + sub { my (undef, undef, $request) = @_; # get the actual program ID: @@ -898,7 +890,7 @@ sub navigation_handler { # should we provide a way to kill buggy embedded programs ? return if $left_locked; warn_on_startup(); - } + }); my %icons = ( ); @@ -960,20 +952,14 @@ $wait_darea->signal_connect(expose_event => sub { gtkflush(); -set_page_raw(0); - -my $old_index; -$notebook_global->signal_connect(switch_page => sub { - my ($notebook, $page, $new_index) = @_; - $help_on_context = $labels[$new_index]{help} || 'drakconf-intro'; - return if !$labels[$new_index]{widget}; - my $page = $notebook_global->get_current_page; - $labels[$old_index]{widget}->set_markup($labels[$old_index]{text}) if -1 < $old_index; - $labels[$new_index]{widget}->set_markup('<span weight="bold">' . $labels[$new_index]{text} . '</span>'); - $old_index = $new_index; -}); +# display first page (we use a timeout so that Y position of widgets is know): +Glib::Timeout->add(100, sub { $buttons[0]->signal_emit('clicked'); 0 }); $window_global->show_all; + +# hide default selection since its position is bogus: +$steps->hide_selection; + hide_buttons(); $emb_box->hide; $wait_darea->realize; @@ -1031,8 +1017,8 @@ sub child_just_exited() { hide_buttons(); $cancel->hide; gtkset_mousecursor_normal(); - foreach my $notebook ($notebook_global, $banner_notebook) { - $notebook->show; + foreach my $w ($steps, $banner_notebook) { + $w->show; } stop_wait_area(); @@ -1114,7 +1100,7 @@ sub run_tool { $exec .= " --summary" if $option_values{expert_wizard} && $exec =~ /drakwizard/; my $embedded = $gtkplug != -1; # not "explicitely not embedded" if ($embedded) { - $notebook_global->hide; + $steps->hide; create_hidden_socket($icon, $text); $emb_box->show; $emb_socket->realize; @@ -1365,12 +1351,6 @@ sub about_mdk_cc() { #------------------------------------------------------------- # mcc specific graphic functions: -sub set_page_raw { - my ($index) = @_; - foreach my $notebook ($notebook_global, $banner_notebook) { - $notebook->set_current_page($index); - } -} sub set_page { my ($index) = @_; |