summaryrefslogtreecommitdiffstats
path: root/perl-install/pixmaps/default.png
blob: c96abec09f049a0bdc437e9bf8f715476a25a21f (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 30 00 00 00 30 08 06 00 00 00 57 02 f9 .PNG........IHDR...0...0.....W..
0020 87 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 12 00 .....bKGD..............pHYs.....
0040 00 0b 12 01 d2 dd 7e fc 00 00 00 07 74 49 4d 45 07 d2 09 04 0f 0b 13 7d 46 3d 8a 00 00 06 32 49 ......~.....tIME.......}F=....2I
0060 44 41 54 78 9c dd 9a 6b 6c 14 d7 15 c7 7f 77 1e 3b f6 82 cd 62 af e3 d8 d8 c4 24 06 63 a7 b5 13 DATx...kl.....w.;...b.....$.c...
0080 51 a7 ae 94 82 1d 20 71 a1 51 95 44 41 8d d4 7e a0 52 81 b6 51 d5 4f 91 22 e5 43 92 2f 95 52 25 Q......q.Q.DA..~.R..Q.O.".C./.R%
00a0 52 a4 08 09 b3 58 51 5a 91 46 8a aa 48 4d 15 a4 20 0b 29 4f 35 a2 72 1e 8d 00 41 30 18 4c 08 50 R....XQZ.F..HM....)O5.r...A0.L.P
00c0 bc 5e ef 63 76 66 ee ed 87 f5 42 0c fb b4 af a3 d2 bf 34 d2 ee cc dd f3 3f ff 7b e6 9c fb 5a a1 .^.cvf....B.......4.....?.{...Z.
00e0 94 a2 18 76 ef de 5d f4 59 1e a3 a3 a3 00 6a dd fa ef b3 bc fe 36 22 2b 6f c7 f3 02 3c 3f c0 f3 ...v..].Y.....j......6"+o...<?..
0100 25 57 af 4c 11 f8 1e 17 26 3f 23 14 0a 89 1d 3b 76 94 b5 99 c7 be 7d fb ca b6 b1 2a b6 76 83 d3 %W.L....&?#....;v.....}....*.v..
0120 52 4a d5 b9 76 3d 4f fe e1 39 7e f0 c3 07 91 66 88 d9 84 4b 32 99 22 95 72 49 a7 b3 a4 33 1e a9 RJ..v=O..9~....f...K2.".rI...3..
0140 8c 47 3a e3 93 49 07 5c bc 70 5c bd 33 f6 01 c9 f8 04 61 c7 17 db b6 6d 5b 08 fd e2 04 c4 62 31 .G:..I.\.p\.3.....a....m[.....b1
0160 65 5b 26 4f 3f f3 02 db 7f f6 4b ae c6 13 24 12 69 92 a9 34 28 1f b8 31 a2 0a 90 80 4f fd ca 36 e[&O?.....K...$.i..4(..1....O..6
0180 d6 f6 3e 86 9b 09 38 3f f1 be 3a f8 fa 9b dc d3 d7 23 7a 7a 7a 96 5e c0 c8 c8 08 42 08 d5 d5 b5 ..>...8?..:......#zzz.^....B....
01a0 9e 37 de 3c 8c 12 21 a6 e3 49 7c cf 05 15 54 41 a9 80 80 c6 96 0d 84 eb d7 f1 c5 89 43 ea ec d9 .7.<..!..I|...TA............C...
01c0 43 0c 0f 0f 8b ea dd 07 a3 1a e7 bb bb bb f9 fb 3f 8e 10 0e d7 e2 ba 19 a4 f4 17 c2 79 0d a6 e5 C...............?...........y...
01e0 70 fb 9a 9f 10 4f d6 31 36 36 56 3c 19 4b a0 22 01 86 61 a8 50 c8 e6 f0 d8 87 d4 d6 2e c3 75 5d p....O.166V<.K."..a.P.........u]
0200 94 92 0b e1 2b 00 45 6b c7 30 df 5c 11 4c 4d 4d 55 fd eb b2 02 0e 1c 38 80 94 92 17 5f 7a 85 e5 ....+.Ek.0.\.LMMU......8...._z..
0220 cb ea c8 66 5d 8a 57 2e 8b 4c 2a cd c4 a9 cf 38 7b fa 73 ce 9d f9 02 d7 cd 54 42 43 cb ea 2d 8c ...f].W..L*....8{.s......TBC..-.
0240 7f fa ef aa a3 50 36 07 94 52 aa b5 b5 85 df fd f6 d7 5c f9 4f 06 29 0b f5 bc 60 72 e2 04 7f 7b .....P6..R........\.O.)...`r...{
0260 63 2f d9 cc 34 4a 29 66 67 67 89 c7 e3 cc cc cc d0 be 66 03 5d bd 0f e3 2c 6b 2e ca 63 9a 0e ae c/..4J)fgg........f.]...,k..c...
0280 df cc a5 4b 97 68 6a 6a d2 23 60 ae 5c f2 c8 a3 8f 13 28 f0 fd 42 ef bc e0 cc e9 63 fc 39 f6 1c ...K.hjj.#`.\.....(..B.....c.9..
02a0 43 43 43 d7 6f ce e1 e4 c9 93 ea c8 91 23 7c 7d fe 53 ee 1f 7e 16 61 d5 17 e5 8b 34 f6 70 fc f8 CCC.o........#|}.S..~.a....4.p..
02c0 c7 aa a9 a9 a9 e2 84 ae 28 07 f6 ec d9 43 10 50 b0 f7 0d d3 66 64 ef f3 79 e7 c5 b7 9d 07 e8 ec ........(....C.P....fd..y.......
02e0 ec 14 fd fd fd c2 cb fa 9c f8 fc ed 1b 1f cf 83 1d aa 27 91 a8 ae 30 94 13 a0 00 be 77 77 37 00 ..................'...0.....ww7.
0300 42 cc 27 17 86 c5 47 ef 1d a2 21 b2 bc a4 91 be be 3e c2 e1 30 e7 4f 7f 8c ef a5 4b 33 9a e1 32 B.'...G...!......>..0.O....K3..2
0320 2e cd 47 49 01 4a 29 06 07 07 73 76 4d b0 2c 0b 21 0c 84 30 30 4c 1b db 0e 71 f4 93 f7 e8 eb eb ..GI.J)...svM.,.!..00L...q......
0340 83 52 5d 0b 38 8e 03 40 62 7a b2 a4 43 a2 b4 99 9b 50 32 07 82 e0 fa 00 65 0a 70 9c 1a 1c 4f 21 .R].8..@bz..C....P2.....e.p...O!
0360 95 49 40 00 02 bc 6c 1a 88 94 25 72 1c 47 70 f3 30 bd 68 94 ad 42 e3 e3 e3 6c da 34 88 94 0a 37 .I@...l...%r.Gp.0.h..B...l.4...7
0380 eb 12 04 72 ae 8c 0a 9c 9a e5 64 d2 71 ee ec 68 29 db 6d 89 44 a2 42 97 aa d3 58 52 c0 ae 5d bb ...r......d.q..h).m.D.B...XR..].
03a0 f2 8e 95 b2 5a 51 cc b3 d9 ac 02 a8 8b b4 13 94 9a 79 a8 4c 25 e6 ae a1 a2 2a c4 f5 ea 52 e8 aa ....ZQ...........y.L%....*...R..
03c0 08 9e e7 d1 b1 6e 08 cb ae 2d de 26 3b 43 c3 ca 9a 4a 4d 02 95 0b 58 14 f6 ef df af 56 34 b4 b3 .....n...-.&;C...JM...X.....V4..
03e0 ae f7 61 4a 05 73 fa ca 97 74 75 75 55 65 7b 41 eb 81 4a 91 9f 04 46 1a db d9 38 fc 34 be 04 3f ..aJ.s...tuuUe{A..J...F...8.4..?
0400 e3 15 6c eb 65 67 a8 0b 5f 65 c5 8a de aa 38 96 2c 02 b1 58 0c 40 75 76 6f 64 fb cf ff 84 1d 72 ..l.eg.._e....8.,..X.@uvod.....r
0420 8a b6 95 81 cb e4 57 6f 33 34 78 3f 54 f1 5a c2 12 45 20 16 8b 21 a5 54 5b 7e fa 24 6b d6 3f 40 ......Wo34x?T.Z..E...!.T[~.$k.?@
0440 3a 9d 2c da 36 f0 5d 2e 9e 79 97 87 b6 fe 08 d3 34 ab e6 d2 2e 20 16 8b a9 90 63 f3 c4 ce 17 a9 :.,.6.]..y......4.........c.....
0460 6f b8 83 54 49 e7 33 4c 1e 3b c8 43 5b ee a3 b9 b9 19 aa ec 7d d0 2c 20 e7 bc c3 ce df bc 4c a4 o..TI.3L.;.C[.......}.,.......L.
0480 8c f3 e9 d9 0b 5c 3c f5 16 bf 78 62 3b 86 61 c0 02 9c 07 8d 02 f2 eb 86 ad db 7e c5 aa d5 5d cc .....\<...xb;.a...........~...].
04a0 26 66 8a b4 14 7c 73 fe 13 64 72 9c c7 1e 1d ce dd 58 04 b4 25 b1 52 4a 35 44 9b d9 ba 7d 27 81 &f...|s..dr......X..%.RJ5D...}'.
04c0 5f b8 d2 80 e0 d8 d1 bf d0 58 3b c1 e6 07 36 e6 6e 2c 12 5a 22 30 32 32 02 40 ef bd 9b 08 02 1f _........X;...6.n,.Z"022.@......
04e0 28 3c d4 7e 79 f4 20 03 1b 56 11 8d 46 41 83 f3 a0 29 02 f9 ea d1 b6 7a 2d 4a 16 76 fe f2 d7 c7 (<.~y....V..FA...).....z-J.v....
0500 89 84 13 5a 9d 07 cd 02 1a 9b da 8a 8c b3 82 73 a7 ff 49 7f 7f 7f ee 8b 46 68 11 20 84 50 00 2d ...Z...........s..I.....Fh...P.-
0520 ab ee c4 30 cc 1b cc 0a c0 c6 09 55 b3 77 54 39 74 09 00 a0 ad fd 2e 4c cb c2 30 43 20 6c c0 06 ...0.......U.wT9t......L..0C.l..
0540 11 02 d3 c6 4d 4e 81 e6 de 07 4d 49 9c 17 f0 fa ab 7f c4 f3 fc 79 9b bb be 1f e0 79 01 b6 6d eb ....MN....MI.........y.....y..m.
0560 a0 ba 09 5a 04 b4 b6 b6 8a ba ba 3a 92 d3 a7 94 65 59 58 42 60 99 50 63 28 94 ad 68 6c 6b 24 12 ...Z.......:....eYXB`.Pc(..hlk$.
0580 f9 b1 0e aa 9b a0 45 c0 e6 cd 9b f3 1f b5 bf 22 e5 f0 9d ac 07 96 12 5a 22 30 3a 3a ca 8a 48 54 ......E........".......Z"0::..HT
05a0 ad b9 eb 6e fc 40 22 03 45 20 25 41 30 77 49 49 6a 76 86 db 1a 2d 31 30 30 a0 83 f2 1a b4 08 90 ...n.@".E.%A0wIIjv...-100.......
05c0 52 aa 68 53 2b bf 7f 6a 2f 57 a7 e3 c4 e3 49 52 c9 cc f5 03 0e 57 71 ee ab 7f 91 ba 7c 38 b7 1b R.hS+..j/W....IR.....Wq.....|8..
05e0 a0 11 5a 04 cc cd 26 09 02 0f cf f3 50 32 0b f8 73 97 07 2a 77 26 10 0e 57 b7 69 55 11 b7 4e 63 ..Z...&.....P2..s..*w&..W.iU..Nc
0600 81 0c 50 05 cf 0c 72 83 58 5e a8 4e e8 b5 a8 14 85 17 ed da f7 b3 ae 41 af 00 51 6c a7 65 e9 aa ..P...r.X^.N...........A..Ql.e..
0620 ab 56 01 a6 61 22 8c 42 69 55 fd 5a b7 52 68 5d 52 5a 56 6e c3 d7 30 1d e6 bd 36 42 b2 54 22 b4 .V..a".BiU.Z.Rh]RZVn..0...6B.T".
0640 08 50 4a 71 f9 f2 05 fe fa da 0b 45 e7 42 33 d3 97 e8 59 5b fc 70 63 a1 d0 22 a0 a3 a3 43 44 a3 .PJq.......E.B3...Y[.pc.."...CD.
0660 51 95 9c 3e 85 61 18 08 c0 11 82 90 a5 72 0c 35 30 70 6f 0f fc af ce 46 e7 e6 42 df f9 3c 08 fe Q..>.a.......r.50po....F..B..<..
0680 0f e6 42 a2 d4 9f 3d 6e 05 dc f2 11 b8 e5 05 fc 17 51 e2 6f 5b dd e2 d6 36 00 00 00 00 49 45 4e ..B...=n.........Q.o[...6....IEN
06a0 44 ae 42 60 82 D.B`.
' href='#n359'>359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 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 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465
package ugtk2;

use diagnostics;
use strict;
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @icon_paths $force_center $force_focus $force_position $grab $pop_it $border); #- leave it on one line, for automatic removal of the line at package creation
use lang;

$::o = { locale => lang::read() } if !$::isInstall;

@ISA = qw(Exporter);
%EXPORT_TAGS = (
    wrappers => [ qw(gtkadd gtkappend gtkappend_page gtkappenditems gtkcombo_setpopdown_strings gtkdestroy
                     gtkentry gtkflush gtkhide gtkmodify_font gtkmove gtkpack gtkpack2 gtkpack2_
                     gtkpack2__ gtkpack_ gtkpack__ gtkpowerpack gtkput gtkradio gtkresize gtkroot
                     gtkset_active gtkset_border_width gtkset_editable gtkset_justify gtkset_alignment gtkset_layout gtkset_line_wrap
                     gtkset_markup gtkset_modal gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_name
                     gtkset_property gtkset_relief gtkset_selectable gtkset_sensitive gtkset_shadow_type gtkset_size_request
                     gtkset_text gtkset_tip gtkset_visibility gtksetstyle gtkshow gtksignal_connect gtksize gtktext_append
                     gtktext_insert ) ],

    helpers => [ qw(add2notebook add_icon_path fill_tiled fill_tiled_coords get_text_coord gtkcolor gtkcreate_img
                    gtkcreate_pixbuf gtkfontinfo gtkset_background n_line_size set_back_pixbuf string_size
                    string_width string_height wrap_paragraph) ],

    create => [ qw(create_adjustment create_box_with_title create_dialog create_factory_menu create_factory_popup_menu
                   create_hbox create_hpaned create_menu create_notebook create_okcancel create_packtable
                   create_scrolled_window create_vbox create_vpaned _create_dialog ) ],

    ask => [ qw(ask_browse_tree_info ask_browse_tree_info_given_widgets ask_dir ask_from_entry ask_okcancel ask_warn
                ask_yesorno ) ],
    dialogs => [ qw(err_dialog info_dialog warn_dialog) ],

);
$EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ];
@EXPORT_OK = map { @$_ } values %EXPORT_TAGS;

use c;
use log;
use common;

use Gtk2;
use Gtk2::Gdk::Keysyms;

unless ($::no_ugtk_init) {
    !check_for_xserver() and die "Cannot be run in console mode.\n";
    $::one_message_has_been_translated and warn("N() was called from $::one_message_has_been_translated BEFORE gtk2 initialisation, replace it with a N_() AND a translate() later.\n"), c::_exit(1);

    Gtk2->init;
    c::bind_textdomain_codeset($_, 'UTF8') foreach 'libDrakX', @::textdomains;
    $::need_utf8_i18n = 1;
}


$border = 5;


# -=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---
#                 wrappers
#
# Functional-style wrappers to existing Gtk functions; allows to program in
# a more functional way, and especially, first, to avoid using temp
# variables, and second, to "see" directly in the code the user interface
# you're building.

sub gtkdestroy                { $_[0] and $_[0]->destroy }
sub gtkflush()                { Gtk2->main_iteration while Gtk2->events_pending }
sub gtkhide                   { $_[0]->hide; $_[0] }
sub gtkmove                   { $_[0]->window->move($_[1], $_[2]); $_[0] }
sub gtkpack                   { gtkpowerpack(1, 1, @_) }
sub gtkpack_                  { gtkpowerpack('arg', 1, @_) }
sub gtkpack__                 { gtkpowerpack(0, 1, @_) }
sub gtkpack2                  { gtkpowerpack(1, 0, @_) }
sub gtkpack2_                 { gtkpowerpack('arg', 0, @_) }
sub gtkpack2__                { gtkpowerpack(0, 0, @_) }
sub gtkput                    { $_[0]->put(gtkshow($_[1]), $_[2], $_[3]); $_[0] }
sub gtkresize                 { $_[0]->window->resize($_[1], $_[2]); $_[0] }
sub gtkset_active             { $_[0]->set_active($_[1]); $_[0] }
sub gtkset_border_width       { $_[0]->set_border_width($_[1]); $_[0] }
sub gtkset_editable           { $_[0]->set_editable($_[1]); $_[0] }
sub gtkset_selectable         { $_[0]->set_selectable($_[1]); $_[0] }
sub gtkset_justify            { $_[0]->set_justify($_[1]); $_[0] }
sub gtkset_alignment          { $_[0]->set_alignment($_[1], $_[2]); $_[0] }
sub gtkset_layout             { $_[0]->set_layout($_[1]); $_[0] }
sub gtkset_modal              { $_[0]->set_modal($_[1]); $_[0] }
sub gtkset_mousecursor_normal { gtkset_mousecursor('left-ptr', @_) }
sub gtkset_mousecursor_wait   { gtkset_mousecursor('watch', @_) }
sub gtkset_relief             { $_[0]->set_relief($_[1]); $_[0] }
sub gtkset_sensitive          { $_[0]->set_sensitive($_[1]); $_[0] }
sub gtkset_visibility         { $_[0]->set_visibility($_[1]); $_[0] }
sub gtkset_tip                { $_[0]->set_tip($_[1], $_[2]) if $_[2]; $_[1] }
sub gtkset_shadow_type        { $_[0]->set_shadow_type($_[1]); $_[0] }
sub gtkset_style              { $_[0]->set_style($_[1]); $_[0] }
sub gtkset_size_request       { $_[0]->set_size_request($_[1], $_[2]); $_[0] }
sub gtkshow                   { $_[0]->show; $_[0] }
sub gtksize                   { $_[0]->size($_[1], $_[2]); $_[0] }
sub gtkset_markup             { $_[0]->set_markup($_[1]); $_[0] }
sub gtkset_line_wrap          { $_[0]->set_line_wrap($_[1]); $_[0] }

sub gtkadd {
    my $w = shift;
    foreach (@_) {
	my $l = $_;
	ref $l or $l = Gtk2::Label->new($l);
	$w->add(gtkshow($l));
    }
    $w
}

sub gtkappend {
    my $w = shift;
    foreach (@_) {
	my $l = $_;
	ref $l or $l = Gtk2::Label->new($l);
	$w->append(gtkshow($l));
    }
    $w
}

sub gtkappenditems {
    my $w = shift;
    $_->show foreach @_;
    $w->append_items(@_);
    $w
}

# append page to a notebook
sub gtkappend_page {
    my $w = shift;
    $w->append_page(@_);
    $w
}

sub gtkentry {
    my ($text) = @_;
    my $e = Gtk2::Entry->new;
    $text and $e->set_text($text);
    $e;
}

sub gtksetstyle { 
    my ($w, $s) = @_;
    $w->set_style($s);
    $w;
}

sub gtkradio {
    my $def = shift;
    my $radio;
    map { gtkset_active($radio = Gtk2::RadioButton->new($radio ? $radio->get_group : undef, $_), $_ eq $def) } @_;
}

sub gtkroot() {
    my $root if 0;
    $root ||= Gtk2::Gdk->get_default_root_window;
}

sub gtkset_text {
    my ($w, $s) = @_;
    $w->set_text($s);
    $w;
}

sub gtkcombo_setpopdown_strings {
    my $w = shift;
    $w->set_popdown_strings(@_);
    $w;
}

sub gtkset_mousecursor {
    my ($type, $w) = @_;
    ($w || gtkroot())->set_cursor(Gtk2::Gdk::Cursor->new($type));
}

sub gtksignal_connect {
    my $w = shift;
    $w->signal_connect(@_);
    $w;
}

sub gtkset_name {
    my ($widget, $name) = @_;
    $widget->set_name($name);
    $widget;
}


sub gtkpowerpack {
    #- Get Default Attributes (if any). 2 syntaxes allowed :
    #- gtkpowerpack( {expand => 1, fill => 0}, $box...) : the attributes are picked from a specified hash ref
    #- gtkpowerpack(1, 0, 1, $box, ...) : the attributes are picked from the non-ref list, in the order (expand, fill, padding, pack_end).
    my @attributes_list = qw(expand fill padding pack_end);
    my $default_attrs = {};
    if (ref($_[0]) eq 'HASH') {
	$default_attrs = shift;
    } elsif (!ref($_[0])) {
	foreach (@attributes_list) {
	    ref($_[0]) and last;
	    $default_attrs->{$_} = shift;
	}
    }
    my $box = shift;

    while (@_) {
	#- Get attributes (if specified). 4 syntaxes allowed (default values are undef ie. false...) :
	#- gtkpowerpack({defaultattrs}, $box, $widget1, $widget2, ...) : the attrs are picked from the default ones (if they exist)
	#- gtkpowerpack($box, {fill=>1, expand=>0, ...}, $widget1, ...) : the attributes are picked from a specified hash ref
	#- gtkpowerpack($box, [1,0,1], $widget1, ...) : the attributes are picked from the array ref : (expand, fill, padding, pack_end).
	#- gtkpowerpack({attr=>'arg'}, $box, 1, $widget1, 0, $widget2, etc...) : the 'arg' value will tell gtkpowerpack to always read the 
	#- attr value directly in the arg list (avoiding confusion between value 0 and Gtk::Label("0"). That can simplify some writings but
	#- this arg(s) MUST then be present...
	my (%attr, $attrs);
	ref($_[0]) eq 'HASH' || ref($_[0]) eq 'ARRAY' and $attrs = shift;
	foreach (@attributes_list) {
	    if (($default_attrs->{$_} || '') eq 'arg') {
		ref($_[0]) and die "error in packing definition\n";
		$attr{$_} = shift;
		ref($attrs) eq 'ARRAY' and shift @$attrs;
	    } elsif (ref($attrs) eq 'HASH' && defined($attrs->{$_})) {
		$attr{$_} = $attrs->{$_};
	    } elsif (ref($attrs) eq 'ARRAY') {
		$attr{$_} = shift @$attrs;
	    } elsif (defined($default_attrs->{$_})) {
		$attr{$_} = int $default_attrs->{$_};
	    } else {
		$attr{$_} = 0;
	    }
	}
	#- Get and pack the widget (create it if necessary to  a label...)
	my $widget = ref($_[0]) ? shift : Gtk2::Label->new(shift);
	my $pack_call = 'pack_'.($attr{pack_end} ? 'end' : 'start');
	$box->$pack_call($widget, $attr{expand}, $attr{fill}, $attr{padding});
	$widget->show;
    }
    return $box;
}

sub gtktreeview_children {
    my ($model, $iter) = @_;
    my @l;
    $model && $iter or return;
    for (my $p = $model->iter_children($iter); $p; $p = $model->iter_next($p)) {
	push @l, $p;
    }
    @l;
}



# -=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---
#                 create
#
# Helpers that allow omitting common operations on common widgets
# (e.g. create widgets with good default properties)

sub create_pixbutton {
    my ($label, $pix, $reverse_order) = @_;
    my @label_and_pix = (0, $label, if_($pix, 0, $pix));
    gtkadd(Gtk2::Button->new,
	   gtkpack_(Gtk2::HBox->new(0, 3),
		    1, "",
		    $reverse_order ? reverse(@label_and_pix) : @label_and_pix,
		    1, ""));
}

sub create_adjustment {
    my ($val, $min, $max) = @_;
    Gtk2::Adjustment->new($val, $min, $max + 1, 1, ($max - $min + 1) / 10, 1);
}

sub create_scrolled_window {
    my ($W, $o_policy, $o_viewport_shadow) = @_;
    my $w = Gtk2::ScrolledWindow->new(undef, undef);
    $w->set_policy($o_policy ? @$o_policy : ('automatic', 'automatic'));
    if (member(ref($W), qw(Gtk2::Layout Gtk2::Text Gtk2::TextView Gtk2::TreeView))) {
	$w->add($W)
    } else {
	$w->add_with_viewport($W);
    }
    $o_viewport_shadow and gtkset_shadow_type($w->child, $o_viewport_shadow);
    $W->can('set_focus_vadjustment') and $W->set_focus_vadjustment($w->get_vadjustment);
    $W->show;
    if (ref($W) eq 'Gtk2::TextView') {
    	gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'in'), $w)
    } else {
	$w
    }
}

sub n_line_size {
    my ($nbline, $type, $widget) = @_;
    my $spacing = ${{ text => 3, various => 17 }}{$type};
    my %fontinfo = gtkfontinfo($widget);
    round($nbline * ($fontinfo{ascent} + $fontinfo{descent} + $spacing) + 8);
}

sub create_box_with_title {
    my $o = shift;

    my $nbline = sum(map { round(length($_) / 60 + 1/2) } map { split "\n" } @_);
    my $box = Gtk2::VBox->new(0,0);
    if ($nbline == 0) {
	$o->{box_size} = 0;
	return $box;
    }
    $o->{box_size} = n_line_size($nbline, 'text', $box);
    if (@_ <= 2 && $nbline > 4) {
	$o->{icon} && !$::isWizard and 
	  eval { gtkpack__($box, gtkset_border_width(gtkpack_(Gtk2::HBox->new(0,0), 1, gtkcreate_img($o->{icon})),5)) };
	my $wanted = $o->{box_size};
	$o->{box_size} = min(200, $o->{box_size});
	my $has_scroll = $o->{box_size} < $wanted;

	my $wtext = Gtk2::TextView->new;
	$wtext->set_left_margin(3);
	$wtext->can_focus($has_scroll);
	$wtext->signal_connect(button_press_event => sub { 1 }); #- disable selecting text and popping the contextual menu (GUI team says it's *horrible* to be able to do select text!)
	chomp(my $text = join("\n", @_));
	my $scroll = create_scrolled_window(gtktext_insert($wtext, $text));
	$scroll->set_size_request(400, $o->{box_size});
	gtkpack_($box, 0, $scroll);
    } else {
	my $a = !$::no_separator;
	undef $::no_separator;
     my $new_label = sub {
         my ($txt) = @_;
         my $w = ref($txt) ? $txt : Gtk2::WrappedLabel->new($txt);
         gtkset_name($w, "Title");
     };
	if ($o->{icon} && (!$::isWizard || $::isInstall)) {
	    gtkpack__($box,
		      gtkpack_(Gtk2::HBox->new(0,0),
			       0, gtkset_size_request(Gtk2::VBox->new(0,0), 15, 0),
			       0, eval { gtkcreate_img($o->{icon}) },
			       0, gtkset_size_request(Gtk2::VBox->new(0,0), 15, 0),
			       1, gtkpack_($o->{box_title} = Gtk2::VBox->new(0,0),
					   1, Gtk2::HBox->new(0,0),
					   (map {
					       my $w = $new_label->($_);
					       $::isWizard and $w->set_justify("left");
					       (0, $w);
					   } map { ref($_) ? $_ : warp_text($_) } @_),
					   1, Gtk2::HBox->new(0,0),
					  )
			      ),
		      if_($a, Gtk2::HSeparator->new)
		     )
	} else {
	    gtkpack__($box,
		      if_($::isWizard, gtkset_size_request(Gtk2::Label->new, 0, 10)),
		      (map {
			  my $w = $new_label->($_);
			  $::isWizard ? gtkpack__(Gtk2::HBox->new(0,0), gtkset_size_request(Gtk2::Label->new, 20, 0), $w)
			              : $w
		      } map { ref($_) ? $_ : warp_text($_) } @_),
		      if_($::isWizard, gtkset_size_request(Gtk2::Label->new, 0, 15)),
		      if_($a, Gtk2::HSeparator->new)
		     )
	}
    }
}

sub _create_dialog {
    my ($title, $o_options) = @_;
    my $dialog = Gtk2::Dialog->new;
    $dialog->set_title($title);
    $dialog->set_position('center-on-parent');  # center-on-parent doesn't work
    $dialog->set_size_request(-1, $o_options->{small} ? -1 : 400);
    $dialog->set_modal(1);
    $dialog->set_transient_for($o_options->{transient}) if $o_options->{transient};
    $dialog;
}


# drakfloppy / drakfont / harddrake2 / mcc
sub create_dialog {
    my ($title, $label, $o_options) = @_;
    my $ret = 0;
    my $dialog = _create_dialog($title, $o_options);
    $dialog->set_border_width(10);
    my $text = ref($label) ? $label : $o_options->{use_markup} ? gtkset_markup(Gtk2::WrappedLabel->new, $label) : Gtk2::WrappedLabel->new($label);
    gtkpack($dialog->vbox,
            gtkpack_(Gtk2::HBox->new,
                     if_($o_options->{stock}, 0, Gtk2::Image->new_from_stock($o_options->{stock}, 'dialog')),
                     1, create_scrolled_window($text, [ 'never', 'automatic' ]),
                    ),
           );

    if ($o_options->{cancel}) {
	my $button2 = Gtk2::Button->new(N("Cancel"));
	$button2->signal_connect(clicked => sub { $ret = 0; $dialog->destroy; Gtk2->main_quit });
	$button2->can_default(1);
	$dialog->action_area->pack_start($button2, 1, 1, 0);
    }

    my $button = Gtk2::Button->new(N("Ok"));
    $button->can_default(1);
    $button->signal_connect(clicked => sub { $ret = 1; $dialog->destroy; Gtk2->main_quit });
    $dialog->action_area->pack_start($button, 1, 1, 0);
    $button->grab_default;

    $dialog->show_all;
    Gtk2->main;
    $ret;
}

sub info_dialog {
    my ($title, $label, $o_options) = @_;
    $o_options ||= { };
    add2hash_($o_options, { small => 1, stock => 'gtk-dialog-info' });
    create_dialog($title, $label, $o_options);
}

sub warn_dialog {
    my ($title, $label, $o_options) = @_;
    $o_options ||= { };
    add2hash_($o_options, { small => 1, stock => 'gtk-dialog-warning', cancel => 1 });
    create_dialog($title, $label, $o_options);
}

sub err_dialog {
    my ($title, $label, $o_options) = @_;
    $o_options ||= { };
    add2hash_($o_options, { small => 1, stock => 'gtk-dialog-error' });
    create_dialog($title, $label, $o_options);
}

sub create_hbox { gtkset_layout(gtkset_border_width(Gtk2::HButtonBox->new, 3), $_[0] || 'spread') }
sub create_vbox { gtkset_layout(Gtk2::VButtonBox->new, $_[0] || 'spread') }

sub create_factory_menu_ {
    my ($type, $name, $window, @menu_items) = @_;
    my $widget = Gtk2::ItemFactory->new($type, $name, my $accel_group = Gtk2::AccelGroup->new);
    $widget->create_items($window, @menu_items);
    $window->add_accel_group($accel_group);
    ($widget->get_widget($name), $widget);
}

sub create_factory_popup_menu { create_factory_menu_("Gtk2::Menu", '<main>', @_) }
sub create_factory_menu { create_factory_menu_("Gtk2::MenuBar", '<main>', @_) }

sub create_menu {
    my $title = shift;
    my $w = Gtk2::MenuItem->new($title);
    $w->set_submenu(gtkshow(gtkappend(Gtk2::Menu->new, @_)));
    $w
}

sub create_notebook {
    my $n = Gtk2::Notebook->new;
    while (@_) {
	my ($title, $book) = splice(@_, 0, 2);
	add2notebook($n, $title, $book);
    }
    $n
}

sub create_packtable {
    my ($options, @l) = @_;
    my $w = Gtk2::Table->new(0, 0, $options->{homogeneous} || 0);
    each_index {
	my ($i, $l) = ($::i, $_);
	each_index {
	    my $j = $::i;
	    if ($_) {
		ref $_ or $_ = Gtk2::Label->new($_);
		$j != $#$l && !$options->{mcc} ?
		  $w->attach($_, $j, $j + 1, $i, $i + 1,
			     'fill', 'fill', 5, 0) :
		  $w->attach($_, $j, $j + 1, $i, $i + 1,
			     ['expand', 'fill'], ref($_) eq 'Gtk2::ScrolledWindow' || $_->get_data('must_grow') ? ['expand', 'fill'] : [], 0, 0);
		$_->show;
	    }
	} @$l;
    } @l;
    $w->set_col_spacings($options->{col_spacings} || 0);
    $w->set_row_spacings($options->{row_spacings} || 0);
    $w
}

sub create_okcancel {
    my ($w, $o_ok, $o_cancel, $o_spread, @other) = @_;
    my $wizard_buttons = $::isWizard && !$w->{pop_it};
    my $cancel = defined $o_cancel || defined $o_ok ? $o_cancel : $wizard_buttons ? N("<- Previous") : N("Cancel");
    my $ok = defined $o_ok ? $o_ok : $wizard_buttons ? ($::Wizard_finished ? N("Finish") : N("Next ->")) : N("Ok");
    my $b1 = gtksignal_connect($w->{ok} = Gtk2::Button->new($ok), clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk2->main_quit });
    my $b2 = $cancel && gtksignal_connect($w->{cancel} = Gtk2::Button->new($cancel), clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk2->main_quit });
    gtksignal_connect($w->{wizcancel} = Gtk2::Button->new(N("Cancel")), clicked => sub { die 'wizcancel' }) if $wizard_buttons && !$::isInstall;
    my @l = grep { $_ } $wizard_buttons ? (if_(!$::isInstall, $w->{wizcancel}), 
                                           if_(!$::Wizard_no_previous, $b2), $b1) : ($::isInstall ? ($b1, $b2) : $b2, $b1);
    my @l2 = map { gtksignal_connect(Gtk2::Button->new($_->[0]), clicked => $_->[1]) } grep {  $_->[2] } @other;
    my @r2 = map { gtksignal_connect(Gtk2::Button->new($_->[0]), clicked => $_->[1]) } grep { !$_->[2] } @other;

    my $box = create_hbox($o_spread || "edge");
    
    $box->pack_start($_, 0, 0, 1) foreach @l2;
    $box->pack_end($_, 0, 0, 1) foreach @r2, @l;
    foreach (@l2, @r2, @l) {
	$_->show;
	$_->can_default($wizard_buttons);
    }
    $box;
}

sub _setup_paned {
    my ($paned, $child1, $child2, %options) = @_;
    foreach ([ 'resize1', 0 ], [ 'shrink1', 1 ], [ 'resize2', 1 ], [ 'shrink2', 1 ]) {
        $options{$_->[0]} = $_->[1] unless defined($options{$_->[0]});
    }
    $paned->pack1(gtkshow($child1), $options{resize1}, $options{shrink1});
    $paned->pack2(gtkshow($child2), $options{resize2}, $options{shrink2});
    gtkshow($paned);
}

sub create_vpaned {
    _setup_paned(Gtk2::VPaned->new, @_);
}

sub create_hpaned {
    _setup_paned(Gtk2::HPaned->new, @_);
}


# -=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---
#                 helpers
#
# Functions that do typical operations on widgets, that you may need in
# several places of your programs.

sub _find_imgfile {
    my ($f, @extensions) = shift;
    @extensions or @extensions = qw(.png .xpm);
    if ($f !~ m|^/|) {
	foreach my $path (icon_paths()) {
	    -e "$path/$f$_" and $f = "$path/$f$_" foreach '', @extensions;
	}
    }
    return $f;
}

# use it if you want to display an icon/image in your app
sub gtkcreate_img {
    return Gtk2::Image->new_from_file(_find_imgfile(@_));
}

# use it if you want to draw an image onto a drawingarea
sub gtkcreate_pixbuf {
    return Gtk2::Gdk::Pixbuf->new_from_file(_find_imgfile(@_));
}

sub gtktext_append { gtktext_insert(@_, append => 1) }

# choose one of the two styles:
# - gtktext_insert($textview, "My text..");
# - gtktext_insert($textview, [ [ 'first text',  { 'foreground' => 'blue', 'background' => 'green', ... } ],
#			        [ 'second text' ],
#		                [ 'third', { 'font' => 'Serif 15', ... } ],
#                               ... ]);
sub gtktext_insert {
    my ($textview, $t, %opts) = @_;
    my $buffer = $textview->get_buffer;
    if (ref($t) eq 'ARRAY') {
        $opts{append} or $buffer->set_text('');
        foreach my $token (@$t) {
            my $iter1 = $buffer->get_end_iter;
            my $c = $buffer->get_char_count;
            if ($token->[0] =~ /^Gtk2::Gdk::Pixbuf/) {
                $buffer->insert_pixbuf($iter1, $token->[0]);
                next;
            }
            $buffer->insert($iter1, $token->[0]);
            if ($token->[1]) {
                my $tag = $buffer->create_tag(rand());
                $tag->set(%{$token->[1]});
                $buffer->apply_tag($tag, $iter1 = $buffer->get_iter_at_offset($c), $buffer->get_end_iter);
            }
        }
    } else {
        $buffer->set_text($t);
    }
    #- the following line is needed to move the cursor to the beginning, so that if the
    #- textview has a scrollbar, it won't scroll to the bottom when focusing (#3633)
    $buffer->place_cursor($buffer->get_start_iter);
    $textview->set_wrap_mode($opts{wrap_mode} || 'word');
    $textview->set_editable($opts{editable} || 0);
    $textview->set_cursor_visible($opts{visible} || 0);
    $textview;
}

# extracts interesting font metrics for a given widget
sub gtkfontinfo {
    my ($widget) = @_;
    my $context = $widget->get_pango_context;
    my $metrics = $context->get_metrics($context->get_font_description, $context->get_language);
    my %fontinfo;
    foreach (qw(ascent descent approximate_char_width approximate_digit_width)) {
	no strict;
	my $func = "get_$_";
	$fontinfo{$_} = Gtk2::Pango->pixels($metrics->$func);
    }
    %fontinfo;
}

sub gtkmodify_font {
    my ($w, $arg) = @_;
    $w->modify_font(ref($arg) ? $arg : Gtk2::Pango::FontDescription->from_string($arg));
    $w;
}

sub gtkset_property {
    my ($w, $property, $value) = @_;
    $w->set_property($property, $value);
    $w;
}

sub set_back_pixbuf {
    my ($widget, $pixbuf) = @_;
    my $window = $widget->window;
    my ($width, $height) = ($pixbuf->get_width, $pixbuf->get_height);
    my $pixmap = Gtk2::Gdk::Pixmap->new($window, $width, $height, $window->get_depth);
    $pixbuf->render_to_drawable($pixmap, $widget->style->fg_gc('normal'), 0, 0, 0, 0, $width, $height, 'none', 0, 0);
    $window->set_back_pixmap($pixmap, 0);
}

sub fill_tiled_coords {