diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2003-12-17 14:50:48 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2003-12-17 14:50:48 +0000 |
commit | d68b4c545f29860e17bbc7edf85160adf0b5cbc7 (patch) | |
tree | cfce5ae3040dc81c618b391874a864b919c9d539 | |
parent | 112cc994d7707f5259efd97930e3b5ed1f32ca8e (diff) | |
download | control-center-d68b4c545f29860e17bbc7edf85160adf0b5cbc7.tar control-center-d68b4c545f29860e17bbc7edf85160adf0b5cbc7.tar.gz control-center-d68b4c545f29860e17bbc7edf85160adf0b5cbc7.tar.bz2 control-center-d68b4c545f29860e17bbc7edf85160adf0b5cbc7.tar.xz control-center-d68b4c545f29860e17bbc7edf85160adf0b5cbc7.zip |
- factorize
- right part:
o let description be clickable as well as the icon
o let description be non selectable
-rwxr-xr-x | control-center | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/control-center b/control-center index 79c4ad7a..6444a3c9 100755 --- a/control-center +++ b/control-center @@ -575,6 +575,8 @@ my @colors = (gtkcolor(0, 0, 0), gtkcolor(0xAA, 0xAA, 0xFF), gtkcolor(0, 0, 0)) my $spacing = 25; my ($lspacing, $left_txt_offset, $icon_offset); +my $hand_cursor = sub { $_[0]->window->set_cursor($cursor_hand) }; + # Create left icons foreach (@tree) { my ($text, $icon, $subtree) = @$_; @@ -644,7 +646,7 @@ foreach (@tree) { $old_state[$my_index] = $curr_state; $darea_left->window->draw_drawable($darea_left->style->bg_gc('normal'), $dbl_area_left[$curr_state], $x, $y, $x, $y, $width, $height); }); - $darea_left->signal_connect(realize => sub { $darea_left->window->set_cursor($cursor_hand) }); + $darea_left->signal_connect(realize => $hand_cursor); $darea_left->signal_connect(enter_notify_event => sub { return if $old_state[$my_index] == -1 || $curr_state[$my_index] != 0; $curr_state[$my_index] = 1; @@ -666,7 +668,7 @@ foreach (@tree) { # deselect previously selected darea if ($index_sav != -1) { $curr_state[$index_sav] = 0; - $darea_left_list[$index_sav]->window->set_cursor($cursor_hand); + $hand_cursor->($darea_left_list[$index_sav]); $darea_left_list[$index_sav]->queue_draw; } else { $still_in_splash_screen = 0 } $index_sav = $my_index; @@ -688,19 +690,28 @@ foreach (@tree) { my ($label, $tag) = @$_; my $text = $exec_hash->{$label}[3]; die "$label 's icon is missing" if !$exec_hash->{$label} && $::testing; - my $event_box = gtkadd(Gtk2::EventBox->new, gtkcreate_img($tag)); + my $hbox_spacing = 10; + my $event_box = gtkadd(Gtk2::EventBox->new, + gtkpack_( + Gtk2::HBox->new(0, $hbox_spacing), + 0, gtkcreate_img($tag), + 1, gtktext_insert( + #- disable selecting text and popping the contextual menu + # (GUI team says it's *horrible* to be able to do select text!) + gtksignal_connect(my $tv = Gtk2::TextView->new, + button_press_event => sub { 1 }), + [ [ $text, {'background_set' => 0, + 'background_stipple_set' => 0 } ] ]) + ) + ); + $tv->set_events([ ]); $event_box->set_events([ 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]); # FIXME: do ->set_pixbuf() on {enter,leave}_events - $event_box->signal_connect(realize => sub { $event_box->window->set_cursor($cursor_hand) }); + $event_box->signal_connect(realize => $hand_cursor); $event_box->signal_connect(button_release_event => sub { compute_exec_string($tag, @{$exec_hash->{$label}}) }); # FIXME : resize sig: ->foreach; set_size_request - my $hbox_spacing = 10; - gtkset_size_request(gtkpack_(Gtk2::HBox->new(0, $hbox_spacing), - 0, $event_box, - 1, gtktext_insert(Gtk2::TextView->new, [ [ $text, {'background_set' => 0, 'background_stipple_set' => 0 } ] ]) - ), 50, -1 - ); + gtkset_size_request($event_box, 50, -1); } @subtree)); add2notebook($notebook_global, "", |