summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-02-13 07:26:59 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-02-13 07:26:59 +0000
commit4ab9d5aa1ccb5fe62e3e8e586fee39a211eba9f7 (patch)
treebf53241015a6f430712817733fc11f15d45ef050
parent3d2901cbc908e1275f023b336b6e58b9f54753f2 (diff)
downloadcontrol-center-4ab9d5aa1ccb5fe62e3e8e586fee39a211eba9f7.tar
control-center-4ab9d5aa1ccb5fe62e3e8e586fee39a211eba9f7.tar.gz
control-center-4ab9d5aa1ccb5fe62e3e8e586fee39a211eba9f7.tar.bz2
control-center-4ab9d5aa1ccb5fe62e3e8e586fee39a211eba9f7.tar.xz
control-center-4ab9d5aa1ccb5fe62e3e8e586fee39a211eba9f7.zip
- fix non embedded rxvt (# 1346)
- less white space at top in right part - fix infamous "mcc can be enlarged but icons never shrink back" - add the introduction text - simplify summary page structure - paint log explanation frame backround in white too, aka enforce the mcc style - (launch_xapp::find_windows): o reduce its overhead by doing simple fork+exec rather than full shell forks o make it more usuable on fast system by not eating cpu power in kernel::schedule(), thus letting rxvt embedding a lot faster
-rwxr-xr-xcontrol-center91
1 files changed, 54 insertions, 37 deletions
diff --git a/control-center b/control-center
index b35c26b1..1c6ff2a2 100755
--- a/control-center
+++ b/control-center
@@ -338,10 +338,9 @@ gtkadd($window_global,
realize => sub { set_back_pixbuf($_[0], gtkcreate_pixbuf('mcc-left-back-middle')) }),
0, gtkcreate_img('mcc-left-back-bottom')
),
- 1, gtkpack_(my $right_box = Gtk2::VBox->new(0, 0),
- 0, gtksignal_connect(gtkset_size_request(Gtk2::DrawingArea->new(), -1, 46),
- realize => sub { set_back_pixbuf($_[0], gtkcreate_pixbuf('mcc-right-top')) }),
-
+ 1, gtkpack_(Gtk2::VBox->new(0, 0),
+ 0, gtksignal_connect(gtkset_size_request(Gtk2::DrawingArea->new(), -1, 1),
+ realize => sub { set_back_pixbuf($_[0], gtkcreate_pixbuf('mcc-right-bottom')) }),
1, gtkpack_(my $emb_box = Gtk2::VBox->new(0, 0),
1, my $emb_wait = gtkpack_(Gtk2::VBox->new(0, 0),
1, Gtk2::HBox->new(0, 0),
@@ -360,7 +359,7 @@ gtkadd($window_global,
)
),
1, my $notebook_global = gtkset_name(Gtk2::Notebook->new, 'mcc'),
- 0, gtkadd(gtkset_shadow_type(gtkset_size_request(gtkset_border_width($exp_frame = Gtk2::Frame->new(N("Logs")), 5), 0, 120), 'etched_in')),
+ 0, gtkset_name(my $w_exp = create_scrolled_window(gtkset_shadow_type(gtkset_size_request(gtkset_border_width($exp_frame = Gtk2::Frame->new(N("Logs")), 5), -1, 120), 'etched_in'), undef, 'none'), 'mcc'),
0, gtksignal_connect(gtkset_size_request(Gtk2::DrawingArea->new(), -1, 1),
realize => sub { set_back_pixbuf($_[0], gtkcreate_pixbuf('mcc-right-bottom')) }),
@@ -370,6 +369,8 @@ gtkadd($window_global,
)
);
+$w_exp->set_policy('never', 'never');
+
$window_global->signal_connect(delete_event => \&quit_global);
$window_global->set_title(N("Mandrake Control Center %s", $version));
$window_global->set_position('center');
@@ -385,29 +386,31 @@ my $pixbuf_icon = gtkcreate_pixbuf('mcc-title-icon');
# main page (summary) :
my $summary = create_scrolled_window(
- gtkpack_(Gtk2::VBox->new(0, 0),
- 1, gtkpack_(Gtk2::VBox->new(0, 0),
- 1, gtkpack_(Gtk2::HBox->new(0, 0),
- 1, Gtk2::VBox->new(0, 0),
- 0, gtkmodify_font(Gtk2::Label->new(N("Welcome to the Mandrake Control Center")),
- Gtk2::Pango::FontDescription->from_string('15')),
- 1, Gtk2::VBox->new(0, 0),
- ),
- 1, Gtk2::HBox->new(0, 0),
- ),
- 0, gtkpack_(Gtk2::HBox->new(0, 0),
- 1, Gtk2::VBox->new(0, 0),
- 0, gtkcreate_img('mcc-welcome-logo')
- )
- ),
- , undef, 'none');
+ gtkpack_(Gtk2::VBox->new(0, 0),
+ 1, gtkset_size_request(
+ gtkset_border_width(
+ gtktext_insert(Gtk2::TextView->new, [
+ [ N("Welcome to the Mandrake Control Center\n\n"),
+ {'size-points' => 15, justification => 'center', 'weight-set' => 1, weight => 1000} ],
+ [ formatAlaTeX(N("Mandrake Control Center is Mandrake Linux's main configuration
+tool. It enables the system administrator to configure the hardware
+and services used for all users.
+
+
+The tools accessed through the Mandrake Control Center greatly
+simplify the use of the system, notably by avoiding the use of the
+evil command line.")) ]
+ ]),
+ 50),
+ 50, 50),
+ 0, gtkpack_(Gtk2::HBox->new(0, 0),
+ 1, Gtk2::VBox->new(0, 0),
+ 0, gtkcreate_img('mcc-welcome-logo')
+ )
+ ),
+ undef, 'none');
-my $str = "Mandrake Control Center is Mandrake Linux's main configuration
-tool. It enables the system administrator to configure the hardware
-and services used for all users. The tools accessed through the
-Mandrake Control Center greatly simplify the use of the system,
-notably by avoiding the use of the evil command line.";
$notebook_global->append_page($summary);
@@ -542,16 +545,18 @@ foreach (@tree) {
# FIXME : resize sig: ->foreach; set_size_request
my $hbox_spacing = 10;
- gtkpack_(Gtk2::HBox->new(0, $hbox_spacing),
- 0, $event_box,
- 1, gtktext_insert(Gtk2::TextView->new, [ [ $text, {'background_set' => 0, 'background_stipple_set' => 0 } ] ])
- );
+ 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
+ );
} @$subtree));
-# my $w = gtkadd(Gtk2::Viewport->new, $tbl);
-# my $vscrollbar = new Gtk2::VScrollbar(Gtk2::Adjustment->new);
-
- $notebook_global->append_page(my $w_ret = create_scrolled_window($tbl, undef, 'none'));
+ $notebook_global->append_page(
+ my $w_ret = create_scrolled_window(gtkset_border_width($tbl, 5),
+ [ 'never', 'automatic' ], 'none'
+ )
+ );
# $w_ret->vscrollbar->set_size_request(19, undef);
}
@@ -630,6 +635,7 @@ sub clean_socket {
sub create_hidden_socket_if_needed {
hide_socket_and_clean(); # clean_socket();
gtkpack($emb_box, $emb_socket = Gtk2::Socket->new) unless $emb_socket;
+ $emb_box->set_focus_child($emb_socket);
$emb_socket->hide;
$emb_wait->hide;
}
@@ -719,14 +725,17 @@ sub compute_exec_string {
$left_locked = 1;
fork_($exec);
} else { # gtkplug == 0
+ $emb_box->grab_focus;
+ $emb_socket->grab_focus;
$emb_socket->show;
$exec_->[0] = $exec;
$SIG{CHLD} = undef;
$emb_socket->steal(launch_xapp(@$exec_));
+ $emb_socket->grab_focus;
$SIG{CHLD} = \&sig_child;
}
} else { # not embedded
- fork_($gtkplug == 0 ? $exec->[0] : $alternate || $exec);
+ fork_($gtkplug == 0 ? $exec_->[0] : $alternate || $exec);
}
#FIXME
# if ($embedded && $gtkplug != -1) {
@@ -752,11 +761,19 @@ sub compute_exec_string {
sub launch_xapp {
my ($exec, $name, $xx) = @_;
- my $find_windows = sub { split '\n', `xwininfo -root -tree -int | grep '$name'` };
+ my $find_windows = sub {
+ local *X;
+ open(X, "-|", "xwininfo -root -tree -int");
+ grep { /$name/ } <X>;
+ };
my @before = &$find_windows();
fork_("$exec; kill -USR1 $$");
my @after = &$find_windows();
- @after = &$find_windows() while @after ne $xx + @before;
+ require Time::HiRes;
+ while (@after ne $xx + @before) {
+ Time::HiRes::usleep(50);
+ @after = &$find_windows()
+ }
my $c = top(difference2(\@after, \@before));
$c =~ /\s*([0-9]*)\s*/;
return $1;