diff options
-rw-r--r-- | ChangeLog | 54 | ||||
-rwxr-xr-x | control-center | 1309 | ||||
-rw-r--r-- | control-center.rc | 436 | ||||
-rw-r--r-- | drakconf.spec | 51 |
4 files changed, 1198 insertions, 652 deletions
@@ -1,3 +1,57 @@ +2002-12-15 19:39 alus + + * po/pl.po: updates and bugfixes + +2002-12-15 17:04 pablo + + * po/: pt_BR.po, sv.po: updated po files + +2002-12-13 10:42 pablo + + * po/ms.po: updated po file + +2002-12-11 12:08 pablo + + * po/ro.po: updated po file + +2002-12-02 15:50 pablo + + * po/sk.po: updated po file + +2002-12-02 05:45 pablo + + * po/: fi.po, vi.po: updated po files + +2002-11-29 13:42 pablo + + * po/pt.po: updated po file + +2002-11-28 20:29 pablo + + * po/: et.po, zh_CN.po: updated po files + +2002-11-28 13:46 pablo + + * po/: af.po, ar.po, az.po, be.po, bg.po, br.po, bs.po, ca.po, + cs.po, cy.po, da.po, de.po, drakconf.pot, el.po, eo.po, es.po, + et.po, eu.po, fi.po, fr.po, ga.po, gl.po, hr.po, hu.po, id.po, + it.po, ja.po, ka.po, ko.po, lt.po, lv.po, ms.po, mt.po, nl.po, + no.po, pl.po, pt.po, pt_BR.po, ro.po, ru.po, sk.po, sl.po, sp.po, + sq.po, sr.po, sv.po, ta.po, tg.po, th.po, tr.po, uk.po, vi.po, + wa.po, zh_CN.po, zh_TW.po: updated po files + +2002-11-27 10:52 tvignaud + + * drakconf.spec: typo fixes + +2002-11-27 10:38 tvignaud + + * cest_ton_boot, relcontrolcenter: [no log message] + +2002-11-27 10:36 tvignaud + + * ChangeLog: [no log message] + 2002-11-27 10:34 tvignaud * drakconf.spec: 9.1-0.3mdk diff --git a/control-center b/control-center index 65f70828..d950bff2 100755 --- a/control-center +++ b/control-center @@ -2,8 +2,10 @@ # $Id$ # Copyright (C) 1999-2002 MandrakeSoft +# Daouda Lo <daouda@mandrakesoft.com> # Damien Krotkine -# Thierry Vignaud (tvignaud@mandrakesoft.com) +# Thierry Vignaud <tvignaud@mandrakesoft.com> +# Yves Duret # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software @@ -18,521 +20,586 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -my $_xbindir = "/usr/X11R6/bin"; -my $_bindir = "/usr/bin"; -my $_sbindir = "/usr/sbin"; -my $mcc_dir = "/usr/share/mcc"; +my $xbindir = "/usr/X11R6/bin"; +my $bindir = "/usr/bin"; +my $sbindir = "/usr/sbin"; +my $mcc_dir = "/usr/share/mcc"; my $themes_dir = "$mcc_dir/themes/"; -my $_wizdir = "/usr/share/wizards"; +my $wizdir = "/usr/share/wizards"; +use strict; +use diagnostics; use lib qw(/usr/lib/libDrakX); use standalone; use common; use interactive; use detect_devices; -use ugtk qw(:helpers :wrappers :various); -use my_gtk qw(:helpers :wrappers :various); -use strict; +use ugtk2 qw(:create :helpers :wrappers); -#--- -# i18n : -# IMPORTANT to get correct namespace (drakconf instead of libDrakX) -#--- +#------------------------------------------------------------- +# i18n : IMPORTANT to get correct namespace (drakconf instead of libDrakX) push @::textdomains, 'drakconf'; -# set the locale, needed for proper fontset and charset selection -#Gtk->set_locale; -use Config; -use POSIX qw(uname); +my ($version, $conffile, $class_install) = ("9.1", "/etc/mcc.conf", "/etc/sysconfig/system"); my $in = 'interactive'->vnew('su', 'default'); # just to get root capabilities -my ($_version, $conffile, $class_install) = ("9.1", "/etc/mcc.conf","/etc/sysconfig/system"); - -#we'll show log only once and don't restart it with new embedded process -my $show_log = 1; -my $still_in_splash_screen = 1; +#------------------------------------------------------------- +# read configuration, set themes, ... my %h = getVarsFromSh($conffile); my %class = getVarsFromSh($class_install); $h{THEME} ||= 'default'; $h{EMBEDDED} ||= bool2text(1); $h{LOGS} ||= bool2text($class{CLASS} eq 'expert' ? 1 : 0); -my ($embedded, $logs) = (text2bool($h{EMBEDDED}), text2bool($h{LOGS})); +my ($embedded, $show_logs, $expert_wizard) = (text2bool($h{EMBEDDED}), text2bool($h{LOGS}), text2bool($h{EXPERT_WIZARD})); my $theme = $h{THEME}; if ("@ARGV" =~ /--theme (\w+)/) { $theme = $1 } -d "$themes_dir/$theme" or $theme = 'default'; -add_icon_path("$themes_dir/$theme"); -my $window_splash = new Gtk::Window -popup; +add_icon_path("$themes_dir/$theme/"); +add_icon_path("$themes_dir/default") if $theme ne 'default'; # fall back if theme miss some icons + +my $rc = "$themes_dir/$theme/gtkrc"; +Gtk2::Rc->parse($rc) if -r $rc; + +#------------------------------------------------------------- +# Splash window: please wait ... +my $window_splash = Gtk2::Window->new('popup'); $window_splash->signal_connect(delete_event => \&quit_global); -$window_splash->set_title(N("Mandrake Control Center")); -$window_splash->set_policy(0, 0, 1); -$window_splash->set_position(1); -$window_splash->add(gtkadd(gtkset_shadow_type(new Gtk::Frame(), 'etched_out'), new Gtk::Label(N("Loading... Please wait")))); +$window_splash->set_title(N("Mandrake Control Center") . $version); +$window_splash->allow_shrink(0); +$window_splash->allow_grow(0); +$window_splash->set_position('center_always'); +$window_splash->add(gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'etched_out'), + gtkpack(Gtk2::VBox->new(0, 0), + if_(-r "$themes_dir/$theme/splash_screen.png", gtkcreate_img("splash_screen")), + Gtk2::Label->new(N("Loading... Please wait")) + ) + ) + ); $window_splash->show_all; -gtkflush; -my $timer_splash = Gtk->timeout_add(200, \>kflush); +gtkflush(); -my $rc = "$mcc_dir/$theme/gtkrc"; --r $rc and Gtk::Rc->parse($rc); -my ($log_check_box, $embedded_check_box, $timeout); +#------------------------------------------------------------- +# we'll show log only once and don't restart it with new embedded process +my $freeze_log = 1; +my $still_in_splash_screen = 1; + +#------------------------------------------------------------- +# Data structures $::isWiz = -e "/usr/sbin/drakwizard"; $::isRpmDrake = -e "/usr/sbin/rpmdrake"; -# { key => [log_exp, binary, gtkplug?, alternate] } -my $exec_hash = - { - N("Boot Disk") => [ "drakfloppy", "$_sbindir/drakfloppy", 1], - N("Boot Config") => [ "drakboot", "$_sbindir/drakboot", 1 ], - N("Auto Install") => [ "drakautoinst", "$_sbindir/drakautoinst", 1 ], - N("Monitor") => [ "XFdrake", "$_sbindir/XFdrake monitor", 1 ], - N("Resolution") => [ "XFdrake", "$_sbindir/XFdrake resolution", 1 ], - N("Graphical server configuration") => [ "XFdrake", "$_sbindir/XFdrake", 1 ], - N("Hardware List") => [ "harddrake", "$_sbindir/harddrake2", 1 ], - N("Mouse") => [ "mousedrake", "$_sbindir/mousedrake", 1 ], - N("Printer") => [ "printerdrake", "$_sbindir/printerdrake", 1, "$_sbindir/printerdrake" ], - N("Scanner") => [ "scannerdrake", "$_sbindir/scannerdrake", 1 ], - N("Users") => [ "userdrake", "$_bindir/userdrake", 1 ], - N("Keyboard") => [ "keyboarddrake", "$_sbindir/keyboarddrake", 1 ], - N("Hard Drives") => [ "diskdrake", "$_sbindir/diskdrake --hd", 1 ], - N("NFS mount points") => [ "diskdrake", "$_sbindir/diskdrake --nfs", 1 ], - N("Samba mount points") => [ "diskdrake", "$_sbindir/diskdrake --smb", 1 ], - N("WebDAV mount points") => [ "diskdrake", "$_sbindir/diskdrake --dav", 1 ], - N("Partition Sharing") => [ "diskdrake", "$_sbindir/diskdrake --fileshare", 1 ], - N("Connection") => [ "drakconnect", "$_sbindir/drakconnect", 1 ], - N("Connection Sharing") => [ "drakgw", "$_sbindir/drakgw", 1 ], - N("Proxy Configuration") => [ "drakproxy", "$_sbindir/drakproxy", 1 ], - N("Security Level") => [ "draksec", "$_sbindir/draksec", 1 ], - N("Security Permissions") => [ "drakperm", "$_sbindir/drakperm", 1 ], - N("Programs scheduling") => [ "drakcronat", "/usr/X11R6/bin/drakcronat", 1 ], - N("Firewall") => [ "drakfirewall", "$_sbindir/drakfirewall", 1 ], - N("Backups") => [ "drakbackup", "$_sbindir/drakbackup", 1 ], - N("Menus") => [ "menudrake", "$_sbindir/menus_launcher.pl", 1, "$_bindir/menudrake" ], - N("Services") => [ "drakxservices", "$_sbindir/drakxservices", 1 ], - N("Fonts") => [ "drakfont", "$_sbindir/drakfont", 1 ], - N("Date & Time") => [ "clock", "$_sbindir/clock.pl", 1 ], - N("Logs") => [ "logdrake", "$_sbindir/logdrake", 1 ], - # little workaround to avoid drakconf freeze - N("Console") => [ "rxvt", "", 0, ["$_xbindir/rxvt", "rxvt", 1] ], -# N("Console") => [ "rxvt", "$_xbindir/rxvt", -1 ], - N("Install Software") => [ "rpmdrake", "$_sbindir/rpmdrake", -1 ], - N("Remove Software") => [ "rpmdrake", "$_sbindir/rpmdrake-remove", -1 ], - N("Mandrake Update") => [ "rpmdrake", "$_sbindir/MandrakeUpdate", -1 ], - N("Software Sources Manager") => [ "rpmdrake", "$_sbindir/edit-urpm-sources.pl", -1 ], - - - N("TV Cards") => [ "drakxtv", "$_sbindir/drakxtv", 1 ], - - N("DNS Client") => ["Client wizard", "drakwizard $_wizdir/client_wizard/client.wiz", -1 ], - N("DHCP") => ["DHCP wizard", "drakwizard $_wizdir/dhcp_wizard/dhcp.wiz", -1 ], - N("DNS") => ["DNS wizard", "drakwizard $_wizdir/dns_wizard/dns.wiz", -1 ], - N("FTP") => ["FTP wizard", "drakwizard $_wizdir/ftp_wizard/ftp.wiz", -1 ], - N("News") => ["News wizard", "drakwizard $_wizdir/news_wizard/news.wiz", -1 ], - N("Postfix") => ["Postfix wizard", "drakwizard $_wizdir/postfix_wizard/postfix.wiz", -1 ], - N("Proxy") => ["Squid wizard", "drakwizard $_wizdir/proxy_wizard/proxy.wiz", -1 ], - N("Samba") => ["Samba wizard", "drakwizard $_wizdir/samba_wizard/samba.wiz", -1 ], - N("Time") => ["Time wizard", "drakwizard $_wizdir/time_wizard/time.wiz", -1 ], - N("Web") => ["Web wizard", "drakwizard $_wizdir/web_wizard/web.wiz", -1 ], - }; +# { key => [ log_exp, binary, gtkplug?, description ] } +# { key => [ log_exp, [ binary, win_nb ], gtkplug?, description ] } +my $exec_hash = +{ + "Auto Install" => [ "drakautoinst", "$sbindir/drakautoinst", 1, N("Auto Install: dummy description") ], + "Backups" => [ "drakbackup", "$sbindir/drakbackup", 1, N("Backups: dummy description") ], + "Boot Config" => [ "drakboot", "$sbindir/drakboot", 1, N("Boot Config: dummy description") ], + "Boot Disk" => [ "drakfloppy", "$sbindir/drakfloppy", 1, N("Boot Disk: dummy description") ], + "Connection Sharing" => [ "drakgw", "$sbindir/drakgw", 1, N("Connection Sharing: dummy description") ], + "Connection" => [ "drakconnect", "$sbindir/drakconnect", 1, N("Connection: dummy description") ], + # little workaround to avoid drakconf freeze +# "Console" => [ "rxvt", "$xbindir/rxvt", -1, N("dummy description") ], + "Console" => [ "rxvt", [ "$xbindir/rxvt", "rxvt", 1 ], 0, N("Console: dummy description") ], + "Date & Time" => [ "clock", "$sbindir/clock.pl", 1, N("Date & Time: dummy description") ], + "Firewall" => [ "drakfirewall", "$sbindir/drakfirewall", 1, N("Firewall: dummy description") ], + "Fonts" => [ "drakfont", "$sbindir/drakfont", 1, N("Fonts: dummy description") ], + "Graphical server configuration" => [ "XFdrake", "$sbindir/XFdrake", 1, N("Graphical server configuration: dummy description") ], + "Hard Drives" => [ "diskdrake", "$sbindir/diskdrake --hd", 1, N("Hard Drives: dummy description") ], + "Hardware List" => [ "harddrake", "$sbindir/harddrake2", 1, N("Hardware List: dummy description") ], + "Install Software" => [ "rpmdrake", "$sbindir/rpmdrake", -1, N("Install Software: dummy description") ], + "Keyboard" => [ "keyboarddrake", "$sbindir/keyboarddrake", 1, N("Keyboard: dummy description") ], + "Logs" => [ "logdrake", "$sbindir/logdrake", 1, N("Logs: dummy description") ], + "Mandrake Update" => [ "rpmdrake", "$sbindir/MandrakeUpdate", -1, N("Mandrake Update: dummy description") ], + "Menus" => [ "menudrake", "$sbindir/menus_launcher.pl", 1, N("Menus: dummy description"), "$bindir/menudrake" ], + "Monitor" => [ "XFdrake", "$sbindir/XFdrake monitor", 1, N("Monitor: dummy description") ], + "Mouse" => [ "mousedrake", "$sbindir/mousedrake", 1, N("Mouse: dummy description") ], + "NFS mount points" => [ "diskdrake", "$sbindir/diskdrake --nfs", 1, N("NFS mount points: dummy description") ], + "Partition Sharing" => [ "diskdrake", "$sbindir/diskdrake --fileshare", 1, N("Partition Sharing: dummy description") ], + "Printer" => [ "printerdrake", "$sbindir/printerdrake", 1, N("Printer: dummy description"), "$sbindir/printerdrake" ], + "Programs scheduling" => [ "drakcronat", "/usr/X11R6/bin/drakcronat", 1, N("Programs scheduling: dummy description") ], + "Proxy Configuration" => [ "drakproxy", "$sbindir/drakproxy", 1, N("Proxy Configuration: dummy description") ], + "Remove Software" => [ "rpmdrake", "$sbindir/rpmdrake-remove", -1, N("Remove Software: dummy description") ], + "Resolution" => [ "XFdrake", "$sbindir/XFdrake resolution", 1, N("Resolution: dummy description") ], + "Samba mount points" => [ "diskdrake", "$sbindir/diskdrake --smb", 1, N("Samba mount points: dummy description") ], + "Scanner" => [ "scannerdrake", "$sbindir/scannerdrake", 1, N("Scanner: dummy description") ], + "Security Level" => [ "draksec", "$sbindir/draksec", 1, N("Security Level: dummy description") ], + "Security Permissions" => [ "drakperm", "$sbindir/drakperm", 1, N("Security Permissions: dummy description") ], + "Services" => [ "drakxservices", "$sbindir/drakxservices", 1, N("Services: dummy description") ], + "Software Sources Manager" => [ "rpmdrake", "$sbindir/edit-urpm-sources.pl", -1, N("Software Sources Manager: dummy description") ], + "TV Cards" => [ "drakxtv", "$sbindir/drakxtv", 1, N("TV Cards: dummy description") ], + "Users" => [ "userdrake", "$bindir/userdrake", 1, N("Users: dummy description") ], + "WebDAV mount points" => [ "diskdrake", "$sbindir/diskdrake --dav", 1, N("WebDAV mount points: dummy description") ], + + "DHCP" => [ "DHCP wizard", "drakwizard $wizdir/dhcp_wizard/dhcp.wiz", -1, N("DHCP wizard: dummy description") ], + "DNS Client" => [ "Client wizard", "drakwizard $wizdir/client_wizard/client.wiz", -1, N("DNS Client wizard: dummy description") ], + "DNS" => [ "DNS wizard", "drakwizard $wizdir/dns_wizard/dns.wiz", -1, N("DNS wizard: dummy description") ], + "FTP" => [ "FTP wizard", "drakwizard $wizdir/ftp_wizard/ftp.wiz", -1, N("FTP wizard: dummy description") ], + "News" => [ "News wizard", "drakwizard $wizdir/news_wizard/news.wiz", -1, N("News wizard: dummy description") ], + "Postfix" => [ "Postfix wizard", "drakwizard $wizdir/postfix_wizard/postfix.wiz", -1, N("Postfix wizard: dummy description") ], + "Proxy" => [ "Squid wizard", "drakwizard $wizdir/proxy_wizard/proxy.wiz", -1, N("Proxy wizard: dummy description") ], + "Samba" => [ "Samba wizard", "drakwizard $wizdir/samba_wizard/samba.wiz", -1, N("Samba wizard: dummy description") ], + "Time" => [ "Time wizard", "drakwizard $wizdir/time_wizard/time.wiz", -1, N("Time wizard: dummy description") ], + "Web" => [ "Web wizard", "drakwizard $wizdir/web_wizard/web.wiz", -1, N("Web wizard: dummy description") ], +}; # { name => [ label, icon core ] } -my %wizard = ("client" => [ N("DNS Client"), 'server-mdk'], - "dhcp" => [ N("DHCP"), 'server-mdk'], - "dns" => [ N("DNS"), 'server-mdk'], - "ftp" => [ N("FTP"), 'ftp-mdk'], - "news" => [ N("News"), 'news-mdk'], - "postfix" => [ N("Postfix"), 'postfix-mdk'], - "proxy" => [ N("Proxy"), 'web-mdk'], - "samba" => [ N("Samba"), 'diskdrake_samba'], - "time" => [ N("Time"), 'time-mdk'], - "web" => [ N("Web"), 'web-mdk'], - ); - -# { class_name => [ -# [ label, icon core ] -# ] -# } +my %wizard = ("client" => [ N("DNS Client"), 'server-mdk' ], + "dhcp" => [ N("DHCP"), 'server-mdk' ], + "dns" => [ N("DNS"), 'server-mdk' ], + "ftp" => [ N("FTP"), 'ftp-mdk' ], + "news" => [ N("News"), 'news-mdk' ], + "postfix" => [ N("Postfix"), 'postfix-mdk' ], + "proxy" => [ N("Proxy"), 'web-mdk' ], + "samba" => [ N("Samba"), 'diskdrake_samba' ], + "time" => [ N("Time"), 'time-mdk' ], + "web" => [ N("Web"), 'web-mdk' ], + ); + +# [ [ class_label, class icon name, [ [ program_label, program icon name ] ... ] ] ] my @tree = - ([N("Boot"), 'boot-mdk', - [ - [N("Boot Disk"), 'drakfloppy-mdk'], - [N("Boot Config"),'drakboot-mdk'], - [N("Auto Install"), 'drakfloppy-mdk'], - ] - ], - [N("Hardware"), 'drakhard-mdk', - [ - [N("Hardware List"),'harddrake-mdk'], - [N("Monitor"),'XFdrake-mdk'], - [N("Resolution"),'resolution-mdk'], - [N("Graphical server configuration"),'XFdrake-mdk'], - [N("TV Cards"),'tv-mdk'], - [N("Keyboard"), 'keyboard-mdk'], - [N("Mouse"), 'mousedrake-mdk'], - [N("Printer"),'printer-mdk'], - [N("Scanner"),'scanner-mdk'], - ] - ], - [N("Mount Points"),'partition-mdk', - [ - [N("Hard Drives"), 'diskdrake_hd'], - (map { - my ($type, $name, $scan) = @$_; - map_index { - my $full_name = $name . ($::i ? $::i + 1 : ''); - $exec_hash->{$full_name} = [ "diskdrake", "$_sbindir/diskdrake --removable=$_->{device}", 1 ]; - [ $full_name, "diskdrake_$type" ]; - } $scan->(); - } do { - my %cdroms_by_type; - foreach (detect_devices::cdroms()) { - my $type = detect_devices::isBurner($_) ? 'burner' : detect_devices::isDvdDrive($_) ? 'DVD' : 'cdrom'; - push @{$cdroms_by_type{$type}}, $_; - } - ( - [ 'cdrom', N("CD-ROM"), sub { @{$cdroms_by_type{cdrom} || []} } ], - [ 'dvd', N("DVD"), sub { @{$cdroms_by_type{DVD} || []} } ], - [ 'cdwriter', N("CD Burner"), sub { @{$cdroms_by_type{burner} || []} } ], - [ 'floppy', N("Floppy"), \&detect_devices::floppies ], - [ 'zip', N("Zip"), \&detect_devices::zips ], - ), - }), - [N("NFS mount points"), 'diskdrake_nfs'], - [N("Samba mount points"), 'diskdrake_samba'], - [N("WebDAV mount points"), 'webdav-mdk'], - [N("Partition Sharing"), 'diskdrake_fileshare'], - ] - ], - [N("Network & Internet"),'net-mdk', - [ - [N("Connection"), 'drakconnect-mdk'], - [N("Proxy Configuration"),'drakconnect-mdk'], - [N("Connection Sharing"),'drakgw-mdk'], - ], - ], - [N("Security"),'security-mdk', - [ - [N("Security Level"), 'draksec-mdk'], - [N("Security Permissions"), 'drakperm-mdk'], - [N("Firewall"), 'firewall-mdk'], - ] - ], - [N("System"),'system-mdk', - [ - [N("Menus") , 'menudrake-mdk'], - [N("Services") , 'service-mdk'], - [N("Fonts"), 'drakfont-mdk'], - [N("Date & Time") , 'time-mdk'], - [N("Logs"), 'logdrake-mdk'], - [N("Console"), 'console-mdk'], - [N("Users"), 'user-mdk'], - [N("Programs scheduling"), 'time-mdk'], - [N("Backups"), 'backup-mdk'], -# [N("RFBDrake"), 'unknown-mdk'], - ] - ], - if_($::isRpmDrake, - [N("Software Management"),'software', - [ - [N("Install Software"), 'rpmdrake'], - [N("Remove Software"), 'rpmdrake-remove'], - [N("Mandrake Update"), 'MandrakeUpdate'], - [N("Software Sources Manager"), 'source-manager'], - ] - ]), - if_($::isWiz, - [N("Server Configuration"), 'wizard-mdk', - [ - (map { - if_(-e '/usr/share/wizards/'.$_.'_wizard/'.$_.'.wiz', $wizard{$_}) - } keys %wizard) - ] - ]), - ); + ([ N("Boot"), 'boot-mdk', + [ + [ "Boot Disk", 'drakfloppy-mdk', ], + [ "Boot Config", 'drakboot-mdk', ], + [ "Auto Install", 'drakfloppy-mdk', ], + ] + ], + [ N("Hardware"), 'drakhard-mdk', + [ + [ "Hardware List", 'harddrake-mdk', ], + [ "Monitor", 'XFdrake-mdk', ], + [ "Resolution", 'resolution-mdk', ], + [ "Graphical server configuration", 'XFdrake-mdk', ], + [ "TV Cards", 'tv-mdk', ], + [ "Keyboard", 'keyboard-mdk', ], + [ "Mouse", 'mousedrake-mdk', ], + [ "Printer", 'printer-mdk', ], + [ "Scanner", 'scanner-mdk', ], + ] + ], + [ N("Mount Points"), 'partition-mdk', + [ + [ "Hard Drives", 'diskdrake_hd', ], + (map { + my ($type, $name, $scan, $text) = @$_; + map_index { + my $full_name = $name . ($::i ? $::i + 1 : ''); + $exec_hash->{$full_name} = [ "diskdrake", "$sbindir/diskdrake --removable=$_->{device}", 1, $text ]; + [ $full_name, "diskdrake_$type" ]; + } $scan->(); + } do { + my %cdroms_by_type; + foreach (detect_devices::cdroms()) { + my $type = detect_devices::isBurner($_) ? 'burner' : detect_devices::isDvdDrive($_) ? 'DVD' : 'cdrom'; + push @{$cdroms_by_type{$type}}, $_; + } ([ 'cdrom', N("CD-ROM"), sub { @{$cdroms_by_type{cdrom} || []} }, N("") ], + [ 'dvd', N("DVD"), sub { @{$cdroms_by_type{DVD} || []} }, N("") ], + [ 'cdwriter', N("CD Burner"), sub { @{$cdroms_by_type{burner} || []} }, N("CD/DVD burner: dummy description") ], + [ 'floppy', N("Floppy"), \&detect_devices::floppies, N("") ], + [ 'zip', N("Zip"), \&detect_devices::zips, N("") ], + ), + }), + [ "NFS mount points", 'diskdrake_nfs', ], + [ "Samba mount points", 'diskdrake_samba', ], + [ "WebDAV mount points", 'webdav-mdk', ], + [ "Partition Sharing", 'diskdrake_fileshare', ], + ] + ], + [ N("Network & Internet"), 'net-mdk', + [ + [ "Connection", 'drakconnect-mdk', ], + [ "Proxy Configuration", 'drakconnect-mdk', ], + [ "Connection Sharing", 'drakgw-mdk', ], + ], + ], + [ N("Security"), 'security-mdk', + [ + [ "Security Level", 'draksec-mdk', ], + [ "Security Permissions", 'drakperm-mdk', ], + [ "Firewall", 'firewall-mdk', ], + ] + ], + [ N("System"), 'system-mdk', + [ + [ "Menus" , 'menudrake-mdk', ], + [ "Services" , 'service-mdk', ], + [ "Fonts", 'drakfont-mdk', ], + [ "Date & Time" , 'time-mdk', ], + [ "Logs", 'logdrake-mdk', ], + [ "Console", 'console-mdk', ], + [ "Users", 'user-mdk', ], + [ "Programs scheduling", 'time-mdk', ], + [ "Backups", 'backup-mdk', ], +# [ "RFBDrake", 'unknown-mdk' ], + ] + ], + if_($::isRpmDrake, + [ N("Software Management"), 'software', + [ + [ "Install Software", 'rpmdrake' ], + [ "Remove Software", 'rpmdrake-remove' ], + [ "Mandrake Update", 'MandrakeUpdate' ], + [ "Software Sources Manager", 'source-manager' ], + ] + ]), + if_($::isWiz, + [ N("Server Configuration"), 'wizard-mdk', + [ + (map { + if_(-e '/usr/share/wizards/'.$_.'_wizard/'.$_.'.wiz', $wizard{$_}) + } keys %wizard) + ] + ]), + ); #------------------------------------------------------------- +# let build the GUI + +# main window : + +my ($global_width, $global_height) = (720, 578); + +my ($timeout, $show_log_check_box, $embedded_check_box, $expert_wizard_check_box); + +my $window_global = gtkset_size_request(Gtk2::Window->new('toplevel'), $global_width, $global_height); +my $pending_app = 0; + +my ($menu, $factory) = create_factory_menu($window_global, + ({ path => N("/_File"), type => '<Branch>' }, + { path => N("/_File") . N("/_Quit"), accelerator => N("<control>Q"), callback => \&quit_global }, +#-PO Don't remember to translate "_Options" the same way "Options" is (but for the underscore of course) + { path => N("/_Options"), type => '<Branch>' }, + { path => N("/_Options") . N("/Display _Logs"), type => '<CheckItem>', + callback => sub { + $show_logs = $show_log_check_box->active; + update_exp(); + } + }, + { path => N("/_Options") . N("/_Embedded Mode"), type => '<ToggleItem>', + callback => sub { + $embedded = $embedded_check_box->active; + if ($embedded) { + $embedded = 0; + splash_warning(N("Embedding support is currently broken as of Gtk+-2.1.5.")); + } + } + }, + if_($::isWiz, + { path => N("/_Options") . N("/Expert mode in _wizards"), type => '<ToggleItem>', + callback => sub { $embedded = $expert_wizard_check_box->active } + }, + ), + + if_(all($themes_dir) > 1, + { path => N("/_Themes"), type => '<Branch>' }, + (map { + my $name = $_; + { path => N("/_Themes") . "/" . ($name eq $theme ? " O " : " ") . "_$_", + callback => sub { + return if $theme eq $name; + !$pending_app || splash_warning(N("This action will restart the control center.\nAny change not applied will be lost."), 1) and sig_usr1(), exec "$0 --theme $name"; + } }; + } grep { -d "$themes_dir/$_" } all($themes_dir)), + { path => N("/_Themes").N("/_More themes"), callback => \&more_themes } + ), + { path => N("/_Help"), type => '<Branch>' }, + { path => N("/_Help").N("/_Report Bug"), callback => sub { fork_("drakbug --report drakconf &") } }, + { path => N("/_Help").N("/_About..."), callback => \&about_mdk_cc } + )); + +#-PO Don't remember to translate "Options" the same way "_Options" is (but without the underscore of course) +$show_log_check_box = $factory->get_widget("<main>" . N("/Options") . N("/Display Logs")); +$embedded_check_box = $factory->get_widget("<main>" . N("/Options") . N("/Embedded Mode")); +$expert_wizard_check_box = $factory->get_widget("<main>" . N("/Options") . N("/Expert mode in wizards")); + +gtkadd($window_global, + gtkpack_(Gtk2::VBox->new(0, 3), + 0, $menu, + 0, gtkset_size_request(my $darea_title = Gtk2::DrawingArea->new, $global_width, 55), + 0, Gtk2::HSeparator->new, + 1, gtkpack_(Gtk2::HBox->new(0, 0), + 0, my $fixed_left = Gtk2::Fixed->new, + 1, gtkpack_(my $right_box = Gtk2::VBox->new(0, 0), + 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), + 0, gtkpack_(Gtk2::HBox->new(0, 0), + 1, Gtk2::VBox->new(0, 0), + 0, gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'etched_out'), + my $run_darea = gtkset_size_request(Gtk2::DrawingArea->new, 128, 128) + ), + 1, Gtk2::VBox->new(0, 0), + ), + 0, Gtk2::Label->new(N("Please wait...")), + 1, Gtk2::HBox->new(0, 0), + 0, gtkadd(gtkset_layout(gtkset_border_width(Gtk2::HButtonBox->new, 10), 'end'), + gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { Gtk2->timeout_remove($timeout) if $timeout; kill('USR1', $$) }), + ) + ) + ), + 1, my $notebook_global = Gtk2::Notebook->new, + ) + ) + ) + ); -my $window_global = new Gtk::Window -toplevel; -my ($pixmap_back_right, undef) = gtkcreate_png('mcc-core-back'); $window_global->signal_connect(delete_event => \&quit_global); -$window_global->set_title(N("Mandrake Control Center %s", $_version)); -$window_global->set_policy(0, 1, 1); -my $notebook_global; +$window_global->set_title(N("Mandrake Control Center %s", $version)); +$window_global->set_position('center'); -my $left_back_pixbuf_unaltered = gtkcreate_png_pixbuf('mcc-left-back'); -my $left_back_pixbuf_unaltered_h = gtkcreate_png_pixbuf('mcc-left-back2'); +$notebook_global->set_property('show-border', 0); +$notebook_global->set_property('show-tabs', 0); #$notebook_global->set_show_tabs(0); + +# banner : + +$darea_title->signal_connect(realize => sub { set_back_pixbuf($darea_title, gtkcreate_pixbuf('mcc-title-back')) }); + +my $pixbuf_icon = gtkcreate_pixbuf('mcc-title-icon'); +$darea_title->signal_connect(expose_event => sub { + $pixbuf_icon->render_to_drawable($darea_title->window, $darea_title->style->white_gc, 0, 0, $darea_title->allocation->width - $pixbuf_icon->get_width, 0, -1, -1, 'none', 0, 0); +}); + + + +# main page (summary) : + +my $summary = Gtk2::Fixed->new; +$summary->set_has_window(1); +$notebook_global->append_page(gtksignal_connect($summary, realize => sub { set_back_pixbuf($summary, gtkcreate_pixbuf("mcc-splash")) })); + +use POSIX qw(:sys_utsname_h :math_h); +my (undef, $nodename, $release, undef, $machine) = POSIX::uname(); +$summary->put(gtkmodify_font(Gtk2::Label->new(N("Welcome to the Mandrake Control Center")), Gtk2::Pango::FontDescription->from_string('15')), + 80, 115); # FIXME: better center it at realize time @(summary->width - (vbox->width/2), summary->height - (vbox->height/2) ) + + +# left icons : my @darea_left_list; -my $cursor_hand = new Gtk::Gdk::Cursor 60; -my $cursor_normal = new Gtk::Gdk::Cursor 68; -my ($index, $left_locked, $pending_app) = (0, 0, 0); -my $darea_left_sav; -my $back; -($back->[0], undef) = gtkcreate_png('mcc-left-back'); - $back->[1] = $back->[0]; -($back->[2], undef) = gtkcreate_png('mcc-left-back2'); +my ($cursor_hand, $cursor_normal) = (Gtk2::Gdk::Cursor->new('hand2'), Gtk2::Gdk::Cursor->new('left-ptr')); + +my $right_back_pixbuf = gtkcreate_pixbuf('mcc-core-back'); +my $left_back_pixbuf_unaltered = gtkcreate_pixbuf('mcc-left-back'); +my $left_back_pixbuf_unaltered_h = gtkcreate_pixbuf('mcc-left-back2'); +my ($back_width, $back_height) = ($left_back_pixbuf_unaltered->get_width, $left_back_pixbuf_unaltered->get_height); + +# 0 => unselected, 1 => highlited, 2 => selected +my @left_back_pixbuf = ($left_back_pixbuf_unaltered, $left_back_pixbuf_unaltered, $left_back_pixbuf_unaltered_h); + +my ($index, $left_locked) = (0, 0); +my $index_sav = -1; + +my (@curr_state, @old_state); +my ($d_width, $d_height) = (160, 44); +my @colors = (gtkcolor(0, 0, 0), gtkcolor(0xAA, 0xAA, 0xFF), gtkcolor(0, 0, 0)); +my $spacing = 25; +my ($lspacing, $txt_offset); + # Create left icons foreach (@tree) { - $index++; - my $index = $index; - my $text = $_->[0]; - - my $darea_left = gtkset_usize(new Gtk::DrawingArea, 160, 45); - $darea_left->{state} = 0; - my ($dbl_area_left, $pix, $width, $height); - $darea_left->set_events(['exposure_mask', 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]); - - # 0 => unselected, 1 => highlited, 2 => selected - my @left_back_pixbuf = ( - compose_with_back($_->[1], $left_back_pixbuf_unaltered), - compose_with_back($_->[1], $left_back_pixbuf_unaltered, 170), - compose_with_back($_->[1], $left_back_pixbuf_unaltered_h)); - my ($pixbuf_width, $pixbuf_height) = ($left_back_pixbuf[0]->get_width, $left_back_pixbuf[0]->get_height); - my $draw = sub { - my ($dx, $dy) = ($darea_left->allocation->[2], $darea_left->allocation->[3]); - my $state = $darea_left->{state}; - unless (defined($dbl_area_left)) { - ($pix, $width, $height) = create_pix_text($darea_left, $text, $darea_left->style->font, - max($dx-40, 0), $dy, 0, 0, $back, 160, 45, 0, 1); - $dbl_area_left = new Gtk::Gdk::Pixmap($darea_left->window, $dx, $dy); - } - # Redraw if state change (selected <=> not selected) - if (!$dbl_area_left->{state} || $state != $dbl_area_left->{state}) { - $dbl_area_left->{state} = $state; - $darea_left->{dbl} = $dbl_area_left; - fill_tiled($darea_left, $dbl_area_left, $back->[$state], 40, $dy, 40, 45); - $dbl_area_left->draw_pixmap($darea_left->style->bg_gc('normal'), $pix->[$state], 0, 0, 40, 0, $width, $height); - $left_back_pixbuf[$state]->render_to_drawable($dbl_area_left, $darea_left->style->fg_gc('normal'), 0, 0, 8, 10, - $pixbuf_width, $pixbuf_height, 'normal', 0, 0); - } - $darea_left->window->draw_pixmap($darea_left->style->bg_gc('normal'), $dbl_area_left, 0, 0, 0, 0, ($dx, $dy)); - }; - $darea_left->signal_connect(expose_event => $draw); + my ($text, $icon, $subtree) = @$_; + my $my_index = $index++; + +# die "gtkput(fixed_left, VBox of StockButtons there or\n (while waiting for gc to implement IconFactory) VBox of Hbox[icon|text]"; + my $darea_left = gtkset_size_request(Gtk2::DrawingArea->new, $d_width, $d_height); + $darea_left->set_events([ 'exposure_mask', 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]); + + my $icon_pixbuf = gtkcreate_pixbuf($icon); + my ($icon_width, $icon_height) = ($icon_pixbuf->get_width, $icon_pixbuf->get_height); + if (!defined $lspacing) { +# $lspacing = ceil(($d_height-$icon_height)/2); + $lspacing = ($d_height-$icon_height)/2; + $txt_offset = $lspacing * 2 + $icon_width; + $lspacing = ceil($lspacing); + } + + my @icon_pixbufs = ($icon_pixbuf, render_shiner($icon_pixbuf, 1.89), $icon_pixbuf); + + my @fonts = map { Gtk2::Pango::FontDescription->from_string($_) } '', 'Bold', 'Bold'; + my ($lines, $widths, $heights, @dbl_area_left); + + push @curr_state, 0; + push @old_state, -1; + + $darea_left->signal_connect(expose_event => sub { + my (undef, $event) = @_; + my $curr_state = $curr_state[$my_index]; + my $full_redraw = $curr_state != $old_state[$my_index]; + my ($x, $y, $width, $height) = $full_redraw ? (0, 0, $d_width, $d_height) : $event->area->values; + # Redraw double buffer on first expose in that particular state (selected <=> not selected): render background, then icon, then text + unless ($dbl_area_left[$curr_state]) { + my $window = $darea_left->window; + $dbl_area_left[$curr_state] = Gtk2::Gdk::Pixmap->new($window, $d_width, $d_height, $window->get_depth); + my $gc = $darea_left->style->fg_gc('normal'); + $left_back_pixbuf[$curr_state]->render_to_drawable($dbl_area_left[$curr_state], $gc, 0, 0, 0, 0, $back_width, $back_height, 'normal', 0, 0); + $icon_pixbufs[$curr_state]->render_to_drawable($dbl_area_left[$curr_state], $gc, 0, 0, $lspacing, $lspacing+2, $icon_width, $icon_height, 'normal', 0, 0); + $darea_left->style->black_gc->set_rgb_fg_color($colors[$curr_state]); +# $darea_left->style->black_gc->set_fg_gc('normal', $colors[$curr_state]); +# $darea_left->style->set_rgb_fg_color($colors[$curr_state]); + + $darea_left->modify_font($fonts[$curr_state]); + + (undef, undef, $lines, $widths, $heights) = get_text_coord($text, $darea_left, $d_width-$txt_offset, $d_height, 0, 0, 0, 0); + my $offset = $heights->[0]/2 if listlength(@$lines) > 1; # multi line texts are offsetted + mapn { +# $_ = "<markup><span foreground=\"blue\">$_</span></markup>" if $curr_state == 1; + # we need Gtk2::Pango::Layout->set_markup to render in blue in highlighted state + $dbl_area_left[$curr_state]->draw_layout($darea_left->style->black_gc, $_[1]+$txt_offset, $_[2]-$offset, $darea_left->create_pango_layout($_[0])); + } $lines, $widths, $heights; + } + $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(enter_notify_event => sub { - return if $darea_left->{state} != 0; - $darea_left->{state} = 1; - &$draw; + return if $old_state[$my_index] == -1 || $curr_state[$my_index] != 0; + $curr_state[$my_index] = 1; + $darea_left->queue_draw; }); $darea_left->signal_connect(leave_notify_event => sub { - return if $darea_left->{state} != 1; - $darea_left->{state} = 0; - &$draw; + return if $curr_state[$my_index] != 1; + $curr_state[$my_index] = 0; + $darea_left->queue_draw; }); $darea_left->signal_connect(button_release_event => sub { - $left_locked and return; - $pending_app && !splash_warning(N("The modifications done in the current module won't be saved."), 1) and return; - clean_socket(); - $notebook_global->show; - $darea_left->{state} == 2 and set_page($index), return; - foreach (@darea_left_list) { - $_->[1]->window->set_cursor($cursor_hand); - if ($_->[1]{state} != 0) { - $_->[1]{state} = 0; - $_->[1]->draw(undef); - } - } - $darea_left->window->set_cursor($cursor_normal); - $darea_left->{state} = 2; - &$draw; - if ($still_in_splash_screen) { - $still_in_splash_screen = 0; - update_exp(); - } - set_page($index); - $darea_left_sav = $darea_left; + return if $left_locked; + return if $pending_app && !splash_warning(N("The modifications done in the current module won't be saved."), 1); + # deselect previously selected darea + if ($index_sav != -1) { + $curr_state[$index_sav] = 0; + $darea_left_list[$index_sav]->window->set_cursor($cursor_hand); + $darea_left_list[$index_sav]->queue_draw; + } else { $still_in_splash_screen = 0 } + $index_sav = $my_index; + $curr_state[$my_index] = 2; + $darea_left->window->set_cursor($cursor_normal); + $darea_left->queue_draw; + set_page($my_index+1); }); - - push @darea_left_list, [ ($index-1)*45, $darea_left ]; -} - -my ($exp_frame, $emb_box, $emb_wait, $emb_socket); -my ($global_width, $global_height) = (720, 578); + # push left icons + $fixed_left->put($darea_left, 0, $my_index*$d_height); + push @darea_left_list, $darea_left; + + + # Create right notebook pages : + + my $fixed = Gtk2::Fixed->new; + $fixed->set_has_window(1); + $fixed = gtksignal_connect( + gtkput($fixed, + create_packtable({ col_spacings => $spacing, row_spacings => $spacing }, + (group_by2(map { + my ($label, $tag) = @$_; + my $text = $exec_hash->{$label}->[3]; + die "$label 's icon is missing" unless $exec_hash->{$label}; + my $event_box = gtkadd(Gtk2::EventBox->new(), my $icon = gtkcreate_img($tag)); + $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(button_release_event => sub { compute_exec_string($tag, @{$exec_hash->{$label}}) }); + + # FIXME : resize sig: ->foreach; set_size_request + + gtkpack(Gtk2::HBox->new(0, 0), + $event_box, + gtkset_size_request(gtktext_insert(Gtk2::TextView->new, [ [ $text, {'background_set' => 0, 'background_stipple_set' => 0 } ] ]), ($global_width-$d_width-$icon_width-$spacing*4-5)/2, -1) +# gtkset_size_request(Gtk2::Label->new($text), ($global_width-$d_width-$icon_width-95)/2, -1) + ); + } @$subtree))), + 0, $spacing), + realize => sub { set_back_pixbuf($fixed, $right_back_pixbuf) }); + + $notebook_global->append_page(my $w_ret = gtkhide(create_scrolled_window($fixed, undef, 'none'))); +# $w_ret->vscrollbar->set_size_request(19, undef); +} -# embedded processes pid will be stocked there -my @pid_launched; +$notebook_global->set_size_request(-1, $index * 60); -# logdrake pid are stocked here -my @pid_exp; -$window_global->add( - gtkpack_(new Gtk::VBox(0, 0), - 0, my $title_w = get_main_menu($window_global), - 0, my $fixed_title = gtkset_usize(new Gtk::Fixed, $global_width, 55), - 0, new Gtk::HSeparator, - 1, gtkpack_(new Gtk::HBox(0, 0), - 0, my $fixed_left = new Gtk::Fixed, - 1, gtkpack_(my $right_box = new Gtk::VBox(0, 0), - 1, gtkpack_($emb_box = new Gtk::VBox(0, 0), - 1, $emb_wait = gtkpack_(new Gtk::VBox(0, 0), - 1, new Gtk::HBox(0, 0), - 0, gtkpack_(new Gtk::HBox(0, 0), - 1, new Gtk::VBox(0, 0), - 0, gtkadd(gtkset_shadow_type(new Gtk::Frame, 'etched_out'), - my $run_darea = gtkset_usize(new Gtk::DrawingArea, 128, 128) - ), - 1, new Gtk::VBox(0, 0), - ), - 0, new Gtk::Label(N("Please wait...")), - 1, new Gtk::HBox(0, 0), - 0, gtkadd(gtkset_layout(gtkset_border_width(new Gtk::HButtonBox, 10), 'end'), - gtksignal_connect(new Gtk::Button(N("Cancel")), clicked => sub { Gtk->timeout_remove($timeout) if $timeout; kill('USR1', $$) }), - ) - ) - ), - 1, $notebook_global = new Gtk::Widget('Gtk::Notebook', - show_border => 0, - show_tabs => 0), - ) - ) - ) - ); +my ($exp_frame, $emb_socket); sub update_exp { return if $still_in_splash_screen || $pending_app; - if ($logs) { + if ($show_logs) { if ($exp_frame) { $exp_frame->show_all; } else { gtkpack__($right_box, - gtkadd($exp_frame = gtkset_shadow_type(gtkset_usize(gtkset_border_width(new Gtk::Frame(N("Logs")), 5), 0, 120), 'etched_out'))); + gtkadd($exp_frame = gtkset_shadow_type(gtkset_size_request(gtkset_border_width(Gtk2::Frame->new(N("Logs")), 5), 0, 120), 'etched_out'))); } - } elsif ($logs) { $exp_frame->hide } + } elsif ($exp_frame) { $exp_frame->hide } } -#540, 420 -my ($notebook_width, $notebook_height) = (540, 420); -$notebook_global->set_usize(40, $index * 50); -$emb_box->set_usize(40, $index * 50); +$emb_box->set_size_request(-1, $index * 50); -if (defined $log_check_box) { - $log_check_box->set_active($logs); +if (defined $show_log_check_box) { + $show_log_check_box->set_active($show_logs); $embedded_check_box->set_active($embedded); + $expert_wizard_check_box->set_active($expert_wizard); } else { print STDERR "BUG with LANGUAGE $ENV{LANGUAGE}\n" } -update_exp(); -res_socket(); - -foreach (@darea_left_list) { $fixed_left->put($_->[1], 0, $_->[0]) } - -$fixed_left->signal_connect(realize => sub { $fixed_left->window->set_back_pixmap($back->[0], 0) }); +create_hidden_socket_if_needed(); -my $dbl_area; -my ($pixmap_back, undef) = gtkcreate_png('mcc-title-back'); -my ($pixmap_icon, undef) = gtkcreate_png('mcc-title-icon'); +# default left background +$fixed_left->set_has_window(1); +$fixed_left->signal_connect(realize => sub { set_back_pixbuf($fixed_left, $left_back_pixbuf[0]) }); -$fixed_title->put(my $darea_title = gtkset_usize(new Gtk::DrawingArea, 335, 55), 0, 0); # 335 -> 450 - -$fixed_title->signal_connect(realize => sub { $fixed_title->window->set_back_pixmap($pixmap_back, 0) }); - -$darea_title->signal_connect(expose_event => sub { - my @dim = @{$_[1]{area}}; - my ($dx, $dy) = ($darea_title->allocation->[2], $darea_title->allocation->[3]); - unless (defined($dbl_area)) { - $dbl_area = new Gtk::Gdk::Pixmap($darea_title->window, $dx, $dy); - fill_tiled($darea_title, $dbl_area, $pixmap_back, 110, 55, $dx, $dy); - $dbl_area->draw_pixmap($darea_title->style->bg_gc('normal'), - $pixmap_icon, 0, 0, 0, 0, 325, 55); - } - $darea_title->window->draw_pixmap($darea_title->style->bg_gc('normal'), - $dbl_area, $dim[0], $dim[1], $dim[0], $dim[1], $dim[2], $dim[3]); -}); - - -my $pix_dbl; -$notebook_global->append_page(my $summary_darea = new Gtk::DrawingArea); -$summary_darea->signal_connect(size_allocate => sub { $pix_dbl = undef }); # needed when hiding emb_box -$summary_darea->signal_connect(expose_event => sub { - my ($dx, $dy) = ($summary_darea->allocation->[2], $summary_darea->allocation->[3]); - unless (defined($pix_dbl)) { - $pix_dbl = new Gtk::Gdk::Pixmap($summary_darea->window, $dx, $dy); - my ($splash_pix, undef) = gtkcreate_png("mcc-splash"); - fill_tiled($summary_darea, $pix_dbl, $splash_pix, $notebook_width, $notebook_height, $dx, $dy); - my $style = $summary_darea->style->copy(); - $style->font(Gtk::Gdk::Font->fontset_load(N("-*-helvetica-medium-r-normal-*-20-*-100-100-p-*-iso8859-1,*-r-*"))); - $pix_dbl->draw_string($style->font, $summary_darea->style->black_gc, 80, 115, N("Welcome to the Mandrake Control Center")); - my ($sysname, $nodename, $release, undef, $machine) = uname(); - my $i = 0; - foreach ([N("System:"), &mandrake_release()], - [N("Hostname:"), $nodename], - [N("Kernel Version:"), $release], - [N("Machine:"), $machine]) { - $pix_dbl->draw_string($summary_darea->style->font, $summary_darea->style->black_gc, 80, 150+$i, $_->[0]); - $pix_dbl->draw_string($summary_darea->style->font, $summary_darea->style->black_gc, 81, 150+$i, $_->[0]); - $pix_dbl->draw_string($summary_darea->style->font, $summary_darea->style->black_gc, 200, 150+$i, $_->[1]); - $i+=20; - } - } - $summary_darea->window->draw_pixmap ($summary_darea->style->white_gc, - $pix_dbl, 0, 0, - 0, 0, $dx, $dy); - 0; - }); +# "wait while launching a program" area : my ($run_pixbuf, $run_counter, $run_counter_add); -my $right_back_pixbuf = gtkcreate_png_pixbuf('mcc-core-back'); $run_darea->signal_connect(expose_event => sub { - my $pixbuf = compose_pixbufs($run_pixbuf, $right_back_pixbuf, $run_counter); - $pixbuf->render_to_drawable($run_darea->window, $run_darea->style->fg_gc('normal'), 0, 0, 0, 0, - $pixbuf->get_width, $pixbuf->get_height, 'normal', 0, 0); + my $pixbuf = render_shiner($run_pixbuf, $run_counter); + my ($window, $gc, $width, $height) = ($run_darea->window, $run_darea->style->fg_gc('normal'), $pixbuf->get_width, $pixbuf->get_height); + $right_back_pixbuf->render_to_drawable($window, $gc, 0, 0, 0, 0, $width, $height, 'normal', 0, 0); + $pixbuf->render_to_drawable($window, $gc, 0, 0, 0, 0, $width, $height, 'normal', 0, 0); $run_counter += $run_counter_add; $run_counter_add = -$run_counter_add if $run_counter < 100; $run_counter_add = -$run_counter_add if 245 < $run_counter; }); +gtkflush(); -$window_global->set_usize($global_width, $global_height); -# Create right notebook pages -foreach (@tree) { - $notebook_global->append_page(gtkicons_labels_widget($_->[2], $window_global, $summary_darea, - $pixmap_back_right, $left_back_pixbuf_unaltered_h, $notebook_width, $notebook_height, 55, 50, 50, 50, 50, 50, \&compute_exec_string, $exec_hash)); -} -gtkflush; +$notebook_global->set_current_page(0); $notebook_global->signal_connect(switch_page => sub { my (undef, $tab_widget, $tab_number) = @_; - $tab_number > 0 or return; - $tab_widget->child->child->child->{redraw_function}->(); + return unless $tab_number > 0; }); -$window_global->set_usize($global_width, $global_height); -#$window_global->set_default_size($global_width, $global_height); -$window_global->set_position('center'); -gtkflush; + $window_global->show_all; +#$darea_title->hide; $emb_box->hide; -my $p = $#tree + ($::isWiz ? 1 : 0); -Gtk->timeout_remove($timer_splash); -$notebook_global->set_page(0); - -$window_splash->destroy(); -$window_global->set_position(1); $SIG{USR1} = \&sig_usr1; $SIG{USR2} = \&sig_usr2; $SIG{TERM} = \&quit_global; $SIG{CHLD} = \&sig_child; -$SIG{CONT} = sub { Gtk->main }; -Gtk->main; +$SIG{CONT} = sub { Gtk2->main }; + +$window_splash->destroy; + +eval { Gtk2->main } while (1); -# got when child go in zombie state +# got when child unexpectedly died and gone in zombie state sub sig_child { - wait; # reap zombies - return unless $left_locked; + wait(); # reap zombies + return unless $left_locked; kill('USR1', $$); splash_warning(N("This program was abnomarly exited")); -# Gtk->main +# Gtk2->main } -# got when finished +# got when child properly exited sub sig_usr1 { $left_locked = 0; clean_socket(); gtkset_mousecursor_normal(); - $darea_left_sav and $darea_left_sav->{state} = 2, $darea_left_sav->draw(undef); $notebook_global->show; } @@ -544,292 +611,278 @@ sub sig_usr2 { } +# embedded processes pid will be stocked there +my @pid_launched; + +# logdrake pid are stocked here +my @pid_exp; + + sub fork_ { my ($prog, $do_not_kill) = @_; my $pid; - unless ($pid = fork) { - splash_warning(N("cannot fork: %s", $~)) unless defined $pid; - exec($prog); + unless ($pid = fork()) { + splash_warning(N("cannot fork: %s", $~)) unless defined $pid; + exec($prog); } return if $do_not_kill; push @pid_launched, $pid if $embedded; - + } sub compute_exec_string { - my ($icon, $log_exp, $exec, $gtkplug, $alternate) = ($_[0], @{$_[1]}); + my ($icon, $log_exp, $exec, $gtkplug, undef, $alternate) = @_; #($_[0], @{$_[1]}); + $exec .= "--summary" if $expert_wizard; if ($embedded) { - if ($gtkplug != -1) { # not explicitely not embedded - $notebook_global->hide; - res_socket(); - $emb_box->show; - $emb_socket->realize; - $exec .= " --embedded " . $emb_socket->window->XWINDOW . " " . $$; - } - if ($gtkplug > 0) { - $emb_wait->show; - undef $run_pixbuf if $run_pixbuf; #->unref; - $run_pixbuf = gtkcreate_png_pixbuf($icon . "_128"); - $run_counter = 255; - $run_counter_add = -10; - Gtk->timeout_remove($timeout) if $timeout; - $timeout = Gtk->timeout_add(70, sub { $run_darea->draw(undef); 1 }); - $left_locked = 1; - $pending_app = 1; - fork_($exec); - } elsif ($gtkplug == -1) { # explicitely not embedded - fork_($exec, 1); - } else { # gtkplug == 0 - $emb_socket->show; - $SIG{CHLD} = undef; - $emb_socket->steal(launch_xapp($alternate)); - $SIG{CHLD} = \&sig_child; - } + if ($gtkplug != -1) { # not explicitely not embedded + $notebook_global->hide; + create_hidden_socket_if_needed(); + $emb_box->show; + $emb_socket->realize; + $exec .= " --embedded " . $emb_socket->window->XWINDOW . " " . $$; + } + if ($gtkplug > 0) { + $emb_wait->show; + undef $run_pixbuf if $run_pixbuf; #->unref; + $run_pixbuf = gtkcreate_pixbuf($icon . "_128"); + $run_counter = 255; + $run_counter_add = -10; + Gtk2->timeout_remove($timeout) if $timeout; + $timeout = Gtk2->timeout_add(70, sub { $run_darea->draw(undef); 1 }); + $left_locked = 1; + $pending_app = 1; + fork_($exec); + } elsif ($gtkplug == -1) { # explicitely not embedded + fork_($exec, 1); + } else { # gtkplug == 0 + $emb_socket->show; + $SIG{CHLD} = undef; + $emb_socket->steal(launch_xapp($exec)); + $SIG{CHLD} = \&sig_child; + } } else { # not embedded - fork_($gtkplug == 0 ? $alternate->[0] : $alternate || $exec); - } - if ($embedded && $gtkplug != -1) { - foreach (@darea_left_list) { - $_->[1]->window->set_cursor($cursor_hand); - if ($_->[1]{state} != 0) { - $_->[1]{state} = 0; - $_->[1]->draw(undef); - } - } + fork_($gtkplug == 0 ? $exec->[0] : $alternate || $exec); } - # start logdrake if needed - if ($logs && $show_log) { - my $pid; - gtkadd($exp_frame, my $exp_socket = new Gtk::Socket); - $exp_socket->realize; - my $exec_log = "logdrake --explain=$log_exp --embedded " . $exp_socket->window->XWINDOW . " " . $$; - $show_log = 0; - if ($exec =~ /(drakfont|drakconnect|drakboot)/) { $exp_frame->hide() } # $window_global->height < 600 -# fork_($exec_log, 1); - unless ($pid = fork) { - splash_warning(N("cannot fork: %s", $~)) unless defined $pid; - exec($exec_log); - } - push @pid_exp, $pid; +# if ($embedded && $gtkplug != -1) { +# foreach (@darea_left_list) { +# $_->->window->set_cursor($cursor_hand); +# if ($_->{state} != 0) { +# $_->{state} = 0; +# $_->->draw(undef); +# } +# } +# } + # (re)start logdrake if needed + if ($show_logs && $freeze_log) { #FIXME && !$exp_socket + my $pid; + my $exp_socket; +#FIXME gtkadd($exp_frame, my $exp_socket = Gtk2::Socket)->new; + $exp_socket->realize; + my $exec_log = "logdrake --explain=$log_exp --embedded " . $exp_socket->window->XWINDOW . " " . $$; + $freeze_log = 0; + if ($exec =~ /(drakfont|drakconnect|drakboot)/) { $exp_frame->hide } # $window_global->height < 600 +# fork_($exec_log, 1); + unless ($pid = fork()) { + splash_warning(N("cannot fork: %s", $~)) unless defined $pid; + exec($exec_log); + } + push @pid_exp, $pid; } } sub launch_xapp { - my $b = "xwininfo -root -tree -int | grep '" . $_[0][1] . "'"; - my @before = split ('\n', `$b`); - my $mcc_pid = $$; - fork_($_[0][0] . "; kill -USR1 $mcc_pid"); - my $res = 0; - while (!$res) { - my @after = split ('\n', `$b`); - while (@after ne ($_[0][2]+@before)) { - @after = split ('\n', `$b`); - } - my $i = 0; - my $c; - foreach (@after) { - $c = $after[$i] if !member($after[$i], @before); - $i++; - } - $c =~ /\s*([0-9]*)\s*/; - $res = $1; + my ($exec, $name, $xx) = @_; + my $find_windows = sub { split '\n', `xwininfo -root -tree -int | grep '$name'` }; + my @before = &$find_windows(); + fork_("$exec; kill -USR1 $$"); + while (1) { + my @after = &$find_windows(); + while (@after ne $xx + @before) { + @after = &$find_windows(); + } + my $c; + foreach (@after) { $c = $_ unless member($_, @before) }; + $c =~ /\s*([0-9]*)\s*/; + return $1; } - $res; } -sub clean_socket { +sub hide_socket_and_clean { $emb_box->hide; - foreach (@pid_launched) { - kill 'TERM', $_ if defined $_; - } - @pid_launched = (); - $emb_socket and $emb_socket->destroy(); $pending_app = 0; update_exp(); } -sub res_socket { - clean_socket(); - gtkpack($emb_box, $emb_socket = new Gtk::Socket); +sub clean_socket { + hide_socket_and_clean(); +# map { kill 'TERM', $_ if defined $_ } @pid_launched; + map { if__($_, kill 'TERM', $_) } @pid_launched; + @pid_launched = (); + $emb_socket and $emb_socket->destroy; # should not happen since our child should have cause the socket to be destroyes when it exited +} + +sub create_hidden_socket_if_needed { + hide_socket_and_clean(); # clean_socket(); + gtkpack($emb_box, $emb_socket = Gtk2::Socket->new) unless $emb_socket; $emb_socket->hide; $emb_wait->hide; } sub quit_global { - foreach (@pid_launched,@pid_exp) { kill 'TERM', $_ if defined $_ } + map { if__($_, kill 'TERM', $_) } @pid_exp; setVarsInSh($conffile, { - EMBEDDED => bool2text($embedded), - LOGS => bool2text($logs), - THEME => $theme, - }); + EMBEDDED => bool2text($embedded), + LOGS => bool2text($show_logs), + EXPERT_WIZARD => bool2text($expert_wizard), + THEME => $theme, + }); gtkset_mousecursor_normal(); - Gtk->exit(0); + Gtk2->exit(0); } sub splash_warning { my ($label, $cancel_button) = @_; my $ret; - my $win_about = new Gtk::Dialog(); - $win_about->set_position(1); - $win_about->set_border_width(10); - - gtkpack__($win_about->action_area, - gtkadd(new Gtk::HButtonBox, - gtksignal_connect(new Gtk::Button($cancel_button ? N("OK") : N("Close")), clicked => sub { $ret = 1; Gtk->main_quit }), - if_($cancel_button, gtksignal_connect(new Gtk::Button(N("Cancel")), clicked => sub { Gtk->main_quit })), - ) - ); - gtkpack($win_about->vbox, - gtkpng("warning"), - new Gtk::Label($label), - ); - $win_about->show_all(); - $win_about->set_modal(1); - Gtk->main; - $win_about->destroy(); + my $window = Gtk2::Dialog->new; + $window->set_position('center-on-parent'); + $window->set_border_width(10); + + gtkpack__($window->action_area, + gtkadd(Gtk2::HButtonBox->new, + gtksignal_connect(Gtk2::Button->new($cancel_button ? N("OK") : N("Close")), clicked => sub { $ret = 1; Gtk2->main_quit }), + if_($cancel_button, gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { Gtk2->main_quit })), + ) + ); + gtkpack($window->vbox, + gtkcreate_img("warning"), + Gtk2::Label->new($label), + ); + $window->show_all; + $window->set_modal(1); + Gtk2->main; + $window->destroy; $ret; } sub new_dialog { my ($title) = @_; - my $window_about = new Gtk::Dialog(); - $window_about->set_position(1); - $window_about->set_border_width(10); - $window_about->set_title($title); - $window_about->action_area->pack_start(gtkadd(new Gtk::HButtonBox, - gtksignal_connect(new Gtk::Button(N("Close")), "clicked" => sub { $window_about->destroy() })),0,0,0); - $window_about->set_policy(0, 0, 1); - $window_about->set_modal(1); - $window_about; + my $dialog = Gtk2::Dialog->new; + $dialog->set_transient_for($window_global); + $dialog->set_position('center-on-parent'); + $dialog->set_border_width(10); + $dialog->set_title($title); + $dialog->action_area->pack_start(gtkadd(Gtk2::HButtonBox->new, + gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { $dialog->destroy })),0,0,0); + gtkset_modal($dialog, 1); } sub more_themes { my $window_about = new_dialog(N("More themes")); - my $style1 = $window_about->style->copy(); - $style1->font(Gtk::Gdk::Font->fontset_load(N("-*-helvetica-medium-r-normal-*-20-*-100-100-p-*-iso8859-1,*-r-*"))); + my $style1 = $window_about->style->copy; +# $style1->font(Gtk2::Gdk::Font->fontset_load(N("-*-helvetica-medium-r-normal-*-20-*-100-100-p-*-iso8859-1,*-r-*"))); gtkpack_($window_about->vbox, - 0, gtksetstyle(new Gtk::Label(N("Getting new themes")), $style1), - 0, gtkadd(gtkset_shadow_type(gtkset_border_width(new Gtk::Frame(N("Additional themes")), 10), 'etched_out'), - gtkpack(new Gtk::HBox(0, 5), - N("Get additional themes on www.damz.net"), - ) - ) - ); - $window_about->show_all(); + 0, gtksetstyle(Gtk2::Label->new(N("Getting new themes")), $style1), + 0, gtkadd(gtkset_shadow_type(gtkset_border_width(Gtk2::Frame->new(N("Additional themes")), 10), 'etched_out'), + gtkpack(Gtk2::HBox->new(0, 5), + N("Get additional themes on www.damz.net"), + ) + ) + ); + $window_about->show_all; } sub about_mdk_cc { my $window_about = new_dialog(N("About - Mandrake Control Center")); - my $label = new Gtk::Label(); - my $style1 = $label->style->copy(); - $style1->font(Gtk::Gdk::Font->fontset_load(N("-*-helvetica-medium-r-normal-*-20-*-100-100-p-*-iso8859-1,*-r-*"))); - my $clist = new Gtk::CList(3); - my $i = -1; - $i++, $clist->append(@$_) foreach ([ N("Authors: "), '', ''], - [ '', 'Thierry Vignaud', 'tvignaud@mandrakesoft.com'], - [ '', 'Daouda Lo', 'daouda@mandrakesoft.com'], - [ '', ''], - [ N("Old authors: "), '', ''], - [ '', 'Chmouel Boudjnah', 'original C version'], - [ '', 'Damien "dam\'s" Krotkine', 'perl version'], - [ '', 'Yves Duret', 'logdrake integration'], - [ '', ''], - [ N("Artwork: "), -#-PO If your language allows it, use eacute for first "e" and egrave for 2nd. - N("Helene Durosini"), 'ln@mandrakesoft.com'], - [ '', 'Anh-Van Nguyen' ,'avnguyen@mandrakesoft.com'], - ); - - # Give our translators the ability to show their family and + my $tree_model = Gtk2::TreeStore->new(Gtk2::GType->STRING, Gtk2::GType->STRING, Gtk2::GType->STRING); + my $list = Gtk2::TreeView->new_with_model($tree_model); + each_index { $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => $::i)) } 0..2; + $list->set_headers_visible(0); + + foreach my $row ([ N("Authors: "), '', '' ], + [ '', 'Chmouel Boudjnah', '(original C version' ], + [ '', 'Damien "dam\'s" Krotkine', '(perl version)' ], + [ '', 'Daouda Lo', '<daouda@mandrakesoft.com>' ], + [ '', 'Thierry Vignaud', '<tvignaud@mandrakesoft.com>' ], + [ '', 'Yves Duret', '(perl version)' ], + [ '', '' ], + [ N("Artwork: "), '', '' ], + [ '', 'Anh-Van Nguyen', '<avnguyen@mandrakesoft.com>' ], +#-PO If your language allows it, use eacute for first "e" and egrave for 2nd one. + [ '', N("Helene Durosini"), '<ln@mandrakesoft.com>' ], + ) { + $tree_model->append_set(undef, [ map_index { $::i => $_ } @$row ])->free; + } + + # Give our translators the ability to show their family and # friends that thez participated ... -#-PO Add your Name here to find it in the About section in your language. +#-PO Add your Name here to find it in the About section in your language. my $translator_name = N("~ * ~"); #-PO Add your E-Mail address here if you want to show it in the about doialog. my $translator_email = N("~ @ ~"); if ($translator_name ne "~ * ~ " && 0) { - $i++, $clist->append(@$_) foreach ([ '', ''], - [ N("Translator: "), - $translator_name, $translator_email], - ); + $list->append_set(undef, [ 0 => $_->[0], 1 => $_->[1] ])->free foreach [ '', '' ], [ N("Translator: "), $translator_name, $translator_email ]; } - $clist->set_selectable($_, 0) foreach 0..$i; - $clist->columns_autosize(); - $clist->set_column_justification(0, "right"); + $list->get_selection()->set_mode('none'); gtkpack_($window_about->vbox, - -r "$themes_dir/$theme/splash_screen_about.png" ? - (0, gtkpng("splash_screen_about")) : (1, gtksetstyle(new Gtk::Label(N("Mandrake Control Center %s\n", $_version)), $style1),), - 0, new Gtk::Label(''), - 0, new Gtk::Label(N("Copyright (C) 2001-2002 Mandrakesoft SA")), - 0, new Gtk::Label(''), - 1, $clist, - ); - $clist->columns_autosize(); - $window_about->show_all(); + -r "$themes_dir/$theme/splash_screen_about.png" ? + (0, gtkcreate_img("splash_screen_about")) : (1, gtkmodify_font(Gtk2::Label->new(N("Mandrake Control Center %s\n", $version)), 'Bold 24'),), + 0, Gtk2::Label->new("\n" . N("Copyright (C) 2001-2002 Mandrakesoft SA") . "\n"), + 1, $list, + ); + $window_about->show_all; } sub connect_to_site { - my ($link,$help)=@_; + my ($link, $help)=@_; my $browser = $ENV{BROWSER}; my $initial_user = $ENV{INITIAL_USER}; unless ($browser) { - splash_warning(" ". N("Warning: No browser specified") ." "); + splash_warning(" " . N("Warning: No browser specified") . " "); return; } if ($help) { - fork_("$browser $link &"); + fork_("$browser $link &"); } else { - if ($initial_user ne "root" && $initial_user ne undef) { - fork_("su -m -l $initial_user -c \"$browser $link &\""); - } else { - splash_warning(" ".N("Security Warning: I'm not allowed to connect to the internet as root user")." "); - } + if ($initial_user ne "root" && $initial_user ne undef) { + fork_("su -m -l $initial_user -c \"$browser $link &\""); + } else { + splash_warning(" ".N("Security Warning: I'm not allowed to connect to the internet as root user")." "); + } } } -sub get_main_menu { - my ($window) = @_; - my $menu = ugtk::create_factory_menu($window, - ({ path => N("/_File"), type => '<Branch>' }, - { path => N("/_File") . N("/_Quit"), accelerator => N("<control>Q"), callback => \&quit_global }, -#-PO Don't remember to translate "_Options" the same way "Options" is (but for the underscore of course) - { path => N("/_Options"), type => '<Branch>' }, - { path => N("/_Options") . N("/Display _Logs"), type => '<CheckItem>', - callback => sub { - $logs = $log_check_box->active; - update_exp(); - } - }, - { path => N("/_Options") . N("/_Embedded Mode"), type => '<ToggleItem>', - callback => sub { $embedded = $embedded_check_box->active } - }, - if_(all($themes_dir) > 1, - { path => N("/_Themes"), type => '<Branch>' }, - (map { {path => N("/_Themes") . "/" . ($_ eq $theme ? " O " : " ") . "_$_", - callback => sub { - $theme eq $_ and return; - !$pending_app || splash_warning(N("This action will restart the control center.\nAny change not applied will be lost."), 1) and sig_usr1(), exec "$0 --theme $_"; - }}; - } grep { -d "$themes_dir/$_" } all($themes_dir)), - { path => N("/_Themes").N("/_More themes"), callback => \&more_themes }), - { path => N("/_Help"), type => '<Branch>' }, - { path => N("/_Help").N("/_Report Bug"), callback => sub { fork_("drakbug --report drakconf &") } }, - { path => N("/_Help").N("/_About..."), callback => \&about_mdk_cc } - )); - my $factory = $menu->{factory}; -#-PO Don't remember to translate "Options" the same way "_Options" is (but without the underscore of course) - $log_check_box = $factory->get_widget("<main>".N("/Options").N("/Display Logs")); - $embedded_check_box = $factory->get_widget("<main>".N("/Options").N("/Embedded Mode")); - return $menu; -} - sub set_page { my ($index) = @_; - update_exp; -# if $still_in_splash_screen; - $notebook_global->set_page($index); + update_exp(); + $notebook_global->set_current_page($index); +} + + + +sub new_pixbuf { + my ($pixbuf) = @_; + my ($width, $height) = ($pixbuf->get_height, $pixbuf->get_width); + my $new_pixbuf = Gtk2::Gdk::Pixbuf->new('rgb', 1, 8, $height, $width); + $new_pixbuf->fill(0x00000000); # transparent white + $width, $height, $new_pixbuf; +} + +sub render_alpha { + my ($pixbuf, $alpha_threshold) = @_; + my ($width, $height, $new_pixbuf) = new_pixbuf($pixbuf); + $pixbuf->composite($new_pixbuf, 0, 0, $width, $height, 0, 0, 1, 1, 'nearest', $alpha_threshold); + $new_pixbuf; +} + + +sub render_shiner { + my ($pixbuf, $shine_value) = @_; + my (undef, undef, $new_pixbuf) = new_pixbuf($pixbuf); + $pixbuf->saturate_and_pixelate($new_pixbuf, $shine_value, 0); + $new_pixbuf; } diff --git a/control-center.rc b/control-center.rc index 74257d4d..1b7d9b55 100644 --- a/control-center.rc +++ b/control-center.rc @@ -1,3 +1,28 @@ +# gtkrc -- gtkrc for MCC themes +# +# Copyright (C) 2000, 2001 Eazel, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id$ +# +# Authors: Thierry Vignaud <tvignaud@mandrakesoft.com> + + +pixmap_path "/usr/share/mcc/themes/default/" + style "any" { fontset = "-adobe-helvetica-medium-r-normal--*-120-75-75-p-*-iso8859-*,*-r-*" @@ -27,6 +52,7 @@ style "any" } + #widget_class "GtkWindow" style "window" widget_class "*Area*" style "any" #widget_class "*abel*" style "any" @@ -41,3 +67,413 @@ widget_class "*Area*" style "any" #class "GtkRadioButton" style "checkradiobutton" #class "GtkCheckButton" style "checkradiobutton" + + + + + +# The syntax in the engine sections is a mess. Here are some hints: + +# gradient : '{' direction gradient-color-list '}' +# | '<' INT '>' -- palette ref + +# direction : /* nothing */ +# | VERTICAL +# | HORIZONTAL + +# gradient-color-list : color +# : color ',' gradient-color-list +# : color '[' weight ']' gradient-color-list + +# weight : FLOAT +# | INT + +# color : "#RRGGBB" +# | '{' FLOAT ',' FLOAT ',' FLOAT '}' +# | '<' color-ext '>' + +# color-ext : STRING -- file in $HOME to read color from +# | '<' INT '>' -- use indexed palette entry +# | '<' INT ',' FLOAT '>' -- multiply palette entry + +# Default style for all widgets to build from +style "default" +{ + GtkWidget::interior_focus = 0 + GtkWidget::focus_padding = 0 + GtkWidegt::focus_line_width = 3 + + GtkRange::slider_width = 11 + GtkRange::stepper_size = 11 + GtkRange::trough_border = 2 + + GtkScale::slider_length = 16 + GtkCheckButton::indicator_size = 10 + GtkCheckButton::indicator_spacing = 3 + + #GtkMenuBar::shadow_type = GTK_SHADOW_NONE + GtkToolBar::shadow_type = GTK_SHADOW_NONE + #GtkSpinButton::shadow_type = GTK_SHADOW_NONE + + GtkOptionMenu::indicator_size = { 11, 6 } + GtkOptionMenu::indicator_spacing = { 30, 5, 2, 2 } + + fg[NORMAL] = "#000000" + fg[ACTIVE] = "#000000" + fg[PRELIGHT] = "#000000" + fg[SELECTED] = "#ffffff" + fg[INSENSITIVE] = "#000000" + + bg[NORMAL] = "#dcdcdc" + bg[ACTIVE] = "#ababab" + bg[PRELIGHT] = "#f2f2f2" + bg[INSENSITIVE] = "#ffffff" + bg[SELECTED] = "#0A5F89" + + text[NORMAL] = "#000000" + text[ACTIVE] = "#ffffff" + text[PRELIGHT] = "#ffffff" + text[SELECTED] = "#ffffff" + text[INSENSITIVE] = "#ffffff" + + base[NORMAL] = "#ffffff" + base[PRELIGHT] = "#ffffff" + base[INSENSITIVE] = "#ffffff" + + engine "crux-engine" { + + # The focus/selection color + palette[0] = { "#21449c" } + + # The gradient used for recoloring images + palette[1] = { "#000000", <0>, "#ffffff" } + + # Used for recolouring inactive images + palette[2] = { "#000000", "#888888", "#ffffff" } + + # Set these colors here, so we can just reference the palette + bg[SELECTED] = <0> + base[SELECTED] = <0> + + focus_color = <0> + insensitive_colors = "#636563", "#cecfce" + + # Create the default (only) stock image table. This maps from + # identifiers used in the engine to reference image parts to + # the actual images, and sets attributes of the images + stock + { + "CHECK" { + image = "check-default.png" + } + "CHECK_FOCUS" { + image = "check-default-focus.png" + recolor = <1> + } + "CHECK_HI" { + image = "check-hilight.png" + } + "CHECK_HI_FOCUS" { + image = "check-hilight-focus.png" + recolor = <1> + } + "CHECK_PRESSED" { + image = "check-pressed.png" + } + "CHECK_PRESSED_FOCUS" { + image = "check-pressed-focus.png" + recolor = <1> + } + "CHECK_DISABLED" { + image = "check-insensitive.png" + } + "CHECK_ACTIVE" { + image = "check-active-default.png" + } + "CHECK_ACTIVE_FOCUS" { + image = "check-active-default-focus.png" + recolor = <1> + } + "CHECK_ACTIVE_HI" { + image = "check-active-hilight.png" + } + "CHECK_ACTIVE_HI_FOCUS" { + image = "check-active-hilight-focus.png" + recolor = <1> + } + "CHECK_ACTIVE_PRESSED" { + image = "check-active-pressed.png" + } + "CHECK_ACTIVE_PRESSED_FOCUS" { + image = "check-active-pressed-focus.png" + recolor = <1> + } + "CHECK_ACTIVE_DISABLED" { + image = "check-active-insensitive.png" + } + "OPTION" { + image = "radio-default.png" + } + "OPTION_FOCUS" { + image = "radio-default-focus.png" + recolor = <1> + } + "OPTION_HI" { + image = "radio-hilight.png" + } + "OPTION_HI_FOCUS" { + image = "radio-hilight-focus.png" + recolor = <1> + } + "OPTION_PRESSED" { + image = "radio-pressed.png" + } + "OPTION_PRESSED_FOCUS" { + image = "radio-pressed-focus.png" + recolor = <1> + } + "OPTION_DISABLED" { + image = "radio-insensitive.png" + } + "OPTION_ACTIVE" { + image = "radio-active-default.png" + } + "OPTION_ACTIVE_FOCUS" { + image = "radio-active-default-focus.png" + recolor = <1> + } + "OPTION_ACTIVE_HI" { + image = "radio-active-hilight.png" + } + "OPTION_ACTIVE_HI_FOCUS" { + image = "radio-active-hilight-focus.png" + recolor = <1> + } + "OPTION_ACTIVE_PRESSED" { + image = "radio-active-pressed.png" + } + "OPTION_ACTIVE_PRESSED_FOCUS" { + image = "radio-active-pressed-focus.png" + recolor = <1> + } + "OPTION_ACTIVE_DISABLED" { + image = "radio-active-insensitive.png" + } + "H_TROUGH" { + image = "scroller-h-trough.png" + border = { 28, 28, 2, 2 } + } + "V_TROUGH" { + image = "scroller-v-trough.png" + border = { 2, 2, 28, 28 } + } + "ARROW_UP" { + image = "scroller-arrow-up.png" + } + "ARROW_UP_HI" { + image = "scroller-arrow-up-hilight.png" + } + "ARROW_UP_ACTIVE" { + image = "scroller-arrow-up-pressed.png" + } + "ARROW_DOWN" { + image = "scroller-arrow-down.png" + } + "ARROW_DOWN_HI" { + image = "scroller-arrow-down-hilight.png" + } + "ARROW_DOWN_ACTIVE" { + image = "scroller-arrow-down-pressed.png" + } + "ARROW_RIGHT" { + image = "scroller-arrow-right.png" + } + "ARROW_RIGHT_HI" { + image = "scroller-arrow-right-hilight.png" + } + "ARROW_RIGHT_ACTIVE" { + image = "scroller-arrow-right-pressed.png" + } + "ARROW_LEFT" { + image = "scroller-arrow-left.png" + } + "ARROW_LEFT_HI" { + image = "scroller-arrow-left-hilight.png" + } + "ARROW_LEFT_ACTIVE" { + image = "scroller-arrow-left-pressed.png" + } + "H_SCROLLBAR" { + image = "scroller-h.png" + border = { 3, 3, 1, 1 } + recolor = <1> + } + "H_SCROLLBAR_HI" { + image = "scroller-h-hilight.png" + border = { 3, 3, 1, 1 } + recolor = <1> + } + "H_SCROLLBAR_INACTIVE" { + image = "scroller-h.png" + border = { 3, 3, 1, 1 } + recolor = <2> + } + "H_SCROLLBAR_THUMB" { + image = "scroller-h-thumb.png" + recolor = <1> + } + "H_SCROLLBAR_THUMB_HI" { + image = "scroller-h-thumb-hilight.png" + recolor = <1> + } + "H_SCROLLBAR_THUMB_INACTIVE" { + image = "scroller-h-thumb.png" + recolor = <2> + } + "V_SCROLLBAR" { + image = "scroller-v.png" + border = { 1, 1, 3, 3 } + recolor = <1> + } + "V_SCROLLBAR_HI" { + image = "scroller-v-hilight.png" + border = { 1, 1, 3, 3 } + recolor = <1> + } + "V_SCROLLBAR_INACTIVE" { + image = "scroller-v.png" + border = { 1, 1, 3, 3 } + recolor = <2> + } + "V_SCROLLBAR_THUMB" { + image = "scroller-v-thumb.png" + recolor = <1> + } + "V_SCROLLBAR_THUMB_HI" { + image = "scroller-v-thumb-hilight.png" + recolor = <1> + } + "V_SCROLLBAR_THUMB_INACTIVE" { + image = "scroller-v-thumb.png" + recolor = <2> + } + "PROGRESS_BAR" { + image = "progressbar.png" + border = { 4, 4, 1, 1 } + recolor = <1> + } + "PROGRESS_BAR_LEFT" { + image = "progressbar-left.png" + } + "PROGRESS_BAR_RIGHT" { + image = "progressbar-right.png" + border = { 0, 0, 2, 0 } + } + "PROGRESS_BAR_INACTIVE" { + image = "progressbar.png" + border = { 4, 4, 1, 1 } + recolor = <2> + } + "PROGRESS_TROUGH" { + image = "progressbar_trough.png" + border = { 6, 4, 6, 4 } + } + "H_SLIDER_THUMB" { + image = "slider_h_thumb.png" + border = { 4, 4, 1, 1 } + recolor = <1> + } + "H_SLIDER_THUMB_INACTIVE" { + image = "slider_h_thumb.png" + border = { 4, 4, 1, 1 } + recolor = <2> + } + "H_SLIDER_TROUGH" { + image = "slider_h_trough.png" + border = { 6, 6, 0, 0 } + } + "H_SLIDER_TROUGH_ACTIVE" { + image = "slider_h_trough_focus.png" + border = { 6, 6, 0, 0 } + recolor = <1> + } + "V_SLIDER_THUMB" { + image = "slider_v_thumb.png" + border = { 1, 1, 4, 4 } + recolor = <1> + } + "V_SLIDER_THUMB_INACTIVE" { + image = "slider_v_thumb.png" + border = { 1, 1, 4, 4 } + recolor = <2> + } + "V_SLIDER_TROUGH" { + image = "slider_v_trough.png" + border = { 0, 0, 6, 6 } + } + "V_SLIDER_TROUGH_ACTIVE" { + image = "slider_v_trough_focus.png" + border = { 0, 0, 6, 6 } + recolor = <1> + } + "TAB_TOP" { + image = "tab_usel.png" + border = { 4, 4, 10, 5 } + } + "TAB_TOP_LEFT" { + image = "tab_usel-left.png" + border = { 4, 4, 10, 5 } + } + "TAB_TOP_ACTIVE" { + image = "tab_sel.png" + border = { 4, 14, 10, 5 } + } + "TAB_BOTTOM" { + image = "tab_usel-bottom.png" + border = { 4, 4, 10, 5 } + } + "TAB_BOTTOM_LEFT" { + image = "tab_usel-bottom-left.png" + border = { 4, 4, 10, 5 } + } + "TAB_BOTTOM_ACTIVE" { + image = "tab_sel-bottom.png" + border = { 4, 4, 10, 5 } + } + "SPIN_ARROW_UP" { + image = "arrow_up-spinner.png" + } + "SPIN_ARROW_DOWN" { + image = "arrow_down-spinner.png" + } + } + } +} + +# common default +#class "GtkWidget" style "default" + + + +# MCC right icons: keep parent background on transparent parts +style "eventbox" +{ + # Causes the parent-relative feature of gdk_window_set_back_pixmap () + # to be used. + bg_pixmap[NORMAL] = "<parent>" + bg_pixmap[INSENSITIVE] = "<parent>" + bg_pixmap[PRELIGHT] = "<parent>" + bg_pixmap[SELECTED] = "<parent>" + bg_pixmap[ACTIVE] = "<parent>" + engine "crux-engine" {} +} + +# Ensure that there are no holes in tool bars, etc.. +class "GtkEventBox" style "eventbox" +class "GtkSocket" style "eventbox" +#class "GtkNotebook" style "eventbox" + + +# These don't work right with GTK2, ends up drawing black +#class "GtkPlug" style "eventbox" + diff --git a/drakconf.spec b/drakconf.spec index 2ad9e5cb..a9347530 100644 --- a/drakconf.spec +++ b/drakconf.spec @@ -1,39 +1,38 @@ # Changed by Makefile of cvs. # do not edit here, but in cvs/soft/control-center -Summary: The Mandrake Control Center -Name: drakconf -Version: 9.1 -Release: 0.3mdk +Summary: The Mandrake Control Center +Name: drakconf +Version: 9.1 +Release: 0.4mdk # get the source from our cvs repository (see # http://www.linuxmandrake.com/en/cvs.php3) -Source0: %name-%version.tar.bz2 -Source1: drakconf16.png.bz2 -Source2: drakconf32.png.bz2 -Source3: drakconf48.png.bz2 -License: GPL -Group: System/Configuration/Other -Url: http://www.mandrakelinux.com/en/cvs.php3 -Obsoletes: DrakConf -Provides: DrakConf +Source0: %name-%version.tar.bz2 +Source1: drakconf16.png.bz2 +Source2: drakconf32.png.bz2 +Source3: drakconf48.png.bz2 +License: GPL +Group: System/Configuration/Other +Url: http://www.mandrakelinux.com/en/cvs.php3 +Obsoletes: DrakConf +Provides: DrakConf BuildRequires: gettext -Requires: mandrake-release, drakxtools >= 1.1.12-2mdk, gtk+mdk >= 0.1.6-10mdk -Requires: menudrake >= 0.6.5-2mdk, harddrake-ui >= 1.1.8-16mdk -Requires: perl-GTK, perl-GTK-GdkImlib, usermode -Requires: popt >= 1.6.3-9mdk -Requires: XFree86-100dpi-fonts -Requires: rxvt, drakcronat >= 0.1.2-9mdk, draksec >= 0.1-4mdk, perl-GTK-GdkPixbuf, userdrake -BuildRoot: %_tmppath/%name-%version-buildroot +Requires: mandrake-release, drakxtools >= 9.1-0.4mdk +#gtk+mdk >= 0.1.6-10mdk +Requires: harddrake-ui >= 9.1-0.4mdk, popt >= 1.6.3-9mdk, usermode +Requires: perl-GTK2, gtk-engines2, XFree86-100dpi-fonts +Requires: drakcronat >= 0.1.2-9mdk, draksec >= 0.1-4mdk, menudrake >= 0.6.5-2mdk, rxvt, userdrake +BuildRoot: %_tmppath/%name-%version-buildroot %description drakconf includes the Mandrake Control Center which is an interface to multiple utilities from DrakXtools. %package themes -Summary: Mandrake Control Center Themes -Release: %{release}plf -Requires: drakconf >= %version -Group: System/Configuration/Other +Summary: Mandrake Control Center Themes +Release: %{release}plf +Requires: drakconf >= %version +Group: System/Configuration/Other %description themes This package contains fancy themes for the standard Mandrake Control @@ -109,6 +108,10 @@ rm -rf $RPM_BUILD_ROOT %_datadir/mcc/themes/kde %changelog +* Thu Dec 19 2002 Thierry Vignaud <tvignaud@mandrakesoft.com> 9.1-0.4mdk +- gtk+2 port +- lot of cleaning + * Wed Nov 27 2002 Thierry Vignaud <tvignaud@mandrakesoft.com> 9.1-0.3mdk - fix bad side effect of c-z by using a wrapper - make mcc more robust against embeded prog crashes |