From a173390d34fc7782b0cf94e3d8c9c9f4cb22d565 Mon Sep 17 00:00:00 2001 From: Matteo Pasotti Date: Sat, 12 Jan 2013 00:12:55 +0000 Subject: - gui.pm: added support for icons to tree and table; temporary disabled format_name_n_summary - icon.pm: made get_icon indipendent from gtk - localization.pm: temporary workaround to let rpmdragora access rpmdrake ts - rpmdragora: now use the workaround as the other modules --- AdminPanel/Rpmdragora/gui.pm | 23 ++- AdminPanel/Rpmdragora/icon.pm | 372 ++++++++++++++++++---------------- AdminPanel/Rpmdragora/localization.pm | 35 ++++ modules/rpmdragora/rpmdragora | 3 + 4 files changed, 247 insertions(+), 186 deletions(-) create mode 100644 AdminPanel/Rpmdragora/localization.pm diff --git a/AdminPanel/Rpmdragora/gui.pm b/AdminPanel/Rpmdragora/gui.pm index 3731871..6206492 100644 --- a/AdminPanel/Rpmdragora/gui.pm +++ b/AdminPanel/Rpmdragora/gui.pm @@ -33,6 +33,10 @@ use strict; our @ISA = qw(Exporter); use lib qw(/usr/lib/libDrakX); use common; + +# TO WORKAROUND LOCALIZATION ISSUE +use AdminPanel::Rpmdragora::localization; + use yui; use AdminPanel::rpmdragora; use AdminPanel::Rpmdragora::open_db; @@ -412,7 +416,7 @@ sub set_node_state { #$model->set($iter, $pkg_columns{state} => $state); #$model->set($iter, $pkg_columns{selected} => to_bool(member($state, qw(base installed to_install)))); #$pkg->{selected})); #$model->set($iter, $pkg_columns{selectable} => to_bool($state ne 'base')); - $iter->addCell($state,"/home/matteo/workspace/AdminPanel/trunk/modules/rpmdragora/icons/state_$state.png"); + $iter->addCell($state,"/usr/share/rpmdrake/icons/state_$state.png"); $iter->addCell("".to_bool(member($state, qw(base installed to_install))),''); $iter->addCell("".to_bool($state ne 'base'),''); } @@ -434,10 +438,12 @@ sub add_parent { my @items = split('\|', $root); my $i = 0; for my $item (@items) { + chomp $item; $item = trim($item); - my $treeItem = new yui::YTreeItem($item, 0); + my $treeItem; if($i == 0){ $parent = $item; + $treeItem = new yui::YTreeItem($item,get_icon($item,0),0); if(!defined($groups_tree{$parent})) { $groups_tree{$parent} = { parent => $treeItem, @@ -450,6 +456,7 @@ sub add_parent { # push @{$groups_tree{$parent}{'children'}}, $item; #} if(!defined($groups_tree{$parent}{'children'}{$item})){ + $treeItem = new yui::YTreeItem($item,get_icon($item,$parent),0); $groups_tree{$parent}{'children'}{$item} = $treeItem; $groups_tree{$parent}{'parent'}->addChild($treeItem); } @@ -476,16 +483,17 @@ sub add_node { $version = "" if(!defined($version)); $release = "" if(!defined($release)); $arch = "" if(!defined($arch)); - my $newTableItem = new yui::YTableItem(format_name_n_summary($name, get_summary($leaf)), + #my $newTableItem = new yui::YTableItem(format_name_n_summary($name, get_summary($leaf)), + my $newTableItem = new yui::YTableItem($name."\n".$leaf, $version, $release, $arch); - $w->{detail_list}->addItem($newTableItem); set_node_state($newTableItem, $state, $w->{detail_list}); + $w->{detail_list}->addItem($newTableItem); $ptree{$leaf} = [ $newTableItem->label() ]; } else { $iter = $w->{tree_model}->append_set(add_parent($w->{tree},$root, $state), [ $grp_columns{label} => $leaf ]); - push @{$wtree{$leaf}}, $iter; + #push @{$wtree{$leaf}}, $iter; } } else { my $parent = add_parent($w->{tree}, $root, $state); @@ -1107,7 +1115,8 @@ sub groups_tree { sub group_has_parent { my ($group) = shift; - return (defined($groups_tree{$group}{parent})); + return 0 if(!defined($group)); + return defined($groups_tree{$group}{parent}); } sub group_parent { @@ -1119,7 +1128,7 @@ sub group_parent { return $groups_tree{$group}{parent} if(group_has_parent($group)); for my $sup (keys %groups_tree){ for my $item(keys %{$groups_tree{$sup}{children}}){ - if($item eq $group){ + if(defined($group) && ($item eq $group)){ return $groups_tree{$sup}{parent}; } } diff --git a/AdminPanel/Rpmdragora/icon.pm b/AdminPanel/Rpmdragora/icon.pm index 8646432..11e51ef 100644 --- a/AdminPanel/Rpmdragora/icon.pm +++ b/AdminPanel/Rpmdragora/icon.pm @@ -29,204 +29,218 @@ our @ISA = qw(Exporter); use lib qw(/usr/lib/libDrakX); use common; +# TO WORKAROUND LOCALIZATION ISSUE +use AdminPanel::Rpmdragora::localization; our @EXPORT = qw(get_icon); #- /usr/share/rpmlint/config (duplicates are normal, so that we are not too far away from .py) my %group_icons = ( - N_("All") => 'system_section', - N_("Accessibility") => 'accessibility_section', - N_("Archiving") => 'archiving_section', - join('|', N_("Archiving"), N_("Backup")) => 'backup_section', - join('|', N_("Archiving"), N_("Cd burning")) => 'cd_burning_section', - join('|', N_("Archiving"), N_("Compression")) => 'compression_section', - join('|', N_("Archiving"), N_("Other")) => 'other_archiving', - N_("Communications") => 'communications_section', - join('|', N_("Communications"), N_("Bluetooth")) => 'communications_section', - join('|', N_("Communications"), N_("Bluetooth")) => 'communications_section', - join('|', N_("Communications"), N_("Dial-Up")) => 'communications_section', - join('|', N_("Communications"), N_("Fax")) => 'communications_section', - join('|', N_("Communications"), N_("Mobile")) => 'communications_section', - join('|', N_("Communications"), N_("Radio")) => 'communications_section', - join('|', N_("Communications"), N_("Serial")) => 'communications_section', - join('|', N_("Communications"), N_("Telephony")) => 'communications_section', - N_("Databases") => 'databases_section', - N_("Development") => 'development_section', - join('|', N_("Development"), N_("Basic")) => '', - join('|', N_("Development"), N_("C")) => '', - join('|', N_("Development"), N_("C++")) => '', - join('|', N_("Development"), N_("C#")) => '', - join('|', N_("Development"), N_("Databases")) => 'databases_section', - join('|', N_("Development"), N_("Erlang")) => '', - join('|', N_("Development"), N_("GNOME and GTK+")) => 'gnome_section', - join('|', N_("Development"), N_("Java")) => '', - join('|', N_("Development"), N_("KDE and Qt")) => 'kde_section', - join('|', N_("Development"), N_("Kernel")) => 'hardware_configuration_section', - join('|', N_("Development"), N_("OCaml")) => '', - join('|', N_("Development"), N_("Other")) => 'development_tools_section', - join('|', N_("Development"), N_("Perl")) => '', - join('|', N_("Development"), N_("PHP")) => '', - join('|', N_("Development"), N_("Python")) => '', - join('|', N_("Development"), N_("Tools")) => '', - join('|', N_("Development"), N_("X11")) => 'office_section', - N_("Documentation") => 'documentation_section', - N_("Editors") => 'emulators_section', - N_("Education") => 'education_section', - N_("Emulators") => 'emulators_section', - N_("File tools") => 'file_tools_section', - N_("Games") => 'amusement_section', - join('|', N_("Games"), N_("Adventure")) => 'adventure_section', - join('|', N_("Games"), N_("Arcade")) => 'arcade_section', - join('|', N_("Games"), N_("Boards")) => 'boards_section', - join('|', N_("Games"), N_("Cards")) => 'cards_section', - join('|', N_("Games"), N_("Other")) => 'other_amusement', - join('|', N_("Games"), N_("Puzzles")) => 'puzzle_section', - join('|', N_("Games"), N_("Shooter")) => 'other_amusement', - join('|', N_("Games"), N_("Sports")) => 'sport_section', - join('|', N_("Games"), N_("Strategy")) => 'strategy_section', - N_("Geography") => 'geosciences_section', - N_("Graphical desktop") => 'office_section', - join('|', N_("Graphical desktop"), + N("All") => 'system_section', + N("Accessibility") => 'accessibility_section', + N("Archiving") => 'archiving_section', + join('|', N("Archiving"), N("Backup")) => 'backup_section', + join('|', N("Archiving"), N("Cd burning")) => 'cd_burning_section', + join('|', N("Archiving"), N("Compression")) => 'compression_section', + join('|', N("Archiving"), N("Other")) => 'other_archiving', + N("Communications") => 'communications_section', + join('|', N("Communications"), N("Bluetooth")) => 'communications_section', + join('|', N("Communications"), N("Bluetooth")) => 'communications_section', + join('|', N("Communications"), N("Dial-Up")) => 'communications_section', + join('|', N("Communications"), N("Fax")) => 'communications_section', + join('|', N("Communications"), N("Mobile")) => 'communications_section', + join('|', N("Communications"), N("Radio")) => 'communications_section', + join('|', N("Communications"), N("Serial")) => 'communications_section', + join('|', N("Communications"), N("Telephony")) => 'communications_section', + N("Databases") => 'databases_section', + N("Development") => 'development_section', + join('|', N("Development"), N("Basic")) => '', + join('|', N("Development"), N("C")) => '', + join('|', N("Development"), N("C++")) => '', + join('|', N("Development"), N("C#")) => '', + join('|', N("Development"), N("Databases")) => 'databases_section', + join('|', N("Development"), N("Erlang")) => '', + join('|', N("Development"), N("GNOME and GTK+")) => 'gnome_section', + join('|', N("Development"), N("Java")) => '', + join('|', N("Development"), N("KDE and Qt")) => 'kde_section', + join('|', N("Development"), N("Kernel")) => 'hardware_configuration_section', + join('|', N("Development"), N("OCaml")) => '', + join('|', N("Development"), N("Other")) => 'development_tools_section', + join('|', N("Development"), N("Perl")) => '', + join('|', N("Development"), N("PHP")) => '', + join('|', N("Development"), N("Python")) => '', + join('|', N("Development"), N("Tools")) => '', + join('|', N("Development"), N("X11")) => 'office_section', + N("Documentation") => 'documentation_section', + N("Editors") => 'emulators_section', + N("Education") => 'education_section', + N("Emulators") => 'emulators_section', + N("File tools") => 'file_tools_section', + N("Games") => 'amusement_section', + join('|', N("Games"), N("Adventure")) => 'adventure_section', + join('|', N("Games"), N("Arcade")) => 'arcade_section', + join('|', N("Games"), N("Boards")) => 'boards_section', + join('|', N("Games"), N("Cards")) => 'cards_section', + join('|', N("Games"), N("Other")) => 'other_amusement', + join('|', N("Games"), N("Puzzles")) => 'puzzle_section', + join('|', N("Games"), N("Shooter")) => 'other_amusement', + join('|', N("Games"), N("Sports")) => 'sport_section', + join('|', N("Games"), N("Strategy")) => 'strategy_section', + N("Geography") => 'geosciences_section', + N("Graphical desktop") => 'office_section', + join('|', N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N_("Enlightenment")) => '', - join('|', N_("Graphical desktop"), N_("FVWM based")) => '', - join('|', N_("Graphical desktop"), + N("Enlightenment")) => '', + join('|', N("Graphical desktop"), N("FVWM based")) => '', + join('|', N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N_("GNOME")) => 'gnome_section', - join('|', N_("Graphical desktop"), + N("GNOME")) => 'gnome_section', + join('|', N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N_("Icewm")) => '', - join('|', N_("Graphical desktop"), + N("Icewm")) => '', + join('|', N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N_("KDE")) => 'kde_section', - join('|', N_("Graphical desktop"), N_("Other")) => 'more_applications_other_section', - join('|', N_("Graphical desktop"), + N("KDE")) => 'kde_section', + join('|', N("Graphical desktop"), N("Other")) => 'more_applications_other_section', + join('|', N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N_("Sawfish")) => '', - join('|', N_("Graphical desktop"), + N("Sawfish")) => '', + join('|', N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N_("WindowMaker")) => '', - join('|', N_("Graphical desktop"), + N("WindowMaker")) => '', + join('|', N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N_("Xfce")) => '', - N_("Graphics") => 'graphics_section', - join('|', N_("Graphics"), N_("3D")) => '', - join('|', N_("Graphics"), N_("Editors")) => '', - join('|', N_("Graphics"), N_("Other")) => '', - join('|', N_("Graphics"), N_("Photography")) => '', - join('|', N_("Graphics"), N_("Scanning")) => '', - join('|', N_("Graphics"), N_("Viewers")) => '', - N_("Monitoring") => 'monitoring_section', - N_("Multimedia") => 'multimedia_section', - join('|', N_("Multimedia"), N_("Video")) => 'video_section', - N_("Networking") => 'networking_section', - join('|', N_("Networking"), N_("Chat")) => 'chat_section', - join('|', N_("Networking"), N_("File transfer")) => 'file_transfer_section', - join('|', N_("Networking"), N_("IRC")) => 'irc_section', - join('|', N_("Networking"), N_("Instant messaging")) => 'instant_messaging_section', - join('|', N_("Networking"), N_("Mail")) => 'mail_section', - join('|', N_("Networking"), N_("News")) => 'news_section', - join('|', N_("Networking"), N_("Other")) => 'other_networking', - join('|', N_("Networking"), N_("Remote access")) => 'remote_access_section', - join('|', N_("Networking"), N_("WWW")) => 'networking_www_section', - N_("Office") => 'office_section', - join('|', N_("Office"), N_("Dictionary")) => '', - join('|', N_("Office"), N_("Finance")) => '', - join('|', N_("Office"), N_("Management")) => '', - join('|', N_("Office"), N_("Organizer")) => '', - join('|', N_("Office"), N_("Other")) => '', - join('|', N_("Office"), N_("Spreadsheet")) => '', - join('|', N_("Office"), N_("Suite")) => '', - join('|', N_("Office"), N_("Word processor")) => '', - N_("Public Keys") => 'packaging_section', - N_("Publishing") => 'publishing_section', - N_("Security") => 'packaging_section', - N_("Sciences") => 'sciences_section', - join('|', N_("Sciences"), N_("Astronomy")) => 'astronomy_section', - join('|', N_("Sciences"), N_("Biology")) => 'biology_section', - join('|', N_("Sciences"), N_("Chemistry")) => 'chemistry_section', - join('|', N_("Sciences"), N_("Computer science")) => 'computer_science_section', - join('|', N_("Sciences"), N_("Geosciences")) => 'geosciences_section', - join('|', N_("Sciences"), N_("Mathematics")) => 'mathematics_section', - join('|', N_("Sciences"), N_("Other")) => 'other_sciences', - join('|', N_("Sciences"), N_("Physics")) => 'physics_section', - N_("Shells") => 'shells_section', - N_("Sound") => 'sound_section', - join('|', N_("Sound"), N_("Editors and Converters")) => '', - join('|', N_("Sound"), N_("Midi")) => '', - join('|', N_("Sound"), N_("Mixers")) => '', - join('|', N_("Sound"), N_("Players")) => '', - join('|', N_("Sound"), N_("Utilities")) => '', - join('|', N_("Sound"), N_("Visualization")) => '', - N_("System") => 'system_section', - join('|', N_("System"), N_("Base")) => 'system_section', - join('|', N_("System"), N_("Cluster")) => 'parallel_computing_section', - join('|', N_("System"), N_("Configuration")) => 'configuration_section', - join('|', N_("System"), N_("Configuration"), N_("Boot and Init")) => 'boot_init_section', - join('|', N_("System"), N_("Configuration"), N_("Hardware")) => 'hardware_configuration_section', - join('|', N_("System"), N_("Configuration"), N_("Networking")) => 'networking_configuration_section', - join('|', N_("System"), N_("Configuration"), N_("Other")) => 'system_other_section', - join('|', N_("System"), N_("Configuration"), N_("Packaging")) => 'packaging_section', - join('|', N_("System"), N_("Configuration"), N_("Printing")) => 'printing_section', - join('|', N_("System"), N_("Fonts")) => 'chinese_section', - join('|', N_("System"), N_("Fonts"), N_("Console")) => 'interpreters_section', - join('|', N_("System"), N_("Fonts"), N_("True type")) => '', - join('|', N_("System"), N_("Fonts"), N_("Type1")) => '', - join('|', N_("System"), N_("Fonts"), N_("X11 bitmap")) => '', - join('|', N_("System"), N_("Internationalization")) => 'chinese_section', - join('|', N_("System"), N_("Kernel and hardware")) => 'hardware_configuration_section', - join('|', N_("System"), N_("Libraries")) => '', - join('|', N_("System"), N_("Printing")) => 'printing_section', - join('|', N_("System"), N_("Servers")) => '', - join('|', N_("System"), + N("Xfce")) => '', + N("Graphics") => 'graphics_section', + join('|', N("Graphics"), N("3D")) => '', + join('|', N("Graphics"), N("Editors")) => '', + join('|', N("Graphics"), N("Other")) => '', + join('|', N("Graphics"), N("Photography")) => '', + join('|', N("Graphics"), N("Scanning")) => '', + join('|', N("Graphics"), N("Viewers")) => '', + N("Monitoring") => 'monitoring_section', + N("Multimedia") => 'multimedia_section', + join('|', N("Multimedia"), N("Video")) => 'video_section', + N("Networking") => 'networking_section', + join('|', N("Networking"), N("Chat")) => 'chat_section', + join('|', N("Networking"), N("File transfer")) => 'file_transfer_section', + join('|', N("Networking"), N("IRC")) => 'irc_section', + join('|', N("Networking"), N("Instant messaging")) => 'instant_messaging_section', + join('|', N("Networking"), N("Mail")) => 'mail_section', + join('|', N("Networking"), N("News")) => 'news_section', + join('|', N("Networking"), N("Other")) => 'other_networking', + join('|', N("Networking"), N("Remote access")) => 'remote_access_section', + join('|', N("Networking"), N("WWW")) => 'networking_www_section', + N("Office") => 'office_section', + join('|', N("Office"), N("Dictionary")) => '', + join('|', N("Office"), N("Finance")) => '', + join('|', N("Office"), N("Management")) => '', + join('|', N("Office"), N("Organizer")) => '', + join('|', N("Office"), N("Other")) => '', + join('|', N("Office"), N("Spreadsheet")) => '', + join('|', N("Office"), N("Suite")) => '', + join('|', N("Office"), N("Word processor")) => '', + N("Public Keys") => 'packaging_section', + N("Publishing") => 'publishing_section', + N("Security") => 'packaging_section', + N("Sciences") => 'sciences_section', + join('|', N("Sciences"), N("Astronomy")) => 'astronomy_section', + join('|', N("Sciences"), N("Biology")) => 'biology_section', + join('|', N("Sciences"), N("Chemistry")) => 'chemistry_section', + join('|', N("Sciences"), N("Computer science")) => 'computer_science_section', + join('|', N("Sciences"), N("Geosciences")) => 'geosciences_section', + join('|', N("Sciences"), N("Mathematics")) => 'mathematics_section', + join('|', N("Sciences"), N("Other")) => 'other_sciences', + join('|', N("Sciences"), N("Physics")) => 'physics_section', + N("Shells") => 'shells_section', + N("Sound") => 'sound_section', + join('|', N("Sound"), N("Editors and Converters")) => '', + join('|', N("Sound"), N("Midi")) => '', + join('|', N("Sound"), N("Mixers")) => '', + join('|', N("Sound"), N("Players")) => '', + join('|', N("Sound"), N("Utilities")) => '', + join('|', N("Sound"), N("Visualization")) => '', + N("System") => 'system_section', + join('|', N("System"), N("Base")) => 'system_section', + join('|', N("System"), N("Cluster")) => 'parallel_computing_section', + join('|', N("System"), N("Configuration")) => 'configuration_section', + join('|', N("System"), N("Configuration"), N("Boot and Init")) => 'boot_init_section', + join('|', N("System"), N("Configuration"), N("Hardware")) => 'hardware_configuration_section', + join('|', N("System"), N("Configuration"), N("Networking")) => 'networking_configuration_section', + join('|', N("System"), N("Configuration"), N("Other")) => 'system_other_section', + join('|', N("System"), N("Configuration"), N("Packaging")) => 'packaging_section', + join('|', N("System"), N("Configuration"), N("Printing")) => 'printing_section', + join('|', N("System"), N("Fonts")) => 'chinese_section', + join('|', N("System"), N("Fonts"), N("Console")) => 'interpreters_section', + join('|', N("System"), N("Fonts"), N("True type")) => '', + join('|', N("System"), N("Fonts"), N("Type1")) => '', + join('|', N("System"), N("Fonts"), N("X11 bitmap")) => '', + join('|', N("System"), N("Internationalization")) => 'chinese_section', + join('|', N("System"), N("Kernel and hardware")) => 'hardware_configuration_section', + join('|', N("System"), N("Libraries")) => '', + join('|', N("System"), N("Printing")) => 'printing_section', + join('|', N("System"), N("Servers")) => '', + join('|', N("System"), #-PO: This is a package/product name. Only translate it if needed: - N_("X11")) => 'office_section', - N_("Terminals") => 'terminals_section', - N_("Text tools") => 'text_tools_section', - N_("Toys") => 'toys_section', - N_("Video") => 'video_section', - join('|', N_("Video"), N_("Editors and Converters")) => '', - join('|', N_("Video"), N_("Players")) => '', - join('|', N_("Video"), N_("Utilities")) => '', + N("X11")) => 'office_section', + N("Terminals") => 'terminals_section', + N("Text tools") => 'text_tools_section', + N("Toys") => 'toys_section', + N("Video") => 'video_section', + join('|', N("Video"), N("Editors and Converters")) => '', + join('|', N("Video"), N("Players")) => '', + join('|', N("Video"), N("Utilities")) => '', # for Mageia Choice: - N_("Workstation") => 'office_section', - join('|', N_("Workstation"), N_("Configuration")) => 'configuration_section', - join('|', N_("Workstation"), N_("Console Tools")) => 'interpreters_section', - join('|', N_("Workstation"), N_("Documentation")) => 'documentation_section', - join('|', N_("Workstation"), N_("Game station")) => 'amusement_section', - join('|', N_("Workstation"), N_("Internet station")) => 'networking_section', - join('|', N_("Workstation"), N_("Multimedia station")) => 'multimedia_section', - join('|', N_("Workstation"), N_("Network Computer (client)")) => 'other_networking', - join('|', N_("Workstation"), N_("Office Workstation")) => 'office_section', - join('|', N_("Workstation"), N_("Scientific Workstation")) => 'sciences_section', - N_("Graphical Environment") => 'office_section', + N("Workstation") => 'office_section', + join('|', N("Workstation"), N("Configuration")) => 'configuration_section', + join('|', N("Workstation"), N("Console Tools")) => 'interpreters_section', + join('|', N("Workstation"), N("Documentation")) => 'documentation_section', + join('|', N("Workstation"), N("Game station")) => 'amusement_section', + join('|', N("Workstation"), N("Internet station")) => 'networking_section', + join('|', N("Workstation"), N("Multimedia station")) => 'multimedia_section', + join('|', N("Workstation"), N("Network Computer (client)")) => 'other_networking', + join('|', N("Workstation"), N("Office Workstation")) => 'office_section', + join('|', N("Workstation"), N("Scientific Workstation")) => 'sciences_section', + N("Graphical Environment") => 'office_section', - join('|', N_("Graphical Environment"), N_("GNOME Workstation")) => 'gnome_section', - join('|', N_("Graphical Environment"), N_("IceWm Desktop")) => 'icewm', - join('|', N_("Graphical Environment"), N_("KDE Workstation")) => 'kde_section', - join('|', N_("Graphical Environment"), N_("Other Graphical Desktops")) => 'more_applications_other_section', - N_("Development") => 'development_section', - join('|', N_("Development"), N_("Development")) => 'development_section', - join('|', N_("Development"), N_("Documentation")) => 'documentation_section', - N_("Server") => 'archiving_section', - join('|', N_("Server"), N_("DNS/NIS")) => 'networking_section', - join('|', N_("Server"), N_("Database")) => 'databases_section', - join('|', N_("Server"), N_("Firewall/Router")) => 'networking_section', - join('|', N_("Server"), N_("Mail")) => 'mail_section', - join('|', N_("Server"), N_("Mail/Groupware/News")) => 'mail_section', - join('|', N_("Server"), N_("Network Computer server")) => 'networking_section', - join('|', N_("Server"), N_("Web/FTP")) => 'networking_www_section', + join('|', N("Graphical Environment"), N("GNOME Workstation")) => 'gnome_section', + join('|', N("Graphical Environment"), N("IceWm Desktop")) => 'icewm', + join('|', N("Graphical Environment"), N("KDE Workstation")) => 'kde_section', + join('|', N("Graphical Environment"), N("Other Graphical Desktops")) => 'more_applications_other_section', + N("Development") => 'development_section', + join('|', N("Development"), N("Development")) => 'development_section', + join('|', N("Development"), N("Documentation")) => 'documentation_section', + N("Server") => 'archiving_section', + join('|', N("Server"), N("DNS/NIS")) => 'networking_section', + join('|', N("Server"), N("Database")) => 'databases_section', + join('|', N("Server"), N("Firewall/Router")) => 'networking_section', + join('|', N("Server"), N("Mail")) => 'mail_section', + join('|', N("Server"), N("Mail/Groupware/News")) => 'mail_section', + join('|', N("Server"), N("Network Computer server")) => 'networking_section', + join('|', N("Server"), N("Web/FTP")) => 'networking_www_section', ); sub get_icon { - my ($group, $o_parent) = @_; - my $pixbuf; - my $path = $group =~ /\|/ ? '/usr/share/icons/mini/' : '/usr/share/icons/'; - my $create_pixbuf = sub { eval { gtknew('Pixbuf', file => join('', $path, $_[0], '.png')) } }; - $pixbuf = $create_pixbuf->($group_icons{$group}); - $pixbuf ||= $create_pixbuf->($group_icons{$o_parent}) if $o_parent; - $pixbuf ||= $create_pixbuf->('applications_section'); + my ($group, $parent) = @_; + my $path; + if($parent == 0){ + $path = '/usr/share/icons/'; + }else{ + $path = '/usr/share/icons/mini/'; + } + my $icon_path = ""; + if(defined($group_icons{$group})){ + $icon_path = join('', $path, $group_icons{$group}, '.png'); + }elsif(defined($group_icons{$parent."\|".$group})){ + $icon_path = join('', $path, $group_icons{$parent."\|".$group}, '.png'); + }else{ + $icon_path = join('', $path, 'applications_section', '.png'); + } + unless(-e $icon_path){ + $icon_path = join('', $path, 'applications_section', '.png'); + } + return $icon_path; } 1; diff --git a/AdminPanel/Rpmdragora/localization.pm b/AdminPanel/Rpmdragora/localization.pm new file mode 100644 index 0000000..fb199d9 --- /dev/null +++ b/AdminPanel/Rpmdragora/localization.pm @@ -0,0 +1,35 @@ +#!/usr/bin/perl +# vim: set et ts=4 sw=4: +package AdminPanel::Rpmdragora::localization; +#***************************************************************************** +# +# Copyright (c) 2013 Matteo Pasotti +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2, as +# published by the Free Software Foundation. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +#***************************************************************************** +use strict; +use warnings; +use diagnostics; +use lib qw(/usr/lib/libDrakX); +use common; + +Locale::gettext::bind_textdomain_codeset($_, 'UTF8') foreach 'libDrakX', if_(!$::isInstall, 'libDrakX-standalone'), + if_($::isRestore, 'draksnapshot'), if_($::isInstall, 'urpmi'), + 'drakx-net', 'drakx-kbd-mouse-x11', # shared translation + @::textdomains; + +#========= UGLY WORKAROUND ============ +push @::textdomains, 'rpmdrake'; +#========= UGLY WORKAROUND ============ diff --git a/modules/rpmdragora/rpmdragora b/modules/rpmdragora/rpmdragora index c927802..9a7599f 100755 --- a/modules/rpmdragora/rpmdragora +++ b/modules/rpmdragora/rpmdragora @@ -32,6 +32,9 @@ use lib qw(/usr/lib/libDrakX); use common; use utf8; +# TO WORKAROUND LOCALIZATION ISSUE +use AdminPanel::Rpmdragora::localization; + use AdminPanel::Rpmdragora::init; use standalone; #- standalone must be loaded very first, for 'explanations', but after rpmdragora::init use AdminPanel::rpmdragora; -- cgit v1.2.1