aboutsummaryrefslogtreecommitdiffstats
path: root/po
diff options
context:
space:
mode:
authorpapoteur-mga <yves.brungard_git@gadz.org>2013-11-19 22:08:45 +0100
committerpapoteur-mga <yves.brungard_git@gadz.org>2013-11-19 22:08:45 +0100
commita643c46ded2324682b2c68623a5f4ba4589c8650 (patch)
tree7bda1cf6222ffffb6c19461651784faf05e8a6ef /po
parentcdf7dae116a43589bff2f205af35dd4ce7d16707 (diff)
downloadisodumper-a643c46ded2324682b2c68623a5f4ba4589c8650.tar
isodumper-a643c46ded2324682b2c68623a5f4ba4589c8650.tar.gz
isodumper-a643c46ded2324682b2c68623a5f4ba4589c8650.tar.bz2
isodumper-a643c46ded2324682b2c68623a5f4ba4589c8650.tar.xz
isodumper-a643c46ded2324682b2c68623a5f4ba4589c8650.zip
Update pt_BR and sv
Diffstat (limited to 'po')
-rw-r--r--po/pt_BR.po91
-rw-r--r--po/sv.po59
2 files changed, 81 insertions, 69 deletions
diff --git a/po/pt_BR.po b/po/pt_BR.po
index b94421e..91ca9d8 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -9,51 +9,52 @@ msgstr ""
"Project-Id-Version: isodumper\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-02 16:41+0100\n"
-"PO-Revision-Date: 2008-09-28 23:20+0000\n"
-"Last-Translator: elias <Unknown>\n"
+"PO-Revision-Date: 2013-11-10 17:21-0300\n"
+"Last-Translator: Márcio Padula <padula1000@gmail.com>\n"
"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2009-06-12 12:08+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
+"X-Generator: Poedit 1.5.4\n"
#: lib/isodumper.py:98
msgid "Mb"
-msgstr ""
+msgstr "Mb"
#: lib/isodumper.py:115
msgid "Image: "
-msgstr "Imagem: "
+msgstr "Imagem:"
#: lib/isodumper.py:116
msgid "Target Device: "
-msgstr "Dispositivo alvo: "
+msgstr "Dispositivo alvo:"
#: lib/isodumper.py:119
msgid "The device is too small to contain the ISO file."
-msgstr ""
+msgstr "O dispositivo é muito pequeno para conter o arquivo ISO."
#: lib/isodumper.py:126
msgid "The device is bigger than 32 Gbytes. Are you sure you want use it?"
msgstr ""
+"O dispositivo é maior do que 32 Gbytes. Tem certeza que você quer usá-lo?"
#: lib/isodumper.py:143
msgid "Unmounting all partitions of "
-msgstr "Desmontando todas as partições de "
+msgstr "Desmontando todas as partições de"
#: lib/isodumper.py:145
msgid "Trying to unmount "
-msgstr "Tentando desmontar "
+msgstr "Tentando desmontar"
#: lib/isodumper.py:151
msgid " was terminated by signal "
-msgstr " foi terminado pelo sinal "
+msgstr " foi terminado pelo sinal"
#: lib/isodumper.py:151 lib/isodumper.py:157
msgid "Error, umount "
-msgstr "Erro, desmontar "
+msgstr "Erro, desmontar"
#: lib/isodumper.py:155
msgid " successfully unmounted"
@@ -61,61 +62,59 @@ msgstr " desmontado com sucesso"
#: lib/isodumper.py:157
msgid " returned "
-msgstr " retornado "
+msgstr " retornado"
#: lib/isodumper.py:160
msgid "Execution failed: "
-msgstr "Falha na execução: "
+msgstr "Falha na execução:"
#: lib/isodumper.py:168
msgid "Could not read mtab !"
-msgstr "Não pode ler mtab !"
+msgstr "Não foi possível ler mtab!"
#: lib/isodumper.py:177 lib/isodumper.py:200
msgid "Reading error."
-msgstr ""
+msgstr "Erro de leitura."
#: lib/isodumper.py:183
msgid "You have not the rights for writing on the device"
-msgstr ""
+msgstr "Você não tem os direitos para escrever no dispositivo"
#: lib/isodumper.py:188
msgid " to "
-msgstr " para "
+msgstr " para"
#: lib/isodumper.py:188
msgid "Writing "
-msgstr "Escrevendo "
+msgstr "Escrevendo"
#: lib/isodumper.py:189
-#, fuzzy
msgid "Executing copy from "
-msgstr "Executando: dd if="
+msgstr "Execução de cópia"
#: lib/isodumper.py:205 lib/isodumper.py:223
-#, fuzzy
msgid "Writing error."
-msgstr "Escrevendo "
+msgstr "Escrevendo erro."
#: lib/isodumper.py:210
msgid "Wrote: "
-msgstr "Escrevido: "
+msgstr "Escreveu:"
#: lib/isodumper.py:218
msgid " successfully written to"
-msgstr " escrito com sucesso a"
+msgstr " escrito com sucesso"
#: lib/isodumper.py:218
msgid "Image "
-msgstr "Imagem "
+msgstr "Imagem"
#: lib/isodumper.py:219
msgid "Bytes written: "
-msgstr ""
+msgstr "Bytes escrito:"
#: share/isodumper/isodumper.glade.h:1
msgid "IsoDumper"
-msgstr ""
+msgstr "IsoDumper"
#: share/isodumper/isodumper.glade.h:2
msgid ""
@@ -127,14 +126,13 @@ msgid ""
" the device during the following operation."
msgstr ""
"<b>Aviso</b>\n"
-" Isto irá <b>destruir todos os dados</b> do dispositivo\n"
-" alvo, você tem certeza que deseja prosseguir ?\n"
+" Isto irá <b>destruir todos os dados</b> no alvo\n"
+" dispositivo, você tem certeza que deseja continuar?\n"
"\n"
-" Se você disser sim aqui, por favor <b>não desplugue</b>\n"
+" Se você disser sim aqui, por favor <b>não desligue</b>\n"
" este dispositivo durante a operação seguinte."
#: share/isodumper/isodumper.glade.h:8
-#, fuzzy
msgid ""
"<b>Error</b>\n"
" Something went wrong, please see the details\n"
@@ -143,9 +141,12 @@ msgid ""
" A logfile isodumper.log with the content will be saved in your\n"
" homedir/.isodumper when the application is closed."
msgstr ""
-"<b>Erro<b/>Algo deu errado, por favor veja a janelade detalhes para o erro "
-"exatoUm arquivo log com o conteúdo sera salvo em seuhomedir se a aplicação "
-"for fechada"
+"<b>Erro<b/>\n"
+" Algo deu errado, por favor, consulte os detalhes\n"
+" janela para o erro exato.\n"
+" \n"
+" O arquivo de log da isodumper.log com o conteúdo será salvo na sua\n"
+"  homedir/.isodumper quando o aplicativo for fechado."
#: share/isodumper/isodumper.glade.h:14
msgid "Write Image:"
@@ -153,7 +154,7 @@ msgstr "Escrever Imagem:"
#: share/isodumper/isodumper.glade.h:15
msgid "Select an image file to be written to the device"
-msgstr "Selecionar um arquivo de imagem para ser escrito no dispositivo"
+msgstr "Selecione um arquivo de imagem a ser gravado no dispositivo"
#: share/isodumper/isodumper.glade.h:16
msgid "Select Image"
@@ -165,7 +166,7 @@ msgstr "para"
#: share/isodumper/isodumper.glade.h:18
msgid "Select target device to write the image to"
-msgstr "Selecione dispositivo alvo para escrever a imagem a"
+msgstr "Selecione dispositivo de destino para gravar a imagem em"
#: share/isodumper/isodumper.glade.h:19
msgid " "
@@ -177,7 +178,7 @@ msgstr "Detalhes"
#: share/isodumper/isodumper.glade.h:21
msgid "Write to device"
-msgstr "Escrever para o dispositivo"
+msgstr "Escreva para o dispositivo"
#: share/isodumper/isodumper.glade.h:22
msgid ""
@@ -187,9 +188,13 @@ msgid ""
" You need to plug in a USB Key\n"
" to which the image can be written."
msgstr ""
+"<b>Aviso</b>\n"
+" Não foram encontrados dispositivos de destino. \n"
+"\n"
+" Você precisa se conectar em uma chave USB\n"
+" para a qual a imagem pode ser gravada."
#: share/isodumper/isodumper.glade.h:27
-#, fuzzy
msgid ""
"<b>Success</b>\n"
" The image was successfully written to the\n"
@@ -199,9 +204,13 @@ msgid ""
" of the operation will be saved in your homedir/.isodumper/ when\n"
" you close the application."
msgstr ""
-"<b>Sucesso</b>A imagem foi escrita com sucesso parao dispositivo alvo.Você "
-"está livre para desplugar agora, um log daoperação será salva em sua Pasta "
-"Pessoal sevocê fechar esta aplicação."
+"<b>Sucesso</b>\n"
+" A imagem foi escrita com sucesso para o\n"
+" dispositivo alvo.\n"
+" \n"
+" Você já pode desligá-lo agora, um isodumper.log \n"
+" da operação será salvo no seu diretório de seu usuário/.isodumper/ quando\n"
+" você fechar o aplicativo."
#~ msgid "gtk-ok"
#~ msgstr "gtk-ok"
diff --git a/po/sv.po b/po/sv.po
index a2f4567..2026bfb 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -9,19 +9,20 @@ msgstr ""
"Project-Id-Version: isodumper\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-02 16:41+0100\n"
-"PO-Revision-Date: 2008-10-27 09:56+0000\n"
-"Last-Translator: Daniel Nylander <yeager@ubuntu.com>\n"
+"PO-Revision-Date: 2013-11-12 18:20+0100\n"
+"Last-Translator: Kristoffer Grundström <kristoffer.grundstrom1983@gmail."
+"com>\n"
"Language-Team: Swedish <sv@li.org>\n"
"Language: sv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2009-06-12 12:08+0000\n"
-"X-Generator: Launchpad (build Unknown)\n"
+"X-Generator: Poedit 1.5.4\n"
#: lib/isodumper.py:98
msgid "Mb"
-msgstr ""
+msgstr "Mb"
#: lib/isodumper.py:115
msgid "Image: "
@@ -33,11 +34,12 @@ msgstr "Målenhet: "
#: lib/isodumper.py:119
msgid "The device is too small to contain the ISO file."
-msgstr ""
+msgstr "Enheten är för liten för att innehålla ISO-filen."
#: lib/isodumper.py:126
msgid "The device is bigger than 32 Gbytes. Are you sure you want use it?"
msgstr ""
+"Enheten är större än 32 Gbytes. Är du säker på att du vill använda den?"
#: lib/isodumper.py:143
msgid "Unmounting all partitions of "
@@ -49,7 +51,7 @@ msgstr "Försöker att avmontera "
#: lib/isodumper.py:151
msgid " was terminated by signal "
-msgstr " blev terminerad med signal "
+msgstr " blev avslutad av signal"
#: lib/isodumper.py:151 lib/isodumper.py:157
msgid "Error, umount "
@@ -57,7 +59,7 @@ msgstr "Error, avmontera "
#: lib/isodumper.py:155
msgid " successfully unmounted"
-msgstr " avmonterades"
+msgstr " avmontering lyckades"
#: lib/isodumper.py:157
msgid " returned "
@@ -69,15 +71,15 @@ msgstr "Körningen misslyckades: "
#: lib/isodumper.py:168
msgid "Could not read mtab !"
-msgstr "Kunde inte läsa mtab!"
+msgstr "Kunde inte läsa mtab !"
#: lib/isodumper.py:177 lib/isodumper.py:200
msgid "Reading error."
-msgstr ""
+msgstr "Läs-fel."
#: lib/isodumper.py:183
msgid "You have not the rights for writing on the device"
-msgstr ""
+msgstr "Du har inte rättigheter för att skriva till enheten"
#: lib/isodumper.py:188
msgid " to "
@@ -88,14 +90,12 @@ msgid "Writing "
msgstr "Skriver "
#: lib/isodumper.py:189
-#, fuzzy
msgid "Executing copy from "
-msgstr "Kör: dd if="
+msgstr "Kör kopia från"
#: lib/isodumper.py:205 lib/isodumper.py:223
-#, fuzzy
msgid "Writing error."
-msgstr "Skriver "
+msgstr "Skriv-fel:"
#: lib/isodumper.py:210
msgid "Wrote: "
@@ -111,11 +111,11 @@ msgstr "Avbildningen "
#: lib/isodumper.py:219
msgid "Bytes written: "
-msgstr ""
+msgstr "Bytes skrivna:"
#: share/isodumper/isodumper.glade.h:1
msgid "IsoDumper"
-msgstr ""
+msgstr "IsoDumper"
#: share/isodumper/isodumper.glade.h:2
msgid ""
@@ -130,11 +130,10 @@ msgstr ""
" Detta kommer att <b>förstöra all data</b> på målenheten.\n"
" Är du säker på att du vill fortsätta?\n"
"\n"
-" Om du svarar ja här bör du <b>inte koppla från</b>\n"
+" Om du svarar ok här bör du <b>inte koppla från</b>\n"
" enheten under de följande åtgärderna."
#: share/isodumper/isodumper.glade.h:8
-#, fuzzy
msgid ""
"<b>Error</b>\n"
" Something went wrong, please see the details\n"
@@ -144,11 +143,11 @@ msgid ""
" homedir/.isodumper when the application is closed."
msgstr ""
"<b>Fel</b>\n"
-" Någonting gick fel. Se detaljfönstret\n"
-" för det exakta felet.\n"
+" Någonting gick fel. vänligen titta i detaljfönstret\n"
+" för det specifika felet.\n"
" \n"
-" En loggfil med innehållet kommer att sparas i\n"
-" din hemmapp om programmet stängs."
+" En loggfil kallad isodumper.log med innehållet kommer att sparas i\n"
+" hem-mappen/.isodumper när programmet stängs ner."
#: share/isodumper/isodumper.glade.h:14
msgid "Write Image:"
@@ -168,7 +167,7 @@ msgstr "till"
#: share/isodumper/isodumper.glade.h:18
msgid "Select target device to write the image to"
-msgstr "Välj målenhet för att skriva avbildningen till"
+msgstr "Välj målenhet att skriva avbilden till"
#: share/isodumper/isodumper.glade.h:19
msgid " "
@@ -190,9 +189,13 @@ msgid ""
" You need to plug in a USB Key\n"
" to which the image can be written."
msgstr ""
+"<b>Varning</b>\n"
+" Inga målenheter hittades. \n"
+"\n"
+" Du bör ansluta ett USB-minne\n"
+" som avbilden kan skrivas till."
#: share/isodumper/isodumper.glade.h:27
-#, fuzzy
msgid ""
"<b>Success</b>\n"
" The image was successfully written to the\n"
@@ -203,12 +206,12 @@ msgid ""
" you close the application."
msgstr ""
"<b>Lyckades</b>\n"
-" Avbildningen blev skrevs korrekt till\n"
+" Avbildningen skrevs korrekt till\n"
" målenheten.\n"
" \n"
-" Du kan koppla från enheten nu. En logg av\n"
-" åtgärderna kommer att sparas i din hemmapp om\n"
-" du stänger programmet."
+" Du kan nu koppla från enheten. En logg kallad isodumper.log \n"
+" av åtgärderna kommer att sparas i hem-mappen{.isodumper/ när\n"
+" du stänger ner programmet."
#~ msgid "The dd process ended with an error !"
#~ msgstr "dd-processen avslutades med ett fel!"
d='n685' href='#n685'>685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997
package interactive::gtk; # $Id: gtk.pm 261628 2009-10-09 16:25:51Z tv $

use diagnostics;
use strict;
use vars qw(@ISA);

@ISA = qw(interactive);

use interactive;
use common;
use mygtk2;
use ugtk2 qw(:helpers :wrappers :create);
use Gtk2::Gdk::Keysyms;

my $forgetTime = 1000; #- in milli-seconds

sub new {
    my $w = &interactive::new;
    ($w->{windowwidth}, $w->{windowheight}) = gtkroot()->get_size if !$::isInstall;
    $w;
}
sub enter_console { my ($o) = @_; $o->{suspended} = common::setVirtual(1) }
sub leave_console { my ($o) = @_; common::setVirtual(delete $o->{suspended}) }
sub adapt_markup { 
    #- nothing needed, the default markup is gtk2's
    my ($_o, $s) = @_; return $s;
}

sub exit { ugtk2::exit(@_) }

sub ask_fileW {
    my ($in, $common) = @_;

    my $w = ugtk2::create_file_selector(%$common);

    my $file;
    $w->main(sub { 
	$file = $w->{chooser}->get_filename;
	my $err = ugtk2::file_selected_check($common->{save}, $common->{want_a_dir}, $file);
	$err and $in->ask_warn('', $err);
	!$err;
    }) && $file;
}

sub create_boxradio {
    my ($e, $onchange_f, $double_click) = @_;

    my $boxradio = gtkpack2__(Gtk2::VBox->new,
			      my @radios = gtkradio('', @{$e->{formatted_list}}));
    my $tips = Gtk2::Tooltips->new;
    mapn {
	my ($txt, $w) = @_;
	# workaround infamous 6 years old gnome bug #101968:
	$w->child->set_size_request(mygtk2::get_label_width(), -1) if $e->{alignment} ne 'right' && !$e->{label};
	$w->signal_connect(button_press_event => $double_click) if $double_click;

	$w->signal_connect(key_press_event => $e->{may_go_to_next});
	$w->signal_connect(clicked => sub { 
	    ${$e->{val}} ne $txt or return;
	    $onchange_f->(sub { $txt });
	});
	if ($e->{help}) {
	    gtkset_tip($tips, $w,
		       ref($e->{help}) eq 'HASH' ? $e->{help}{$txt} :
		       ref($e->{help}) eq 'CODE' ? $e->{help}($txt) : $e->{help});
	}
    } $e->{list}, \@radios;

    $boxradio, sub {
	my ($v, $full_struct) = @_;
	mapn { 
	    $_[0]->set_active($_[1] eq $v);
	    $full_struct->{focus_w} = $_[0] if $_[1] eq $v;
	} \@radios, $e->{list};
    }, $radios[0];
}

sub create_treeview_list {
    my ($e, $onchange_f, $double_click) = @_;
    my $curr;

    my $list = Gtk2::ListStore->new("Glib::String");
    my $list_tv = Gtk2::TreeView->new_with_model($list);
    $list_tv->set_headers_visible(0);
    $list_tv->get_selection->set_mode('browse');
    my $textcolumn = Gtk2::TreeViewColumn->new_with_attributes(undef, my $renderer = Gtk2::CellRendererText->new, 'text' => 0);
    $list_tv->append_column($textcolumn);
    $renderer->set_property('ellipsize', 'end');
    
    my $select = sub {
	my ($path) = @_;
	return if !$list_tv->get_model;
	$list_tv->set_cursor($path, undef, 0);
	Glib::Timeout->add(100, sub { $list_tv->scroll_to_cell($path, undef, 1, 0.5, 0); 0 });
    };

    my ($starting_word, $start_reg) = ('', '^');
    my $timeout;
    $list_tv->set_enable_search(0);
    $list_tv->signal_connect(key_press_event => sub {
        my ($_w, $event) = @_;
	my $c = chr($event->keyval & 0xff);

	Glib::Source->remove($timeout) if $timeout; $timeout = '';
	
	if ($event->keyval >= 0x100) {
	    $e->{may_go_to_next}(), return 1 if member($event->keyval, ($Gtk2::Gdk::Keysyms{Return}, $Gtk2::Gdk::Keysyms{KP_Enter}));
	    $starting_word = '' if !member($event->keyval, ($Gtk2::Gdk::Keysyms{Control_L}, $Gtk2::Gdk::Keysyms{Control_R}));
	} else {
	    if (member('control-mask', @{$event->state})) {
		$c eq 's' or return 1;
		$start_reg and $start_reg = '', return 1;
		$curr++;
	    } else {
		$e->{may_go_to_next}(), return 1 if $c eq ' ';

		$curr++ if $starting_word eq '' || $starting_word eq $c;
		$starting_word .= $c unless $starting_word eq $c;
	    }
	    my @l = @{$e->{formatted_list}};
	    my $word = quotemeta $starting_word;
	    my $j; for ($j = 0; $j < @l; $j++) {
		 $l[($j + $curr) % @l] =~ /$start_reg$word/i and last;
	    }
	    if ($j == @l) {
		$starting_word = '';
	    } else {
		$select->(Gtk2::TreePath->new_from_string(($j + $curr) % @l));
	    }

	    $timeout = Glib::Timeout->add($forgetTime, sub { $timeout = $starting_word = ''; 0 });
	}
	0;
    });
    $list_tv->show;

    $list->append_set([ 0 => $_ ]) foreach @{$e->{formatted_list}};

    $list_tv->get_selection->signal_connect(changed => sub {
	my ($model, $iter) = $_[0]->get_selected;
	$model && $iter or return;
	$onchange_f->(sub {
	    my $row = $model->get_path_str($iter);
	    $e->{list}[$curr = $row];
	});
    });
    $list_tv->signal_connect(button_press_event => $double_click) if $double_click;

    $list_tv, sub {
	my ($v) = @_;
	eval {
	    my $nb = find_index { $_ eq $v } @{$e->{list}};
	    my ($old_path) = $list_tv->get_cursor;
	    if (!$old_path || $nb != $old_path->to_string) {
		$select->(Gtk2::TreePath->new_from_string($nb));
	    }
	    undef $old_path if $old_path;
	};
    };
}

sub __create_tree_model {
    my ($e) = @_;

    my $sep = quotemeta $e->{separator};
    my $tree_model = Gtk2::TreeStore->new("Glib::String", if_($e->{image2f}, "Gtk2::Gdk::Pixbuf"));

    my $build_value = sub {
	my ($v) = @_;
	my $type = 0;
	if ($e->{image2f}) {
	    my $image = $e->{image2f}->($_[0]);
	    ($type, $v) = (1, gtkcreate_pixbuf($image)) if $image; 
	}
	[ $type => $v ];
    };

    my (%wtree, $parent);
    $parent = sub {
	if (my $w = $wtree{"$_[0]$e->{separator}"}) { return $w }
	my $s = '';
	foreach (split $sep, $_[0]) {
	    $wtree{"$s$_$e->{separator}"} ||= 
	      $tree_model->append_set($s ? $parent->($s) : undef, $build_value->($_));
	    $s .= "$_$e->{separator}";
	}
	$wtree{$s};
    };

    $tree_model->{path_str_list} = [ map {
	my ($root, $leaf) = /(.*)$sep(.+)/ ? ($1, $2) : ('', $_);
	my $iter = $tree_model->append_set($parent->($root), $build_value->($leaf));

	$tree_model->get_path_str($iter);
    } @{$e->{formatted_list}} ];

    undef $_ foreach values %wtree;
    undef %wtree;

    $tree_model;
}

sub create_treeview_tree {
    my ($e, $onchange_f, $double_click) = @_;

    my $tree_model = __create_tree_model($e);
    my $tree = Gtk2::TreeView->new_with_model($tree_model);
    $tree->get_selection->set_mode('browse');
    {
	my $col = Gtk2::TreeViewColumn->new;
	$col->pack_start(my $texrender = Gtk2::CellRendererText->new, 0);
	$col->add_attribute($texrender, text => 0);
	if ($e->{image2f}) {
	    $col->pack_start(my $pixrender = Gtk2::CellRendererPixbuf->new, 0);
	    $col->add_attribute($pixrender, pixbuf => 1);
	}
	$tree->append_column($col);
    }
    $tree->set_headers_visible(0);

    my $select = sub {
	my ($path_str) = @_;
	my $path = Gtk2::TreePath->new_from_string($path_str);
	$tree->expand_to_path($path);
	$tree->set_cursor($path, undef, 0);
        gtkflush();  #- workaround gtk2 bug not honouring centering on the given row if node was closed
	$tree->scroll_to_cell($path, undef, 1, 0.5, 0);
    };

    my $curr = $tree_model->get_iter_first; #- default value
    $tree->expand_all if $e->{tree_expanded};

    my $selected_via_click;

    $tree->get_selection->signal_connect(changed => sub {
	my ($model, $iter) = $_[0]->get_selected;
	$model && $iter or return;
	undef $curr if ref $curr;
	my $path = $tree_model->get_path($curr = $iter);
	if (!$tree_model->iter_has_child($iter)) {
	    $onchange_f->(sub {
		my $path_str = $path->to_string;
		my $i = find_index { $path_str eq $_ } @{$tree_model->{path_str_list}};
		$e->{list}[$i];
	    });
	} else {
	    $tree->expand_row($path, 0) if $selected_via_click;
	}
    });
    my ($starting_word, $start_reg) = ('', "^");
    my $timeout;

    my $toggle = sub {
	if ($tree_model->iter_has_child($curr)) {
	    $tree->toggle_expansion($tree_model->get_path($curr), 0);

	} else {
	    &{$e->{may_go_to_next}};
	}
    };

    $tree->set_enable_search(0);
    $tree->signal_connect(key_press_event => sub {
        my ($_w, $event) = @_;
	$selected_via_click = 0;
	my $c = chr($event->keyval & 0xff);
	$curr or return 0;
	Glib::Source->remove($timeout) if $timeout; $timeout = '';

	if ($event->keyval >= 0x100) {
	    &$toggle and return 1 if member($event->keyval, ($Gtk2::Gdk::Keysyms{Return}, $Gtk2::Gdk::Keysyms{KP_Enter}));
	    $starting_word = '' if !member($event->keyval, ($Gtk2::Gdk::Keysyms{Control_L}, $Gtk2::Gdk::Keysyms{Control_R}));
	} else {
	    my $next;
	    if (member('control-mask', @{$event->state})) {
		$c eq "s" or return 1;
		$start_reg and $start_reg = '', return 0;
		$next = 1;
	    } else {
		&$toggle and return 1 if $c eq ' ';
		$next = 1 if $starting_word eq '' || $starting_word eq $c;
		$starting_word .= $c unless $starting_word eq $c;
	    }
	    my $word = quotemeta $starting_word;
	    my ($after, $best);

	    my $sep = quotemeta $e->{separator};
	    my $currpath = $tree_model->get_path_str($curr);
	    mapn {
		my ($path_str, $v) = @_;
		$next &&= !$after;
		$after ||= $path_str eq $currpath;
		$v =~ s/.*$sep//;
		if ($v =~ /$start_reg$word/i) {
		    if ($after && !$next) {
			($best, $after) = ($path_str, 0);
		    } else {
			$best ||= $path_str;
		    }
		}
	    } $tree_model->{path_str_list}, $e->{formatted_list};

	    if (defined $best) {
		$select->($best);
	    } else {
		$starting_word = '';
	    }

	    $timeout = Glib::Timeout->add($forgetTime, sub { $timeout = $starting_word = ''; 0 });
	}
	0;
    });
    $tree->signal_connect(button_press_event => sub {
	$selected_via_click = 1;
	&$double_click if $curr && !$tree_model->iter_has_child($curr) && $double_click;
    });

    $tree, sub {
        my $v = may_apply($e->{format}, $_[0]);
        eval {
            my $i = find_index { $v eq $_ } @{$e->{formatted_list}};

            my ($model, $iter) = $tree->get_selection->get_selected;

            my $new_path_str = $tree_model->{path_str_list}[$i];
            my $old_path_str = $model && $tree_model->get_path_str($iter);

            $select->($new_path_str) if $new_path_str ne $old_path_str;
            undef $iter if ref $iter;
        };
    };
}

#- $actions is a ref list of $action
#- $action is a { kind => $kind, action => sub { ... }, button => Gtk2::Button->new(...) }
#-   where $kind is one of '', 'modify', 'remove', 'add'
sub add_modify_remove_action {
    my ($button, $buttons, $e, $treelist) = @_;

    if (member($button->{kind}, 'modify', 'remove')) {
	@{$e->{list}} or return;
    }
    my $r = $button->{action}->(${$e->{val}});
    defined $r or return;
    
    if ($button->{kind} eq 'add') {
	${$e->{val}} = $r;
    } elsif ($button->{kind} eq 'remove') {
	${$e->{val}} = $e->{list}[0];
    }
    ugtk2::gtk_set_treelist($treelist, [ map { may_apply($e->{format}, $_) } @{$e->{list}} ]);

    add_modify_remove_sensitive($buttons, $e);
    1;
}

sub add_padding {
    my ($w) = @_;
    gtknew('HBox', children => [
        0, gtknew('Alignment', width => $mygtk2::left_padding),
        1, $w
    ]);
}  

sub create_widget {
    my ($o, $common, $e, $onchange_f, $update, $ignore_ref) = @_;

    my $onchange = sub {
	my ($f) = @_;
	sub { $onchange_f->($f, @_) };
    };

    my ($w, $real_w, $focus_w, $set);
    if ($e->{type} eq 'iconlist') {
	$w = Gtk2::Button->new;
	$set = sub {
	    gtkdestroy($e->{icon});
	    my $f = $e->{icon2f}->($_[0]);
	    $e->{icon} = -e $f ?
	      gtkcreate_img($f) :
		Gtk2::WrappedLabel->new(may_apply($e->{format}, $_[0]));
	    $w->add(gtkshow($e->{icon}));
	};
	$w->signal_connect(clicked => sub {
			       $onchange_f->(sub { next_val_in_array(${$e->{val}}, $e->{list}) });
			       $set->(${$e->{val}});
			   });
        if ($e->{alignment} eq 'right') {
            $real_w = gtknew('HButtonBox', layout => 'start', children_tight => [ $w ]);
        } else {
            $real_w = gtkpack_(Gtk2::HBox->new(0,10), 1, Gtk2::HBox->new(0,0), 0, $w, 1, Gtk2::HBox->new(0,0));
        }
    } elsif ($e->{type} eq 'bool') {
	if ($e->{image}) {
	    $w = ugtk2::gtkadd(Gtk2::CheckButton->new, gtkshow(gtkcreate_img($e->{image})));
	} else {
	    #-		warn "\"text\" member should have been used instead of \"label\" one at:\n", common::backtrace(), "\n" if $e->{label} && !$e->{text};
	    $w = Gtk2::CheckButton->new_with_label($e->{text});
	}
	$w->signal_connect(clicked => $onchange->(sub { $w->get_active }));
	$set = sub { $w->set_active($_[0]) };
        $real_w = add_padding($w);
    } elsif ($e->{type} eq 'only_label') {
        my @common = (
            # workaround infamous 6 years old gnome bug #101968:
            if_($e->{alignment} ne 'right', width => mygtk2::get_label_width())
        );
	$w = $e->{title} ? 
	         gtknew('Title2', label => escape_text_for_TextView_markup_format(${$e->{val}}), @common) :
		 gtknew($e->{alignment} eq 'right' ? 'Label_Right' : 'Label_Left',
                        line_wrap => 1, text_markup => ${$e->{val}}, @common);
    } elsif ($e->{type} eq 'label') {
	$w = gtknew('WrappedLabel', text_markup => ${$e->{val}});
	$set = sub { $w->set($_[0]) };
    } elsif ($e->{type} eq 'empty') {
	$w = gtknew('HBox', height => $e->{height});
    } elsif ($e->{type} eq 'button') {
	$w = gtknew(($e->{install_button} ? 'Install_Button' : 'Button'), 
                    text => '', clicked => $e->{clicked_may_quit_cooked});
	$set = sub {
            my $w = $w->child;
            # handle Install_Buttons: