From 6c2d56ce192f2236715b5acb3c496bbc398debde Mon Sep 17 00:00:00 2001 From: "raveit65 (via Travis CI)" Date: Sun, 20 Jun 2021 00:14:40 +0000 Subject: Deploy mate-desktop/caja-extensions to github.com/mate-desktop/caja-extensions.git:gh-pages --- .../index.html | 97 + .../report-1aac7e.html | 1024 ++++++++ .../report-541059.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1594 ++++++++++++ .../1.html | 1526 +++++++++++ .../2.html | 508 ++++ .../3.html | 1894 ++++++++++++++ .../4.html | 942 +++++++ .../5.html | 582 +++++ .../6.html | 1288 +++++++++ .../7.html | 1140 ++++++++ .../8.html | 2744 +++++++++++++++++++ .../9.html | 554 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-1b455d.html | 1024 ++++++++ .../report-39c2a6.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1594 ++++++++++++ .../1.html | 1526 +++++++++++ .../2.html | 508 ++++ .../3.html | 1894 ++++++++++++++ .../4.html | 942 +++++++ .../5.html | 582 +++++ .../6.html | 1288 +++++++++ .../7.html | 1140 ++++++++ .../8.html | 2744 +++++++++++++++++++ .../9.html | 554 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-1eb1b3.html | 1024 ++++++++ .../report-234045.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1594 ++++++++++++ .../1.html | 1526 +++++++++++ .../2.html | 508 ++++ .../3.html | 1894 ++++++++++++++ .../4.html | 942 +++++++ .../5.html | 582 +++++ .../6.html | 1288 +++++++++ .../7.html | 1140 ++++++++ .../8.html | 2744 +++++++++++++++++++ .../9.html | 554 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-890f46.html | 1024 ++++++++ .../report-c9e062.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1594 ++++++++++++ .../1.html | 1526 +++++++++++ .../2.html | 508 ++++ .../3.html | 1894 ++++++++++++++ .../4.html | 942 +++++++ .../5.html | 582 +++++ .../6.html | 1288 +++++++++ .../7.html | 1140 ++++++++ .../8.html | 2744 +++++++++++++++++++ .../9.html | 554 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-1f2279.html | 1024 ++++++++ .../report-ea9546.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1594 ++++++++++++ .../1.html | 1526 +++++++++++ .../2.html | 508 ++++ .../3.html | 1894 ++++++++++++++ .../4.html | 942 +++++++ .../5.html | 582 +++++ .../6.html | 1288 +++++++++ .../7.html | 1140 ++++++++ .../8.html | 2744 +++++++++++++++++++ .../9.html | 554 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-da206f.html | 1024 ++++++++ .../report-e739c1.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1594 ++++++++++++ .../1.html | 1526 +++++++++++ .../2.html | 508 ++++ .../3.html | 1894 ++++++++++++++ .../4.html | 942 +++++++ .../5.html | 582 +++++ .../6.html | 1288 +++++++++ .../7.html | 1140 ++++++++ .../8.html | 2744 +++++++++++++++++++ .../9.html | 554 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-c9eaed.html | 1024 ++++++++ .../report-fbaf83.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1599 ++++++++++++ .../1.html | 1531 +++++++++++ .../2.html | 513 ++++ .../3.html | 1899 ++++++++++++++ .../4.html | 947 +++++++ .../5.html | 587 +++++ .../6.html | 1293 +++++++++ .../7.html | 1145 ++++++++ .../8.html | 2749 ++++++++++++++++++++ .../9.html | 559 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-081f15.html | 1024 ++++++++ .../report-837dd6.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1599 ++++++++++++ .../1.html | 1531 +++++++++++ .../2.html | 513 ++++ .../3.html | 1899 ++++++++++++++ .../4.html | 947 +++++++ .../5.html | 587 +++++ .../6.html | 1293 +++++++++ .../7.html | 1145 ++++++++ .../8.html | 2749 ++++++++++++++++++++ .../9.html | 559 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-067466.html | 1024 ++++++++ .../report-df9db1.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1599 ++++++++++++ .../1.html | 1531 +++++++++++ .../2.html | 513 ++++ .../3.html | 1899 ++++++++++++++ .../4.html | 947 +++++++ .../5.html | 587 +++++ .../6.html | 1293 +++++++++ .../7.html | 1145 ++++++++ .../8.html | 2749 ++++++++++++++++++++ .../9.html | 559 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + .../index.html | 97 + .../report-131056.html | 1024 ++++++++ .../report-aa40d4.html | 1024 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1599 ++++++++++++ .../1.html | 1531 +++++++++++ .../2.html | 513 ++++ .../3.html | 1899 ++++++++++++++ .../4.html | 947 +++++++ .../5.html | 587 +++++ .../6.html | 1293 +++++++++ .../7.html | 1145 ++++++++ .../8.html | 2749 ++++++++++++++++++++ .../9.html | 561 ++++ .../index.html | 153 ++ .../stats.html | 114 + .../style.css | 137 + CNAME | 1 + index.html | 47 + 182 files changed, 159000 insertions(+) create mode 100644 2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/index.html create mode 100644 2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/report-1aac7e.html create mode 100644 2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/report-541059.html create mode 100644 2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/scanview.css create mode 100644 2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/sorttable.js create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/0.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/1.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/2.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/3.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/4.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/5.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/6.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/7.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/8.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/9.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/index.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/stats.html create mode 100644 2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/style.css create mode 100644 2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/index.html create mode 100644 2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/report-1b455d.html create mode 100644 2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/report-39c2a6.html create mode 100644 2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/scanview.css create mode 100644 2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/sorttable.js create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/0.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/1.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/2.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/3.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/4.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/5.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/6.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/7.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/8.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/9.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/index.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/stats.html create mode 100644 2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/style.css create mode 100644 2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/index.html create mode 100644 2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/report-1eb1b3.html create mode 100644 2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/report-234045.html create mode 100644 2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/scanview.css create mode 100644 2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/sorttable.js create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/0.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/1.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/2.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/3.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/4.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/5.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/6.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/7.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/8.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/9.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/index.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/stats.html create mode 100644 2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/style.css create mode 100644 2021-03-08-151632-5816-1@3ed9a7d14a00_master/index.html create mode 100644 2021-03-08-151632-5816-1@3ed9a7d14a00_master/report-890f46.html create mode 100644 2021-03-08-151632-5816-1@3ed9a7d14a00_master/report-c9e062.html create mode 100644 2021-03-08-151632-5816-1@3ed9a7d14a00_master/scanview.css create mode 100644 2021-03-08-151632-5816-1@3ed9a7d14a00_master/sorttable.js create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/0.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/1.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/2.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/3.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/4.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/5.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/6.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/7.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/8.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/9.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/index.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/stats.html create mode 100644 2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/style.css create mode 100644 2021-03-11-214927-5824-1@73da71ed6a7c_master/index.html create mode 100644 2021-03-11-214927-5824-1@73da71ed6a7c_master/report-1f2279.html create mode 100644 2021-03-11-214927-5824-1@73da71ed6a7c_master/report-ea9546.html create mode 100644 2021-03-11-214927-5824-1@73da71ed6a7c_master/scanview.css create mode 100644 2021-03-11-214927-5824-1@73da71ed6a7c_master/sorttable.js create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/0.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/1.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/2.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/3.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/4.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/5.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/6.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/7.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/8.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/9.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/index.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/stats.html create mode 100644 2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/style.css create mode 100644 2021-04-22-220600-5791-1@826f67590ab2_master/index.html create mode 100644 2021-04-22-220600-5791-1@826f67590ab2_master/report-da206f.html create mode 100644 2021-04-22-220600-5791-1@826f67590ab2_master/report-e739c1.html create mode 100644 2021-04-22-220600-5791-1@826f67590ab2_master/scanview.css create mode 100644 2021-04-22-220600-5791-1@826f67590ab2_master/sorttable.js create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/0.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/1.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/2.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/3.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/4.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/5.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/6.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/7.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/8.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/9.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/index.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/stats.html create mode 100644 2021-04-22-220639-9772-cppcheck@826f67590ab2_master/style.css create mode 100644 2021-05-29-194309-6385-1@ae9d57a55ef3_master/index.html create mode 100644 2021-05-29-194309-6385-1@ae9d57a55ef3_master/report-c9eaed.html create mode 100644 2021-05-29-194309-6385-1@ae9d57a55ef3_master/report-fbaf83.html create mode 100644 2021-05-29-194309-6385-1@ae9d57a55ef3_master/scanview.css create mode 100644 2021-05-29-194309-6385-1@ae9d57a55ef3_master/sorttable.js create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/0.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/1.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/2.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/3.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/4.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/5.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/6.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/7.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/8.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/9.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/index.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/stats.html create mode 100644 2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/style.css create mode 100644 2021-06-05-093948-6368-1@5827807e577b_master/index.html create mode 100644 2021-06-05-093948-6368-1@5827807e577b_master/report-081f15.html create mode 100644 2021-06-05-093948-6368-1@5827807e577b_master/report-837dd6.html create mode 100644 2021-06-05-093948-6368-1@5827807e577b_master/scanview.css create mode 100644 2021-06-05-093948-6368-1@5827807e577b_master/sorttable.js create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/0.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/1.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/2.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/3.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/4.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/5.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/6.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/7.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/8.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/9.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/index.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/stats.html create mode 100644 2021-06-05-094029-7788-cppcheck@5827807e577b_master/style.css create mode 100644 2021-06-05-094508-6398-1@5827807e577b_v1.25.1/index.html create mode 100644 2021-06-05-094508-6398-1@5827807e577b_v1.25.1/report-067466.html create mode 100644 2021-06-05-094508-6398-1@5827807e577b_v1.25.1/report-df9db1.html create mode 100644 2021-06-05-094508-6398-1@5827807e577b_v1.25.1/scanview.css create mode 100644 2021-06-05-094508-6398-1@5827807e577b_v1.25.1/sorttable.js create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/0.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/1.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/2.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/3.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/4.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/5.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/6.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/7.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/8.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/9.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/index.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/stats.html create mode 100644 2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/style.css create mode 100644 2021-06-20-001311-6397-1@05a180885c0d_master/index.html create mode 100644 2021-06-20-001311-6397-1@05a180885c0d_master/report-131056.html create mode 100644 2021-06-20-001311-6397-1@05a180885c0d_master/report-aa40d4.html create mode 100644 2021-06-20-001311-6397-1@05a180885c0d_master/scanview.css create mode 100644 2021-06-20-001311-6397-1@05a180885c0d_master/sorttable.js create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/0.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/1.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/2.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/3.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/4.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/5.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/6.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/7.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/8.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/9.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/index.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/stats.html create mode 100644 2021-06-20-001352-7924-cppcheck@05a180885c0d_master/style.css create mode 100644 CNAME create mode 100644 index.html diff --git a/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/index.html b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/index.html new file mode 100644 index 0000000..cef66de --- /dev/null +++ b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@096159014a26
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 11.0.0 (Fedora 11.0.0-2.fc33) +
Date:Thu Feb 25 11:07:18 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
+ + diff --git a/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/report-1aac7e.html b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/report-1aac7e.html new file mode 100644 index 0000000..f5329f7 --- /dev/null +++ b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/report-1aac7e.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-sign-compare -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-02-25-110718-6239-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/report-541059.html b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/report-541059.html new file mode 100644 index 0000000..9aa712a --- /dev/null +++ b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/report-541059.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-sign-compare -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-02-25-110718-6239-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/scanview.css b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/sorttable.js b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-02-25-110718-6239-1@05dfd4cd360c_image-converter-path/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/1.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/1.html new file mode 100644 index 0000000..034d97d --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/1.html @@ -0,0 +1,1526 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/2.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/2.html new file mode 100644 index 0000000..ece1fab --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/2.html @@ -0,0 +1,508 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/3.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/3.html new file mode 100644 index 0000000..6d83c37 --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/3.html @@ -0,0 +1,1894 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/4.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/4.html new file mode 100644 index 0000000..d919dc7 --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/4.html @@ -0,0 +1,942 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/5.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/5.html new file mode 100644 index 0000000..08ef2a6 --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/5.html @@ -0,0 +1,582 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/6.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/6.html new file mode 100644 index 0000000..076d802 --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/6.html @@ -0,0 +1,1288 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/7.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/7.html new file mode 100644 index 0000000..4eff080 --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/7.html @@ -0,0 +1,1140 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/8.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/8.html new file mode 100644 index 0000000..510ccf0 --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/8.html @@ -0,0 +1,2744 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/9.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/9.html new file mode 100644 index 0000000..36376e2 --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/9.html @@ -0,0 +1,554 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/index.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/stats.html b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/style.css b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-02-25-110755-9444-cppcheck@05dfd4cd360c_image-converter-path/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/index.html b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/index.html new file mode 100644 index 0000000..67ac289 --- /dev/null +++ b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@5c053b9b68f9
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 11.0.0 (Fedora 11.0.0-2.fc33) +
Date:Thu Feb 25 11:18:28 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
+ + diff --git a/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/report-1b455d.html b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/report-1b455d.html new file mode 100644 index 0000000..4081433 --- /dev/null +++ b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/report-1b455d.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-sign-compare -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-02-25-111828-6236-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/report-39c2a6.html b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/report-39c2a6.html new file mode 100644 index 0000000..42a8c2f --- /dev/null +++ b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/report-39c2a6.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-sign-compare -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-02-25-111828-6236-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/scanview.css b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/sorttable.js b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-02-25-111828-6236-1@dd13d6bf48e8_image-converter-path/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/1.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/1.html new file mode 100644 index 0000000..034d97d --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/1.html @@ -0,0 +1,1526 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/2.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/2.html new file mode 100644 index 0000000..ece1fab --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/2.html @@ -0,0 +1,508 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/3.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/3.html new file mode 100644 index 0000000..6d83c37 --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/3.html @@ -0,0 +1,1894 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/4.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/4.html new file mode 100644 index 0000000..d919dc7 --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/4.html @@ -0,0 +1,942 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/5.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/5.html new file mode 100644 index 0000000..08ef2a6 --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/5.html @@ -0,0 +1,582 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/6.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/6.html new file mode 100644 index 0000000..076d802 --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/6.html @@ -0,0 +1,1288 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/7.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/7.html new file mode 100644 index 0000000..4eff080 --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/7.html @@ -0,0 +1,1140 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/8.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/8.html new file mode 100644 index 0000000..510ccf0 --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/8.html @@ -0,0 +1,2744 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/9.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/9.html new file mode 100644 index 0000000..36376e2 --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/9.html @@ -0,0 +1,554 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/index.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/stats.html b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/style.css b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-02-25-111906-1427-cppcheck@dd13d6bf48e8_image-converter-path/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/index.html b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/index.html new file mode 100644 index 0000000..a7c026e --- /dev/null +++ b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@cea3275735e6
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 11.0.0 (Fedora 11.0.0-2.fc33) +
Date:Thu Feb 25 11:57:31 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
+ + diff --git a/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/report-1eb1b3.html b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/report-1eb1b3.html new file mode 100644 index 0000000..6ba4bb7 --- /dev/null +++ b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/report-1eb1b3.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-sign-compare -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-02-25-115731-6240-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/report-234045.html b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/report-234045.html new file mode 100644 index 0000000..bf22e80 --- /dev/null +++ b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/report-234045.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wno-sign-compare -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-02-25-115731-6240-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/scanview.css b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/sorttable.js b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-02-25-115731-6240-1@38ccb3eb4b0e_image-converter-path/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/1.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/1.html new file mode 100644 index 0000000..034d97d --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/1.html @@ -0,0 +1,1526 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/2.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/2.html new file mode 100644 index 0000000..ece1fab --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/2.html @@ -0,0 +1,508 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/3.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/3.html new file mode 100644 index 0000000..6d83c37 --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/3.html @@ -0,0 +1,1894 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/4.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/4.html new file mode 100644 index 0000000..d919dc7 --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/4.html @@ -0,0 +1,942 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/5.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/5.html new file mode 100644 index 0000000..08ef2a6 --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/5.html @@ -0,0 +1,582 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/6.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/6.html new file mode 100644 index 0000000..076d802 --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/6.html @@ -0,0 +1,1288 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/7.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/7.html new file mode 100644 index 0000000..4eff080 --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/7.html @@ -0,0 +1,1140 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/8.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/8.html new file mode 100644 index 0000000..510ccf0 --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/8.html @@ -0,0 +1,2744 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/9.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/9.html new file mode 100644 index 0000000..36376e2 --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/9.html @@ -0,0 +1,554 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/index.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/stats.html b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/style.css b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-02-25-115809-9594-cppcheck@38ccb3eb4b0e_image-converter-path/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-03-08-151632-5816-1@3ed9a7d14a00_master/index.html b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/index.html new file mode 100644 index 0000000..3a7a08a --- /dev/null +++ b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@df2edb2a7798
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 11.0.0 (Fedora 11.0.0-2.fc33) +
Date:Mon Mar 8 15:16:32 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
+ + diff --git a/2021-03-08-151632-5816-1@3ed9a7d14a00_master/report-890f46.html b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/report-890f46.html new file mode 100644 index 0000000..237300d --- /dev/null +++ b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/report-890f46.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-03-08-151632-5816-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-03-08-151632-5816-1@3ed9a7d14a00_master/report-c9e062.html b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/report-c9e062.html new file mode 100644 index 0000000..e198bef --- /dev/null +++ b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/report-c9e062.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-03-08-151632-5816-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-03-08-151632-5816-1@3ed9a7d14a00_master/scanview.css b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-03-08-151632-5816-1@3ed9a7d14a00_master/sorttable.js b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-03-08-151632-5816-1@3ed9a7d14a00_master/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/1.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/1.html new file mode 100644 index 0000000..034d97d --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/1.html @@ -0,0 +1,1526 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/2.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/2.html new file mode 100644 index 0000000..ece1fab --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/2.html @@ -0,0 +1,508 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/3.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/3.html new file mode 100644 index 0000000..6d83c37 --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/3.html @@ -0,0 +1,1894 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/4.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/4.html new file mode 100644 index 0000000..d919dc7 --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/4.html @@ -0,0 +1,942 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/5.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/5.html new file mode 100644 index 0000000..08ef2a6 --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/5.html @@ -0,0 +1,582 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/6.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/6.html new file mode 100644 index 0000000..076d802 --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/6.html @@ -0,0 +1,1288 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/7.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/7.html new file mode 100644 index 0000000..4eff080 --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/7.html @@ -0,0 +1,1140 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/8.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/8.html new file mode 100644 index 0000000..510ccf0 --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/8.html @@ -0,0 +1,2744 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/9.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/9.html new file mode 100644 index 0000000..36376e2 --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/9.html @@ -0,0 +1,554 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/index.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/stats.html b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/style.css b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-03-08-151711-8075-cppcheck@3ed9a7d14a00_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-03-11-214927-5824-1@73da71ed6a7c_master/index.html b/2021-03-11-214927-5824-1@73da71ed6a7c_master/index.html new file mode 100644 index 0000000..ecf4978 --- /dev/null +++ b/2021-03-11-214927-5824-1@73da71ed6a7c_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@3093a90d04d6
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 11.0.0 (Fedora 11.0.0-2.fc33) +
Date:Thu Mar 11 21:49:27 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
+ + diff --git a/2021-03-11-214927-5824-1@73da71ed6a7c_master/report-1f2279.html b/2021-03-11-214927-5824-1@73da71ed6a7c_master/report-1f2279.html new file mode 100644 index 0000000..4848afa --- /dev/null +++ b/2021-03-11-214927-5824-1@73da71ed6a7c_master/report-1f2279.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-03-11-214927-5824-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-03-11-214927-5824-1@73da71ed6a7c_master/report-ea9546.html b/2021-03-11-214927-5824-1@73da71ed6a7c_master/report-ea9546.html new file mode 100644 index 0000000..2af67d8 --- /dev/null +++ b/2021-03-11-214927-5824-1@73da71ed6a7c_master/report-ea9546.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-03-11-214927-5824-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-03-11-214927-5824-1@73da71ed6a7c_master/scanview.css b/2021-03-11-214927-5824-1@73da71ed6a7c_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-03-11-214927-5824-1@73da71ed6a7c_master/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-03-11-214927-5824-1@73da71ed6a7c_master/sorttable.js b/2021-03-11-214927-5824-1@73da71ed6a7c_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-03-11-214927-5824-1@73da71ed6a7c_master/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/1.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/1.html new file mode 100644 index 0000000..034d97d --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/1.html @@ -0,0 +1,1526 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/2.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/2.html new file mode 100644 index 0000000..ece1fab --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/2.html @@ -0,0 +1,508 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/3.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/3.html new file mode 100644 index 0000000..6d83c37 --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/3.html @@ -0,0 +1,1894 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/4.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/4.html new file mode 100644 index 0000000..d919dc7 --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/4.html @@ -0,0 +1,942 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/5.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/5.html new file mode 100644 index 0000000..08ef2a6 --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/5.html @@ -0,0 +1,582 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/6.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/6.html new file mode 100644 index 0000000..076d802 --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/6.html @@ -0,0 +1,1288 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/7.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/7.html new file mode 100644 index 0000000..4eff080 --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/7.html @@ -0,0 +1,1140 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/8.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/8.html new file mode 100644 index 0000000..510ccf0 --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/8.html @@ -0,0 +1,2744 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/9.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/9.html new file mode 100644 index 0000000..36376e2 --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/9.html @@ -0,0 +1,554 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/index.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/stats.html b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/style.css b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-03-11-215006-7782-cppcheck@73da71ed6a7c_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-04-22-220600-5791-1@826f67590ab2_master/index.html b/2021-04-22-220600-5791-1@826f67590ab2_master/index.html new file mode 100644 index 0000000..a509a40 --- /dev/null +++ b/2021-04-22-220600-5791-1@826f67590ab2_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@df57de7ddce6
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 11.0.0 (Fedora 11.0.0-2.fc33) +
Date:Thu Apr 22 22:06:00 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
+ + diff --git a/2021-04-22-220600-5791-1@826f67590ab2_master/report-da206f.html b/2021-04-22-220600-5791-1@826f67590ab2_master/report-da206f.html new file mode 100644 index 0000000..c45e31a --- /dev/null +++ b/2021-04-22-220600-5791-1@826f67590ab2_master/report-da206f.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-04-22-220600-5791-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-04-22-220600-5791-1@826f67590ab2_master/report-e739c1.html b/2021-04-22-220600-5791-1@826f67590ab2_master/report-e739c1.html new file mode 100644 index 0000000..aab5115 --- /dev/null +++ b/2021-04-22-220600-5791-1@826f67590ab2_master/report-e739c1.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-04-22-220600-5791-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-04-22-220600-5791-1@826f67590ab2_master/scanview.css b/2021-04-22-220600-5791-1@826f67590ab2_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-04-22-220600-5791-1@826f67590ab2_master/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-04-22-220600-5791-1@826f67590ab2_master/sorttable.js b/2021-04-22-220600-5791-1@826f67590ab2_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-04-22-220600-5791-1@826f67590ab2_master/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/1.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/1.html new file mode 100644 index 0000000..034d97d --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/1.html @@ -0,0 +1,1526 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/2.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/2.html new file mode 100644 index 0000000..ece1fab --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/2.html @@ -0,0 +1,508 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/3.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/3.html new file mode 100644 index 0000000..6d83c37 --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/3.html @@ -0,0 +1,1894 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/4.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/4.html new file mode 100644 index 0000000..d919dc7 --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/4.html @@ -0,0 +1,942 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/5.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/5.html new file mode 100644 index 0000000..08ef2a6 --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/5.html @@ -0,0 +1,582 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/6.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/6.html new file mode 100644 index 0000000..076d802 --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/6.html @@ -0,0 +1,1288 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/7.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/7.html new file mode 100644 index 0000000..4eff080 --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/7.html @@ -0,0 +1,1140 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/8.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/8.html new file mode 100644 index 0000000..510ccf0 --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/8.html @@ -0,0 +1,2744 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/9.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/9.html new file mode 100644 index 0000000..36376e2 --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/9.html @@ -0,0 +1,554 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/index.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/stats.html b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/style.css b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-04-22-220639-9772-cppcheck@826f67590ab2_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-05-29-194309-6385-1@ae9d57a55ef3_master/index.html b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/index.html new file mode 100644 index 0000000..f00e6ed --- /dev/null +++ b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@b16b5e27a94f
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34) +
Date:Sat May 29 19:43:09 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
+ + diff --git a/2021-05-29-194309-6385-1@ae9d57a55ef3_master/report-c9eaed.html b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/report-c9eaed.html new file mode 100644 index 0000000..9785a4b --- /dev/null +++ b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/report-c9eaed.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-05-29-194309-6385-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info)((__typeof__ (file_info)) (g_object_ref) (file_info)),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-05-29-194309-6385-1@ae9d57a55ef3_master/report-fbaf83.html b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/report-fbaf83.html new file mode 100644 index 0000000..425edbd --- /dev/null +++ b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/report-fbaf83.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-05-29-194309-6385-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info)((__typeof__ (file_info)) (g_object_ref) (file_info)),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-05-29-194309-6385-1@ae9d57a55ef3_master/scanview.css b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-05-29-194309-6385-1@ae9d57a55ef3_master/sorttable.js b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-05-29-194309-6385-1@ae9d57a55ef3_master/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/1.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/1.html new file mode 100644 index 0000000..e44f0e4 --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/1.html @@ -0,0 +1,1531 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/2.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/2.html new file mode 100644 index 0000000..b993801 --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/2.html @@ -0,0 +1,513 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/3.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/3.html new file mode 100644 index 0000000..82ada5d --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/3.html @@ -0,0 +1,1899 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/4.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/4.html new file mode 100644 index 0000000..2fbdc69 --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/4.html @@ -0,0 +1,947 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/5.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/5.html new file mode 100644 index 0000000..651580d --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/5.html @@ -0,0 +1,587 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/6.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/6.html new file mode 100644 index 0000000..b41892e --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/6.html @@ -0,0 +1,1293 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/7.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/7.html new file mode 100644 index 0000000..e72e241 --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/7.html @@ -0,0 +1,1145 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/8.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/8.html new file mode 100644 index 0000000..4625ab9 --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/8.html @@ -0,0 +1,2749 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/9.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/9.html new file mode 100644 index 0000000..9351a6b --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/9.html @@ -0,0 +1,559 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/index.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/stats.html b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/style.css b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-05-29-194349-4158-cppcheck@ae9d57a55ef3_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-06-05-093948-6368-1@5827807e577b_master/index.html b/2021-06-05-093948-6368-1@5827807e577b_master/index.html new file mode 100644 index 0000000..e9c7eed --- /dev/null +++ b/2021-06-05-093948-6368-1@5827807e577b_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@4965d5705002
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34) +
Date:Sat Jun 5 09:39:48 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
+ + diff --git a/2021-06-05-093948-6368-1@5827807e577b_master/report-081f15.html b/2021-06-05-093948-6368-1@5827807e577b_master/report-081f15.html new file mode 100644 index 0000000..9cce177 --- /dev/null +++ b/2021-06-05-093948-6368-1@5827807e577b_master/report-081f15.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-06-05-093948-6368-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info)((__typeof__ (file_info)) (g_object_ref) (file_info)),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-06-05-093948-6368-1@5827807e577b_master/report-837dd6.html b/2021-06-05-093948-6368-1@5827807e577b_master/report-837dd6.html new file mode 100644 index 0000000..23fd60f --- /dev/null +++ b/2021-06-05-093948-6368-1@5827807e577b_master/report-837dd6.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-06-05-093948-6368-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info)((__typeof__ (file_info)) (g_object_ref) (file_info)),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-06-05-093948-6368-1@5827807e577b_master/scanview.css b/2021-06-05-093948-6368-1@5827807e577b_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-06-05-093948-6368-1@5827807e577b_master/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-06-05-093948-6368-1@5827807e577b_master/sorttable.js b/2021-06-05-093948-6368-1@5827807e577b_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-06-05-093948-6368-1@5827807e577b_master/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/1.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/1.html new file mode 100644 index 0000000..e44f0e4 --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/1.html @@ -0,0 +1,1531 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/2.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/2.html new file mode 100644 index 0000000..b993801 --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/2.html @@ -0,0 +1,513 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/3.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/3.html new file mode 100644 index 0000000..82ada5d --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/3.html @@ -0,0 +1,1899 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/4.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/4.html new file mode 100644 index 0000000..2fbdc69 --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/4.html @@ -0,0 +1,947 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/5.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/5.html new file mode 100644 index 0000000..651580d --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/5.html @@ -0,0 +1,587 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/6.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/6.html new file mode 100644 index 0000000..b41892e --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/6.html @@ -0,0 +1,1293 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/7.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/7.html new file mode 100644 index 0000000..e72e241 --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/7.html @@ -0,0 +1,1145 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/8.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/8.html new file mode 100644 index 0000000..4625ab9 --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/8.html @@ -0,0 +1,2749 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/9.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/9.html new file mode 100644 index 0000000..9351a6b --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/9.html @@ -0,0 +1,559 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/index.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/stats.html b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-06-05-094029-7788-cppcheck@5827807e577b_master/style.css b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-06-05-094029-7788-cppcheck@5827807e577b_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/index.html b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/index.html new file mode 100644 index 0000000..ea6257e --- /dev/null +++ b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@cc7b7b5d2d42
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34) +
Date:Sat Jun 5 09:45:08 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
+ + diff --git a/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/report-067466.html b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/report-067466.html new file mode 100644 index 0000000..d3b8153 --- /dev/null +++ b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/report-067466.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-06-05-094508-6398-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info)((__typeof__ (file_info)) (g_object_ref) (file_info)),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/report-df9db1.html b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/report-df9db1.html new file mode 100644 index 0000000..32651b9 --- /dev/null +++ b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/report-df9db1.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-06-05-094508-6398-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info)((__typeof__ (file_info)) (g_object_ref) (file_info)),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/scanview.css b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/sorttable.js b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-06-05-094508-6398-1@5827807e577b_v1.25.1/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/1.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/1.html new file mode 100644 index 0000000..e44f0e4 --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/1.html @@ -0,0 +1,1531 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/2.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/2.html new file mode 100644 index 0000000..b993801 --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/2.html @@ -0,0 +1,513 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/3.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/3.html new file mode 100644 index 0000000..82ada5d --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/3.html @@ -0,0 +1,1899 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/4.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/4.html new file mode 100644 index 0000000..2fbdc69 --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/4.html @@ -0,0 +1,947 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/5.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/5.html new file mode 100644 index 0000000..651580d --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/5.html @@ -0,0 +1,587 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/6.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/6.html new file mode 100644 index 0000000..b41892e --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/6.html @@ -0,0 +1,1293 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/7.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/7.html new file mode 100644 index 0000000..e72e241 --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/7.html @@ -0,0 +1,1145 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/8.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/8.html new file mode 100644 index 0000000..4625ab9 --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/8.html @@ -0,0 +1,2749 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/9.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/9.html new file mode 100644 index 0000000..9351a6b --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/9.html @@ -0,0 +1,559 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/index.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/index.html new file mode 100644 index 0000000..4a2aefb --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
90variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/stats.html b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/style.css b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-06-05-094547-7071-cppcheck@5827807e577b_v1.25.1/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/2021-06-20-001311-6397-1@05a180885c0d_master/index.html b/2021-06-20-001311-6397-1@05a180885c0d_master/index.html new file mode 100644 index 0000000..9c3a585 --- /dev/null +++ b/2021-06-20-001311-6397-1@05a180885c0d_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@9e218d2ec9c2
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 12.0.0 (Fedora 12.0.0-2.fc34) +
Date:Sun Jun 20 00:13:11 2021
+

Bug Summary

+ + + + +
Bug TypeQuantityDisplay?
All Bugs2
Security
Potential insecure memory buffer bounds restriction in call 'strcpy'2
+

Reports

+ + + + + + + + + + + + + + + + + + + + +
Bug GroupBug Type ▾FileFunction/MethodLinePath Length
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2951View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
+ + diff --git a/2021-06-20-001311-6397-1@05a180885c0d_master/report-131056.html b/2021-06-20-001311-6397-1@05a180885c0d_master/report-131056.html new file mode 100644 index 0000000..8e7e3b1 --- /dev/null +++ b/2021-06-20-001311-6397-1@05a180885c0d_master/report-131056.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 295, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-06-20-001311-6397-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info)((__typeof__ (file_info)) (g_object_ref) (file_info)),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-06-20-001311-6397-1@05a180885c0d_master/report-aa40d4.html b/2021-06-20-001311-6397-1@05a180885c0d_master/report-aa40d4.html new file mode 100644 index 0000000..09f4d98 --- /dev/null +++ b/2021-06-20-001311-6397-1@05a180885c0d_master/report-aa40d4.html @@ -0,0 +1,1024 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 294, column 2
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
+ +

Annotated Source Code

+

Press '?' + to see keyboard shortcuts

+ + +
clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name caja-open-terminal.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -D HAVE_CONFIG_H -I . -I .. -D G_DISABLE_DEPRECATED -D GDK_PIXBUF_DISABLE_DEPRECATED -D MATELOCALEDIR="/usr/local/share/locale" -I .. -D G_LOG_DOMAIN="Caja-Open-Terminal" -D DATADIR="/usr/local/share" -I /usr/include/caja -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/sysprof-4 -I /usr/include/mate-desktop-2.0 -I /usr/include/gtk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/libxml2 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/gio-unix-2.0 -I /usr/include/cloudproviders -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include -I /usr/include/at-spi-2.0 -I /usr/include/startup-notification-1.0 -I /usr/include/dconf -D PIC -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -fdebug-compilation-dir /rootdir/open-terminal -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-checker security.insecureAPI.strcpy -analyzer-output=html -faddrsig -o /rootdir/html-report/2021-06-20-001311-6397-1 -x c caja-open-terminal.c +
+ + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1/*
2 * caja-open-terminal.c
3 *
4 * Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * Author: Christian Neumair <chris@gnome-de.org>
21 *
22 */
23
24#ifdef HAVE_CONFIG_H1
25#include <config.h>
26#endif
27
28#include <glib/gi18n-lib.h>
29
30#include "caja-open-terminal.h"
31
32#include <libcaja-extension/caja-menu-provider.h>
33#include <libcaja-extension/caja-configurable.h>
34
35#include <gtk/gtkicontheme.h>
36#include <gtk/gtkwidget.h>
37#include <gtk/gtkmain.h>
38
39#include <libmate-desktop/mate-desktop-item.h>
40#include <gio/gio.h>
41
42#include <errno(*__errno_location ()).h>
43#include <fcntl.h>
44#include <string.h> /* for strcmp, strdup, ... */
45#include <unistd.h> /* for chdir */
46#include <stdlib.h> /* for atoi */
47#include <sys/stat.h>
48
49#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
50#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
51#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
52#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
53#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
54#define TERM_EXEC_KEY"exec" "exec"
55
56static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
57static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
58
59static GType terminal_type = 0;
60
61typedef enum {
62 FILE_INFO_LOCAL,
63 FILE_INFO_DESKTOP,
64 FILE_INFO_SFTP,
65 FILE_INFO_OTHER
66} TerminalFileInfo;
67
68static TerminalFileInfo
69get_terminal_file_info (CajaFileInfo *file_info)
70{
71 TerminalFileInfo ret;
72 char *uri;
73 char *uri_scheme;
74
75 uri = caja_file_info_get_activation_uri (file_info);
76 uri_scheme = g_uri_parse_scheme (uri);
77
78 if (strcmp (uri_scheme, "file") == 0) {
79 ret = FILE_INFO_LOCAL;
80 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
81 ret = FILE_INFO_DESKTOP;
82 } else if (strcmp (uri_scheme, "sftp") == 0 ||
83 strcmp (uri_scheme, "ssh") == 0) {
84 ret = FILE_INFO_SFTP;
85 } else {
86 ret = FILE_INFO_OTHER;
87 }
88
89 g_free (uri_scheme);
90 g_free (uri);
91
92 return ret;
93}
94
95static char *
96lookup_in_data_dir (const char *basename,
97 const char *data_dir)
98{
99 char *path;
100
101 path = g_build_filename (data_dir, basename, NULL((void*)0));
102 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
103 g_free (path);
104 return NULL((void*)0);
105 }
106
107 return path;
108}
109
110static char *
111lookup_in_data_dirs (const char *basename)
112{
113 const char * const *system_data_dirs;
114 const char *user_data_dir;
115 char *retval;
116 int i;
117
118 user_data_dir = g_get_user_data_dir ();
119 system_data_dirs = g_get_system_data_dirs ();
120
121 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
122 return retval;
123 }
124
125 for (i = 0; system_data_dirs[i]; i++) {
126 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
127 return retval;
128 }
129
130 return NULL((void*)0);
131}
132
133static inline gboolean
134desktop_opens_home_dir (void)
135{
136 gboolean result;
137 GSettings* settings;
138
139 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
140 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
141 g_object_unref (settings);
142 return result;
143}
144
145static inline gboolean
146set_desktop_opens_home_dir (gboolean val)
147{
148 gboolean result;
149 GSettings* settings;
150
151 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
152 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
153 g_object_unref (settings);
154 return result;
155}
156
157static inline gboolean
158desktop_is_home_dir (void)
159{
160 gboolean result;
161 GSettings* settings;
162
163 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
164 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
165 g_object_unref (settings);
166 return result;
167}
168
169static inline gchar*
170default_terminal_application (void)
171{
172 gchar *result;
173 GSettings* settings;
174
175 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
176 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
177 g_object_unref (settings);
178
179 if (result == NULL((void*)0) || strlen (result) == 0) {
180 g_free (result);
181 result = g_strdup ("mate-terminal");
182 }
183
184 return result;
185}
186
187static inline gboolean
188set_default_terminal_application (const gchar* exec)
189{
190 gboolean result;
191 GSettings* settings;
192
193 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
194 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
195 g_object_unref (settings);
196 return result;
197}
198
199static void
200parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
201 char **path)
202{
203 char *uri = g_file_get_uri (file);
204 char *u, *h, *s, *p;
205 char *h_end;
206
207 g_assert (uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 207, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
208
209 u = strchr(uri, ':');
210 g_assert (u != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (u != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 210, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
211 u += 3; /* Skip over :// to userid */
212
213 p = strchr (u, '/');
214 h = strchr(u, '@');
215
216 if (h && ((p == NULL((void*)0)) || (h < p))) {
217 *h='\0';
218 h++;
219 } else {
220 h = u;
221 u = NULL((void*)0);
222 }
223
224 s = strchr(h, ':');
225
226 if (s && (p == NULL((void*)0) || s < p)) {
227 h_end = s;
228 *s = '\0';
229 s++;
230 } else {
231 h_end = p;
232 s = NULL((void*)0);
233 }
234
235 if (h_end == NULL((void*)0)) {
236 h_end = h + strlen(h);
237 }
238
239 *user = g_strdup(u);
240 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
241 *path = g_uri_unescape_string (p, "/");
242 *h_end = '\0';
243 *host = g_strdup(h);
244
245 g_free (uri);
246}
247
248static void
249append_sftp_info (char **terminal_exec,
250 CajaFileInfo *file_info)
251{
252 GFile *vfs_uri;
253 char *host_name, *path, *user_name;
254 char *user_host, *cmd, *quoted_cmd;
255 char *host_port_switch;
256 char *quoted_path;
257 char *remote_cmd;
258 char *quoted_remote_cmd;
259 guint host_port;
260
261 g_assert (terminal_exec != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (terminal_exec != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 261, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
262 g_assert (file_info != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (file_info != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 262, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
263
264
265 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
266 g_assert (vfs_uri != NULL)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (vfs_uri != ((void*)0)) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 266, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
267
268 g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
269 g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_
; if (g_file_has_uri_scheme(vfs_uri, "sftp")==(!(0)) || g_file_has_uri_scheme
(vfs_uri, "ssh")==(!(0))) _g_boolean_var_ = 1; else _g_boolean_var_
= 0; _g_boolean_var_; }), 1)) ; else g_assertion_message_expr
("Caja-Open-Terminal", "caja-open-terminal.c", 269, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
270
271 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
272
273 if (host_port == 0) {
274 host_port_switch = g_strdup ("");
275 } else {
276 host_port_switch = g_strdup_printf ("-p %d", host_port);
277 }
278
279 if (user_name != NULL((void*)0)) {
280 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
281 } else {
282 user_host = g_strdup (host_name);
283 }
284
285 quoted_path = g_shell_quote (path);
286 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
287 quoted_remote_cmd = g_shell_quote (remote_cmd);
288
289 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
290 quoted_cmd = g_shell_quote (cmd);
291 g_free (cmd);
292
293 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
294 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
295 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
296
297 g_free (host_name);
298 g_free (user_name);
299 g_free (host_port_switch);
300 g_free (path);
301 g_free (quoted_path);
302
303 g_free (remote_cmd);
304 g_free (quoted_remote_cmd);
305 g_free (quoted_cmd);
306 g_free (user_host);
307 g_object_unref (vfs_uri);
308}
309
310static void
311open_terminal_callback (CajaMenuItem *item,
312 CajaFileInfo *file_info)
313{
314 GdkDisplay *display;
315 const gchar *display_str;
316 const gchar *old_display_str;
317 gchar *uri;
318 gchar **argv, *terminal_exec;
319 gchar *working_directory;
320 gchar *dfile;
321 MateDesktopItem *ditem;
322 GdkScreen *screen;
323
324 terminal_exec = default_terminal_application();
325
326 switch (get_terminal_file_info (file_info)) {
327 case FILE_INFO_LOCAL:
328 uri = caja_file_info_get_activation_uri (file_info);
329 if (uri != NULL((void*)0)) {
330 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
331 } else {
332 working_directory = g_strdup (g_get_home_dir ());
333 }
334 g_free (uri);
335 break;
336
337 case FILE_INFO_DESKTOP:
338 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
339 working_directory = g_strdup (g_get_home_dir ());
340 } else {
341 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
342 }
343 break;
344
345 case FILE_INFO_SFTP:
346 working_directory = NULL((void*)0);
347 append_sftp_info (&terminal_exec, file_info);
348 break;
349
350 case FILE_INFO_OTHER:
351 default:
352 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 352, ((const char*) (__func__)), ((void*)0)); } while (0)
;
353 }
354
355 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
356 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
357 } else {
358 dfile = NULL((void*)0);
359 }
360
361 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
362
363 display_str = NULL((void*)0);
364 old_display_str = g_getenv ("DISPLAY");
365
366 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
367 display = gdk_screen_get_display (screen);
368 if (screen != NULL((void*)0)) {
369 display_str = gdk_display_get_name (display);
370 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
371 }
372
373 if (dfile != NULL((void*)0)) {
374 int orig_cwd = -1;
375
376 do {
377 orig_cwd = open (".", O_RDONLY00);
378 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
379
380 if (orig_cwd == -1) {
381 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
382 } else if (working_directory != NULL((void*)0)) {
383
384 if (chdir (working_directory) == -1) {
385 int ret;
386
387 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
388 working_directory);
389
390 do {
391 ret = close (orig_cwd);
392 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
393
394 if (ret == -1) {
395 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
396 }
397
398 orig_cwd = -1;
399 }
400 }
401
402 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
403
404 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
405 if (gtk_get_current_event_time () > 0) {
406 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
407 }
408 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
409 mate_desktop_item_unref (ditem);
410 g_free (dfile);
411
412 if (orig_cwd != -1) {
413 int ret;
414
415 ret = fchdir (orig_cwd);
416 if (ret == -1) {
417 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
418 working_directory);
419 }
420
421 do {
422 ret = close (orig_cwd);
423 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
424
425 if (ret == -1) {
426 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
427 }
428 }
429 } else {
430 g_spawn_async (working_directory,
431 argv,
432 NULL((void*)0),
433 G_SPAWN_SEARCH_PATH,
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0),
437 NULL((void*)0));
438 }
439
440 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
441
442 g_strfreev (argv);
443 g_free (terminal_exec);
444 g_free (working_directory);
445}
446
447static CajaMenuItem *
448open_terminal_menu_item_new (CajaFileInfo *file_info,
449 TerminalFileInfo terminal_file_info,
450 GdkScreen *screen,
451 gboolean is_file_item)
452{
453 CajaMenuItem *ret;
454 const char *name;
455 const char *tooltip;
456
457 switch (terminal_file_info) {
458 case FILE_INFO_LOCAL:
459 case FILE_INFO_SFTP:
460 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
461 if (is_file_item) {
462 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
463 } else {
464 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
465 }
466 break;
467
468 case FILE_INFO_DESKTOP:
469 if (desktop_opens_home_dir ()) {
470 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
471 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
472 } else {
473 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
474 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
475 }
476 break;
477
478 case FILE_INFO_OTHER:
479 default:
480 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 480, ((const char*) (__func__)), ((void*)0)); } while (0)
;
481 }
482
483 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
484 name, tooltip, "terminal");
485
486 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
487 "CajaOpenTerminal::screen",
488 screen);
489
490 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
491 g_object_ref (file_info)((__typeof__ (file_info)) (g_object_ref) (file_info)),
492 (GDestroyNotify) g_object_unref);
493 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
495 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
496
497 return ret;
498}
499
500static GList *
501caja_open_terminal_get_background_items (CajaMenuProvider *provider,
502 GtkWidget *window,
503 CajaFileInfo *file_info)
504{
505 CajaMenuItem *item;
506 TerminalFileInfo terminal_file_info;
507
508 terminal_file_info = get_terminal_file_info (file_info);
509 switch (terminal_file_info) {
510 case FILE_INFO_LOCAL:
511 case FILE_INFO_DESKTOP:
512 case FILE_INFO_SFTP:
513 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
514 return g_list_append (NULL((void*)0), item);
515
516 case FILE_INFO_OTHER:
517 return NULL((void*)0);
518
519 default:
520 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 520, ((const char*) (__func__)), ((void*)0)); } while (0)
;
521 }
522}
523
524static GList *
525caja_open_terminal_get_file_items (CajaMenuProvider *provider,
526 GtkWidget *window,
527 GList *files)
528{
529 CajaMenuItem *item;
530 TerminalFileInfo terminal_file_info;
531
532 if (g_list_length (files) != 1 ||
533 (!caja_file_info_is_directory (files->data) &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
535 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
536 return NULL((void*)0);
537 }
538
539 terminal_file_info = get_terminal_file_info (files->data);
540 switch (terminal_file_info) {
541 case FILE_INFO_LOCAL:
542 case FILE_INFO_SFTP:
543 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
544 return g_list_append (NULL((void*)0), item);
545
546 case FILE_INFO_DESKTOP:
547 case FILE_INFO_OTHER:
548 return NULL((void*)0);
549
550 default:
551 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 551, ((const char*) (__func__)), ((void*)0)); } while (0)
;
552 }
553}
554
555static void
556caja_open_terminal_run_config (CajaConfigurable *provider)
557{
558 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
559 gchar * terminal;
560
561 extconf_dialog = gtk_dialog_new ();
562 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
563
564 extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop")((char *) g_dgettext ("caja-extensions", "Open at Home if trying to open on desktop"
))
);
565 extconf_exec = gtk_entry_new ();
566 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
567 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
568
569 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
, desktop_opens_home_dir ());
570
571 terminal = default_terminal_application();
572 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
573 g_free (terminal);
574
575 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
576 gtk_widget_show (extconf_inform2);
577 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
578 gtk_widget_show (extconf_exec);
579 gtk_box_set_child_packing (GTK_BOX (extconf_inform1)((((GtkBox*) g_type_check_instance_cast ((GTypeInstance*) ((extconf_inform1
)), ((gtk_box_get_type ()))))))
, extconf_exec, FALSE(0), FALSE(0), 0, GTK_PACK_END);
580
581 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
582 gtk_widget_show (extconf_desktophomedir);
583 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
584 gtk_widget_show (extconf_inform1);
585 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
586 gtk_widget_show (extconf_exec);
587 gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
, _("Close")((char *) g_dgettext ("caja-extensions", "Close")), GTK_RESPONSE_OK, NULL((void*)0));
588
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
591 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
592
593 gtk_window_set_title (GTK_WINDOW (extconf_dialog)((((GtkWindow*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_window_get_type ()))))))
, _("open-terminal Configuration")((char *) g_dgettext ("caja-extensions", "open-terminal Configuration"
))
);
594 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
595
596 set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
));
597 set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)((((GtkToggleButton*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_desktophomedir)), ((gtk_toggle_button_get_type (
)))))))
));
598
599 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
600}
601
602static void
603caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
604{
605 iface->get_background_items = caja_open_terminal_get_background_items;
606 iface->get_file_items = caja_open_terminal_get_file_items;
607}
608
609static void
610caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
611{
612 iface->run_config = caja_open_terminal_run_config;
613}
614
615static void
616caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
617{
618}
619
620static void
621caja_open_terminal_class_init (CajaOpenTerminalClass *class)
622{
623}
624
625GType
626caja_open_terminal_get_type (void)
627{
628 return terminal_type;
629}
630
631void
632caja_open_terminal_register_type (GTypeModule *module)
633{
634 static const GTypeInfo info = {
635 sizeof (CajaOpenTerminalClass),
636 (GBaseInitFunc) NULL((void*)0),
637 (GBaseFinalizeFunc) NULL((void*)0),
638 (GClassInitFunc) caja_open_terminal_class_init,
639 NULL((void*)0),
640 NULL((void*)0),
641 sizeof (CajaOpenTerminal),
642 0,
643 (GInstanceInitFunc) caja_open_terminal_instance_init,
644 };
645
646 static const GInterfaceInfo menu_provider_iface_info = {
647 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
648 NULL((void*)0),
649 NULL((void*)0)
650 };
651
652 static const GInterfaceInfo configurable_iface_info = {
653 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
654 NULL((void*)0),
655 NULL((void*)0)
656 };
657
658 terminal_type = g_type_module_register_type (module,
659 G_TYPE_OBJECT((GType) ((20) << (2))),
660 "CajaOpenTerminal",
661 &info, 0);
662
663 g_type_module_add_interface (module,
664 terminal_type,
665 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
666 &menu_provider_iface_info);
667
668 g_type_module_add_interface (module,
669 terminal_type,
670 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
671 &configurable_iface_info);
672}
diff --git a/2021-06-20-001311-6397-1@05a180885c0d_master/scanview.css b/2021-06-20-001311-6397-1@05a180885c0d_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2021-06-20-001311-6397-1@05a180885c0d_master/scanview.css @@ -0,0 +1,62 @@ +body { color:#000000; background-color:#ffffff } +body { font-family: Helvetica, sans-serif; font-size:9pt } +h1 { font-size: 14pt; } +h2 { font-size: 12pt; } +table { font-size:9pt } +table { border-spacing: 0px; border: 1px solid black } +th, table thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:center; + font-weight: bold; font-family: Verdana; + white-space:nowrap; +} +.W { font-size:0px } +th, td { padding:5px; padding-left:8px; text-align:left } +td.SUMM_DESC { padding-left:12px } +td.DESC { white-space:pre } +td.Q { text-align:right } +td { text-align:left } +tbody.scrollContent { overflow:auto } + +table.form_group { + background-color: #ccc; + border: 1px solid #333; + padding: 2px; +} + +table.form_inner_group { + background-color: #ccc; + border: 1px solid #333; + padding: 0px; +} + +table.form { + background-color: #999; + border: 1px solid #333; + padding: 2px; +} + +td.form_label { + text-align: right; + vertical-align: top; +} +/* For one line entires */ +td.form_clabel { + text-align: right; + vertical-align: center; +} +td.form_value { + text-align: left; + vertical-align: top; +} +td.form_submit { + text-align: right; + vertical-align: top; +} + +h1.SubmitFail { + color: #f00; +} +h1.SubmitOk { +} diff --git a/2021-06-20-001311-6397-1@05a180885c0d_master/sorttable.js b/2021-06-20-001311-6397-1@05a180885c0d_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2021-06-20-001311-6397-1@05a180885c0d_master/sorttable.js @@ -0,0 +1,492 @@ +/* + SortTable + version 2 + 7th April 2007 + Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ + + Instructions: + Download this file + Add to your HTML + Add class="sortable" to any table you'd like to make sortable + Click on the headers to sort + + Thanks to many, many people for contributions and suggestions. + Licenced as X11: http://www.kryogenix.org/code/browser/licence.html + This basically means: do what you want with it. +*/ + + +var stIsIE = /*@cc_on!@*/false; + +sorttable = { + init: function() { + // quit if this function has already been called + if (arguments.callee.done) return; + // flag this function so we don't do the same thing twice + arguments.callee.done = true; + // kill the timer + if (_timer) clearInterval(_timer); + + if (!document.createElement || !document.getElementsByTagName) return; + + sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; + + forEach(document.getElementsByTagName('table'), function(table) { + if (table.className.search(/\bsortable\b/) != -1) { + sorttable.makeSortable(table); + } + }); + + }, + + makeSortable: function(table) { + if (table.getElementsByTagName('thead').length == 0) { + // table doesn't have a tHead. Since it should have, create one and + // put the first table row in it. + the = document.createElement('thead'); + the.appendChild(table.rows[0]); + table.insertBefore(the,table.firstChild); + } + // Safari doesn't support table.tHead, sigh + if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; + + if (table.tHead.rows.length != 1) return; // can't cope with two header rows + + // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as + // "total" rows, for example). This is B&R, since what you're supposed + // to do is put them in a tfoot. So, if there are sortbottom rows, + // for backward compatibility, move them to tfoot (creating it if needed). + sortbottomrows = []; + for (var i=0; i5' : ' ▴'; + this.appendChild(sortrevind); + return; + } + if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { + // if we're already sorted by this column in reverse, just + // re-reverse the table, which is quicker + sorttable.reverse(this.sorttable_tbody); + this.className = this.className.replace('sorttable_sorted_reverse', + 'sorttable_sorted'); + this.removeChild(document.getElementById('sorttable_sortrevind')); + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + return; + } + + // remove sorttable_sorted classes + theadrow = this.parentNode; + forEach(theadrow.childNodes, function(cell) { + if (cell.nodeType == 1) { // an element + cell.className = cell.className.replace('sorttable_sorted_reverse',''); + cell.className = cell.className.replace('sorttable_sorted',''); + } + }); + sortfwdind = document.getElementById('sorttable_sortfwdind'); + if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } + sortrevind = document.getElementById('sorttable_sortrevind'); + if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } + + this.className += ' sorttable_sorted'; + sortfwdind = document.createElement('span'); + sortfwdind.id = "sorttable_sortfwdind"; + sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; + this.appendChild(sortfwdind); + + // build an array to sort. This is a Schwartzian transform thing, + // i.e., we "decorate" each row with the actual sort key, + // sort based on the sort keys, and then put the rows back in order + // which is a lot faster because you only do getInnerText once per row + row_array = []; + col = this.sorttable_columnindex; + rows = this.sorttable_tbody.rows; + for (var j=0; j 12) { + // definitely dd/mm + return sorttable.sort_ddmm; + } else if (second > 12) { + return sorttable.sort_mmdd; + } else { + // looks like a date, but we can't tell which, so assume + // that it's dd/mm (English imperialism!) and keep looking + sortfn = sorttable.sort_ddmm; + } + } + } + } + return sortfn; + }, + + getInnerText: function(node) { + // gets the text we want to use for sorting for a cell. + // strips leading and trailing whitespace. + // this is *not* a generic getInnerText function; it's special to sorttable. + // for example, you can override the cell text with a customkey attribute. + // it also gets .value for fields. + + hasInputs = (typeof node.getElementsByTagName == 'function') && + node.getElementsByTagName('input').length; + + if (node.getAttribute("sorttable_customkey") != null) { + return node.getAttribute("sorttable_customkey"); + } + else if (typeof node.textContent != 'undefined' && !hasInputs) { + return node.textContent.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.innerText != 'undefined' && !hasInputs) { + return node.innerText.replace(/^\s+|\s+$/g, ''); + } + else if (typeof node.text != 'undefined' && !hasInputs) { + return node.text.replace(/^\s+|\s+$/g, ''); + } + else { + switch (node.nodeType) { + case 3: + if (node.nodeName.toLowerCase() == 'input') { + return node.value.replace(/^\s+|\s+$/g, ''); + } + case 4: + return node.nodeValue.replace(/^\s+|\s+$/g, ''); + break; + case 1: + case 11: + var innerText = ''; + for (var i = 0; i < node.childNodes.length; i++) { + innerText += sorttable.getInnerText(node.childNodes[i]); + } + return innerText.replace(/^\s+|\s+$/g, ''); + break; + default: + return ''; + } + } + }, + + reverse: function(tbody) { + // reverse the rows in a tbody + newrows = []; + for (var i=0; i=0; i--) { + tbody.appendChild(newrows[i]); + } + delete newrows; + }, + + /* sort functions + each sort function takes two parameters, a and b + you are comparing a[0] and b[0] */ + sort_numeric: function(a,b) { + aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); + if (isNaN(aa)) aa = 0; + bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); + if (isNaN(bb)) bb = 0; + return aa-bb; + }, + sort_alpha: function(a,b) { + if (a[0]==b[0]) return 0; + if (a[0] 0 ) { + var q = list[i]; list[i] = list[i+1]; list[i+1] = q; + swap = true; + } + } // for + t--; + + if (!swap) break; + + for(var i = t; i > b; --i) { + if ( comp_func(list[i], list[i-1]) < 0 ) { + var q = list[i]; list[i] = list[i-1]; list[i-1] = q; + swap = true; + } + } // for + b++; + + } // while(swap) + } +} + +/* ****************************************************************** + Supporting functions: bundled here to avoid depending on a library + ****************************************************************** */ + +// Dean Edwards/Matthias Miller/John Resig + +/* for Mozilla/Opera9 */ +if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", sorttable.init, false); +} + +/* for Internet Explorer */ +/*@cc_on @*/ +/*@if (@_win32) + document.write(" + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.imageconverter"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 0000, 0000, 0000, 0050, 0011, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0002, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0003, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 0005, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0004, 0000, 0114, 0000, 0040, 0001, 0000, 0000, 0044, 0001, 0000, 0000, 0362, 0306, 0050, 0375, 
+  0004, 0000, 0000, 0000, 0044, 0001, 0000, 0000, 0024, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0212, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0212, 0007, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0220, 0007, 0000, 0000, 0224, 0007, 0000, 0000, 0176, 0157, 0252, 0021, 
+  0002, 0000, 0000, 0000, 0224, 0007, 0000, 0000, 0013, 0000, 0114, 0000, 0240, 0007, 0000, 0000, 
+  0244, 0007, 0000, 0000, 0110, 0122, 0272, 0300, 0003, 0000, 0000, 0000, 0244, 0007, 0000, 0000, 
+  0017, 0000, 0114, 0000, 0264, 0007, 0000, 0000, 0300, 0007, 0000, 0000, 0324, 0265, 0002, 0000, 
+  0377, 0377, 0377, 0377, 0300, 0007, 0000, 0000, 0001, 0000, 0114, 0000, 0304, 0007, 0000, 0000, 
+  0310, 0007, 0000, 0000, 0157, 0174, 0237, 0161, 0004, 0000, 0000, 0000, 0310, 0007, 0000, 0000, 
+  0024, 0000, 0166, 0000, 0340, 0007, 0000, 0000, 0130, 0015, 0000, 0000, 0073, 0056, 0277, 0311, 
+  0004, 0000, 0000, 0000, 0130, 0015, 0000, 0000, 0017, 0000, 0166, 0000, 0150, 0015, 0000, 0000, 
+  0334, 0020, 0000, 0000, 0201, 0321, 0040, 0031, 0000, 0000, 0000, 0000, 0334, 0020, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0344, 0020, 0000, 0000, 0350, 0020, 0000, 0000, 0157, 0162, 0147, 0057, 
+  0010, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 0147, 0145, 0055, 0162, 
+  0145, 0163, 0151, 0172, 0145, 0056, 0165, 0151, 0316, 0140, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0135, 0335, 0123, 0343, 0066, 0020, 0177, 0277, 0277, 0302, 0325, 0153, 0047, 
+  0304, 0061, 0220, 0206, 0233, 0304, 0067, 0224, 0226, 0153, 0147, 0372, 0164, 0320, 0351, 0243, 
+  0107, 0261, 0105, 0242, 0103, 0221, 0134, 0131, 0046, 0111, 0377, 0372, 0312, 0162, 0200, 0204, 
+  0370, 0103, 0212, 0015, 0227, 0017, 0061, 0303, 0114, 0160, 0264, 0053, 0355, 0157, 0265, 0253, 
+  0335, 0225, 0045, 0206, 0137, 0026, 0063, 0342, 0074, 0041, 0236, 0140, 0106, 0107, 0240, 0167, 
+  0346, 0002, 0007, 0321, 0220, 0105, 0230, 0116, 0106, 0340, 0357, 0373, 0333, 0316, 0000, 0174, 
+  0361, 0077, 0015, 0177, 0352, 0164, 0234, 0257, 0210, 0042, 0016, 0005, 0212, 0234, 0071, 0026, 
+  0123, 0147, 0102, 0140, 0204, 0234, 0363, 0063, 0317, 0073, 0363, 0234, 0116, 0107, 0066, 0302, 
+  0124, 0040, 0376, 0000, 0103, 0344, 0177, 0162, 0234, 0041, 0107, 0377, 0246, 0230, 0243, 0304, 
+  0041, 0170, 0074, 0002, 0023, 0361, 0370, 0063, 0170, 0355, 0050, 0043, 0003, 0135, 0325, 0216, 
+  0215, 0277, 0243, 0120, 0070, 0041, 0201, 0111, 0062, 0002, 0137, 0305, 0343, 0165, 0364, 0075, 
+  0115, 0304, 0014, 0121, 0001, 0034, 0034, 0215, 0000, 0174, 0371, 0273, 0007, 0062, 0012, 0111, 
+  0023, 0163, 0026, 0043, 0056, 0226, 0016, 0205, 0063, 0064, 0002, 0204, 0315, 0021, 0007, 0176, 
+  0157, 0330, 0175, 0376, 0242, 0270, 0135, 0032, 0307, 0252, 0235, 0353, 0326, 0265, 0174, 0202, 
+  0044, 0105, 0300, 0277, 0254, 0155, 0230, 0010, 0024, 0007, 0230, 0206, 0034, 0251, 0001, 0327, 
+  0217, 0041, 0206, 0023, 0264, 0101, 0360, 0246, 0213, 0141, 0067, 0007, 0304, 0024, 0033, 0257, 
+  0035, 0154, 0256, 0344, 0217, 0046, 0070, 0022, 0306, 0303, 0201, 0347, 0334, 0302, 0043, 0036, 
+  0377, 0234, 0111, 0362, 0034, 0031, 0234, 0175, 0054, 0263, 0247, 0047, 0234, 0340, 0061, 0221, 
+  0062, 0334, 0363, 0024, 0325, 0015, 0051, 0204, 0064, 0170, 0140, 0141, 0232, 0000, 0377, 0026, 
+  0222, 0244, 0266, 0075, 0016, 0031, 0015, 0262, 0217, 0300, 0227, 0116, 0241, 0043, 0311, 0103, 
+  0104, 0114, 0244, 0370, 0015, 0103, 0302, 0046, 0271, 0030, 0322, 0277, 0340, 0377, 0120, 0020, 
+  0345, 0217, 0332, 0031, 0240, 0300, 0102, 0312, 0356, 0010, 0016, 0151, 0102, 0240, 0200, 0022, 
+  0211, 0021, 0130, 0042, 0111, 0376, 0115, 0365, 0346, 0050, 0030, 0223, 0132, 0066, 0313, 0030, 
+  0005, 0123, 0234, 0151, 0051, 0037, 0336, 0026, 0101, 0070, 0305, 0044, 0312, 0077, 0147, 0344, 
+  0104, 0172, 0316, 0051, 0043, 0021, 0342, 0335, 0125, 0203, 0356, 0132, 0213, 0274, 0265, 0243, 
+  0174, 0054, 0205, 0244, 0243, 0376, 0224, 0252, 0032, 0263, 0005, 0170, 0341, 0261, 0205, 0325, 
+  0257, 0153, 0337, 0232, 0043, 0123, 0104, 0063, 0203, 0174, 0202, 0151, 0100, 0320, 0103, 0066, 
+  0375, 0074, 0003, 0022, 0216, 0047, 0123, 0123, 0032, 0301, 0142, 0103, 0212, 0061, 0023, 0202, 
+  0315, 0164, 0211, 0030, 0307, 0322, 0216, 0240, 0220, 0213, 0022, 0360, 0345, 0352, 0044, 0160, 
+  0010, 0211, 0016, 0141, 0022, 0303, 0120, 0256, 0221, 0245, 0375, 0024, 0153, 0013, 0206, 0131, 
+  0117, 0001, 0344, 0010, 0256, 0251, 0245, 0120, 0161, 0251, 0024, 0203, 0156, 0252, 0157, 0127, 
+  0025, 0026, 0372, 0075, 0270, 0144, 0251, 0010, 0022, 0261, 0314, 0354, 0034, 0321, 0250, 0224, 
+  0160, 0143, 0226, 0326, 0015, 0070, 0267, 0312, 0261, 0372, 0334, 0003, 0157, 0251, 0212, 0206, 
+  0061, 0106, 0244, 0320, 0326, 0202, 0233, 0002, 0307, 0120, 0315, 0254, 0322, 0155, 0151, 0202, 
+  0150, 0112, 0312, 0121, 0210, 0360, 0023, 0112, 0202, 0010, 0075, 0300, 0224, 0010, 0163, 0016, 
+  0312, 0023, 0003, 0077, 0167, 0310, 0046, 0204, 0151, 0202, 0202, 0224, 0112, 0167, 0101, 0060, 
+  0335, 0101, 0150, 0110, 0346, 0160, 0231, 0004, 0311, 0224, 0315, 0203, 0325, 0030, 0252, 0131, 
+  0254, 0173, 0345, 0115, 0306, 0060, 0174, 0224, 0266, 0120, 0337, 0045, 0132, 0304, 0220, 0106, 
+  0346, 0103, 0175, 0300, 0204, 0230, 0123, 0305, 0054, 0301, 0271, 0141, 0273, 0125, 0102, 0025, 
+  0216, 0176, 0303, 0365, 0066, 0067, 0005, 0257, 0231, 0051, 0344, 0353, 0316, 0361, 0233, 0202, 
+  0321, 0214, 0076, 0334, 0351, 0330, 0153, 0143, 0072, 0026, 0211, 0137, 0054, 0172, 0231, 0330, 
+  0106, 0353, 0105, 0056, 0263, 0021, 0111, 0255, 0375, 0025, 0010, 0273, 0045, 0350, 0266, 0315, 
+  0325, 0005, 0071, 0073, 0233, 0103, 0133, 0113, 0253, 0166, 0114, 0261, 0103, 0134, 0141, 0342, 
+  0206, 0156, 0271, 0012, 0262, 0077, 0304, 0127, 0124, 0002, 0124, 0352, 0355, 0202, 0005, 0044, 
+  0170, 0122, 0355, 0240, 0013, 0040, 0232, 0302, 0110, 0256, 0131, 0131, 0174, 0015, 0174, 0312, 
+  0150, 0165, 0277, 0205, 0140, 0025, 0003, 0166, 0235, 0015, 0046, 0317, 0253, 0012, 0332, 0067, 
+  0000, 0256, 0051, 0170, 0205, 0000, 0312, 0000, 0074, 0210, 0141, 0024, 0325, 0314, 0226, 0172, 
+  0040, 0164, 0215, 0252, 0065, 0050, 0332, 0200, 0243, 0056, 0147, 0030, 0354, 0302, 0300, 0310, 
+  0162, 0265, 0254, 0130, 0157, 0030, 0225, 0252, 0331, 0105, 0075, 0255, 0250, 0250, 0055, 0065, 
+  0065, 0007, 0110, 0017, 0244, 0142, 0240, 0276, 0301, 0010, 0263, 0365, 0210, 0154, 0025, 0235, 
+  0004, 0252, 0160, 0300, 0263, 0157, 0363, 0030, 0015, 0324, 0361, 0066, 0011, 0331, 0356, 0020, 
+  0311, 0206, 0001, 0235, 0254, 0227, 0317, 0272, 0062, 0266, 0246, 0266, 0206, 0221, 0235, 0171, 
+  0244, 0147, 0064, 0031, 0212, 0130, 0116, 0127, 0053, 0101, 0042, 0040, 0027, 0115, 0030, 0145, 
+  0051, 0366, 0123, 0013, 0160, 0105, 0034, 0312, 0274, 0210, 0106, 0322, 0005, 0010, 0306, 0115, 
+  0371, 0225, 0005, 0247, 0333, 0275, 0226, 0005, 0253, 0272, 0301, 0153, 0143, 0344, 0365, 0242, 
+  0331, 0126, 0222, 0255, 0155, 0224, 0264, 0304, 0057, 0114, 0306, 0332, 0362, 0017, 0067, 0154, 
+  0066, 0146, 0322, 0233, 0336, 0243, 0305, 0252, 0150, 0034, 0146, 0117, 0306, 0154, 0041, 0344, 
+  0023, 0345, 0045, 0300, 0176, 0130, 0155, 0013, 0066, 0226, 0004, 0162, 0175, 0343, 0313, 0346, 
+  0303, 0122, 0154, 0002, 0205, 0120, 0310, 0110, 0072, 0063, 0323, 0273, 0344, 0207, 0005, 0232, 
+  0045, 0365, 0355, 0126, 0055, 0375, 0253, 0376, 0342, 0252, 0077, 0354, 0252, 0317, 0332, 0104, 
+  0075, 0157, 0260, 0220, 0277, 0246, 0144, 0375, 0013, 0167, 0161, 0061, 0160, 0115, 0311, 0006, 
+  0256, 0273, 0350, 0273, 0306, 0144, 0075, 0327, 0273, 0130, 0374, 0322, 0037, 0354, 0040, 0234, 
+  0053, 0061, 0061, 0357, 0257, 0057, 0351, 0172, 0356, 0245, 0071, 0341, 0225, 0047, 0011, 0075, 
+  0175, 0011, 0363, 0166, 0032, 0112, 0056, 0051, 0226, 0256, 0246, 0252, 0316, 0000, 0267, 0254, 
+  0372, 0167, 0105, 0273, 0141, 0316, 0212, 0135, 0107, 0237, 0151, 0253, 0053, 0250, 0376, 0212, 
+  0240, 0351, 0356, 0076, 0162, 0211, 0151, 0352, 0054, 0332, 0136, 0141, 0172, 0207, 0265, 0302, 
+  0374, 0245, 0242, 0304, 0043, 0131, 0103, 0312, 0103, 0336, 0030, 0057, 0020, 0111, 0154, 0210, 
+  0244, 0061, 0201, 0275, 0037, 0061, 0201, 0165, 0360, 0326, 0303, 0272, 0025, 0234, 0233, 0143, 
+  0334, 0070, 0004, 0325, 0300, 0266, 0026, 0127, 0233, 0273, 0177, 0120, 0356, 0336, 0152, 0166, 
+  0036, 0102, 0142, 0263, 0362, 0323, 0313, 0312, 0267, 0371, 0115, 0070, 0113, 0143, 0340, 0227, 
+  0325, 0204, 0354, 0152, 0166, 0174, 0011, 0377, 0135, 0214, 0351, 0172, 0075, 0060, 0016, 0245, 
+  0336, 0345, 0263, 0235, 0253, 0200, 0373, 0350, 0013, 0136, 0137, 0174, 0003, 0376, 0332, 0373, 
+  0223, 0373, 0070, 0237, 0155, 0166, 0141, 0263, 0013, 0215, 0354, 0002, 0361, 0120, 0316, 0140, 
+  0353, 0220, 0155, 0172, 0361, 0303, 0323, 0213, 0236, 0115, 0057, 0216, 0163, 0153, 0120, 0016, 
+  0136, 0260, 0331, 0373, 0356, 0014, 0336, 0250, 0076, 0354, 0276, 0240, 0315, 0100, 0154, 0006, 
+  0162, 0242, 0031, 0310, 0211, 0204, 0154, 0377, 0340, 0110, 0114, 0077, 0333, 0011, 0174, 0174, 
+  0071, 0307, 0333, 0024, 0172, 0236, 0151, 0372, 0124, 0222, 0150, 0317, 0046, 0321, 0173, 0232, 
+  0202, 0130, 0217, 0134, 0343, 0221, 0377, 0100, 0331, 0021, 0054, 0353, 0222, 0165, 0146, 0360, 
+  0371, 0141, 0273, 0344, 0251, 0122, 0365, 0251, 0370, 0344, 0163, 0353, 0223, 0353, 0147, 0364, 
+  0205, 0365, 0311, 0366, 0265, 0211, 0103, 0166, 0311, 0227, 0266, 0256, 0371, 0256, 0165, 0115, 
+  0357, 0243, 0352, 0232, 0325, 0230, 0126, 0020, 0227, 0023, 0226, 0022, 0255, 0136, 0056, 0314, 
+  0116, 0013, 0075, 0233, 0241, 0336, 0151, 0240, 0052, 0377, 0263, 0137, 0047, 0201, 0112, 0175, 
+  0213, 0272, 0250, 0300, 0271, 0253, 0071, 0073, 0252, 0170, 0102, 0041, 0070, 0226, 0221, 0002, 
+  0052, 0175, 0137, 0363, 0265, 0311, 0252, 0337, 0271, 0012, 0061, 0200, 0243, 0356, 0273, 0030, 
+  0201, 0061, 0043, 0021, 0350, 0226, 0251, 0264, 0232, 0277, 0261, 0136, 0333, 0073, 0374, 0151, 
+  0174, 0162, 0355, 0300, 0016, 0043, 0333, 0123, 0200, 0216, 0075, 0005, 0250, 0031, 0214, 0331, 
+  0123, 0200, 0366, 0024, 0340, 0211, 0154, 0365, 0301, 0070, 0106, 0064, 0172, 0267, 0135, 0276, 
+  0153, 0305, 0336, 0356, 0357, 0235, 0332, 0376, 0236, 0335, 0204, 0073, 0224, 0362, 0302, 0332, 
+  0011, 0241, 0114, 0222, 0100, 0367, 0140, 0320, 0041, 0330, 0251, 0120, 0147, 0031, 0013, 0334, 
+  0322, 0131, 0176, 0137, 0132, 0144, 0313, 0145, 0107, 0267, 0047, 0167, 0042, 0345, 0062, 0301, 
+  0034, 0251, 0150, 0344, 0250, 0113, 0372, 0254, 0137, 0336, 0327, 0255, 0070, 0173, 0330, 0250, 
+  0375, 0252, 0331, 0156, 0051, 0302, 0126, 0344, 0213, 0251, 0272, 0151, 0322, 0040, 0364, 0325, 
+  0267, 0316, 0325, 0005, 0231, 0230, 0072, 0252, 0217, 0135, 0301, 0155, 0073, 0111, 0151, 0302, 
+  0246, 0141, 0314, 0333, 0112, 0274, 0333, 0106, 0254, 0333, 0146, 0234, 0133, 0362, 0016, 0333, 
+  0166, 0116, 0245, 0153, 0032, 0366, 0325, 0141, 0133, 0142, 0077, 0314, 0022, 0373, 0255, 0014, 
+  0106, 0262, 0066, 0266, 0300, 0276, 0067, 0005, 0366, 0303, 0275, 0136, 0321, 0344, 0166, 0302, 
+  0132, 0171, 0353, 0157, 0127, 0334, 0224, 0161, 0363, 0266, 0351, 0374, 0246, 0342, 0316, 0034, 
+  0107, 0023, 0044, 0136, 0246, 0324, 0346, 0143, 0107, 0146, 0223, 0061, 0243, 0211, 0034, 0115, 
+  0247, 0017, 0374, 0325, 0255, 0277, 0162, 0052, 0256, 0067, 0252, 0047, 0275, 0174, 0046, 0365, 
+  0012, 0111, 0337, 0074, 0114, 0066, 0057, 0010, 0037, 0166, 0327, 0376, 0353, 0300, 0377, 0016, 
+  0226, 0320, 0061, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 0000, 
+  0003, 0000, 0000, 0000, 0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 
+  0004, 0000, 0000, 0000, 0151, 0155, 0141, 0147, 0145, 0143, 0157, 0156, 0166, 0145, 0162, 0164, 
+  0145, 0162, 0057, 0000, 0001, 0000, 0000, 0000, 0006, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 
+  0057, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0151, 0155, 0141, 
+  0147, 0145, 0055, 0162, 0157, 0164, 0141, 0164, 0145, 0056, 0165, 0151, 0000, 0000, 0000, 0000, 
+  0045, 0105, 0000, 0000, 0001, 0000, 0000, 0000, 0170, 0332, 0355, 0134, 0315, 0162, 0333, 0066, 
+  0020, 0276, 0347, 0051, 0120, 0134, 0073, 0262, 0176, 0062, 0315, 0070, 0035, 0211, 0031, 0327, 
+  0255, 0063, 0235, 0351, 0051, 0161, 0316, 0034, 0210, 0134, 0123, 0210, 0041, 0200, 0005, 0100, 
+  0313, 0172, 0253, 0076, 0103, 0237, 0254, 0040, 0050, 0333, 0222, 0005, 0212, 0204, 0310, 0270, 
+  0212, 0203, 0233, 0104, 0355, 0056, 0260, 0213, 0305, 0307, 0017, 0013, 0100, 0323, 0017, 0367, 
+  0113, 0206, 0356, 0100, 0052, 0052, 0370, 0014, 0217, 0317, 0106, 0030, 0001, 0117, 0104, 0112, 
+  0171, 0066, 0303, 0137, 0256, 0257, 0006, 0347, 0370, 0103, 0364, 0146, 0372, 0323, 0140, 0200, 
+  0076, 0002, 0007, 0111, 0064, 0244, 0150, 0105, 0365, 0002, 0145, 0214, 0244, 0200, 0336, 0236, 
+  0115, 0046, 0147, 0143, 0064, 0030, 0030, 0041, 0312, 0065, 0310, 0033, 0222, 0100, 0364, 0006, 
+  0241, 0251, 0204, 0277, 0013, 0052, 0101, 0041, 0106, 0347, 0063, 0234, 0351, 0333, 0237, 0361, 
+  0123, 0103, 0245, 0032, 0036, 0132, 0071, 0061, 0377, 0012, 0211, 0106, 0011, 0043, 0112, 0315, 
+  0360, 0107, 0175, 0173, 0221, 0176, 0055, 0224, 0136, 0002, 0327, 0030, 0321, 0164, 0206, 0311, 
+  0343, 0367, 0061, 0056, 0065, 0214, 0116, 0056, 0105, 0016, 0122, 0257, 0021, 0047, 0113, 0230, 
+  0141, 0046, 0126, 0040, 0161, 0064, 0236, 0016, 0037, 0176, 0160, 0313, 0025, 0171, 0136, 0312, 
+  0275, 0175, 0067, 0152, 0222, 0274, 0043, 0254, 0000, 0034, 0275, 0157, 0024, 0124, 0032, 0362, 
+  0230, 0362, 0104, 0202, 0355, 0160, 0163, 0037, 0162, 0222, 0301, 0216, 0302, 0263, 0046, 0246, 
+  0303, 0052, 0040, 0356, 0330, 0374, 0271, 0064, 0352, 0125, 0130, 0150, 0371, 0261, 0056, 0042, 
+  0167, 0124, 0321, 0071, 0063, 0036, 0134, 0313, 0002, 0232, 0272, 0224, 0020, 0036, 0337, 0210, 
+  0244, 0120, 0070, 0272, 0042, 0114, 0065, 0312, 0323, 0104, 0360, 0270, 0374, 0210, 0043, 0363, 
+  0113, 0002, 0112, 0015, 0224, 0026, 0271, 0217, 0037, 0277, 0123, 0302, 0104, 0126, 0071, 0042, 
+  0205, 0066, 0131, 0025, 0247, 0325, 0243, 0176, 0272, 0250, 0251, 0066, 0336, 0043, 0055, 0011, 
+  0127, 0214, 0150, 0142, 0142, 0061, 0303, 0153, 0060, 0352, 0237, 0154, 0153, 0310, 0006, 0122, 
+  0065, 0232, 0131, 0347, 0020, 0057, 0150, 0071, 0116, 0125, 0367, 0366, 0024, 0222, 0005, 0145, 
+  0151, 0365, 0271, 0124, 0147, 0046, 0373, 0027, 0202, 0245, 0040, 0207, 0033, 0201, 0341, 0226, 
+  0104, 0045, 0215, 0354, 0074, 0341, 0204, 0015, 0354, 0127, 0063, 0130, 0163, 0161, 0217, 0037, 
+  0155, 0354, 0305, 0352, 0267, 0255, 0137, 0375, 0043, 0343, 0322, 0131, 0022, 0231, 0121, 0036, 
+  0063, 0270, 0051, 0023, 0160, 0342, 0241, 0042, 0151, 0266, 0360, 0325, 0061, 0251, 0341, 0251, 
+  0061, 0027, 0132, 0213, 0145, 0133, 0045, 0041, 0251, 0231, 0111, 0104, 0033, 0140, 0301, 0221, 
+  0101, 0030, 0115, 0023, 0302, 0332, 0050, 0252, 0234, 0044, 0006, 0347, 0160, 0164, 0356, 0224, 
+  0166, 0017, 0026, 0111, 0312, 0206, 0142, 0042, 0201, 0154, 0215, 0212, 0163, 0334, 0012, 0343, 
+  0005, 0337, 0035, 0275, 0143, 0107, 0320, 0211, 0172, 0144, 0055, 0012, 0035, 0053, 0275, 0056, 
+  0047, 0072, 0360, 0264, 0126, 0161, 0047, 0111, 0233, 0072, 0134, 0115, 0312, 0271, 0375, 0074, 
+  0306, 0317, 0265, 0134, 0335, 0230, 0003, 0163, 0116, 0265, 0370, 0222, 0360, 0004, 0130, 0135, 
+  0267, 0274, 0161, 0253, 0145, 0020, 0175, 0125, 0045, 0044, 0100, 0357, 0100, 0305, 0051, 0334, 
+  0220, 0202, 0151, 0177, 0013, 0026, 0212, 0161, 0124, 0041, 0262, 0217, 0142, 0241, 0040, 0056, 
+  0270, 0101, 0013, 0106, 0171, 0243, 0323, 0333, 0210, 0272, 0153, 0224, 0044, 0267, 0046, 0217, 
+  0233, 0233, 0203, 0373, 0234, 0360, 0324, 0337, 0277, 0033, 0312, 0230, 0277, 0126, 0056, 0024, 
+  0255, 0046, 0345, 0370, 0220, 0123, 0316, 0336, 0357, 0300, 0146, 0367, 0074, 0236, 0164, 0313, 
+  0343, 0352, 0235, 0361, 0372, 0363, 0370, 0007, 0111, 0307, 0111, 0037, 0351, 0350, 0162, 0337, 
+  0355, 0172, 0235, 0333, 0136, 0140, 0137, 0371, 0354, 0245, 0362, 0344, 0360, 0310, 0255, 0342, 
+  0160, 0166, 0317, 0321, 0375, 0071, 0327, 0104, 0120, 0216, 0236, 0016, 0175, 0275, 0027, 0133, 
+  0363, 0201, 0203, 0234, 0140, 0074, 0351, 0372, 0072, 0275, 0222, 0226, 0042, 0277, 0010, 0126, 
+  0034, 0014, 0120, 0055, 0332, 0305, 0367, 0204, 0321, 0254, 0076, 0101, 0152, 0102, 0264, 0040, 
+  0251, 0130, 0305, 0045, 0067, 0306, 0021, 0027, 0374, 0160, 0273, 0316, 0140, 0271, 0003, 0166, 
+  0121, 0166, 0246, 0132, 0025, 0071, 0344, 0073, 0004, 0256, 0153, 0360, 0234, 0001, 0064, 0344, 
+  0071, 0316, 0111, 0232, 0066, 0144, 0113, 0163, 0040, 0332, 0116, 0252, 0336, 0102, 0321, 0107, 
+  0070, 0232, 0370, 0376, 0371, 0061, 0006, 0274, 0146, 0156, 0253, 0131, 0334, 0256, 0033, 0007, 
+  0207, 0346, 0230, 0341, 0351, 0145, 0210, 0372, 0032, 0246, 0356, 0001, 0152, 0027, 0044, 0167, 
+  0240, 0076, 0221, 0224, 0212, 0155, 0106, 0266, 0141, 0047, 0061, 0341, 0031, 0203, 0130, 0226, 
+  0077, 0127, 0044, 0015, 0067, 0031, 0367, 0341, 0154, 0237, 0201, 0225, 0375, 0040, 0034, 0331, 
+  0166, 0176, 0155, 0353, 0146, 0157, 0043, 0327, 0221, 0334, 0371, 0223, 0075, 0257, 0174, 0160, 
+  0231, 0134, 0154, 0136, 0006, 0112, 0023, 0251, 0273, 0030, 0052, 0227, 0310, 0167, 0075, 0204, 
+  0053, 0225, 0144, 0025, 0123, 0236, 0032, 0024, 0320, 0102, 0372, 0332, 0253, 0343, 0247, 0373, 
+  0255, 0326, 0361, 0325, 0266, 0374, 0265, 0163, 0344, 0333, 0021, 0332, 0366, 0004, 0167, 0344, 
+  0023, 0245, 0126, 0356, 0073, 0327, 0143, 0175, 0101, 0304, 0245, 0130, 0316, 0205, 0001, 0324, 
+  0153, 0270, 0177, 0050, 0371, 0132, 0154, 0110, 0312, 0347, 0363, 0106, 0240, 0175, 0251, 0051, 
+  0333, 0171, 0230, 0037, 0346, 0305, 0310, 0313, 0010, 0325, 0260, 0124, 0315, 0162, 0033, 0111, 
+  0027, 0026, 0276, 0037, 0375, 0373, 0217, 0011, 0267, 0110, 0156, 0127, 0264, 0364, 0240, 0224, 
+  0353, 0301, 0240, 0050, 0312, 0322, 0330, 0240, 0117, 0303, 0343, 0163, 0143, 0271, 0255, 0235, 
+  0112, 0116, 0235, 0016, 0016, 0164, 0315, 0265, 0276, 0141, 0140, 0374, 0177, 0300, 0100, 0233, 
+  0160, 0267, 0013, 0165, 0057, 0160, 0333, 0075, 0306, 0235, 0141, 0266, 0105, 0154, 0033, 0343, 
+  0032, 0050, 0352, 0113, 0122, 0124, 0323, 0171, 0055, 0226, 0337, 0230, 0241, 0136, 0332, 0106, 
+  0002, 0075, 0375, 0101, 0351, 0351, 0276, 0275, 0114, 0212, 0302, 0254, 0234, 0153, 0327, 0107, 
+  0201, 0372, 0276, 0076, 0352, 0373, 0071, 0247, 0174, 0033, 0171, 0252, 0101, 0127, 0346, 0351, 
+  0321, 0210, 0163, 0212, 0160, 0360, 0164, 0204, 0003, 0107, 0133, 0307, 0071, 0116, 0061, 0243, 
+  0003, 0211, 0353, 0224, 0320, 0177, 0331, 0367, 0335, 0053, 0131, 0260, 0365, 0366, 0312, 0251, 
+  0147, 0001, 0051, 0144, 0022, 0100, 0155, 0057, 0317, 0002, 0312, 0167, 0331, 0301, 0013, 0053, 
+  0233, 0036, 0126, 0066, 0343, 0227, 0132, 0331, 0034, 0216, 0351, 0001, 0345, 0172, 0305, 0132, 
+  0245, 0315, 0201, 0236, 0162, 0337, 0352, 0141, 0106, 0266, 0333, 0227, 0072, 0204, 0151, 0247, 
+  0265, 0047, 0125, 0013, 0063, 0366, 0270, 0033, 0262, 0347, 0030, 0150, 0063, 0223, 0234, 0022, 
+  0255, 0045, 0065, 0014, 0004, 0152, 0253, 0053, 0117, 0042, 0233, 0266, 0127, 0140, 0217, 0206, 
+  0041, 0173, 0162, 0162, 0206, 0347, 0202, 0245, 0170, 0130, 0067, 0254, 0207, 0355, 0173, 0217, 
+  0155, 0177, 0107, 0021, 0274, 0367, 0121, 0273, 0236, 0105, 0030, 0275, 0354, 0321, 0230, 0260, 
+  0047, 0035, 0366, 0244, 0303, 0236, 0164, 0330, 0223, 0016, 0005, 0277, 0235, 0202, 0037, 0311, 
+  0163, 0340, 0351, 0067, 0053, 0365, 0135, 0130, 0363, 0241, 0306, 0027, 0266, 0240, 0103, 0035, 
+  0356, 0064, 0313, 0026, 0177, 0160, 0055, 0327, 0025, 0026, 0224, 0236, 0304, 0140, 0277, 0277, 
+  0216, 0171, 0252, 0355, 0266, 0272, 0003, 0226, 0316, 0252, 0233, 0067, 0151, 0050, 0303, 0205, 
+  0062, 0334, 0017, 0136, 0206, 0323, 0002, 0231, 0214, 0001, 0144, 0357, 0215, 0005, 0200, 0017, 
+  0045, 0270, 0160, 0270, 0300, 0223, 0102, 0123, 0156, 0057, 0077, 0172, 0160, 0350, 0366, 0263, 
+  0163, 0163, 0147, 0223, 0162, 0144, 0333, 0070, 0066, 0270, 0175, 0257, 0166, 0272, 0230, 0351, 
+  0110, 0236, 0173, 0201, 0310, 0076, 0110, 0163, 0237, 0204, 0271, 0146, 0103, 0174, 0177, 0161, 
+  0326, 0166, 0152, 0204, 0172, 0175, 0250, 0327, 0177, 0237, 0365, 0372, 0053, 0103, 0106, 0112, 
+  0231, 0120, 0251, 0077, 0231, 0112, 0375, 0370, 0273, 0275, 0065, 0350, 0163, 0351, 0256, 0321, 
+  0337, 0346, 0113, 0203, 0273, 0076, 0356, 0376, 0001, 0102, 0165, 0173, 0176, 0260, 0242, 0151, 
+  0006, 0372, 0061, 0245, 0166, 0037, 0043, 0011, 0052, 0027, 0134, 0231, 0336, 0014, 0336, 0341, 
+  0150, 0163, 0023, 0335, 0244, 0342, 0266, 0120, 0263, 0352, 0057, 0017, 0252, 0023, 0247, 0352, 
+  0263, 0207, 0152, 0367, 0077, 0053, 0246, 0303, 0255, 0077, 0063, 0371, 0017, 0146, 0110, 0026, 
+  0045, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0145, 0162, 0162, 0157, 0162, 0055, 0144, 0151, 
+  0141, 0154, 0157, 0147, 0056, 0165, 0151, 0000, 0022, 0031, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0131, 0115, 0163, 0233, 0060, 0020, 0275, 0367, 0127, 0250, 0272, 0166, 0360, 
+  0127, 0072, 0231, 0034, 0154, 0062, 0375, 0112, 0246, 0063, 0075, 0265, 0351, 0231, 0021, 0142, 
+  0015, 0252, 0145, 0211, 0112, 0042, 0066, 0375, 0365, 0025, 0140, 0327, 0046, 0226, 0215, 0301, 
+  0356, 0244, 0165, 0173, 0303, 0260, 0117, 0332, 0267, 0373, 0166, 0131, 0344, 0361, 0355, 0162, 
+  0316, 0321, 0043, 0050, 0315, 0244, 0230, 0340, 0141, 0157, 0200, 0021, 0010, 0052, 0043, 0046, 
+  0342, 0011, 0376, 0372, 0160, 0347, 0335, 0340, 0133, 0377, 0305, 0370, 0245, 0347, 0241, 0173, 
+  0020, 0240, 0210, 0201, 0010, 0055, 0230, 0111, 0120, 0314, 0111, 0004, 0350, 0252, 0067, 0032, 
+  0365, 0106, 0310, 0363, 0254, 0021, 0023, 0006, 0324, 0224, 0120, 0360, 0137, 0040, 0064, 0126, 
+  0360, 0075, 0143, 0012, 0064, 0342, 0054, 0234, 0340, 0330, 0314, 0136, 0341, 0315, 0106, 0005, 
+  0014, 0367, 0113, 0073, 0031, 0176, 0003, 0152, 0020, 0345, 0104, 0353, 0011, 0276, 0067, 0263, 
+  0217, 0163, 0022, 0003, 0106, 0054, 0232, 0140, 0126, 0134, 0016, 0161, 0141, 0147, 0055, 0123, 
+  0045, 0123, 0120, 0046, 0107, 0202, 0314, 0141, 0202, 0037, 0231, 0146, 0041, 0007, 0354, 0077, 
+  0250, 0014, 0306, 0375, 0365, 0123, 0267, 0061, 0045, 0042, 0230, 0112, 0232, 0151, 0354, 0337, 
+  0021, 0256, 0033, 0355, 0031, 0225, 0042, 0050, 0056, 0261, 0157, 0237, 0120, 0320, 0332, 0323, 
+  0106, 0246, 0165, 0330, 0270, 0137, 0071, 0357, 0346, 0361, 0236, 0021, 0056, 0343, 0212, 0010, 
+  0050, 0045, 0125, 0020, 0125, 0167, 0316, 0343, 0141, 0050, 0125, 0004, 0052, 0130, 0260, 0310, 
+  0044, 0330, 0037, 0216, 0232, 0354, 0015, 0063, 0066, 0130, 0310, 0050, 0042, 0064, 0047, 0206, 
+  0330, 0320, 0115, 0160, 0016, 0166, 0273, 0017, 0205, 0163, 0115, 0360, 0005, 0023, 0221, 0134, 
+  0004, 0251, 0324, 0314, 0330, 0024, 0142, 0237, 0102, 0221, 0356, 0026, 0161, 0254, 0330, 0173, 
+  0160, 0314, 0156, 0046, 0117, 0041, 0110, 0254, 0240, 0326, 0260, 0035, 0000, 0115, 0030, 0217, 
+  0120, 0141, 0267, 0242, 0026, 0022, 0265, 0212, 0154, 0261, 0034, 0267, 0062, 0114, 0044, 0267, 
+  0021, 0352, 0257, 0000, 0375, 0022, 0121, 0103, 0227, 0202, 0025, 0204, 0173, 0345, 0117, 0253, 
+  0250, 0120, 0056, 0067, 0153, 0354, 0044, 0364, 0355, 0326, 0323, 0226, 0162, 0354, 0222, 0160, 
+  0027, 0106, 0052, 0146, 0303, 0116, 0252, 0014, 0330, 0152, 0062, 0214, 0022, 0356, 0004, 0272, 
+  0031, 0022, 0132, 0100, 0003, 0242, 0200, 0154, 0121, 0161, 0222, 0315, 0214, 0221, 0242, 0116, 
+  0271, 0023, 0355, 0256, 0324, 0135, 0270, 0004, 0226, 0051, 0021, 0121, 0273, 0315, 0022, 0071, 
+  0227, 0261, 0355, 0135, 0262, 0330, 0256, 0015, 0220, 0223, 0134, 0146, 0046, 0320, 0046, 0057, 
+  0370, 0125, 0133, 0357, 0305, 0156, 0251, 0253, 0071, 0254, 0125, 0123, 0010, 0313, 0353, 0021, 
+  0176, 0212, 0162, 0171, 0022, 0002, 0167, 0326, 0156, 0360, 0145, 0306, 0322, 0175, 0116, 0165, 
+  0316, 0127, 0103, 0316, 0332, 0102, 0025, 0120, 0140, 0217, 0240, 0203, 0010, 0246, 0044, 0343, 
+  0246, 0375, 0012, 0231, 0206, 0040, 0023, 0266, 0232, 0071, 0023, 0215, 0276, 0157, 0267, 0345, 
+  0372, 0242, 0204, 0316, 0354, 0213, 0255, 0171, 0273, 0143, 0144, 0346, 0302, 0115, 0031, 0347, 
+  0355, 0121, 0233, 0236, 0072, 0070, 0104, 0312, 0351, 0175, 0255, 0255, 0235, 0056, 0306, 0341, 
+  0151, 0142, 0174, 0107, 0004, 0005, 0176, 0371, 0162, 0054, 0347, 0022, 0354, 0127, 0343, 0311, 
+  0157, 0323, 0361, 0056, 0234, 0360, 0005, 0311, 0165, 0240, 0023, 0373, 0046, 0136, 0371, 0160, 
+  0251, 0245, 0060, 0174, 0356, 0122, 0270, 0072, 0255, 0024, 0076, 0203, 0121, 0371, 0377, 0306, 
+  0174, 0041, 0152, 0034, 0235, 0111, 0215, 0345, 0054, 0261, 0263, 0102, 0051, 0303, 0265, 0244, 
+  0230, 0230, 0101, 0204, 0373, 0117, 0127, 0333, 0101, 0272, 0202, 0351, 0016, 0344, 0276, 0040, 
+  0266, 0032, 0275, 0232, 0043, 0270, 0023, 0075, 0353, 0113, 0120, 0014, 0350, 0166, 0166, 0072, 
+  0060, 0070, 0265, 0175, 0031, 0072, 0342, 0275, 0023, 0353, 0335, 0252, 0167, 0117, 0363, 0145, 
+  0271, 0027, 0123, 0377, 0315, 0263, 0116, 0271, 0307, 0366, 0250, 0265, 0307, 0211, 0365, 0370, 
+  0230, 0366, 0164, 0216, 0226, 0162, 0320, 0163, 0027, 0126, 0333, 0364, 0330, 0354, 0270, 0076, 
+  0111, 0233, 0111, 0273, 0211, 0127, 0047, 0002, 0056, 0333, 0023, 0070, 0237, 0312, 0373, 0204, 
+  0257, 0335, 0243, 0226, 0321, 0354, 0207, 0135, 0346, 0372, 0060, 0166, 0137, 0107, 0075, 0334, 
+  0125, 0073, 0067, 0205, 0303, 0315, 0241, 0023, 0364, 0250, 0341, 0367, 0100, 0237, 0335, 0333, 
+  0153, 0333, 0212, 0354, 0123, 0365, 0056, 0337, 0234, 0326, 0030, 0130, 0232, 0277, 0101, 0164, 
+  0373, 0207, 0220, 0067, 0002, 0225, 0124, 0120, 0102, 0064, 0222, 0224, 0146, 0112, 0101, 0324, 
+  0153, 0273, 0376, 0102, 0221, 0264, 0033, 0063, 0015, 0334, 0306, 0230, 0164, 0216, 0314, 0234, 
+  0054, 0253, 0363, 0255, 0200, 0046, 0104, 0131, 0102, 0257, 0007, 0155, 0227, 0310, 0011, 0147, 
+  0361, 0061, 0342, 0272, 0234, 0072, 0032, 0236, 0273, 0216, 0376, 0361, 0357, 0351, 0077, 0177, 
+  0320, 0152, 0112, 0175, 0363, 0310, 0124, 0347, 0130, 0077, 0053, 0255, 0316, 0014, 0075, 0133, 
+  0210, 0061, 0030, 0375, 0013, 0121, 0273, 0215, 0024, 0350, 0124, 0012, 0155, 0275, 0031, 0142, 
+  0177, 0165, 0260, 0065, 0356, 0327, 0154, 0032, 0221, 0336, 0365, 0032, 0072, 0154, 0013, 0035, 
+  0254, 0221, 0127, 0116, 0344, 0223, 0233, 0272, 0176, 0170, 0077, 0356, 0157, 0375, 0163, 0361, 
+  0023, 0211, 0251, 0110, 0070, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0155, 0141, 0164, 0145, 
+  0057, 0000, 0000, 0000, 0002, 0000, 0000, 0000
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[4329]; const double alignment; void * const ptr;}  imageconverter_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\034\001\000\000\000\000\000\050\011\000\000\000"
+  "\000\000\000\000\000\000\000\000\002\000\000\000\003\000\000\000"
+  "\003\000\000\000\005\000\000\000\006\000\000\000\007\000\000\000"
+  "\007\000\000\000\113\120\220\013\005\000\000\000\034\001\000\000"
+  "\004\000\114\000\040\001\000\000\044\001\000\000\362\306\050\375"
+  "\004\000\000\000\044\001\000\000\024\000\166\000\070\001\000\000"
+  "\212\007\000\000\137\144\153\207\010\000\000\000\212\007\000\000"
+  "\005\000\114\000\220\007\000\000\224\007\000\000\176\157\252\021"
+  "\002\000\000\000\224\007\000\000\013\000\114\000\240\007\000\000"
+  "\244\007\000\000\110\122\272\300\003\000\000\000\244\007\000\000"
+  "\017\000\114\000\264\007\000\000\300\007\000\000\324\265\002\000"
+  "\377\377\377\377\300\007\000\000\001\000\114\000\304\007\000\000"
+  "\310\007\000\000\157\174\237\161\004\000\000\000\310\007\000\000"
+  "\024\000\166\000\340\007\000\000\130\015\000\000\073\056\277\311"
+  "\004\000\000\000\130\015\000\000\017\000\166\000\150\015\000\000"
+  "\334\020\000\000\201\321\040\031\000\000\000\000\334\020\000\000"
+  "\005\000\114\000\344\020\000\000\350\020\000\000\157\162\147\057"
+  "\010\000\000\000\143\141\152\141\055\151\155\141\147\145\055\162"
+  "\145\163\151\172\145\056\165\151\316\140\000\000\001\000\000\000"
+  "\170\332\355\135\335\123\343\066\020\177\277\277\302\325\153\047"
+  "\304\061\220\206\233\304\067\224\226\153\147\372\164\320\351\243"
+  "\107\261\105\242\103\221\134\131\046\111\377\372\312\162\200\204"
+  "\370\103\212\015\227\017\061\303\114\160\264\053\355\157\265\253"
+  "\335\225\045\206\137\026\063\342\074\041\236\140\106\107\240\167"
+  "\346\002\007\321\220\105\230\116\106\340\357\373\333\316\000\174"
+  "\361\077\015\177\352\164\234\257\210\042\016\005\212\234\071\026"
+  "\123\147\102\140\204\234\363\063\317\073\363\234\116\107\066\302"
+  "\124\040\376\000\103\344\177\162\234\041\107\377\246\230\243\304"
+  "\041\170\074\002\023\361\370\063\170\355\050\043\003\135\325\216"
+  "\215\277\243\120\070\041\201\111\062\002\137\305\343\165\364\075"
+  "\115\304\014\121\001\034\034\215\000\174\371\273\007\062\012\111"
+  "\023\163\026\043\056\226\016\205\063\064\002\204\315\021\007\176"
+  "\157\330\175\376\242\270\135\032\307\252\235\353\326\265\174\202"
+  "\044\105\300\277\254\155\230\010\024\007\230\206\034\251\001\327"
+  "\217\041\206\023\264\101\360\246\213\141\067\007\304\024\033\257"
+  "\035\154\256\344\217\046\070\022\306\303\201\347\334\302\043\036"
+  "\377\234\111\362\034\031\234\175\054\263\247\047\234\340\061\221"
+  "\062\334\363\024\325\015\051\204\064\170\140\141\232\000\377\026"
+  "\222\244\266\075\016\031\015\262\217\300\227\116\241\043\311\103"
+  "\104\114\244\370\015\103\302\046\271\030\322\277\340\377\120\020"
+  "\345\217\332\031\240\300\102\312\356\010\016\151\102\240\200\022"
+  "\211\021\130\042\111\376\115\365\346\050\030\223\132\066\313\030"
+  "\005\123\234\151\051\037\336\026\101\070\305\044\312\077\147\344"
+  "\104\172\316\051\043\021\342\335\125\203\356\132\213\274\265\243"
+  "\174\054\205\244\243\376\224\252\032\263\005\170\341\261\205\325"
+  "\257\153\337\232\043\123\104\063\203\174\202\151\100\320\103\066"
+  "\375\074\003\022\216\047\123\123\032\301\142\103\212\061\023\202"
+  "\315\164\211\030\307\322\216\240\220\213\022\360\345\352\044\160"
+  "\010\211\016\141\022\303\120\256\221\245\375\024\153\013\206\131"
+  "\117\001\344\010\256\251\245\120\161\251\024\203\156\252\157\127"
+  "\025\026\372\075\270\144\251\010\022\261\314\354\034\321\250\224"
+  "\160\143\226\326\015\070\267\312\261\372\334\003\157\251\212\206"
+  "\061\106\244\320\326\202\233\002\307\120\315\254\322\155\151\202"
+  "\150\112\312\121\210\360\023\112\202\010\075\300\224\010\163\016"
+  "\312\023\003\077\167\310\046\204\151\202\202\224\112\167\101\060"
+  "\335\101\150\110\346\160\231\004\311\224\315\203\325\030\252\131"
+  "\254\173\345\115\306\060\174\224\266\120\337\045\132\304\220\106"
+  "\346\103\175\300\204\230\123\305\054\301\271\141\273\125\102\025"
+  "\216\176\303\365\066\067\005\257\231\051\344\353\316\361\233\202"
+  "\321\214\076\334\351\330\153\143\072\026\211\137\054\172\231\330"
+  "\106\353\105\056\263\021\111\255\375\025\010\273\045\350\266\315"
+  "\325\005\071\073\233\103\133\113\253\166\114\261\103\134\141\342"
+  "\206\156\271\012\262\077\304\127\124\002\124\352\355\202\005\044"
+  "\170\122\355\240\013\040\232\302\110\256\131\131\174\015\174\312"
+  "\150\165\277\205\140\025\003\166\235\015\046\317\253\012\332\067"
+  "\000\256\051\170\205\000\312\000\074\210\141\024\325\314\226\172"
+  "\040\164\215\252\065\050\332\200\243\056\147\030\354\302\300\310"
+  "\162\265\254\130\157\030\225\252\331\105\075\255\250\250\055\065"
+  "\065\007\110\017\244\142\240\276\301\010\263\365\210\154\025\235"
+  "\004\252\160\300\263\157\363\030\015\324\361\066\011\331\356\020"
+  "\311\206\001\235\254\227\317\272\062\266\246\266\206\221\235\171"
+  "\244\147\064\031\212\130\116\127\053\101\042\040\027\115\030\145"
+  "\051\366\123\013\160\105\034\312\274\210\106\322\005\010\306\115"
+  "\371\225\005\247\333\275\226\005\253\272\301\153\143\344\365\242"
+  "\331\126\222\255\155\224\264\304\057\114\306\332\362\017\067\154"
+  "\066\146\322\233\336\243\305\252\150\034\146\117\306\154\041\344"
+  "\023\345\045\300\176\130\155\013\066\226\004\162\175\343\313\346"
+  "\303\122\154\002\205\120\310\110\072\063\323\273\344\207\005\232"
+  "\045\365\355\126\055\375\253\376\342\252\077\354\252\317\332\104"
+  "\075\157\260\220\277\246\144\375\013\167\161\061\160\115\311\006"
+  "\256\273\350\273\306\144\075\327\273\130\374\322\037\354\040\234"
+  "\053\061\061\357\257\057\351\172\356\245\071\341\225\047\011\075"
+  "\175\011\363\166\032\112\056\051\226\256\246\252\316\000\267\254"
+  "\372\167\105\273\141\316\212\135\107\237\151\253\053\250\376\212"
+  "\240\351\356\076\162\211\151\352\054\332\136\141\172\207\265\302"
+  "\374\245\242\304\043\131\103\312\103\336\030\057\020\111\154\210"
+  "\244\061\201\275\037\061\201\165\360\326\303\272\025\234\233\143"
+  "\334\070\004\325\300\266\026\127\233\273\177\120\356\336\152\166"
+  "\036\102\142\263\362\323\313\312\267\371\115\070\113\143\340\227"
+  "\325\204\354\152\166\174\011\377\135\214\351\172\075\060\016\245"
+  "\336\345\263\235\253\200\373\350\013\136\137\174\003\376\332\373"
+  "\223\373\070\237\155\166\141\263\013\215\354\002\361\120\316\140"
+  "\353\220\155\172\361\303\323\213\236\115\057\216\163\153\120\016"
+  "\136\260\331\373\356\014\336\250\076\354\276\240\315\100\154\006"
+  "\162\242\031\310\211\204\154\377\340\110\114\077\333\011\174\174"
+  "\071\307\333\024\172\236\151\372\124\222\150\317\046\321\173\232"
+  "\202\130\217\134\343\221\377\100\331\021\054\353\222\165\146\360"
+  "\371\141\273\344\251\122\365\251\370\344\163\353\223\353\147\364"
+  "\205\365\311\366\265\211\103\166\311\227\266\256\371\256\165\115"
+  "\357\243\352\232\325\230\126\020\227\023\226\022\255\136\056\314"
+  "\116\013\075\233\241\336\151\240\052\377\263\137\047\201\112\175"
+  "\213\272\250\300\271\253\071\073\252\170\102\041\070\226\221\002"
+  "\052\175\137\363\265\311\252\337\271\012\061\200\243\356\273\030"
+  "\201\061\043\021\350\226\251\264\232\277\261\136\333\073\374\151"
+  "\174\162\355\300\016\043\333\123\200\216\075\005\250\031\214\331"
+  "\123\200\366\024\340\211\154\365\301\070\106\064\172\267\135\276"
+  "\153\305\336\356\357\235\332\376\236\335\204\073\224\362\302\332"
+  "\011\241\114\222\100\367\140\320\041\330\251\120\147\031\013\334"
+  "\322\131\176\137\132\144\313\145\107\267\047\167\042\345\062\301"
+  "\034\251\150\344\250\113\372\254\137\336\327\255\070\173\330\250"
+  "\375\252\331\156\051\302\126\344\213\251\272\151\322\040\364\325"
+  "\267\316\325\005\231\230\072\252\217\135\301\155\073\111\151\302"
+  "\246\141\314\333\112\274\333\106\254\333\146\234\133\362\016\333"
+  "\166\116\245\153\032\366\325\141\133\142\077\314\022\373\255\014"
+  "\106\262\066\266\300\276\067\005\366\303\275\136\321\344\166\302"
+  "\132\171\353\157\127\334\224\161\363\266\351\374\246\342\316\034"
+  "\107\023\044\136\246\324\346\143\107\146\223\061\243\211\034\115"
+  "\247\017\374\325\255\277\162\052\256\067\252\047\275\174\046\365"
+  "\012\111\337\074\114\066\057\010\037\166\327\376\353\300\377\016"
+  "\226\320\061\000\050\165\165\141\171\051\143\141\152\141\057\000"
+  "\003\000\000\000\145\170\164\145\156\163\151\157\156\163\057\000"
+  "\004\000\000\000\151\155\141\147\145\143\157\156\166\145\162\164"
+  "\145\162\057\000\001\000\000\000\006\000\000\000\007\000\000\000"
+  "\057\000\000\000\000\000\000\000\143\141\152\141\055\151\155\141"
+  "\147\145\055\162\157\164\141\164\145\056\165\151\000\000\000\000"
+  "\045\105\000\000\001\000\000\000\170\332\355\134\315\162\333\066"
+  "\020\276\347\051\120\134\073\262\176\062\315\070\035\211\031\327"
+  "\255\063\235\351\051\161\316\034\210\134\123\210\041\200\005\100"
+  "\313\172\253\076\103\237\254\040\050\333\222\005\212\204\310\270"
+  "\212\203\233\104\355\056\260\213\305\307\017\013\100\323\017\367"
+  "\113\206\356\100\052\052\370\014\217\317\106\030\001\117\104\112"
+  "\171\066\303\137\256\257\006\347\370\103\364\146\372\323\140\200"
+  "\076\002\007\111\064\244\150\105\365\002\145\214\244\200\336\236"
+  "\115\046\147\143\064\030\030\041\312\065\310\033\222\100\364\006"
+  "\241\251\204\277\013\052\101\041\106\347\063\234\351\333\237\361"
+  "\123\103\245\032\036\132\071\061\377\012\211\106\011\043\112\315"
+  "\360\107\175\173\221\176\055\224\136\002\327\030\321\164\206\311"
+  "\343\367\061\056\065\214\116\056\105\016\122\257\021\047\113\230"
+  "\141\046\126\040\161\064\236\016\037\176\160\313\025\171\136\312"
+  "\275\175\067\152\222\274\043\254\000\034\275\157\024\124\032\362"
+  "\230\362\104\202\355\160\163\037\162\222\301\216\302\263\046\246"
+  "\303\052\040\356\330\374\271\064\352\125\130\150\371\261\056\042"
+  "\167\124\321\071\063\036\134\313\002\232\272\224\020\036\337\210"
+  "\244\120\070\272\042\114\065\312\323\104\360\270\374\210\043\363"
+  "\113\002\112\015\224\026\271\217\037\277\123\302\104\126\071\042"
+  "\205\066\131\025\247\325\243\176\272\250\251\066\336\043\055\011"
+  "\127\214\150\142\142\061\303\153\060\352\237\154\153\310\006\122"
+  "\065\232\131\347\020\057\150\071\116\125\367\366\024\222\005\145"
+  "\151\365\271\124\147\046\373\027\202\245\040\207\033\201\341\226"
+  "\104\045\215\354\074\341\204\015\354\127\063\130\163\161\217\037"
+  "\155\354\305\352\267\255\137\375\043\343\322\131\022\231\121\036"
+  "\063\270\051\023\160\342\241\042\151\266\360\325\061\251\341\251"
+  "\061\027\132\213\145\133\045\041\251\231\111\104\033\140\301\221"
+  "\101\030\115\023\302\332\050\252\234\044\006\347\160\164\356\224"
+  "\166\017\026\111\312\206\142\042\201\154\215\212\163\334\012\343"
+  "\005\337\035\275\143\107\320\211\172\144\055\012\035\053\275\056"
+  "\047\072\360\264\126\161\047\111\233\072\134\115\312\271\375\074"
+  "\306\317\265\134\335\230\003\163\116\265\370\222\360\004\130\135"
+  "\267\274\161\253\145\020\175\125\045\044\100\357\100\305\051\334"
+  "\220\202\151\177\013\026\212\161\124\041\262\217\142\241\040\056"
+  "\270\101\013\106\171\243\323\333\210\272\153\224\044\267\046\217"
+  "\233\233\203\373\234\360\324\337\277\033\312\230\277\126\056\024"
+  "\255\046\345\370\220\123\316\336\357\300\146\367\074\236\164\313"
+  "\343\352\235\361\372\363\370\007\111\307\111\037\351\350\162\337"
+  "\355\172\235\333\136\140\137\371\354\245\362\344\360\310\255\342"
+  "\160\166\317\321\375\071\327\104\120\216\236\016\175\275\027\133"
+  "\363\201\203\234\140\074\351\372\072\275\222\226\042\277\010\126"
+  "\034\014\120\055\332\305\367\204\321\254\076\101\152\102\264\040"
+  "\251\130\305\045\067\306\021\027\374\160\273\316\140\271\003\166"
+  "\121\166\246\132\025\071\344\073\004\256\153\360\234\001\064\344"
+  "\071\316\111\232\066\144\113\163\040\332\116\252\336\102\321\107"
+  "\070\232\370\376\371\061\006\274\146\156\253\131\334\256\033\007"
+  "\207\346\230\341\351\145\210\372\032\246\356\001\152\027\044\167"
+  "\240\076\221\224\212\155\106\266\141\047\061\341\031\203\130\226"
+  "\077\127\044\015\067\031\367\341\154\237\201\225\375\040\034\331"
+  "\166\176\155\353\146\157\043\327\221\334\371\223\075\257\174\160"
+  "\231\134\154\136\006\112\023\251\273\030\052\227\310\167\075\204"
+  "\053\225\144\025\123\236\032\024\320\102\372\332\253\343\247\373"
+  "\255\326\361\325\266\374\265\163\344\333\021\332\366\004\167\344"
+  "\023\245\126\356\073\327\143\175\101\304\245\130\316\205\001\324"
+  "\153\270\177\050\371\132\154\110\312\347\363\106\240\175\251\051"
+  "\333\171\230\037\346\305\310\313\010\325\260\124\315\162\033\111"
+  "\027\026\276\037\375\373\217\011\267\110\156\127\264\364\240\224"
+  "\353\301\240\050\312\322\330\240\117\303\343\163\143\271\255\235"
+  "\112\116\235\016\016\164\315\265\276\141\140\374\177\300\100\233"
+  "\160\267\013\165\057\160\333\075\306\235\141\266\105\154\033\343"
+  "\032\050\352\113\122\124\323\171\055\226\337\230\241\136\332\106"
+  "\002\075\375\101\351\351\276\275\114\212\302\254\234\153\327\107"
+  "\201\372\276\076\352\373\071\247\174\033\171\252\101\127\346\351"
+  "\321\210\163\212\160\360\164\204\003\107\133\307\071\116\061\243"
+  "\003\211\353\224\320\177\331\367\335\053\131\260\365\366\312\251"
+  "\147\001\051\144\022\100\155\057\317\002\312\167\331\301\013\053"
+  "\233\036\126\066\343\227\132\331\034\216\351\001\345\172\305\132"
+  "\245\315\201\236\162\337\352\141\106\266\333\227\072\204\151\247"
+  "\265\047\125\013\063\366\270\033\262\347\030\150\063\223\234\022"
+  "\255\045\065\014\004\152\253\053\117\042\233\266\127\140\217\206"
+  "\041\173\162\162\206\347\202\245\170\130\067\254\207\355\173\217"
+  "\155\177\107\021\274\367\121\273\236\105\030\275\354\321\230\260"
+  "\047\035\366\244\303\236\164\330\223\016\005\277\235\202\037\311"
+  "\163\340\351\067\053\365\135\130\363\241\306\027\266\240\103\035"
+  "\356\064\313\026\177\160\055\327\025\026\224\236\304\140\277\277"
+  "\216\171\252\355\266\272\003\226\316\252\233\067\151\050\303\205"
+  "\062\334\017\136\206\323\002\231\214\001\144\357\215\005\200\017"
+  "\045\270\160\270\300\223\102\123\156\057\077\172\160\350\366\263"
+  "\163\163\147\223\162\144\333\070\066\270\175\257\166\272\230\351"
+  "\110\236\173\201\310\076\110\163\237\204\271\146\103\174\177\161"
+  "\326\166\152\204\172\175\250\327\177\237\365\372\053\103\106\112"
+  "\231\120\251\077\231\112\375\370\273\275\065\350\163\351\256\321"
+  "\337\346\113\203\273\076\356\376\001\102\165\173\176\260\242\151"
+  "\006\372\061\245\166\037\043\011\052\027\134\231\336\014\336\341"
+  "\150\163\023\335\244\342\266\120\263\352\057\017\252\023\247\352"
+  "\263\207\152\367\077\053\246\303\255\077\063\371\017\146\110\026"
+  "\045\000\050\165\165\141\171\051\145\162\162\157\162\055\144\151"
+  "\141\154\157\147\056\165\151\000\022\031\000\000\001\000\000\000"
+  "\170\332\355\131\115\163\233\060\020\275\367\127\250\272\166\360"
+  "\127\072\231\034\154\062\375\112\246\063\075\265\351\231\021\142"
+  "\015\252\145\211\112\042\066\375\365\025\140\327\046\226\215\301"
+  "\356\244\165\173\303\260\117\332\267\373\166\131\344\361\355\162"
+  "\316\321\043\050\315\244\230\340\141\157\200\021\010\052\043\046"
+  "\342\011\376\372\160\347\335\340\133\377\305\370\245\347\241\173"
+  "\020\240\210\201\010\055\230\111\120\314\111\004\350\252\067\032"
+  "\365\106\310\363\254\021\023\006\324\224\120\360\137\040\064\126"
+  "\360\075\143\012\064\342\054\234\340\330\314\136\341\315\106\005"
+  "\014\367\113\073\031\176\003\152\020\345\104\353\011\276\067\263"
+  "\217\163\022\003\106\054\232\140\126\134\016\161\141\147\055\123"
+  "\045\123\120\046\107\202\314\141\202\037\231\146\041\007\354\077"
+  "\250\014\306\375\365\123\267\061\045\042\230\112\232\151\354\337"
+  "\021\256\033\355\031\225\042\050\056\261\157\237\120\320\332\323"
+  "\106\246\165\330\270\137\071\357\346\361\236\021\056\343\212\010"
+  "\050\045\125\020\125\167\316\343\141\050\125\004\052\130\260\310"
+  "\044\330\037\216\232\354\015\063\066\130\310\050\042\064\047\206"
+  "\330\320\115\160\016\166\273\017\205\163\115\360\005\023\221\134"
+  "\004\251\324\314\330\024\142\237\102\221\356\026\161\254\330\173"
+  "\160\314\156\046\117\041\110\254\240\326\260\035\000\115\030\217"
+  "\120\141\267\242\026\022\265\212\154\261\034\267\062\114\044\267"
+  "\021\352\257\000\375\022\121\103\227\202\025\204\173\345\117\253"
+  "\250\120\056\067\153\354\044\364\355\326\323\226\162\354\222\160"
+  "\027\106\052\146\303\116\252\014\330\152\062\214\022\356\004\272"
+  "\031\022\132\100\003\242\200\154\121\161\222\315\214\221\242\116"
+  "\271\023\355\256\324\135\270\004\226\051\021\121\273\315\022\071"
+  "\227\261\355\135\262\330\256\015\220\223\134\146\046\320\046\057"
+  "\370\125\133\357\305\156\251\253\071\254\125\123\010\313\353\021"
+  "\176\212\162\171\022\002\167\326\156\360\145\306\322\175\116\165"
+  "\316\127\103\316\332\102\025\120\140\217\240\203\010\246\044\343"
+  "\246\375\012\231\206\040\023\266\232\071\023\215\276\157\267\345"
+  "\372\242\204\316\354\213\255\171\273\143\144\346\302\115\031\347"
+  "\355\121\233\236\072\070\104\312\351\175\255\255\235\056\306\341"
+  "\151\142\174\107\004\005\176\371\162\054\347\022\354\127\343\311"
+  "\157\323\361\056\234\360\005\311\165\240\023\373\046\136\371\160"
+  "\251\245\060\174\356\122\270\072\255\024\076\203\121\371\377\306"
+  "\174\041\152\034\235\111\215\345\054\261\263\102\051\303\265\244"
+  "\230\230\101\204\373\117\127\333\101\272\202\351\016\344\276\040"
+  "\266\032\275\232\043\270\023\075\353\113\120\014\350\166\166\072"
+  "\060\070\265\175\031\072\342\275\023\353\335\252\167\117\363\145"
+  "\271\027\123\377\315\263\116\271\307\366\250\265\307\211\365\370"
+  "\230\366\164\216\226\162\320\163\027\126\333\364\330\354\270\076"
+  "\111\233\111\273\211\127\047\002\056\333\023\070\237\312\373\204"
+  "\257\335\243\226\321\354\207\135\346\372\060\166\137\107\075\334"
+  "\125\073\067\205\303\315\241\023\364\250\341\367\100\237\335\333"
+  "\153\333\212\354\123\365\056\337\234\326\030\130\232\277\101\164"
+  "\373\207\220\067\002\225\124\120\102\064\222\224\146\112\101\324"
+  "\153\273\376\102\221\264\033\063\015\334\306\230\164\216\314\234"
+  "\054\253\363\255\200\046\104\131\102\257\007\155\227\310\011\147"
+  "\361\061\342\272\234\072\032\236\273\216\376\361\357\351\077\177"
+  "\320\152\112\175\363\310\124\347\130\077\053\255\316\014\075\133"
+  "\210\061\030\375\013\121\273\215\024\350\124\012\155\275\031\142"
+  "\177\165\260\065\356\327\154\032\221\336\365\032\072\154\013\035"
+  "\254\221\127\116\344\223\233\272\176\170\077\356\157\375\163\361"
+  "\023\211\251\110\070\000\050\165\165\141\171\051\155\141\164\145"
+  "\057\000\000\000\002\000\000\000" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { imageconverter_resource_data.data, sizeof (imageconverter_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *imageconverter_get_resource (void);
+GResource *imageconverter_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/1.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/1.html new file mode 100644 index 0000000..e44f0e4 --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/1.html @@ -0,0 +1,1531 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ *  caja-open-terminal.c
+ *
+ *  Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Christian Neumair <chris@gnome-de.org>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <gtk/gtkicontheme.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkmain.h>
+
+#include <libmate-desktop/mate-desktop-item.h>
+#include <gio/gio.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h> /* for strcmp, strdup, ... */
+#include <unistd.h> /* for chdir */
+#include <stdlib.h> /* for atoi */
+#include <sys/stat.h>
+
+#define COT_SCHEMA "org.mate.caja-open-terminal"
+#define COT_DESKTOP_KEY "desktop-opens-home-dir"
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_DESKTOP_KEY "desktop-is-home-dir"
+#define TERM_SCHEMA "org.mate.applications-terminal"
+#define TERM_EXEC_KEY "exec"
+
+static void caja_open_terminal_instance_init (CajaOpenTerminal      *cvs);
+static void caja_open_terminal_class_init    (CajaOpenTerminalClass *class);
+
+static GType terminal_type = 0;
+
+typedef enum {
+	FILE_INFO_LOCAL,
+	FILE_INFO_DESKTOP,
+	FILE_INFO_SFTP,
+	FILE_INFO_OTHER
+} TerminalFileInfo;
+
+static TerminalFileInfo
+get_terminal_file_info (CajaFileInfo *file_info)
+{
+	TerminalFileInfo  ret;
+	char             *uri;
+	char             *uri_scheme;
+
+	uri = caja_file_info_get_activation_uri (file_info);
+	uri_scheme = g_uri_parse_scheme (uri);
+
+	if (strcmp (uri_scheme, "file") == 0) {
+		ret = FILE_INFO_LOCAL;
+	} else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
+		ret = FILE_INFO_DESKTOP;
+	} else if (strcmp (uri_scheme, "sftp") == 0 ||
+		   strcmp (uri_scheme, "ssh") == 0) {
+		ret = FILE_INFO_SFTP;
+	} else {
+		ret = FILE_INFO_OTHER;
+	}
+
+	g_free (uri_scheme);
+	g_free (uri);
+
+	return ret;
+}
+
+static char *
+lookup_in_data_dir (const char *basename,
+                    const char *data_dir)
+{
+	char *path;
+
+	path = g_build_filename (data_dir, basename, NULL);
+	if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+		g_free (path);
+		return NULL;
+	}
+
+	return path;
+}
+
+static char *
+lookup_in_data_dirs (const char *basename)
+{
+	const char * const *system_data_dirs;
+	const char          *user_data_dir;
+	char                *retval;
+	int                  i;
+
+	user_data_dir    = g_get_user_data_dir ();
+	system_data_dirs = g_get_system_data_dirs ();
+
+	if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
+		return retval;
+	}
+
+	for (i = 0; system_data_dirs[i]; i++) {
+		if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
+			return retval;
+	}
+
+	return NULL;
+}
+
+static inline gboolean
+desktop_opens_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+set_desktop_opens_home_dir (gboolean val)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (COT_SCHEMA);
+	result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gboolean
+desktop_is_home_dir (void)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (CAJA_SCHEMA);
+	result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
+	g_object_unref (settings);
+	return result;
+}
+
+static inline gchar*
+default_terminal_application (void)
+{
+	gchar *result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_get_string (settings, TERM_EXEC_KEY);
+	g_object_unref (settings);
+
+	if (result == NULL || strlen (result) == 0) {
+		g_free (result);
+		result = g_strdup ("mate-terminal");
+	}
+
+	return result;
+}
+
+static inline gboolean
+set_default_terminal_application (const gchar* exec)
+{
+	gboolean result;
+	GSettings* settings;
+
+	settings = g_settings_new (TERM_SCHEMA);
+	result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
+	g_object_unref (settings);
+	return result;
+}
+
+static void
+parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
+		char **path)
+{
+	char *uri = g_file_get_uri (file);
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);
+
+	u = strchr(uri, ':');
+	g_assert (u != NULL);
+	u += 3;  /* Skip over :// to userid */
+
+	p = strchr (u, '/');
+	h = strchr(u, '@');
+
+	if (h && ((p == NULL) || (h < p))) {
+		*h='\0';
+		h++;
+	} else {
+		h = u;
+		u = NULL;
+	}
+
+	s = strchr(h, ':');
+
+	if (s && (p == NULL || s < p)) {
+		h_end = s;
+		*s = '\0';
+		s++;
+	} else {
+		h_end = p;
+		s = NULL;
+	}
+
+	if (h_end == NULL) {
+		h_end = h + strlen(h);
+	}
+
+	*user = g_strdup(u);
+	*port = s == NULL ? 0 : atoi(s); /* FIXME: getservbyname ? */
+	*path = g_uri_unescape_string (p, "/");
+	*h_end = '\0';
+	*host = g_strdup(h);
+
+	g_free (uri);
+}
+
+static void
+append_sftp_info (char **terminal_exec,
+		  CajaFileInfo *file_info)
+{
+	GFile *vfs_uri;
+	char *host_name, *path, *user_name;
+	char *user_host, *cmd, *quoted_cmd;
+	char *host_port_switch;
+	char *quoted_path;
+	char *remote_cmd;
+	char *quoted_remote_cmd;
+	guint host_port;
+
+	g_assert (terminal_exec != NULL);
+	g_assert (file_info != NULL);
+
+
+	vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
+	g_assert (vfs_uri != NULL);
+
+	g_assert (g_file_has_uri_scheme(vfs_uri, "sftp")==TRUE ||
+		  g_file_has_uri_scheme(vfs_uri, "ssh")==TRUE);
+
+	parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
+
+	if (host_port == 0) {
+		host_port_switch = g_strdup ("");
+	} else {
+		host_port_switch = g_strdup_printf ("-p %d", host_port);
+	}
+
+	if (user_name != NULL) {
+		user_host = g_strdup_printf ("%s@%s", user_name, host_name);
+	} else {
+		user_host = g_strdup (host_name);
+	}
+
+	quoted_path = g_shell_quote (path);
+	remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
+	quoted_remote_cmd = g_shell_quote (remote_cmd);
+
+	cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
+	quoted_cmd = g_shell_quote (cmd);
+	g_free (cmd);
+
+	*terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
+	strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
+	strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
+
+	g_free (host_name);
+	g_free (user_name);
+	g_free (host_port_switch);
+	g_free (path);
+	g_free (quoted_path);
+
+	g_free (remote_cmd);
+	g_free (quoted_remote_cmd);
+	g_free (quoted_cmd);
+	g_free (user_host);
+	g_object_unref (vfs_uri);
+}
+
+static void
+open_terminal_callback (CajaMenuItem *item,
+			CajaFileInfo *file_info)
+{
+	GdkDisplay   *display;
+	const gchar *display_str;
+	const gchar *old_display_str;
+	gchar *uri;
+	gchar **argv, *terminal_exec;
+	gchar *working_directory;
+	gchar *dfile;
+	MateDesktopItem *ditem;
+	GdkScreen *screen;
+
+	terminal_exec = default_terminal_application();
+
+	switch (get_terminal_file_info (file_info)) {
+		case FILE_INFO_LOCAL:
+			uri = caja_file_info_get_activation_uri (file_info);
+			if (uri != NULL) {
+				working_directory = g_filename_from_uri (uri, NULL, NULL);
+			} else {
+				working_directory = g_strdup (g_get_home_dir ());
+			}
+			g_free (uri);
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
+				working_directory = g_strdup (g_get_home_dir ());
+			} else {
+				working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
+			}
+			break;
+
+		case FILE_INFO_SFTP:
+			working_directory = NULL;
+			append_sftp_info (&terminal_exec, file_info);
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
+		dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
+	} else {
+		dfile = NULL;
+	}
+
+	g_shell_parse_argv (terminal_exec, NULL, &argv, NULL);
+
+	display_str = NULL;
+	old_display_str = g_getenv ("DISPLAY");
+
+	screen = g_object_get_data (G_OBJECT (item), "CajaOpenTerminal::screen");
+	display = gdk_screen_get_display (screen);
+	if (screen != NULL) {
+		display_str = gdk_display_get_name (display);
+		g_setenv ("DISPLAY", display_str, TRUE);
+	}
+
+	if (dfile != NULL) {
+		int orig_cwd = -1;
+
+		do {
+			orig_cwd = open (".", O_RDONLY);
+		} while (orig_cwd == -1 && errno == EINTR);
+
+		if (orig_cwd == -1) {
+			g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
+		} else if (working_directory != NULL) {
+
+			if (chdir (working_directory) == -1) {
+				int ret;
+
+				g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
+					   working_directory);
+
+				do {
+					ret = close (orig_cwd);
+				} while (ret == -1 && errno == EINTR);
+
+				if (ret == -1) {
+					g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
+				}
+
+				orig_cwd = -1;
+			}
+		}
+
+		ditem = mate_desktop_item_new_from_file (dfile, 0, NULL);
+
+		mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
+		if (gtk_get_current_event_time () > 0) {
+			mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
+		}
+		mate_desktop_item_launch (ditem, NULL, MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL);
+		mate_desktop_item_unref (ditem);
+		g_free (dfile);
+
+		if (orig_cwd != -1) {
+			int ret;
+
+			ret = fchdir (orig_cwd);
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
+					   working_directory);
+			}
+
+			do {
+				ret = close (orig_cwd);
+			} while (ret == -1 && errno == EINTR);
+
+			if (ret == -1) {
+				g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
+			}
+		}
+	} else {
+		g_spawn_async (working_directory,
+			       argv,
+			       NULL,
+			       G_SPAWN_SEARCH_PATH,
+			       NULL,
+			       NULL,
+			       NULL,
+			       NULL);
+	}
+
+	g_setenv ("DISPLAY", old_display_str, TRUE);
+
+	g_strfreev (argv);
+	g_free (terminal_exec);
+	g_free (working_directory);
+}
+
+static CajaMenuItem *
+open_terminal_menu_item_new (CajaFileInfo	  *file_info,
+                             TerminalFileInfo  terminal_file_info,
+                             GdkScreen        *screen,
+                             gboolean          is_file_item)
+{
+	CajaMenuItem *ret;
+	const char *name;
+	const char *tooltip;
+
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			name = _("Open in _Terminal");
+			if (is_file_item) {
+				tooltip = _("Open the currently selected folder in a terminal");
+			} else {
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_DESKTOP:
+			if (desktop_opens_home_dir ()) {
+				name = _("Open _Terminal");
+				tooltip = _("Open a terminal");
+			} else {
+				name = _("Open in _Terminal");
+				tooltip = _("Open the currently open folder in a terminal");
+			}
+			break;
+
+		case FILE_INFO_OTHER:
+		default:
+			g_assert_not_reached ();
+	}
+
+	ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
+				      name, tooltip, "terminal");
+
+	g_object_set_data (G_OBJECT (ret),
+			   "CajaOpenTerminal::screen",
+			   screen);
+
+	g_object_set_data_full (G_OBJECT (ret), "file-info",
+				g_object_ref (file_info),
+				(GDestroyNotify) g_object_unref);
+	g_signal_connect (ret, "activate",
+			  G_CALLBACK (open_terminal_callback),
+			  file_info);
+
+	return ret;
+}
+
+static GList *
+caja_open_terminal_get_background_items (CajaMenuProvider *provider,
+                                         GtkWidget        *window,
+                                         CajaFileInfo     *file_info)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	terminal_file_info = get_terminal_file_info (file_info);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static GList *
+caja_open_terminal_get_file_items (CajaMenuProvider *provider,
+                                   GtkWidget        *window,
+                                   GList            *files)
+{
+	CajaMenuItem *item;
+	TerminalFileInfo  terminal_file_info;
+
+	if (g_list_length (files) != 1 ||
+	    (!caja_file_info_is_directory (files->data) &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
+	     caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
+		return NULL;
+	}
+
+	terminal_file_info = get_terminal_file_info (files->data);
+	switch (terminal_file_info) {
+		case FILE_INFO_LOCAL:
+		case FILE_INFO_SFTP:
+			item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE);
+			return g_list_append (NULL, item);
+
+		case FILE_INFO_DESKTOP:
+		case FILE_INFO_OTHER:
+			return NULL;
+
+		default:
+			g_assert_not_reached ();
+	}
+}
+
+static void
+caja_open_terminal_run_config (CajaConfigurable *provider)
+{
+	GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
+	gchar * terminal;
+
+	extconf_dialog = gtk_dialog_new ();
+	extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog));
+
+	extconf_desktophomedir = gtk_check_button_new_with_label (_("Open at Home if trying to open on desktop"));
+	extconf_exec = gtk_entry_new ();
+	extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+	extconf_inform2 = gtk_label_new (_("Terminal application:"));
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir), desktop_opens_home_dir ());
+
+	terminal = default_terminal_application();
+	gtk_entry_set_text (GTK_ENTRY (extconf_exec), terminal);
+	g_free (terminal);
+
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_inform2);
+	gtk_widget_show (extconf_inform2);
+	gtk_container_add (GTK_CONTAINER (extconf_inform1), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_box_set_child_packing (GTK_BOX (extconf_inform1), extconf_exec, FALSE, FALSE, 0, GTK_PACK_END);
+
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_desktophomedir);
+	gtk_widget_show (extconf_desktophomedir);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_inform1);
+	gtk_widget_show (extconf_inform1);
+	gtk_container_add (GTK_CONTAINER (extconf_content), extconf_exec);
+	gtk_widget_show (extconf_exec);
+	gtk_dialog_add_buttons (GTK_DIALOG (extconf_dialog), _("Close"), GTK_RESPONSE_OK, NULL);
+
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog), 6);
+	gtk_container_set_border_width (GTK_CONTAINER (extconf_content), 6);
+
+	gtk_window_set_title (GTK_WINDOW (extconf_dialog), _("open-terminal Configuration"));
+	gtk_dialog_run (GTK_DIALOG (extconf_dialog));
+
+	set_default_terminal_application (gtk_entry_get_text (GTK_ENTRY (extconf_exec)));
+	set_desktop_opens_home_dir (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (extconf_desktophomedir)));
+
+	gtk_widget_destroy (GTK_WIDGET (extconf_dialog));
+}
+
+static void
+caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_background_items = caja_open_terminal_get_background_items;
+	iface->get_file_items = caja_open_terminal_get_file_items;
+}
+
+static void
+caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
+{
+	iface->run_config = caja_open_terminal_run_config;
+}
+
+static void
+caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
+{
+}
+
+static void
+caja_open_terminal_class_init (CajaOpenTerminalClass *class)
+{
+}
+
+GType
+caja_open_terminal_get_type (void)
+{
+	return terminal_type;
+}
+
+void
+caja_open_terminal_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaOpenTerminalClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_open_terminal_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaOpenTerminal),
+		0,
+		(GInstanceInitFunc) caja_open_terminal_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	static const GInterfaceInfo configurable_iface_info = {
+		(GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
+		NULL,
+		NULL
+	};
+
+	terminal_type = g_type_module_register_type (module,
+						     G_TYPE_OBJECT,
+						     "CajaOpenTerminal",
+						     &info, 0);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+
+	g_type_module_add_interface (module,
+				     terminal_type,
+				     CAJA_TYPE_CONFIGURABLE,
+				     &configurable_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/2.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/2.html new file mode 100644 index 0000000..b993801 --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/2.html @@ -0,0 +1,513 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
/*
+ *  Caja-sendto
+ *
+ *  Copyright (C) 2004 Free Software Foundation, Inc.
+ *
+ *  This library 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 library 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
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Author: Roberto Majadas <roberto.majadas@openshine.com>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-nste.h"
+
+static GObjectClass *parent_class;
+
+static void
+sendto_callback (CajaMenuItem *item,
+	      gpointer          user_data)
+{
+	GList            *files, *scan;
+	gchar            *uri;
+	GString          *cmd;
+
+	files = g_object_get_data (G_OBJECT (item), "files");
+
+	cmd = g_string_new ("caja-sendto");
+
+	for (scan = files; scan; scan = scan->next) {
+		CajaFileInfo *file = scan->data;
+
+		uri = caja_file_info_get_uri (file);
+		g_string_append_printf (cmd, " \"%s\"", uri);
+		g_free (uri);
+	}
+
+	g_spawn_command_line_async (cmd->str, NULL);
+
+	g_string_free (cmd, TRUE);
+}
+
+static GList *
+caja_nste_get_file_items (CajaMenuProvider *provider,
+			      GtkWidget            *window,
+			      GList                *files)
+{
+	GList    *items = NULL;
+	gboolean  one_item;
+	CajaMenuItem *item;
+
+	if (files == NULL)
+		return NULL;
+
+	one_item = (files != NULL) && (files->next == NULL);
+	if (one_item &&
+	    !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send file by mail, instant message..."),
+					       "document-send");
+	} else {
+		item = caja_menu_item_new ("CajaNste::sendto",
+					       _("Send to..."),
+					       _("Send files by mail, instant message..."),
+					       "document-send");
+	}
+  g_signal_connect (item,
+      "activate",
+      G_CALLBACK (sendto_callback),
+      provider);
+  g_object_set_data_full (G_OBJECT (item),
+      "files",
+      caja_file_info_list_copy (files),
+      (GDestroyNotify) caja_file_info_list_free);
+
+  items = g_list_append (items, item);
+
+	return items;
+}
+
+
+static void
+caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_nste_get_file_items;
+}
+
+
+static void
+caja_nste_instance_init (CajaNste *nste)
+{
+}
+
+
+static void
+caja_nste_class_init (CajaNsteClass *class)
+{
+	parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType nste_type = 0;
+
+
+GType
+caja_nste_get_type (void)
+{
+	return nste_type;
+}
+
+
+void
+caja_nste_register_type (GTypeModule *module)
+{
+	static const GTypeInfo info = {
+		sizeof (CajaNsteClass),
+		(GBaseInitFunc) NULL,
+		(GBaseFinalizeFunc) NULL,
+		(GClassInitFunc) caja_nste_class_init,
+		NULL,
+		NULL,
+		sizeof (CajaNste),
+		0,
+		(GInstanceInitFunc) caja_nste_instance_init,
+	};
+
+	static const GInterfaceInfo menu_provider_iface_info = {
+		(GInterfaceInitFunc) caja_nste_menu_provider_iface_init,
+		NULL,
+		NULL
+	};
+
+	nste_type = g_type_module_register_type (module,
+					         G_TYPE_OBJECT,
+					         "CajaNste",
+					         &info, 0);
+
+	g_type_module_add_interface (module,
+				     nste_type,
+				     CAJA_TYPE_MENU_PROVIDER,
+				     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/3.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/3.html new file mode 100644 index 0000000..82ada5d --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/3.html @@ -0,0 +1,1899 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2004 Roberto Majadas
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include "caja-sendto-plugin.h"
+
+#define CAJA_SENDTO_LAST_MEDIUM	"last-medium"
+#define CAJA_SENDTO_LAST_COMPRESS	"last-compress"
+#define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10
+
+#define UNINSTALLED_PLUGINDIR "plugins/removable-devices"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+
+enum {
+	COLUMN_ICON,
+	COLUMN_DESCRIPTION,
+	NUM_COLUMNS,
+};
+
+/* Options */
+static char **filenames = NULL;
+
+GList *file_list = NULL;
+gboolean has_dirs = FALSE;
+GList *plugin_list = NULL;
+GHashTable *hash ;
+guint option = 0;
+
+static GSettings *settings = NULL;
+
+typedef struct _NS_ui NS_ui;
+
+struct _NS_ui {
+	GtkWidget *dialog;
+	GtkWidget *options_combobox;
+	GtkWidget *send_to_label;
+	GtkWidget *hbox_contacts_ws;
+	GtkWidget *cancel_button;
+	GtkWidget *send_button;
+	GtkWidget *pack_combobox;
+	GtkWidget *pack_checkbutton;
+	GtkWidget *pack_entry;
+	GList *contact_widgets;
+
+	GtkWidget *status_box;
+	GtkWidget *status_image;
+	GtkWidget *status_label;
+	guint status_timeoutid;
+};
+
+static const GOptionEntry entries[] = {
+	{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" },
+	{ NULL }
+};
+
+static void
+destroy_dialog (GtkWidget *widget, gpointer data )
+{
+        gtk_main_quit ();
+}
+
+static char *
+get_filename_from_list (void)
+{
+	GList *l;
+	GString *common_part = NULL;
+	gboolean matches = TRUE;
+	guint offset = 0;
+	const char *encoding;
+	gboolean use_utf8 = TRUE;
+
+	encoding = g_getenv ("G_FILENAME_ENCODING");
+
+	if (encoding != NULL && strcasecmp(encoding, "UTF-8") != 0)
+		use_utf8 = FALSE;
+
+	if (file_list == NULL)
+		return NULL;
+
+	common_part = g_string_new("");
+
+	while (TRUE) {
+		gunichar cur_char = '\0';
+		for (l = file_list; l ; l = l->next) {
+			char *path = NULL, *name = NULL;
+			char *offset_name = NULL;
+
+			path = g_filename_from_uri ((char *) l->data,
+					NULL, NULL);
+			if (!path)
+				break;
+
+			name = g_path_get_basename (path);
+
+			if (!use_utf8) {
+				char *tmp;
+
+				tmp = g_filename_to_utf8 (name, -1,
+						NULL, NULL, NULL);
+				g_free (name);
+				name = tmp;
+			}
+
+			if (!name) {
+				g_free (path);
+				break;
+			}
+
+			if (offset >= g_utf8_strlen (name, -1)) {
+				g_free(name);
+				g_free(path);
+				matches = FALSE;
+				break;
+			}
+
+			offset_name = g_utf8_offset_to_pointer (name, offset);
+
+			if (offset_name == g_utf8_strrchr (name, -1, '.')) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			if (cur_char == '\0') {
+				cur_char = g_utf8_get_char (offset_name);
+			} else if (cur_char != g_utf8_get_char (offset_name)) {
+				g_free (name);
+				g_free (path);
+				matches = FALSE;
+				break;
+			}
+			g_free (name);
+			g_free (path);
+		}
+		if (matches == TRUE && cur_char != '\0') {
+			offset++;
+			common_part = g_string_append_unichar (common_part,
+					cur_char);
+		} else {
+			break;
+		}
+	}
+
+	if (g_utf8_strlen (common_part->str, -1) < 4) {
+		g_string_free (common_part, TRUE);
+		return NULL;
+	}
+
+	return g_string_free (common_part, FALSE);
+}
+
+static char *
+pack_files (NS_ui *ui)
+{
+	char *engrampa_cmd;
+	const char *filename;
+	GList *l;
+	GString *cmd, *tmp;
+	char *pack_type, *tmp_dir, *tmp_work_dir, *packed_file;
+
+	engrampa_cmd = g_find_program_in_path ("engrampa");
+	filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+
+	g_assert (filename != NULL && *filename != '\0');
+
+	tmp_dir = g_strdup_printf ("%s/caja-sendto-%s",
+				   g_get_tmp_dir(), g_get_user_name());
+	g_mkdir (tmp_dir, 0700);
+	tmp_work_dir = g_strdup_printf ("%s/caja-sendto-%s/%li",
+					g_get_tmp_dir(), g_get_user_name(),
+					time(NULL));
+	g_mkdir (tmp_work_dir, 0700);
+	g_free (tmp_dir);
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX(ui->pack_combobox)) != 0) {
+		pack_type = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(ui->pack_combobox));
+	} else {
+		pack_type = NULL;
+		g_assert_not_reached ();
+	}
+
+	g_settings_set_int (settings,
+			    CAJA_SENDTO_LAST_COMPRESS,
+			    gtk_combo_box_get_active(GTK_COMBO_BOX(ui->pack_combobox)));
+
+	cmd = g_string_new ("");
+	g_string_printf (cmd, "%s --add-to=\"%s/%s%s\"",
+			 engrampa_cmd, tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (engrampa_cmd);
+
+	/* engrampa doesn't understand URIs */
+	for (l = file_list ; l; l=l->next){
+		char *file;
+
+		file = g_filename_from_uri (l->data, NULL, NULL);
+		g_string_append_printf (cmd," \"%s\"", file);
+		g_free (file);
+	}
+
+	g_spawn_command_line_sync (cmd->str, NULL, NULL, NULL, NULL);
+	g_string_free (cmd, TRUE);
+	tmp = g_string_new("");
+	g_string_printf (tmp,"%s/%s%s", tmp_work_dir,
+			 filename,
+			 pack_type);
+	g_free (pack_type);
+	g_free (tmp_work_dir);
+	packed_file = g_filename_to_uri (tmp->str, NULL, NULL);
+	g_string_free(tmp, TRUE);
+	return packed_file;
+}
+
+static gboolean
+status_label_clear (gpointer data)
+{
+	NS_ui *ui = (NS_ui *) data;
+	gtk_label_set_label (GTK_LABEL (ui->status_label), "");
+	gtk_widget_hide (ui->status_image);
+
+	ui->status_timeoutid = 0;
+
+	return FALSE;
+}
+
+static void
+send_button_cb (GtkWidget *widget, NS_ui *ui)
+{
+	char *error;
+	NstPlugin *p;
+	GtkWidget *w;
+
+	gtk_widget_set_sensitive (ui->dialog, FALSE);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	w = (GtkWidget *) g_list_nth_data (ui->contact_widgets, option);
+
+	if (ui->status_timeoutid != 0) {
+		g_source_remove (ui->status_timeoutid);
+		status_label_clear (ui);
+	}
+
+	if (p == NULL)
+		return;
+
+	if (p->info->validate_destination != NULL) {
+		error = NULL;
+		if (p->info->validate_destination (p, w, &error) == FALSE) {
+			char *message;
+
+			message = g_strdup_printf ("<b>%s</b>", error);
+			g_free (error);
+			gtk_label_set_markup (GTK_LABEL (ui->status_label), message);
+			g_free (message);
+			ui->status_timeoutid = g_timeout_add_seconds (CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS,
+								      status_label_clear,
+								      ui);
+			gtk_widget_show (ui->status_image);
+			gtk_widget_show (ui->status_box);
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+	}
+
+	g_settings_set_string (settings,
+			       CAJA_SENDTO_LAST_MEDIUM,
+			       p->info->id);
+
+	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
+		char *f;
+
+		f = pack_files (ui);
+		if (f != NULL) {
+			GList *packed_file = NULL;
+			packed_file = g_list_append (packed_file, f);
+			if (!p->info->send_files (p, w, packed_file)) {
+				g_free (f);
+				g_list_free (packed_file);
+				return;
+			}
+			g_list_free (packed_file);
+		} else {
+			gtk_widget_set_sensitive (ui->dialog, TRUE);
+			return;
+		}
+		g_free (f);
+	} else {
+		if (!p->info->send_files (p, w, file_list)) {
+			g_list_free_full (file_list, g_free);
+			file_list = NULL;
+			return;
+		}
+		g_list_free (file_list);
+		file_list = NULL;
+	}
+	destroy_dialog (NULL,NULL);
+}
+
+static void
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		if (gtk_widget_is_sensitive (ui->pack_entry)) {
+			gtk_widget_grab_focus (ui->pack_entry);
+		} else {
+			gtk_widget_grab_focus (ui->pack_checkbutton);
+		}
+	} else {
+		send_button_cb (widget, ui);
+	}
+}
+
+static void
+toggle_pack_check (GtkWidget *widget, NS_ui *ui)
+{
+	GtkToggleButton *t = GTK_TOGGLE_BUTTON (widget);
+	gboolean enabled, send_enabled;
+
+	enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (t));
+	gtk_widget_set_sensitive (ui->pack_combobox, enabled);
+	gtk_widget_set_sensitive (ui->pack_entry, enabled);
+
+	send_enabled = TRUE;
+
+	if (enabled) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+	GtkWidget *w;
+	NstPlugin *p;
+	gboolean supports_dirs = FALSE;
+
+	w = g_list_nth_data (ui->contact_widgets, option);
+	option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
+	gtk_widget_hide (w);
+	w = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_show (w);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), w);
+
+	p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+	supports_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+}
+
+static void
+set_contact_widgets (NS_ui *ui)
+{
+	GList *aux ;
+	GtkWidget *w;
+	NstPlugin *p;
+
+	ui->contact_widgets = NULL;
+
+	for (aux = plugin_list; aux; aux = aux->next){
+		p = (NstPlugin *) aux->data;
+		w = p->info->get_contacts_widget(p);
+		gtk_box_pack_end (GTK_BOX(ui->hbox_contacts_ws),w, TRUE, TRUE, 0);
+		gtk_widget_hide (GTK_WIDGET(w));
+		ui->contact_widgets = g_list_append (ui->contact_widgets, w);
+		if (GTK_IS_ENTRY (w)) {
+			g_signal_connect_after (G_OBJECT (w), "activate",
+						G_CALLBACK (send_if_no_pack_cb), ui);
+		}
+	}
+}
+
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
+	GdkPixbuf *pixbuf;
+        GtkTreeIter iter;
+        GtkListStore *model;
+	GtkIconTheme *it;
+	GtkCellRenderer *renderer;
+	GtkWidget *widget;
+	GList *aux;
+	NstPlugin *p;
+	char *last_used = NULL;
+	int i = 0;
+	gboolean last_used_support_dirs = FALSE;
+
+	it = gtk_icon_theme_get_default ();
+
+	model = gtk_list_store_new (NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+
+	last_used = g_settings_get_string (settings,
+					   CAJA_SENDTO_LAST_MEDIUM);
+
+	for (aux = plugin_list; aux; aux = aux->next) {
+		p = (NstPlugin *) aux->data;
+		pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
+						   GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+		gtk_list_store_append (model, &iter);
+		gtk_list_store_set (model, &iter,
+		                    COLUMN_ICON, pixbuf,
+#ifdef ENABLE_NLS
+		                    COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description),
+#else
+		                    COLUMN_DESCRIPTION, p->info->description,
+#endif /* ENABLE_NLS */
+		                    -1);
+		if (last_used != NULL && !strcmp(last_used, p->info->id)) {
+			option = i;
+			last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES);
+		}
+		i++;
+	}
+	g_free(last_used);
+
+	gtk_combo_box_set_model (GTK_COMBO_BOX(ui->options_combobox),
+				GTK_TREE_MODEL (model));
+	renderer = gtk_cell_renderer_pixbuf_new ();
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    FALSE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "pixbuf", COLUMN_ICON,
+                                        NULL);
+        renderer = gtk_cell_renderer_text_new ();
+        g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+        gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (ui->options_combobox),
+                                    renderer,
+                                    TRUE);
+        gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (ui->options_combobox),
+					renderer,
+                                        "text", COLUMN_DESCRIPTION,
+                                        NULL);
+
+	g_signal_connect (G_OBJECT (ui->options_combobox), "changed",
+			  G_CALLBACK (option_changed), ui);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+	/* Grab the focus for the most recently used widget */
+	widget = g_list_nth_data (ui->contact_widgets, option);
+	gtk_widget_grab_focus (widget);
+
+	return last_used_support_dirs;
+}
+
+static void
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
+{
+	gboolean send_enabled;
+
+	send_enabled = TRUE;
+
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+		const char *filename;
+
+		filename = gtk_entry_get_text(GTK_ENTRY(ui->pack_entry));
+		if (filename == NULL || *filename == '\0')
+			send_enabled = FALSE;
+	}
+
+	gtk_widget_set_sensitive (ui->send_button, send_enabled);
+}
+
+static void
+update_button_image (GtkSettings *gtk_settings,
+                     GParamSpec  *spec,
+                     GtkWidget   *widget)
+{
+	gboolean show_images;
+
+	g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL);
+	if (show_images == FALSE)
+		gtk_widget_hide (widget);
+	else
+		gtk_widget_show (widget);
+}
+
+static void
+caja_sendto_create_ui (void)
+{
+	GtkBuilder *builder;
+	GError* error = NULL;
+	NS_ui *ui;
+	gboolean one_file = FALSE;
+	gboolean supports_dirs;
+	GtkSettings *gtk_settings;
+	GtkWidget *button_image;
+
+	builder = gtk_builder_new ();
+	if (gtk_builder_add_from_resource (builder, "/org/mate/caja/extensions/sendto/caja-sendto.ui", &error) == 0) {
+		g_warning ("Could not parse UI definition: %s", error->message);
+		g_error_free (error);
+	}
+
+	ui = g_new0 (NS_ui, 1);
+
+	ui->hbox_contacts_ws = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_contacts_widgets"));
+	ui->send_to_label = GTK_WIDGET (gtk_builder_get_object (builder, "send_to_label"));
+	ui->options_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "options_combobox"));
+	ui->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "caja_sendto_dialog"));
+	ui->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "cancel_button"));
+	ui->send_button = GTK_WIDGET (gtk_builder_get_object (builder, "send_button"));
+	ui->pack_combobox = GTK_WIDGET (gtk_builder_get_object (builder, "pack_combobox"));
+	ui->pack_entry = GTK_WIDGET (gtk_builder_get_object (builder, "pack_entry"));
+	ui->pack_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "pack_checkbutton"));
+	ui->status_box = GTK_WIDGET (gtk_builder_get_object (builder, "status_box"));
+	ui->status_label = GTK_WIDGET (gtk_builder_get_object (builder, "status_label"));
+	ui->status_image = GTK_WIDGET (gtk_builder_get_object (builder, "status_image"));
+
+	gtk_settings = gtk_settings_get_default ();
+	button_image = GTK_WIDGET (gtk_builder_get_object (builder, "image1"));
+	g_signal_connect (G_OBJECT (gtk_settings), "notify::gtk-button-images",
+			  G_CALLBACK (update_button_image), button_image);
+	update_button_image (gtk_settings, NULL, button_image);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
+				  g_settings_get_int (settings,
+						      CAJA_SENDTO_LAST_COMPRESS));
+
+	if (file_list != NULL && file_list->next != NULL)
+		one_file = FALSE;
+	else if (file_list != NULL)
+		one_file = TRUE;
+
+	gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), _("Files"));
+
+	if (one_file) {
+		char *filepath = NULL, *filename = NULL;
+
+		filepath = g_filename_from_uri ((char *)file_list->data,
+				NULL, NULL);
+
+		if (filepath != NULL)
+			filename = g_path_get_basename (filepath);
+		if (filename != NULL && filename[0] != '\0')
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry), filename);
+
+		g_free (filename);
+		g_free (filepath);
+	} else {
+		char *filename = get_filename_from_list ();
+		if (filename != NULL && filename[0] != '\0') {
+			gtk_entry_set_text (GTK_ENTRY (ui->pack_entry),
+					filename);
+		}
+		g_free (filename);
+	}
+
+	set_contact_widgets (ui);
+	supports_dirs = set_model_for_options_combobox (ui);
+	g_signal_connect (G_OBJECT (ui->dialog), "destroy",
+                          G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
+			  G_CALLBACK (destroy_dialog), NULL);
+	g_signal_connect (G_OBJECT (ui->send_button), "clicked",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "activate",
+			  G_CALLBACK (send_button_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
+			  G_CALLBACK (pack_entry_changed_cb), ui);
+	g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+			  G_CALLBACK (toggle_pack_check), ui);
+
+	g_object_unref (builder);
+
+	if (has_dirs == FALSE || supports_dirs != FALSE) {
+		gboolean toggle;
+
+		toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+		gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+		gtk_widget_set_sensitive (ui->pack_entry, toggle);
+	} else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+		gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+	}
+
+	gtk_widget_show (ui->dialog);
+
+}
+
+static void
+caja_sendto_plugin_dir_process (const char *plugindir)
+{
+	GDir *dir;
+	const char *item;
+	NstPlugin *p = NULL;
+	gboolean (*nst_init_plugin)(NstPlugin *p);
+	GError *err = NULL;
+
+	dir = g_dir_open (plugindir, 0, &err);
+
+	if (dir == NULL) {
+		g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
+	} else {
+		while ((item = g_dir_read_name(dir))) {
+			if (g_str_has_suffix (item, SOEXT)) {
+				g_autofree gchar *module_path = NULL;
+
+				p = g_new0(NstPlugin, 1);
+
+				module_path = g_module_build_path (plugindir, item);
+				if (!module_path) {
+					g_free (p);
+					continue;
+				}
+
+				p->module = g_module_open (module_path, 0);
+			        if (!p->module) {
+                			g_warning ("error opening %s: %s", module_path, g_module_error ());
+					g_free (p);
+					continue;
+				}
+
+				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *) &nst_init_plugin)) {
+			                g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					g_free (p);
+					continue;
+				}
+
+				nst_init_plugin (p);
+				if (p->info->init(p)) {
+					plugin_list = g_list_append (plugin_list, p);
+				} else {
+					g_free (p);
+				}
+			}
+		}
+		g_dir_close (dir);
+	}
+}
+
+static gboolean
+caja_sendto_plugin_init (void)
+{
+	if (g_file_test (UNINSTALLED_PLUGINDIR, G_FILE_TEST_IS_DIR) != FALSE) {
+		/* Try to load the local plugins */
+		GError *err = NULL;
+		GDir *dir;
+		const char *item;
+
+		dir = g_dir_open ("plugins/", 0, &err);
+		if (dir == NULL) {
+			g_warning ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+			if (err)
+				g_error_free (err);
+			return FALSE;
+		}
+		while ((item = g_dir_read_name(dir))) {
+			char *plugindir;
+
+			plugindir = g_strdup_printf ("plugins/%s/.libs/", item);
+			if (g_file_test (plugindir, G_FILE_TEST_IS_DIR) != FALSE)
+				caja_sendto_plugin_dir_process (plugindir);
+			g_free (plugindir);
+		}
+		g_dir_close (dir);
+	}
+
+	if (g_list_length (plugin_list) == 0)
+		caja_sendto_plugin_dir_process (PLUGINDIR);
+
+	return g_list_length (plugin_list) != 0;
+}
+
+static char *
+escape_ampersands_and_commas (const char *url)
+{
+	int i;
+	char *str, *ptr;
+
+	/* Count the number of ampersands & commas */
+	i = 0;
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, '&')) != NULL) {
+		i++;
+		ptr++;
+	}
+	ptr = (char *) url;
+	while ((ptr = strchr (ptr, ',')) != NULL) {
+		i++;
+		ptr++;
+	}
+
+	/* No ampersands or commas ? */
+	if (i == 0)
+		return NULL;
+
+	/* Replace the '&' */
+	str = g_malloc0 (strlen (url) - i + 3 * i + 1);
+	ptr = str;
+	for (i = 0; url[i] != '\0'; i++) {
+		if (url[i] == '&') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = '6';
+		} else if (url[i] == ',') {
+			*ptr++ = '%';
+			*ptr++ = '2';
+			*ptr++ = 'C';
+		} else {
+			*ptr++ = url[i];
+		}
+	}
+
+	return str;
+}
+
+static void
+caja_sendto_init (void)
+{
+	int i;
+
+	if (g_module_supported() == FALSE)
+		g_error ("Could not initialize gmodule support");
+
+	for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
+		GFile *file;
+		char *filename, *escaped, *uri;
+
+		file = g_file_new_for_commandline_arg (filenames[i]);
+		filename = g_file_get_path (file);
+		g_object_unref (file);
+		if (filename == NULL)
+			continue;
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
+			has_dirs = TRUE;
+
+		uri = g_filename_to_uri (filename, NULL, NULL);
+		g_free (filename);
+		escaped = escape_ampersands_and_commas (uri);
+
+		if (escaped == NULL) {
+			file_list = g_list_prepend (file_list, uri);
+		} else {
+			file_list = g_list_prepend (file_list, escaped);
+			g_free (uri);
+		}
+	}
+
+	if (file_list == NULL) {
+		g_print (_("Expects URIs or filenames to be passed as options\n"));
+		exit (1);
+	}
+
+	file_list = g_list_reverse (file_list);
+}
+
+int main (int argc, char **argv)
+{
+	GOptionContext *context;
+	GError *error = NULL;
+
+#ifdef ENABLE_NLS
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+
+	context = g_option_context_new ("");
+	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+		g_print (_("Could not parse command-line options: %s\n"), error->message);
+		g_error_free (error);
+		return 1;
+	}
+
+	settings = g_settings_new ("org.mate.Caja.Sendto");
+	caja_sendto_init ();
+	if (caja_sendto_plugin_init () == FALSE) {
+		GtkWidget *error_dialog;
+
+		error_dialog =
+			gtk_message_dialog_new (NULL,
+						GTK_DIALOG_MODAL,
+						GTK_MESSAGE_ERROR,
+						GTK_BUTTONS_OK,
+						_("Could not load any plugins."));
+		gtk_message_dialog_format_secondary_text
+			(GTK_MESSAGE_DIALOG (error_dialog),
+			 _("Please verify your installation"));
+
+		gtk_window_set_title (GTK_WINDOW (error_dialog), ""); /* as per HIG */
+		gtk_container_set_border_width (GTK_CONTAINER (error_dialog), 5);
+		gtk_dialog_set_default_response (GTK_DIALOG (error_dialog),
+						 GTK_RESPONSE_OK);
+		gtk_dialog_run (GTK_DIALOG (error_dialog));
+		return 1;
+	}
+	caja_sendto_create_ui ();
+
+	gtk_main ();
+	g_object_unref(settings);
+
+	return 0;
+}
+
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/4.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/4.html new file mode 100644 index 0000000..2fbdc69 --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/4.html @@ -0,0 +1,947 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
#include <gio/gio.h>
+
+#if defined (__ELF__) && ( __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
+# define SECTION __attribute__ ((section (".gresource.sendto"), aligned (8)))
+#else
+# define SECTION
+#endif
+
+#ifdef _MSC_VER
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = { {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  0107, 0126, 0141, 0162, 0151, 0141, 0156, 0164, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 
+  0030, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0000, 0000, 0000, 0050, 0007, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 
+  0004, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0007, 0000, 0000, 0000, 0113, 0120, 0220, 0013, 
+  0001, 0000, 0000, 0000, 0344, 0000, 0000, 0000, 0004, 0000, 0114, 0000, 0350, 0000, 0000, 0000, 
+  0354, 0000, 0000, 0000, 0324, 0265, 0002, 0000, 0377, 0377, 0377, 0377, 0354, 0000, 0000, 0000, 
+  0001, 0000, 0114, 0000, 0360, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0072, 0001, 0040, 0252, 
+  0003, 0000, 0000, 0000, 0364, 0000, 0000, 0000, 0007, 0000, 0114, 0000, 0374, 0000, 0000, 0000, 
+  0000, 0001, 0000, 0000, 0176, 0157, 0252, 0021, 0005, 0000, 0000, 0000, 0000, 0001, 0000, 0000, 
+  0013, 0000, 0114, 0000, 0014, 0001, 0000, 0000, 0020, 0001, 0000, 0000, 0201, 0321, 0040, 0031, 
+  0000, 0000, 0000, 0000, 0020, 0001, 0000, 0000, 0005, 0000, 0114, 0000, 0030, 0001, 0000, 0000, 
+  0034, 0001, 0000, 0000, 0137, 0144, 0153, 0207, 0004, 0000, 0000, 0000, 0034, 0001, 0000, 0000, 
+  0005, 0000, 0114, 0000, 0044, 0001, 0000, 0000, 0050, 0001, 0000, 0000, 0057, 0342, 0160, 0066, 
+  0002, 0000, 0000, 0000, 0050, 0001, 0000, 0000, 0016, 0000, 0166, 0000, 0070, 0001, 0000, 0000, 
+  0266, 0006, 0000, 0000, 0157, 0162, 0147, 0057, 0004, 0000, 0000, 0000, 0057, 0000, 0000, 0000, 
+  0000, 0000, 0000, 0000, 0163, 0145, 0156, 0144, 0164, 0157, 0057, 0000, 0006, 0000, 0000, 0000, 
+  0145, 0170, 0164, 0145, 0156, 0163, 0151, 0157, 0156, 0163, 0057, 0000, 0002, 0000, 0000, 0000, 
+  0155, 0141, 0164, 0145, 0057, 0000, 0000, 0000, 0005, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 
+  0057, 0000, 0000, 0000, 0003, 0000, 0000, 0000, 0143, 0141, 0152, 0141, 0055, 0163, 0145, 0156, 
+  0144, 0164, 0157, 0056, 0165, 0151, 0000, 0000, 0301, 0074, 0000, 0000, 0001, 0000, 0000, 0000, 
+  0170, 0332, 0355, 0033, 0333, 0162, 0342, 0066, 0364, 0175, 0277, 0302, 0325, 0153, 0007, 0010, 
+  0244, 0323, 0146, 0072, 0300, 0316, 0136, 0232, 0114, 0147, 0372, 0266, 0351, 0263, 0106, 0226, 
+  0117, 0100, 0033, 0041, 0271, 0222, 0014, 0041, 0137, 0137, 0331, 0046, 0004, 0007, 0371, 0042, 
+  0343, 0315, 0102, 0302, 0233, 0021, 0072, 0107, 0072, 0367, 0213, 0244, 0361, 0307, 0207, 0005, 
+  0017, 0226, 0240, 0064, 0223, 0142, 0202, 0206, 0375, 0013, 0024, 0200, 0240, 0062, 0142, 0142, 
+  0066, 0101, 0377, 0336, 0136, 0367, 0256, 0320, 0307, 0351, 0207, 0361, 0057, 0275, 0136, 0160, 
+  0003, 0002, 0024, 0061, 0020, 0005, 0053, 0146, 0346, 0301, 0214, 0223, 0010, 0202, 0313, 0376, 
+  0150, 0324, 0037, 0005, 0275, 0236, 0235, 0304, 0204, 0001, 0165, 0107, 0050, 0114, 0077, 0004, 
+  0301, 0130, 0301, 0177, 0011, 0123, 0240, 0003, 0316, 0302, 0011, 0232, 0231, 0373, 0137, 0321, 
+  0363, 0102, 0051, 0030, 0032, 0144, 0363, 0144, 0370, 0035, 0250, 0011, 0050, 0047, 0132, 0117, 
+  0320, 0215, 0271, 0377, 0173, 0101, 0146, 0200, 0002, 0026, 0115, 0020, 0113, 0077, 0207, 0050, 
+  0235, 0147, 0147, 0306, 0112, 0306, 0240, 0314, 0072, 0020, 0144, 0001, 0023, 0264, 0144, 0232, 
+  0205, 0034, 0320, 0364, 0126, 0045, 0060, 0036, 0074, 0375, 0353, 0236, 0114, 0211, 0300, 0167, 
+  0222, 0046, 0032, 0115, 0257, 0011, 0327, 0265, 0363, 0031, 0225, 0002, 0247, 0237, 0150, 0032, 
+  0131, 0260, 0005, 0010, 0323, 0323, 0040, 0242, 0042, 0334, 0170, 0220, 0357, 0276, 0031, 0041, 
+  0243, 0237, 0114, 0210, 0225, 0101, 0317, 0202, 0123, 0340, 0076, 0124, 0174, 0145, 0204, 0313, 
+  0131, 0116, 0006, 0045, 0337, 0011, 0116, 0331, 0140, 0044, 0216, 0362, 0361, 0156, 0166, 0151, 
+  0230, 0261, 0014, 0010, 0214, 0042, 0102, 0163, 0142, 0210, 0145, 0307, 0004, 0255, 0301, 0202, 
+  0177, 0263, 0253, 0005, 0267, 0262, 0337, 0357, 0167, 0043, 0062, 0307, 0332, 0353, 0030, 0360, 
+  0334, 0052, 0257, 0205, 0313, 0150, 0332, 0003, 0240, 0163, 0306, 0243, 0374, 0073, 0005, 0347, 
+  0126, 0305, 0347, 0222, 0107, 0240, 0006, 0233, 0011, 0203, 0235, 0031, 0371, 0354, 0040, 0063, 
+  0006, 0101, 0170, 0057, 0373, 0151, 0205, 0034, 0312, 0007, 0264, 0305, 0261, 0307, 0345, 0317, 
+  0073, 0377, 0372, 0263, 0323, 0005, 0263, 0040, 0152, 0306, 0004, 0346, 0160, 0147, 0011, 0033, 
+  0216, 0074, 0100, 0024, 0233, 0315, 0175, 0141, 0214, 0214, 0075, 0041, 0102, 0151, 0214, 0134, 
+  0064, 0005, 0222, 0212, 0131, 0171, 0022, 0143, 0275, 0007, 0232, 0132, 0067, 0142, 0030, 0045, 
+  0274, 0011, 0240, 0216, 0011, 0265, 0316, 0254, 0164, 0035, 0267, 0264, 0010, 0115, 0127, 0302, 
+  0104, 0001, 0331, 0021, 0213, 0123, 0160, 0211, 0045, 0103, 0024, 0305, 0327, 0126, 0204, 0056, 
+  0070, 0116, 0326, 0062, 0061, 0130, 0233, 0165, 0352, 0041, 0034, 0352, 0134, 0244, 0244, 0070, 
+  0126, 0276, 0341, 0047, 0173, 0116, 0275, 0001, 0016, 0363, 0241, 0227, 0260, 0256, 0315, 0204, 
+  0300, 0235, 0146, 0212, 0277, 0070, 0034, 0113, 0065, 0262, 0112, 0267, 0327, 0220, 0225, 0276, 
+  0240, 0012, 0050, 0260, 0045, 0150, 0034, 0301, 0035, 0111, 0270, 0361, 0307, 0220, 0171, 0162, 
+  0064, 0315, 0035, 0272, 0017, 0140, 0242, 0001, 0047, 0302, 0072, 0015, 0316, 0104, 0013, 0242, 
+  0011, 0137, 0221, 0265, 0306, 0172, 0056, 0127, 0170, 0263, 0207, 0152, 0024, 0273, 0136, 0275, 
+  0210, 0230, 0320, 0173, 0153, 0021, 0365, 0113, 0302, 0103, 0114, 0104, 0344, 0277, 0325, 0073, 
+  0306, 0271, 0077, 0124, 0054, 0065, 0313, 0315, 0373, 0242, 0212, 0050, 0347, 0356, 0013, 0016, 
+  0370, 0020, 0203, 0110, 0343, 0105, 0027, 0346, 0360, 0255, 0302, 0120, 0337, 0246, 0055, 0014, 
+  0317, 0312, 0354, 0124, 0346, 0141, 0027, 0312, 0354, 0042, 0337, 0115, 0172, 0031, 0331, 0136, 
+  0061, 0047, 0247, 0331, 0013, 0044, 0046, 0121, 0224, 0205, 0331, 0253, 0346, 0020, 0364, 0036, 
+  0247, 0271, 0127, 0165, 0124, 0363, 0365, 0022, 0016, 0246, 0356, 0061, 0164, 0337, 0063, 0324, 
+  0045, 0144, 0255, 0155, 0266, 0253, 0064, 0240, 0161, 0376, 0323, 0042, 0007, 0362, 0161, 0226, 
+  0327, 0052, 0113, 0260, 0137, 0305, 0241, 0125, 0062, 0250, 0324, 0037, 0343, 0007, 0302, 0331, 
+  0254, 0072, 0214, 0070, 0130, 0064, 0047, 0221, 0165, 0106, 0271, 0076, 0012, 0051, 0252, 0327, 
+  0165, 0062, 0313, 0315, 0260, 0117, 0351, 0146, 0322, 0132, 0004, 0271, 0346, 0037, 0300, 0270, 
+  0103, 0231, 0347, 0144, 0240, 0055, 0026, 0360, 0326, 0224, 0207, 0243, 0132, 0370, 0122, 0106, 
+  0270, 0231, 0161, 0243, 0130, 0204, 0312, 0246, 0037, 0310, 0213, 0056, 0370, 0121, 0127, 0340, 
+  0134, 0265, 0101, 0240, 0254, 0136, 0155, 0055, 0260, 0025, 0006, 0052, 0171, 0262, 0020, 0276, 
+  0110, 0052, 0145, 0343, 0226, 0317, 0027, 0271, 0010, 0145, 0352, 0371, 0262, 0144, 0110, 0306, 
+  0251, 0273, 0321, 0230, 0246, 0243, 0341, 0236, 0077, 0354, 0134, 0172, 0135, 0111, 0320, 0205, 
+  0147, 0336, 0064, 0376, 0327, 0347, 0034, 0315, 0362, 0217, 0132, 0063, 0043, 0306, 0020, 0072, 
+  0257, 0114, 0020, 0252, 0261, 0130, 0215, 0334, 0042, 0271, 0150, 0112, 0122, 0355, 0176, 0235, 
+  0251, 0364, 0241, 0172, 0365, 0211, 0332, 0332, 0360, 0237, 0074, 0133, 0336, 0246, 0331, 0106, 
+  0342, 0074, 0201, 0076, 0145, 0265, 0332, 0304, 0032, 0155, 0210, 0062, 0155, 0221, 0124, 0227, 
+  0021, 0001, 0046, 0372, 0317, 0266, 0250, 0075, 0213, 0316, 0112, 0077, 0050, 0140, 0041, 0005, 
+  0243, 0170, 0305, 0242, 0031, 0330, 0160, 0366, 0322, 0075, 0034, 0225, 0125, 0135, 0274, 0057, 
+  0253, 0072, 0233, 0120, 0245, 0011, 0031, 0054, 0137, 0337, 0204, 0116, 0111, 0323, 0207, 0307, 
+  0255, 0351, 0333, 0224, 0144, 0156, 0375, 0214, 0165, 0070, 0266, 0022, 0242, 0106, 0157, 0074, 
+  0221, 0076, 0145, 0355, 0367, 0252, 0353, 0374, 0131, 0131, 0162, 0140, 0321, 0132, 0170, 0247, 
+  0225, 0025, 0275, 0232, 0126, 0127, 0063, 0245, 0002, 0270, 0034, 0260, 0024, 0150, 0163, 0142, 
+  0221, 0126, 0252, 0117, 0176, 0257, 0131, 0045, 0132, 0025, 0051, 0216, 0253, 0012, 0055, 0165, 
+  0346, 0137, 0101, 0033, 0046, 0062, 0153, 0251, 0105, 0152, 0225, 0100, 0261, 0060, 0061, 0240, 
+  0113, 0245, 0266, 0235, 0262, 0131, 0170, 0005, 0331, 0311, 0127, 0260, 0044, 0074, 0261, 0077, 
+  0103, 0153, 0062, 0150, 0120, 0046, 0323, 0152, 0374, 0336, 0202, 0355, 0256, 0303, 0351, 0335, 
+  0066, 0071, 0261, 0176, 0375, 0271, 0005, 0165, 0156, 0101, 0265, 0157, 0101, 0175, 0256, 0354, 
+  0143, 0274, 0315, 0016, 0124, 0353, 0044, 0243, 0264, 0221, 0374, 0343, 0072, 0120, 0163, 0240, 
+  0205, 0023, 0271, 0354, 0230, 0200, 0246, 0243, 0245, 0307, 0162, 0207, 0324, 0326, 0051, 0172, 
+  0110, 0317, 0377, 0133, 0327, 0007, 0135, 0247, 0223, 0207, 0240, 0331, 0077, 0322, 0373, 0371, 
+  0245, 0131, 0207, 0055, 0210, 0110, 0221, 0025, 0146, 0042, 0262, 0352, 0153, 0244, 0072, 0216, 
+  0132, 0254, 0161, 0324, 0075, 0074, 0002, 0037, 0034, 0215, 0217, 0245, 0224, 0073, 0341, 0172, 
+  0315, 0317, 0003, 0172, 0024, 0151, 0173, 0214, 0372, 0113, 0030, 0265, 0336, 0361, 0201, 0220, 
+  0375, 0256, 0303, 0323, 0021, 0373, 0072, 0364, 0121, 0035, 0165, 0343, 0233, 0132, 0161, 0163, 
+  0113, 0356, 0314, 0232, 0273, 0261, 0350, 0116, 0254, 0272, 0241, 0145, 0067, 0254, 0365, 0333, 
+  0053, 0357, 0323, 0101, 0322, 0055, 0074, 0230, 0335, 0070, 0336, 0354, 0044, 0351, 0265, 0324, 
+  0370, 0140, 0051, 0247, 0327, 0004, 0227, 0200, 0323, 0103, 0315, 0337, 0274, 0360, 0060, 0003, 
+  0013, 0135, 0077, 0157, 0063, 0163, 0332, 0377, 0343, 0161, 0074, 0310, 0276, 0232, 0203, 0330, 
+  0230, 0335, 0017, 0037, 0107, 0255, 0340, 0146, 0355, 0226, 0173, 0360, 0007, 0173, 0144, 0161, 
+  0123, 0230, 0174, 0236, 0076, 0073, 0211, 0066, 0167, 0215, 0176, 0234, 0223, 0170, 0107, 0251, 
+  0325, 0271, 0237, 0370, 0306, 0372, 0211, 0066, 0114, 0305, 0012, 0264, 0076, 0367, 0023, 0217, 
+  0251, 0237, 0170, 0272, 0127, 0046, 0175, 0156, 0002, 0326, 0322, 0333, 0345, 0115, 0306, 0374, 
+  0326, 0205, 0041, 0046, 0321, 0070, 0254, 0275, 0331, 0250, 0101, 0244, 0173, 0133, 0202, 0047, 
+  0023, 0032, 0137, 0156, 0154, 0330, 0351, 0335, 0171, 0100, 0265, 0331, 0373, 0346, 0262, 0360, 
+  0161, 0366, 0176, 0033, 0267, 0113, 0252, 0136, 0056, 0145, 0057, 0220, 0172, 0240, 0224, 0124, 
+  0257, 0161, 0035, 0372, 0255, 0037, 0026, 0354, 0136, 0072, 0312, 0125, 0250, 0054, 0304, 0235, 
+  0266, 0012, 0225, 0307, 0270, 0354, 0237, 0067, 0251, 0112, 0357, 0055, 0116, 0134, 0266, 0215, 
+  0023, 0105, 0032, 0213, 0257, 0025, 0363, 0227, 0156, 0275, 0315, 0125, 0212, 0055, 0104, 0141, 
+  0070, 0260, 0071, 0122, 0054, 0205, 0266, 0273, 0351, 0375, 0216, 0246, 0205, 0127, 0143, 0066, 
+  0161, 0331, 0235, 0132, 0217, 0340, 0322, 0152, 0367, 0363, 0053, 0033, 0047, 0370, 0213, 0101, 
+  0135, 0174, 0244, 0152, 0353, 0300, 0347, 0207, 0306, 0377, 0003, 0111, 0326, 0104, 0031, 0000, 
+  0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1719]; const double alignment; void * const ptr;}  sendto_resource_data = {<--- union member 'Anonymous0::alignment' is never used.<--- union member 'Anonymous0::ptr' is never used.
+  "\107\126\141\162\151\141\156\164\000\000\000\000\000\000\000\000"
+  "\030\000\000\000\344\000\000\000\000\000\000\050\007\000\000\000"
+  "\000\000\000\000\000\000\000\000\001\000\000\000\003\000\000\000"
+  "\004\000\000\000\007\000\000\000\007\000\000\000\113\120\220\013"
+  "\001\000\000\000\344\000\000\000\004\000\114\000\350\000\000\000"
+  "\354\000\000\000\324\265\002\000\377\377\377\377\354\000\000\000"
+  "\001\000\114\000\360\000\000\000\364\000\000\000\072\001\040\252"
+  "\003\000\000\000\364\000\000\000\007\000\114\000\374\000\000\000"
+  "\000\001\000\000\176\157\252\021\005\000\000\000\000\001\000\000"
+  "\013\000\114\000\014\001\000\000\020\001\000\000\201\321\040\031"
+  "\000\000\000\000\020\001\000\000\005\000\114\000\030\001\000\000"
+  "\034\001\000\000\137\144\153\207\004\000\000\000\034\001\000\000"
+  "\005\000\114\000\044\001\000\000\050\001\000\000\057\342\160\066"
+  "\002\000\000\000\050\001\000\000\016\000\166\000\070\001\000\000"
+  "\266\006\000\000\157\162\147\057\004\000\000\000\057\000\000\000"
+  "\000\000\000\000\163\145\156\144\164\157\057\000\006\000\000\000"
+  "\145\170\164\145\156\163\151\157\156\163\057\000\002\000\000\000"
+  "\155\141\164\145\057\000\000\000\005\000\000\000\143\141\152\141"
+  "\057\000\000\000\003\000\000\000\143\141\152\141\055\163\145\156"
+  "\144\164\157\056\165\151\000\000\301\074\000\000\001\000\000\000"
+  "\170\332\355\033\333\162\342\066\364\175\277\302\325\153\007\010"
+  "\244\323\146\072\300\316\136\232\114\147\372\266\351\263\106\226"
+  "\117\100\033\041\271\222\014\041\137\137\331\046\004\007\371\042"
+  "\343\315\102\302\233\021\072\107\072\367\213\244\361\307\207\005"
+  "\017\226\240\064\223\142\202\206\375\013\024\200\240\062\142\142"
+  "\066\101\377\336\136\367\256\320\307\351\207\361\057\275\136\160"
+  "\003\002\024\061\020\005\053\146\346\301\214\223\010\202\313\376"
+  "\150\324\037\005\275\236\235\304\204\001\165\107\050\114\077\004"
+  "\301\130\301\177\011\123\240\003\316\302\011\232\231\373\137\321"
+  "\363\102\051\030\032\144\363\144\370\035\250\011\050\047\132\117"
+  "\320\215\271\377\173\101\146\200\002\026\115\020\113\077\207\050"
+  "\235\147\147\306\112\306\240\314\072\020\144\001\023\264\144\232"
+  "\205\034\320\364\126\045\060\036\074\375\353\236\114\211\300\167"
+  "\222\046\032\115\257\011\327\265\363\031\225\002\247\237\150\032"
+  "\131\260\005\010\323\323\040\242\042\334\170\220\357\276\031\041"
+  "\243\237\114\210\225\101\317\202\123\340\076\124\174\145\204\313"
+  "\131\116\006\045\337\011\116\331\140\044\216\362\361\156\166\151"
+  "\230\261\014\010\214\042\102\163\142\210\145\307\004\255\301\202"
+  "\177\263\253\005\267\262\337\357\167\043\062\307\332\353\030\360"
+  "\334\052\257\205\313\150\332\003\240\163\306\243\374\073\005\347"
+  "\126\305\347\222\107\240\006\233\011\203\235\031\371\354\040\063"
+  "\006\101\170\057\373\151\205\034\312\007\264\305\261\307\345\317"
+  "\073\377\372\263\323\005\263\040\152\306\004\346\160\147\011\033"
+  "\216\074\100\024\233\315\175\141\214\214\075\041\102\151\214\134"
+  "\064\005\222\212\131\171\022\143\275\007\232\132\067\142\030\045"
+  "\274\011\240\216\011\265\316\254\164\035\267\264\010\115\127\302"
+  "\104\001\331\021\213\123\160\211\045\103\024\305\327\126\204\056"
+  "\070\116\326\062\061\130\233\165\352\041\034\352\134\244\244\070"
+  "\126\276\341\047\173\116\275\001\016\363\241\227\260\256\315\204"
+  "\300\235\146\212\277\070\034\113\065\262\112\267\327\220\225\276"
+  "\240\012\050\260\045\150\034\301\035\111\270\361\307\220\171\162"
+  "\064\315\035\272\017\140\242\001\047\302\072\015\316\104\013\242"
+  "\011\137\221\265\306\172\056\127\170\263\207\152\024\273\136\275"
+  "\210\230\320\173\153\021\365\113\302\103\114\104\344\277\325\073"
+  "\306\271\077\124\054\065\313\315\373\242\212\050\347\356\013\016"
+  "\370\020\203\110\343\105\027\346\360\255\302\120\337\246\055\014"
+  "\317\312\354\124\346\141\027\312\354\042\337\115\172\031\331\136"
+  "\061\047\247\331\013\044\046\121\224\205\331\253\346\020\364\036"
+  "\247\271\127\165\124\363\365\022\016\246\356\061\164\337\063\324"
+  "\045\144\255\155\266\253\064\240\161\376\323\042\007\362\161\226"
+  "\327\052\113\260\137\305\241\125\062\250\324\037\343\007\302\331"
+  "\254\072\214\070\130\064\047\221\165\106\271\076\012\051\252\327"
+  "\165\062\313\315\260\117\351\146\322\132\004\271\346\037\300\270"
+  "\103\231\347\144\240\055\026\360\326\224\207\243\132\370\122\106"
+  "\270\231\161\243\130\204\312\246\037\310\213\056\370\121\127\340"
+  "\134\265\101\240\254\136\155\055\260\025\006\052\171\262\020\276"
+  "\110\052\145\343\226\317\027\271\010\145\352\371\262\144\110\306"
+  "\251\273\321\230\246\243\341\236\077\354\134\172\135\111\320\205"
+  "\147\336\064\376\327\347\034\315\362\217\132\063\043\306\020\072"
+  "\257\114\020\252\261\130\215\334\042\271\150\112\122\355\176\235"
+  "\251\364\241\172\365\211\332\332\360\237\074\133\336\246\331\106"
+  "\342\074\201\076\145\265\332\304\032\155\210\062\155\221\124\227"
+  "\021\001\046\372\317\266\250\075\213\316\112\077\050\140\041\005"
+  "\243\170\305\242\031\330\160\366\322\075\034\225\125\135\274\057"
+  "\253\072\233\120\245\011\031\054\137\337\204\116\111\323\207\307"
+  "\255\351\333\224\144\156\375\214\165\070\266\022\242\106\157\074"
+  "\221\076\145\355\367\252\353\374\131\131\162\140\321\132\170\247"
+  "\225\025\275\232\126\127\063\245\002\270\034\260\024\150\163\142"
+  "\221\126\252\117\176\257\131\045\132\025\051\216\253\012\055\165"
+  "\346\137\101\033\046\062\153\251\105\152\225\100\261\060\061\240"
+  "\113\245\266\235\262\131\170\005\331\311\127\260\044\074\261\077"
+  "\103\153\062\150\120\046\323\152\374\336\202\355\256\303\351\335"
+  "\066\071\261\176\375\271\005\165\156\101\265\157\101\175\256\354"
+  "\143\274\315\016\124\353\044\243\264\221\374\343\072\120\163\240"
+  "\205\023\271\354\230\200\246\243\245\307\162\207\324\326\051\172"
+  "\110\317\377\133\327\007\135\247\223\207\240\331\077\322\373\371"
+  "\245\131\207\055\210\110\221\025\146\042\262\352\153\244\072\216"
+  "\132\254\161\324\075\074\002\037\034\215\217\245\224\073\341\172"
+  "\315\317\003\172\024\151\173\214\372\113\030\265\336\361\201\220"
+  "\375\256\303\323\021\373\072\364\121\035\165\343\233\132\161\163"
+  "\113\356\314\232\273\261\350\116\254\272\241\145\067\254\365\333"
+  "\053\357\323\101\322\055\074\230\335\070\336\354\044\351\265\324"
+  "\370\140\051\247\327\004\227\200\323\103\315\337\274\360\060\003"
+  "\013\135\077\157\063\163\332\377\343\161\074\310\276\232\203\330"
+  "\230\335\017\037\107\255\340\146\355\226\173\360\007\173\144\161"
+  "\123\230\174\236\076\073\211\066\167\215\176\234\223\170\107\251"
+  "\325\271\237\370\306\372\211\066\114\305\012\264\076\367\023\217"
+  "\251\237\170\272\127\046\175\156\002\326\322\333\345\115\306\374"
+  "\326\205\041\046\321\070\254\275\331\250\101\244\173\133\202\047"
+  "\023\032\137\156\154\330\351\335\171\100\265\331\373\346\262\360"
+  "\161\366\176\033\267\113\252\136\056\145\057\220\172\240\224\124"
+  "\257\161\035\372\255\037\026\354\136\072\312\125\250\054\304\235"
+  "\266\012\225\307\270\354\237\067\251\112\357\055\116\134\266\215"
+  "\023\105\032\213\257\025\363\227\156\275\315\125\212\055\104\141"
+  "\070\260\071\122\054\205\266\273\351\375\216\246\205\127\143\066"
+  "\161\331\235\132\217\340\322\152\367\363\053\033\047\370\213\101"
+  "\135\174\244\152\353\300\347\207\306\377\003\111\326\104\031\000"
+  "\050\165\165\141\171\051" };
+#endif /* !_MSC_VER */
+
+static GStaticResource static_resource = { sendto_resource_data.data, sizeof (sendto_resource_data.data) - 1 /* nul terminator */, NULL, NULL, NULL };
+
+G_MODULE_EXPORT
+GResource *sendto_get_resource (void);
+GResource *sendto_get_resource (void)
+{
+  return g_static_resource_get_resource (&static_resource);
+}
+/*
+  If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
+  destructors, in a usable way, including e.g. on library unload. If not you're on
+  your own.
+
+  Some compilers need #pragma to handle this, which does not work with macros,
+  so the way you need to use this is (for constructors):
+
+  #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+  #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
+  #endif
+  G_DEFINE_CONSTRUCTOR(my_constructor)
+  static void my_constructor(void) {
+   ...
+  }
+
+*/
+
+#ifndef __GTK_DOC_IGNORE__
+
+#if  __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
+#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
+
+#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
+/* Visual studio 2008 and later has _Pragma */
+
+#include <stdlib.h>
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* We do some weird things to avoid the constructors being optimized
+ * away on VS2015 if WholeProgramOptimization is enabled. First we
+ * make a reference to the array from the wrapper to make sure its
+ * references. Then we use a pragma to make sure the wrapper function
+ * symbol is always included at the link stage. Also, the symbols
+ * need to be extern (but not dllexport), even though they are not
+ * really used from another object file.
+ */
+
+/* We need to account for differences between the mangling of symbols
+ * for x86 and x64/ARM/ARM64 programs, as symbols on x86 are prefixed
+ * with an underscore but symbols on x64/ARM/ARM64 are not.
+ */
+#ifdef _M_IX86
+#define G_MSVC_SYMBOL_PREFIX "_"
+#else
+#define G_MSVC_SYMBOL_PREFIX ""
+#endif
+
+#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
+#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
+
+#define G_MSVC_CTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _wrapper(void) { _func(); g_slist_find (NULL,  _array ## _func); return 0; } \
+  __pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
+
+#define G_MSVC_DTOR(_func,_sym_prefix) \
+  static void _func(void); \
+  extern int (* _array ## _func)(void);              \
+  int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL,  _array ## _func); return 0; } \
+   __pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
+  __pragma(section(".CRT$XCU",read)) \
+  __declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined (_MSC_VER)
+
+#define G_HAS_CONSTRUCTORS 1
+
+/* Pre Visual studio 2008 must use #pragma section */
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _wrapper(void) { _func(); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  section(".CRT$XCU",read)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void); \
+  static int _func ## _constructor(void) { atexit (_func); return 0; } \
+  __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
+
+#elif defined(__SUNPRO_C)
+
+/* This is not tested, but i believe it should work, based on:
+ * http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
+ */
+
+#define G_HAS_CONSTRUCTORS 1
+
+#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
+#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
+
+#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
+  init(_func)
+#define G_DEFINE_CONSTRUCTOR(_func) \
+  static void _func(void);
+
+#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
+  fini(_func)
+#define G_DEFINE_DESTRUCTOR(_func) \
+  static void _func(void);
+
+#else
+
+/* constructors not supported for this compiler */
+
+#endif
+
+#endif /* __GTK_DOC_IGNORE__ */
+
+#ifdef G_HAS_CONSTRUCTORS
+
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(resource_constructor)
+#endif
+G_DEFINE_CONSTRUCTOR(resource_constructor)
+#ifdef G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(resource_destructor)
+#endif
+G_DEFINE_DESTRUCTOR(resource_destructor)
+
+#else
+#warning "Constructor not supported on this compiler, linking in resources will not work"
+#endif
+
+static void resource_constructor (void)
+{
+  g_static_resource_init (&static_resource);
+}
+
+static void resource_destructor (void)
+{
+  g_static_resource_fini (&static_resource);
+}
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/5.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/5.html new file mode 100644 index 0000000..651580d --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/5.html @@ -0,0 +1,587 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Jader Henrique da Silva
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Jader Henrique da Silva <vovozito@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include "nst-common.h"
+#include "caja-sendto-plugin.h"
+
+enum {
+	COL_PIXBUF,
+	COL_LABEL,
+	NUM_COLS,
+};
+
+#define COMBOBOX_OPTION_NEW_DVD 0
+#define COMBOBOX_OPTION_EXISTING_DVD 1
+
+static GFile *burn = NULL;
+
+static
+gboolean init (NstPlugin *plugin)
+{
+	GtkIconTheme *it;
+	char *cmd;
+
+	g_print ("Init caja burn plugin\n");
+
+	it = gtk_icon_theme_get_default ();
+	gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons");
+
+	cmd = g_find_program_in_path ("brasero");
+	if (cmd == NULL)
+		return FALSE;
+	g_free (cmd);
+
+	burn = g_file_new_for_uri ("burn:/");
+
+	return TRUE;
+}
+
+static
+GtkWidget* get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *widget;
+	GtkCellRenderer *renderer;
+	GtkListStore *store;
+	GtkTreeModel *model;
+	GFileEnumerator *fenum;
+	GFileInfo *file_info = NULL;
+	int selection = COMBOBOX_OPTION_NEW_DVD;
+
+	fenum = g_file_enumerate_children (burn,
+					   G_FILE_ATTRIBUTE_STANDARD_NAME,
+					   G_FILE_QUERY_INFO_NONE,
+					   NULL,
+					   NULL);
+
+	if (fenum != NULL) {
+		file_info = g_file_enumerator_next_file (fenum, NULL, NULL);
+		g_object_unref (fenum);
+	}
+
+	store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, G_TYPE_STRING);
+
+	gtk_list_store_insert_with_values (store, NULL,
+					   INT_MAX,
+					   COL_PIXBUF, "media-optical-blank",
+					   COL_LABEL, _("New CD/DVD"),
+					   -1);
+
+	if (file_info != NULL) {
+		gtk_list_store_insert_with_values (store, NULL,
+						   INT_MAX,
+						   COL_PIXBUF, "media-optical-data-new",
+						   COL_LABEL, _("Existing CD/DVD"),
+						   -1);
+		g_object_unref (file_info);
+		selection = COMBOBOX_OPTION_EXISTING_DVD;
+	}
+
+	model = GTK_TREE_MODEL (store);
+	widget = gtk_combo_box_new_with_model (model);
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"icon-name", COL_PIXBUF,
+					NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget),
+					renderer,
+					"text", COL_LABEL,
+					NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), selection);
+
+	return widget;
+}
+
+static
+gboolean send_files (NstPlugin *plugin,
+		     GtkWidget *burntype_widget,
+		     GList *file_list)
+{
+	GFileEnumerator *fenum;
+	GFileInfo *file_info;
+	GFile *child;
+
+	if (gtk_combo_box_get_active (GTK_COMBO_BOX (burntype_widget)) == COMBOBOX_OPTION_NEW_DVD) {
+		fenum = g_file_enumerate_children (burn,
+						   G_FILE_ATTRIBUTE_STANDARD_NAME,
+						   G_FILE_QUERY_INFO_NONE,
+						   NULL,
+						   NULL);
+
+		if (fenum != NULL) {
+			while ((file_info = g_file_enumerator_next_file (fenum, NULL, NULL)) != NULL) {
+				child = g_file_get_child (burn,
+							  g_file_info_get_name(file_info));
+
+				g_object_unref (file_info);
+				g_file_delete (child, NULL, NULL);
+				g_object_unref (child);
+			}
+			g_object_unref (fenum);
+		}
+	}
+
+	copy_files_to (file_list, burn);
+
+	gtk_show_uri_on_window (NULL, "burn:///", GDK_CURRENT_TIME, NULL);
+
+	return TRUE;
+}
+
+static
+gboolean destroy (NstPlugin *plugin)
+{
+	g_object_unref (burn);
+	burn = NULL;
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"brasero",
+	"caja-burn",
+	N_("CD/DVD Creator"),
+	NULL,
+	CAJA_CAPS_SEND_DIRECTORIES,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/6.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/6.html new file mode 100644 index 0000000..b41892e --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/6.html @@ -0,0 +1,1293 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/*
+ * gajim.c
+ *       gajim plugin for caja-sendto
+ *
+ * Copyright (C) 2006 Dimitur Kirov
+ *               2006 Roberto Majadas <telemaco@openshine.com>
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/org/gajim/dbus/RemoteObject"
+#define INTERFACE "org.gajim.dbus.RemoteInterface"
+#define SERVICE "org.gajim.dbus"
+
+const gchar *COMPLETION_PROPS[] = {"name", "jid"};
+/* list of contacts, which are not offline */
+static GHashTable *jid_table = NULL;
+static gchar *iconset;
+
+DBusGProxy *proxy = NULL;
+
+/*
+ * contact cb, gets property from contact dict
+ * and put online contacts to jid_table
+ */
+static void
+_foreach_contact(gpointer contact, gpointer user_data)
+{
+	const gchar *show;
+
+	GValue *value;
+	GHashTable *contact_table;
+
+	/* holds contact props of already exisiting jid/nick */
+	GHashTable *existing_contact;
+
+	/* name of the contact in completion list
+	   it may be jid, nick, jid (account), or nick(account) */
+	GString *contact_str;
+
+	gchar *jid;
+	gchar *account;
+	gint i;
+
+	if (contact == NULL) {
+		g_warning("Null contact in the list");
+		return;
+	}
+	contact_table = (GHashTable *) contact;
+	account = (gchar *) user_data;
+
+	value = g_hash_table_lookup(contact_table, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+		g_warning("String expected (contact - show)");
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	show = g_value_get_string ((GValue *)value);
+	if(g_str_equal(show, "offline") || g_str_equal(show, "error")) {
+		g_hash_table_destroy(contact_table);
+		return;
+	}
+	/* remove unneeded item with key resource and add account
+	   to contact properties */
+	g_hash_table_insert(contact_table, "account", account);
+	g_hash_table_remove(contact_table, "resource");
+
+	/* add nick the same way as jid */
+	for(i=0;i<2;i++) {
+		value = g_hash_table_lookup(contact_table, COMPLETION_PROPS[i]);
+		if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+			g_warning("String expected (contact - name)");
+			return;
+		}
+		jid = g_value_dup_string((GValue *)value);
+		existing_contact = g_hash_table_lookup(jid_table, jid);
+		if(existing_contact) {
+			/* add existing contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(existing_contact, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													existing_contact);
+			g_string_free(contact_str, FALSE);
+
+			/* add current contact as nick (account) */
+			contact_str = g_string_new(jid);
+			g_string_append(contact_str, " (");
+			g_string_append(contact_str,
+				g_hash_table_lookup(contact_table, "account"));
+			g_string_append(contact_str, ")");
+			g_hash_table_insert(jid_table, contact_str->str,
+													contact_table);
+			g_string_free(contact_str, FALSE);
+		}
+		else {
+			g_hash_table_insert(jid_table, jid, contact_table);
+		}
+	}
+
+}
+
+/*
+ * connect to session bus, onsuccess return TRUE
+ */
+static gboolean
+init_dbus (void)
+{
+	DBusGConnection *connection;
+	GError *error;
+	gchar **accounts;
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Gajim] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+	proxy = dbus_g_proxy_new_for_name(connection,
+									 SERVICE,
+									 OBJ_PATH,
+									 INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL){
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+				G_TYPE_STRV, &accounts, G_TYPE_INVALID))
+	{
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_strfreev(accounts);
+	return TRUE;
+}
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+_handle_dbus_exception (GError *error, gboolean empty_list_messages)
+{
+	if (error == NULL) {
+		g_warning("[Gajim] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Gajim] caught remote method exception %s: %s",
+			dbus_g_error_get_name (error),
+			error->message);
+	}
+	else if(empty_list_messages) {
+		/* empty list and error goes here */
+		g_warning ("[Gajim] empty result set: %d %d %s\n", error->domain,
+			   error->code, error->message);
+	}
+	g_error_free (error);
+}
+
+/*
+ * query object, about the contact list for each account
+ * and fill all available contacts in the contacts table
+ */
+static gboolean
+_get_contacts (void)
+{
+	GError *error;
+	GSList *contacts_list;
+	GHashTable *prefs_map;
+	gchar **accounts;
+	gchar **account_iter;
+	gchar *account;
+
+	error = NULL;
+
+	if (proxy == NULL) {
+		g_warning("[Gajim] unable to connect to session bus");
+		return FALSE;
+	}
+	/* get gajim prefs and lookup for iconset */
+	if (!dbus_g_proxy_call(proxy, "prefs_list", &error, G_TYPE_INVALID,
+			dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING),
+			&prefs_map, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	gpointer iconset_ptr = g_hash_table_lookup(prefs_map, "iconset");
+	if (iconset_ptr != NULL) {
+		iconset = g_strdup((gchar *)iconset_ptr);
+	} else {
+		g_warning("[Gajim] unable to get prefs value for iconset");
+		return FALSE;
+	}
+	g_hash_table_destroy(prefs_map);
+	/* END get gajim prefs */
+	error= NULL;
+	if (!dbus_g_proxy_call (proxy, "list_accounts", &error, G_TYPE_INVALID,
+			G_TYPE_STRV,
+			&accounts, G_TYPE_INVALID))
+	{
+		_handle_dbus_exception(error, TRUE);
+		return FALSE;
+	}
+	for(account_iter = accounts; *account_iter ; account_iter++) {
+		account = g_strdup(*account_iter);
+		error = NULL;
+		/* query gajim remote object and put results in 'contacts_list' */
+		if (!dbus_g_proxy_call (proxy, "list_contacts", &error,
+				G_TYPE_STRING, account, /* call arguments */
+				G_TYPE_INVALID, /* delimiter */
+				/* return value is collection of maps */
+				dbus_g_type_get_collection ("GSList",
+					dbus_g_type_get_map ("GHashTable",
+						G_TYPE_STRING, G_TYPE_VALUE)),
+				&contacts_list, G_TYPE_INVALID))
+		{
+			_handle_dbus_exception(error, FALSE);
+			error = NULL;
+			continue;
+		}
+		g_slist_foreach (contacts_list, _foreach_contact, account);
+		g_slist_free(contacts_list);
+	}
+	g_strfreev (accounts);
+	return TRUE;
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	g_print ("Init gajim plugin\n");
+
+	/* connect to gajim dbus service */
+	jid_table = g_hash_table_new (g_str_hash, g_str_equal);
+	if (!init_dbus()) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+
+static void
+_set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf)
+{
+	GString *pixbuf_path;
+	GError *error;
+
+	pixbuf_path = g_string_new(GAJIM_SHARE_DIR);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "data");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "iconsets");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, iconset);
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, "16x16");
+	g_string_append_c(pixbuf_path, '/');
+	g_string_append(pixbuf_path, show);
+	g_string_append(pixbuf_path, ".png");
+	if(g_file_test(pixbuf_path->str, G_FILE_TEST_EXISTS) &&
+		g_file_test(pixbuf_path->str, G_FILE_TEST_IS_REGULAR)) {
+		error = NULL;
+		*pixbuf = gdk_pixbuf_new_from_file(pixbuf_path->str, &error);
+		if(error != NULL) {
+			g_error_free(error);
+		}
+	}
+	g_string_free(pixbuf_path, FALSE);
+}
+
+static void
+_add_contact_to_model(gpointer key, gpointer value, gpointer user_data)
+{
+	GtkTreeIter *iter;
+	GtkListStore *store;
+	GdkPixbuf *pixbuf;
+	GValue *val;
+	GHashTable *contact_props;
+	const gchar *show;
+
+	contact_props = (GHashTable *) value;
+	pixbuf = NULL;
+	val = g_hash_table_lookup(contact_props, "show");
+	if (value == NULL || !G_VALUE_HOLDS_STRING(val)) {
+		g_warning("String expected (contact - show)");
+		pixbuf = NULL;
+	} else {
+		show = g_value_get_string ((GValue *)val);
+		_set_pixbuf_from_status(show, &pixbuf);
+	}
+
+	store = (GtkListStore *) user_data;
+	iter = g_malloc (sizeof(GtkTreeIter));
+	gtk_list_store_append (store, iter);
+	gtk_list_store_set (store, iter, 0, pixbuf, 1, key, -1);
+	g_free (iter);
+}
+
+/*
+ * put gajim contacts to jid_list
+ * filtering only these which are connected
+ */
+static gboolean
+add_gajim_contacts_to_model (GtkListStore *store)
+{
+	if(!_get_contacts()) {
+		return FALSE;
+	}
+	if(g_hash_table_size(jid_table) == 0) {
+		return FALSE;
+	}
+	g_hash_table_foreach(jid_table, _add_contact_to_model, store);
+	return TRUE;
+}
+
+/*
+ * fill completion model for the entry, using list of
+ * available gajim contacts
+ */
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *entry;
+	GtkEntryCompletion *completion;
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeModel *completion_model;
+
+	entry = gtk_entry_new ();
+	completion = gtk_entry_completion_new ();
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion),
+					renderer,
+					FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer,
+					"pixbuf", 0, NULL);
+
+
+	store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	if(!add_gajim_contacts_to_model (store)) {
+		gtk_widget_set_sensitive(entry, FALSE);
+	}
+	completion_model = GTK_TREE_MODEL (store);
+	gtk_entry_completion_set_model (completion, completion_model);
+	gtk_entry_set_completion (GTK_ENTRY (entry), completion);
+	gtk_entry_completion_set_text_column (completion, 1);
+	g_object_unref (completion_model);
+	g_object_unref (completion);
+	return entry;
+}
+
+static void
+show_error (const gchar *title, const gchar *message)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new_with_markup(NULL,
+								GTK_DIALOG_DESTROY_WITH_PARENT,
+								GTK_MESSAGE_ERROR,
+								GTK_BUTTONS_CLOSE, NULL);
+
+	gchar *msg = g_markup_printf_escaped("<b>%s</b>\n\n%s", title, message);
+	gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), msg);
+	g_free (msg);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
+static gboolean
+send_files (NstPlugin *plugin,
+	    GtkWidget *contact_widget,
+	    GList *file_list)
+{
+	GError *error;
+	GValue *value;
+	GList *file_iter;
+	GHashTable *contact_props;
+
+	gchar *send_to;
+	gchar *jid;
+	gchar *account;
+	gchar *file_path;
+
+	if(proxy == NULL) {
+		show_error(_("Unable to send file"),
+			   _("There is no connection to gajim remote service."));
+		return FALSE;
+	}
+	send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
+	g_debug("[Gajim] sending to: %s", send_to);
+	if (strlen (send_to) != 0){
+		contact_props = g_hash_table_lookup (jid_table, send_to);
+		if(contact_props == NULL) {
+			jid = send_to;
+			account = NULL;
+		}
+		else {
+			value = g_hash_table_lookup(contact_props, "jid");
+			if(value == NULL || !G_VALUE_HOLDS_STRING(value)) {
+				g_warning("[Gajim] string expected (contact - jid)");
+				return FALSE;
+			}
+
+			jid = g_value_dup_string((GValue *)value);
+			account = g_hash_table_lookup(contact_props, "account");
+		}
+	}
+	else {
+		g_warning("[Gajim] missing recipient");
+		show_error(_("Sending file failed"),
+						_("Recipient is missing."));
+		return FALSE;
+	}
+
+	error= NULL;
+	for(file_iter = file_list; file_iter != NULL; file_iter = file_iter->next) {
+		char *uri = file_iter->data;
+
+		g_debug("[Gajim] file: %s", uri);
+		error= NULL;
+		file_path = g_filename_from_uri(uri, NULL, &error);
+		if(error != NULL) {
+			g_warning("%d Unable to convert URI `%s' to absolute file path",
+				error->code, uri);
+			g_error_free(error);
+			continue;
+		}
+
+		g_debug("[Gajim] file: %s", file_path);
+		if(account) {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_STRING, account,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		} else {
+			dbus_g_proxy_call (proxy, "send_file", &error,
+					   G_TYPE_STRING, file_path,
+					   G_TYPE_STRING, jid,
+					   G_TYPE_INVALID,
+					   G_TYPE_INVALID);
+		}
+		g_free(file_path);
+		if(error != NULL)
+		{
+			if(error->domain != DBUS_GERROR || error->code != DBUS_GERROR_INVALID_ARGS) {
+				g_warning("[Gajim] sending file %s to %s failed:", uri, send_to);
+				g_error_free(error);
+				show_error(_("Sending file failed"), _("Unknown recipient."));
+				return FALSE;
+			}
+			g_error_free(error);
+		}
+	}
+	return TRUE;
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	if (proxy != NULL) {
+		g_object_unref(proxy);
+	}
+	g_hash_table_destroy(jid_table);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im-jabber",
+	"gajim",
+	N_("Instant Message (Gajim)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/7.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/7.html new file mode 100644 index 0000000..e72e241 --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/7.html @@ -0,0 +1,1145 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * pidgin.c
+ *       pidgin plugin for caja-sendto
+ *
+ * Copyright (C) 2004 Roberto Majadas
+ * Copyright (C) 2009 Pascal Terjan
+ *
+ * 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 av.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301  USA.
+ *
+ * Author:  Roberto Majadas <roberto.majadas@openshine.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include "caja-sendto-plugin.h"
+
+#define OBJ_PATH "/im/pidgin/purple/PurpleObject"
+#define INTERFACE "im.pidgin.purple.PurpleInterface"
+#define SERVICE "im.pidgin.purple.PurpleService"
+
+static DBusGProxy *proxy = NULL;
+static GHashTable *contact_hash = NULL;
+
+typedef struct _ContactData {
+	int  account;
+	int  id;
+	char *name;
+	char *alias;
+} ContactData;
+
+enum {
+	COL_ICON,
+	COL_ALIAS,
+	NUM_COLS
+};
+
+/*
+ * Print appropriate warnings when dbus raised error
+ * on queries
+ */
+static void
+handle_dbus_exception(GError *error)
+{
+	if (error == NULL) {
+		g_warning("[Pidgin] unable to parse result");
+		return;
+	}
+	else if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+		g_warning ("[Pidgin] caught remote method exception %s: %s",
+			   dbus_g_error_get_name (error),
+			   error->message);
+	}
+	g_error_free (error);
+}
+
+static gboolean
+init (NstPlugin *plugin)
+{
+	DBusGConnection *connection;
+	GError *error;
+	GArray *accounts;
+
+	g_print ("Init pidgin plugin\n");
+
+	error = NULL;
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+	if(error != NULL) {
+		g_warning("[Pidgin] unable to get session bus, error was:\n %s", error->message);
+		g_error_free(error);
+		return FALSE;
+	}
+
+	proxy = dbus_g_proxy_new_for_name(connection,
+					  SERVICE,
+					  OBJ_PATH,
+					  INTERFACE);
+	dbus_g_connection_unref(connection);
+	if (proxy == NULL)
+		return FALSE;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY, &accounts, G_TYPE_INVALID)) {
+		g_object_unref(proxy);
+		g_error_free(error);
+		return FALSE;
+	}
+	g_array_free(accounts, TRUE);
+
+	return TRUE;
+}
+
+static GdkPixbuf *
+get_buddy_icon(int id)
+{
+	GError *error;
+	GdkPixbuf *pixbuf = NULL;
+	gchar *path = NULL;
+	int icon;
+
+	error=NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetIcon", &error,
+				G_TYPE_INT, id,
+				G_TYPE_INVALID,
+				G_TYPE_INT, &icon, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+	}
+	if (icon) {
+		if (!dbus_g_proxy_call (proxy, "PurpleBuddyIconGetFullPath", &error,
+					G_TYPE_INT, icon,
+					G_TYPE_INVALID,
+					G_TYPE_STRING, &path, G_TYPE_INVALID)) {
+			handle_dbus_exception(error);
+		}
+		//FIXME Get the size from somewhere
+		pixbuf = gdk_pixbuf_new_from_file_at_scale(path, 24, 24, TRUE, NULL);
+	}
+
+	return pixbuf;
+}
+
+static void
+add_pidgin_contacts_to_model (GtkTreeStore *store,
+			      GtkTreeIter *iter,
+			      GtkTreeIter *parent)
+{
+	GError *error;
+	GArray *contacts_list;
+	GArray *accounts;
+	int i, j;
+
+	GdkPixbuf *icon;
+	GHashTableIter hiter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+	if(proxy == NULL)
+		return;
+
+	error = NULL;
+	if (!dbus_g_proxy_call (proxy, "PurpleAccountsGetAllActive", &error, G_TYPE_INVALID,
+				DBUS_TYPE_G_INT_ARRAY,
+				&accounts, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return;
+	}
+
+	contact_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+	for(i = 0; i < accounts->len; i++) {
+		int account = g_array_index(accounts, int, i);
+		error = NULL;
+		if (!dbus_g_proxy_call (proxy, "PurpleFindBuddies", &error,
+					G_TYPE_INT, account,
+					G_TYPE_STRING, NULL,
+					G_TYPE_INVALID,
+					DBUS_TYPE_G_INT_ARRAY, &contacts_list, G_TYPE_INVALID))	{
+			handle_dbus_exception(error);
+			continue;
+		}
+		for(j = 0; j < contacts_list->len ; j++) {
+			int id = g_array_index(contacts_list, int, j);
+			int online;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyIsOnline", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_INT, &online, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				continue;
+			}
+			if (!online)
+				continue;
+
+			dat = g_new0 (ContactData, 1);
+
+			dat->account = account;
+			dat->id = id;
+
+			error = NULL;
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetName", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->name, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+				g_free(dat);
+				continue;
+			}
+			if (!dbus_g_proxy_call (proxy, "PurpleBuddyGetAlias", &error,
+						G_TYPE_INT, id,
+						G_TYPE_INVALID,
+						G_TYPE_STRING, &dat->alias, G_TYPE_INVALID)) {
+				handle_dbus_exception(error);
+			}
+
+			contacts_group = g_hash_table_lookup (contact_hash, dat->alias);
+			if (contacts_group == NULL){
+				GPtrArray *new_group = g_ptr_array_new ();
+				g_ptr_array_add (new_group, dat);
+				g_hash_table_insert (contact_hash, dat->alias, new_group);
+			} else {
+				g_ptr_array_add (contacts_group, dat);
+			}
+		}
+		g_array_free(contacts_list, TRUE);
+	}
+	g_array_free (accounts, TRUE);
+
+	g_hash_table_iter_init (&hiter, contact_hash);
+	while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) {
+		gint num_accounts;
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		num_accounts = contacts_group->len;
+
+		gtk_tree_store_append (store, parent, NULL);
+		gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1);
+
+		for (i = 0; i < num_accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (num_accounts == 1) {
+				g_value_init(&val, GDK_TYPE_PIXBUF);
+				g_value_set_object (&val, (gpointer)icon);
+				gtk_tree_store_set_value (store, parent, COL_ICON, &val);
+				g_value_unset (&val);
+				break;
+			}
+			gtk_tree_store_append (store, iter, parent);
+			gtk_tree_store_set (store, iter,
+					    COL_ICON, icon,
+					    COL_ALIAS, dat->alias,
+					    -1);
+		}
+	}
+}
+
+static void
+customize (GtkCellLayout *cell_layout,
+	   GtkCellRenderer *cell,
+	   GtkTreeModel *tree_model,
+	   GtkTreeIter *iter,
+	   gpointer text)
+{
+	gboolean has_child;
+	has_child = gtk_tree_model_iter_has_child (tree_model, iter);
+	if (text) {
+		if (has_child)
+			g_object_set (G_OBJECT(cell), "xpad", 18, NULL);
+		else
+			g_object_set (G_OBJECT(cell), "xpad", 2, NULL);
+	}
+	g_object_set (G_OBJECT(cell), "sensitive", !has_child, NULL);
+}
+
+static GtkWidget *
+get_contacts_widget (NstPlugin *plugin)
+{
+	GtkWidget *cb;
+	GtkCellRenderer *renderer;
+	GtkTreeStore *store;
+	GtkTreeModel *model;
+	GtkTreeIter *iter, *iter2;
+
+	iter = g_malloc (sizeof(GtkTreeIter));
+	iter2 = g_malloc (sizeof(GtkTreeIter));
+	store = gtk_tree_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING);
+	add_pidgin_contacts_to_model (store, iter, iter2);
+	model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), COL_ALIAS,
+					      GTK_SORT_ASCENDING);
+	cb = gtk_combo_box_new_with_model (model);
+
+	renderer = gtk_cell_renderer_pixbuf_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    FALSE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"pixbuf", COL_ICON,
+					NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)FALSE, NULL);
+	renderer = gtk_cell_renderer_text_new ();
+	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cb),
+				    renderer,
+				    TRUE);
+	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (cb),
+					renderer,
+					"text", COL_ALIAS,
+					NULL);
+	g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+	gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cb), renderer,
+					    customize,
+					    (gboolean *)TRUE, NULL);
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 0);
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), iter);
+	if (gtk_tree_model_iter_has_child (model, iter)) {
+		GtkTreePath *path = gtk_tree_path_new_from_indices (0, 0, -1);
+		gtk_tree_model_get_iter (model, iter2, path);
+		gtk_tree_path_free (path);
+		gtk_combo_box_set_active_iter (GTK_COMBO_BOX (cb), iter2);
+	}
+
+	g_free (iter);
+	g_free (iter2);
+	return cb;
+}
+
+static
+gboolean send_file(int account, const char *who, const char *filename)
+{
+	GError *error;
+	int connection;
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "PurpleAccountGetConnection", &error,
+			       G_TYPE_INT, account,
+			       G_TYPE_INVALID,
+			       G_TYPE_INT, &connection, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+
+	if (!connection) {
+		g_warning("[Pidgin] account is not connected");
+		return FALSE;
+	}
+
+	error = NULL;
+	if (!dbus_g_proxy_call(proxy, "ServSendFile", &error,
+			       G_TYPE_INT, connection,
+			       G_TYPE_STRING, who,
+			       G_TYPE_STRING, filename,
+			       G_TYPE_INVALID, G_TYPE_INVALID)) {
+		handle_dbus_exception(error);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static
+gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
+		     GList *file_list)
+{
+	GList *file_iter;
+
+	GFile *file;
+	gchar *file_path;
+
+	gint depth;
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gint *indices;
+	const gchar *alias;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+	GValue val = {0,};
+
+
+	if (proxy == NULL)
+		return FALSE;
+
+	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (contact_widget), &iter);
+	path = gtk_tree_model_get_path (GTK_TREE_MODEL (
+		gtk_combo_box_get_model (GTK_COMBO_BOX(
+			contact_widget))), &iter);
+	depth = gtk_tree_path_get_depth(path);
+	indices = gtk_tree_path_get_indices(path);
+	gtk_tree_path_free (path);
+	gtk_tree_model_get_value (GTK_TREE_MODEL (gtk_combo_box_get_model (
+		    GTK_COMBO_BOX(contact_widget))),
+	    &iter, COL_ALIAS, &val);
+	alias = g_value_get_string (&val);
+	contacts_group = g_hash_table_lookup (contact_hash, alias);
+	g_value_unset (&val);
+	dat = g_ptr_array_index (contacts_group, (depth == 2) ? indices[1] : 0);
+
+	for (file_iter = file_list; file_iter != NULL;
+	    file_iter = g_list_next(file_iter)) {
+		file = g_file_new_for_uri ((gchar *)file_iter->data);
+		file_path = g_file_get_path (file);
+		g_object_unref (file);
+
+		if (file_path == NULL) {
+			g_warning("[Pidgin] Unable to convert URI `%s' to absolute file path",
+				  (gchar *)file_iter->data);
+			continue;
+		}
+
+		if (!send_file(dat->account, dat->name, file_path))
+			g_warning("[Pidgin] Failed to send %s file to %s", file_path, dat->name);
+
+		g_free (file_path);
+	}
+	return TRUE;
+}
+
+static void
+free_contact (ContactData *dat)
+{
+	g_free(dat->name);
+	g_free(dat->alias);
+	g_free(dat);
+}
+
+static gboolean
+destroy (NstPlugin *plugin)
+{
+	GHashTableIter iter;
+	GPtrArray *contacts_group;
+	ContactData *dat;
+
+	g_hash_table_iter_init (&iter, contact_hash);
+	while (g_hash_table_iter_next (&iter, NULL, (gpointer)&contacts_group)) {
+		gint accounts;
+		accounts = contacts_group->len;
+
+		gint i;
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+			free_contact (dat);
+		}
+		g_ptr_array_free (contacts_group, TRUE);
+	}
+	g_hash_table_destroy (contact_hash);
+	return TRUE;
+}
+
+static
+NstPluginInfo plugin_info = {
+	"im",
+	"pidgin",
+	N_("Instant Message (Pidgin)"),
+	NULL,
+	CAJA_CAPS_NONE,
+	init,
+	get_contacts_widget,
+	NULL,
+	send_files,
+	destroy
+};
+
+NST_INIT_PLUGIN (plugin_info)
+
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/8.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/8.html new file mode 100644 index 0000000..4625ab9 --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/8.html @@ -0,0 +1,2749 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
   1
+   2
+   3
+   4
+   5
+   6
+   7
+   8
+   9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  24
+  25
+  26
+  27
+  28
+  29
+  30
+  31
+  32
+  33
+  34
+  35
+  36
+  37
+  38
+  39
+  40
+  41
+  42
+  43
+  44
+  45
+  46
+  47
+  48
+  49
+  50
+  51
+  52
+  53
+  54
+  55
+  56
+  57
+  58
+  59
+  60
+  61
+  62
+  63
+  64
+  65
+  66
+  67
+  68
+  69
+  70
+  71
+  72
+  73
+  74
+  75
+  76
+  77
+  78
+  79
+  80
+  81
+  82
+  83
+  84
+  85
+  86
+  87
+  88
+  89
+  90
+  91
+  92
+  93
+  94
+  95
+  96
+  97
+  98
+  99
+ 100
+ 101
+ 102
+ 103
+ 104
+ 105
+ 106
+ 107
+ 108
+ 109
+ 110
+ 111
+ 112
+ 113
+ 114
+ 115
+ 116
+ 117
+ 118
+ 119
+ 120
+ 121
+ 122
+ 123
+ 124
+ 125
+ 126
+ 127
+ 128
+ 129
+ 130
+ 131
+ 132
+ 133
+ 134
+ 135
+ 136
+ 137
+ 138
+ 139
+ 140
+ 141
+ 142
+ 143
+ 144
+ 145
+ 146
+ 147
+ 148
+ 149
+ 150
+ 151
+ 152
+ 153
+ 154
+ 155
+ 156
+ 157
+ 158
+ 159
+ 160
+ 161
+ 162
+ 163
+ 164
+ 165
+ 166
+ 167
+ 168
+ 169
+ 170
+ 171
+ 172
+ 173
+ 174
+ 175
+ 176
+ 177
+ 178
+ 179
+ 180
+ 181
+ 182
+ 183
+ 184
+ 185
+ 186
+ 187
+ 188
+ 189
+ 190
+ 191
+ 192
+ 193
+ 194
+ 195
+ 196
+ 197
+ 198
+ 199
+ 200
+ 201
+ 202
+ 203
+ 204
+ 205
+ 206
+ 207
+ 208
+ 209
+ 210
+ 211
+ 212
+ 213
+ 214
+ 215
+ 216
+ 217
+ 218
+ 219
+ 220
+ 221
+ 222
+ 223
+ 224
+ 225
+ 226
+ 227
+ 228
+ 229
+ 230
+ 231
+ 232
+ 233
+ 234
+ 235
+ 236
+ 237
+ 238
+ 239
+ 240
+ 241
+ 242
+ 243
+ 244
+ 245
+ 246
+ 247
+ 248
+ 249
+ 250
+ 251
+ 252
+ 253
+ 254
+ 255
+ 256
+ 257
+ 258
+ 259
+ 260
+ 261
+ 262
+ 263
+ 264
+ 265
+ 266
+ 267
+ 268
+ 269
+ 270
+ 271
+ 272
+ 273
+ 274
+ 275
+ 276
+ 277
+ 278
+ 279
+ 280
+ 281
+ 282
+ 283
+ 284
+ 285
+ 286
+ 287
+ 288
+ 289
+ 290
+ 291
+ 292
+ 293
+ 294
+ 295
+ 296
+ 297
+ 298
+ 299
+ 300
+ 301
+ 302
+ 303
+ 304
+ 305
+ 306
+ 307
+ 308
+ 309
+ 310
+ 311
+ 312
+ 313
+ 314
+ 315
+ 316
+ 317
+ 318
+ 319
+ 320
+ 321
+ 322
+ 323
+ 324
+ 325
+ 326
+ 327
+ 328
+ 329
+ 330
+ 331
+ 332
+ 333
+ 334
+ 335
+ 336
+ 337
+ 338
+ 339
+ 340
+ 341
+ 342
+ 343
+ 344
+ 345
+ 346
+ 347
+ 348
+ 349
+ 350
+ 351
+ 352
+ 353
+ 354
+ 355
+ 356
+ 357
+ 358
+ 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
/* caja-share -- Caja File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne@gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-column-provider.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-info-provider.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-property-page-provider.h>
+
+#include "caja-share.h"
+
+#include <gio/gio.h>
+
+#include <gtk/gtk.h>
+
+#include <string.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include "shares.h"
+
+
+#define NEED_IF_GUESTOK_MASK (S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* need go+rx for guest enabled usershares */
+#define NEED_IF_WRITABLE_MASK (S_IWGRP | S_IWOTH)			/* writable usershares need go+w additionally*/
+#define NEED_ALL_MASK         (NEED_IF_GUESTOK_MASK | NEED_IF_WRITABLE_MASK)
+
+static GObjectClass *parent_class;
+
+/* Structure to hold all the information for a share's property page.  If
+ * you add stuff to this, add it to free_property_page_cb() as well.
+ */
+typedef struct {
+  char *path; /* Full path which is being shared */
+  CajaFileInfo *fileinfo; /* Caja file to which this page refers */
+
+  GtkBuilder *ui;
+
+  GtkWidget *main; /* Widget that holds all the rest.  Its "PropertyPage" GObject-data points to this PropertyPage structure */
+
+  GtkWidget *checkbutton_share_folder;
+  GtkWidget *box_share_content;
+  GtkWidget *entry_share_name;
+  GtkWidget *checkbutton_share_rw_ro;
+  GtkWidget *checkbutton_share_guest_ok;
+  GtkWidget *entry_share_comment;
+  GtkWidget *label_status;
+  GtkWidget *button_cancel;
+  GtkWidget *button_apply;
+
+  GtkWidget *standalone_window;
+
+  gboolean was_initially_shared;
+  gboolean was_writable;
+  gboolean is_dirty;
+} PropertyPage;
+
+static void property_page_set_warning (PropertyPage *page);
+static void property_page_set_error (PropertyPage *page, const char *message);
+static void property_page_set_normal (PropertyPage *page);
+
+static void
+property_page_validate_fields (PropertyPage *page)
+{
+  const char *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (g_utf8_strlen (name, -1) <= 12)
+    property_page_set_normal (page);
+  else
+    property_page_set_warning (page);
+}
+
+static gboolean
+message_confirm_missing_permissions (GtkWidget *widget, const char *path, mode_t need_mask)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+  gboolean result;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_QUESTION,
+				   GTK_BUTTONS_NONE,
+				   _("Caja needs to add some permissions to your folder \"%s\" in order to share it"),
+				   display_name);
+
+  /* FIXME: the following message only mentions "permission by others".  We
+   * should probably be more explicit and mention group/other permissions.
+   * We'll be able to do that after the period of string freeze.
+   */
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+					    _("The folder \"%s\" needs the following extra permissions for sharing to work:\n"
+					      "%s%s%s"
+					      "Do you want Caja to add these permissions to the folder automatically?"),
+					    display_name,
+					    (need_mask & (S_IRGRP | S_IROTH)) ? _("  - read permission by others\n") : "",
+					    (need_mask & (S_IWGRP | S_IWOTH)) ? _("  - write permission by others\n") : "",
+					    (need_mask & (S_IXGRP | S_IXOTH)) ? _("  - execute permission by others\n") : "");
+  g_free (display_name);
+
+  gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("Add the permissions automatically"), GTK_RESPONSE_ACCEPT);
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
+  gtk_widget_destroy (dialog);
+
+  return result;
+}
+
+static void
+error_when_changing_permissions (GtkWidget *widget, const char *path)
+{
+  GtkWidget *toplevel;
+  GtkWidget *dialog;
+  char *display_name;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW (toplevel))
+    toplevel = NULL;
+
+  display_name = g_filename_display_basename (path);
+
+  dialog = gtk_message_dialog_new (toplevel ? GTK_WINDOW (toplevel) : NULL,
+				   0,
+				   GTK_MESSAGE_ERROR,
+				   GTK_BUTTONS_OK,
+				   _("Could not change the permissions of folder \"%s\""),
+				   display_name);
+  g_free (display_name);
+
+  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+}
+
+static char *
+get_key_file_path (void)
+{
+  return g_build_filename (g_get_home_dir (), ".mate2", "mate-file-manager-share-modified-permissions", NULL);
+}
+
+static void
+save_key_file (const char *filename, GKeyFile *key_file)
+{
+  char *contents;
+  gsize length;
+
+  /* NULL GError */
+  contents = g_key_file_to_data (key_file, &length, NULL);
+  if (!contents)
+    return;
+
+  /* NULL GError */
+  g_file_set_contents (filename, contents, length, NULL);
+
+  g_free (contents);
+}
+
+static void
+save_changed_permissions (const char *path, mode_t need_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+  char str[50];
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  /* NULL GError
+   *
+   * We don't check the return value of this.  If the file doesn't exist, we'll
+   * simply want to create it.
+   */
+  g_key_file_load_from_file (key_file, key_file_path, 0, NULL);
+
+  g_snprintf (str, sizeof (str), "%o", (guint) need_mask); /* octal, baby */
+  g_key_file_set_string (key_file, path, "need_mask", str);
+
+  save_key_file (key_file_path, key_file);
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+remove_permissions (const char *path, mode_t need_mask)
+{
+  struct stat st;
+  mode_t new_mode;
+
+  if (need_mask == 0)
+    return;
+
+  if (stat (path, &st) != 0)
+    return;
+
+  new_mode = st.st_mode & ~need_mask;
+
+  /* Bleah, no error checking */
+  chmod (path, new_mode);
+}
+
+static void
+remove_from_saved_permissions (const char *path, mode_t remove_mask)
+{
+  GKeyFile *key_file;
+  char *key_file_path;
+
+  if (remove_mask == 0)
+    return;
+
+  key_file = g_key_file_new ();
+  key_file_path = get_key_file_path ();
+
+  if (g_key_file_load_from_file (key_file, key_file_path, 0, NULL))
+    {
+      mode_t need_mask;
+      mode_t remove_from_current_mask;
+      char *str;
+
+      need_mask = 0;
+
+      /* NULL GError */
+      str = g_key_file_get_string (key_file, path, "need_mask", NULL);
+
+      if (str)
+        {
+          guint i;
+
+          if (sscanf (str, "%o", &i) == 1) /* octal */
+            need_mask = i;
+
+          g_free (str);
+        }
+
+      remove_from_current_mask = need_mask & remove_mask;
+      remove_permissions (path, remove_from_current_mask);
+
+      need_mask &= ~remove_mask;
+
+      if (need_mask == 0)
+        {
+          /* NULL GError */
+          g_key_file_remove_group (key_file, path, NULL);
+        }
+      else
+        {
+          char buf[50];
+
+          g_snprintf (buf, sizeof (buf), "%o", (guint) need_mask); /* octal */
+          g_key_file_set_string (key_file, path, "need_mask", buf);
+        }
+
+      save_key_file (key_file_path, key_file);
+    }
+
+  g_key_file_free (key_file);
+  g_free (key_file_path);
+}
+
+static void
+restore_saved_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_ALL_MASK);
+}
+
+static void
+restore_write_permissions (const char *path)
+{
+  remove_from_saved_permissions (path, NEED_IF_WRITABLE_MASK);
+}
+
+typedef enum {
+  CONFIRM_CANCEL_OR_ERROR,
+  CONFIRM_NO_MODIFICATIONS,
+  CONFIRM_MODIFIED
+} ConfirmPermissionsStatus;
+
+static ConfirmPermissionsStatus
+confirm_sharing_permissions (GtkWidget *widget, const char *path, gboolean is_shared, gboolean guest_ok, gboolean is_writable)
+{
+  struct stat st;
+  mode_t mode, new_mode, need_mask;
+
+  if (!is_shared)
+    return CONFIRM_NO_MODIFICATIONS;
+
+  if (stat (path, &st) != 0)
+    return CONFIRM_NO_MODIFICATIONS; /* We'll just let "net usershare" give back an error if the file disappears */
+
+  new_mode = mode = st.st_mode;
+
+  if (guest_ok)
+    new_mode |= NEED_IF_GUESTOK_MASK;
+  if (is_writable)
+    new_mode |= NEED_IF_WRITABLE_MASK;
+
+  need_mask = new_mode & ~mode;
+
+  if (need_mask != 0)
+    {
+      g_assert (mode != new_mode);
+
+      if (!message_confirm_missing_permissions (widget, path, need_mask))
+        return CONFIRM_CANCEL_OR_ERROR;
+
+      if (chmod (path, new_mode) != 0)
+        {
+          error_when_changing_permissions (widget, path);
+          return CONFIRM_CANCEL_OR_ERROR;
+        }
+
+      save_changed_permissions (path, need_mask);
+
+      return CONFIRM_MODIFIED;
+    }
+  else
+    {
+      g_assert (mode == new_mode);
+      return CONFIRM_NO_MODIFICATIONS;
+    }
+
+  g_assert_not_reached ();
+  return CONFIRM_CANCEL_OR_ERROR;
+}
+
+static gboolean
+property_page_commit (PropertyPage *page)
+{
+  gboolean is_shared;
+  ShareInfo share_info;
+  ConfirmPermissionsStatus status;
+  GError *error;
+  gboolean retval;
+
+  is_shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+
+  share_info.path = page->path;
+  share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+  share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment));
+  share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro));
+  share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok));
+
+  /* Do we need to unset the write permissions that we added in the past? */
+  if (is_shared && page->was_writable && !share_info.is_writable)
+    restore_write_permissions (page->path);
+
+  status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable);
+  if (status == CONFIRM_CANCEL_OR_ERROR)
+    return FALSE; /* the user didn't want us to change his folder's permissions */
+
+  error = NULL;
+  retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error);
+
+  if (!retval)
+    {
+      property_page_set_error (page, error->message);
+      g_error_free (error);
+
+      /* Since the operation failed, we restore things to the way they were */
+      if (status == CONFIRM_MODIFIED)
+        restore_saved_permissions (page->path);
+    }
+  else
+    {
+      property_page_validate_fields (page);
+      caja_file_info_invalidate_extension_info (page->fileinfo);
+    }
+
+  if (!is_shared)
+    restore_saved_permissions (page->path);
+
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
+  return retval;
+}
+
+/*--------------------------------------------------------------------------*/
+static gchar *
+get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
+{
+  GFile *file;
+  gchar *fullpath;
+
+  g_assert (fileinfo != NULL);
+
+  file = caja_file_info_get_location(fileinfo);
+  fullpath = g_file_get_path(file);
+  g_assert (fullpath != NULL && g_file_is_native(file)); /* In the beginning we checked that this was a local URI */
+  g_object_unref(file);
+
+  return(fullpath);
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+property_page_set_warning (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
+
+static void
+property_page_set_error (PropertyPage *page, const char *message)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), message);
+}
+
+static void
+property_page_set_normal (PropertyPage *page)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+    }
+
+  if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+    {
+      gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+    }
+
+  gtk_label_set_text (GTK_LABEL (page->label_status), "");
+}
+
+static gboolean
+property_page_share_name_is_valid (PropertyPage *page)
+{
+  const char *newname;
+
+  newname = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+
+  if (strlen (newname) == 0)
+    {
+      property_page_set_error (page, _("The share name cannot be empty"));
+      return FALSE;
+    }
+  else
+    {
+      GError *error;
+      gboolean exists;
+
+      error = NULL;
+      if (!shares_get_share_name_exists (newname, &exists, &error))
+        {
+          char *str;
+
+          str = g_strdup_printf (_("Error while getting share information: %s"), error->message);
+          property_page_set_error (page, str);
+          g_free (str);
+          g_error_free (error);
+
+          return FALSE;
+        }
+
+      if (exists)
+        {
+          property_page_set_error (page, _("Another share has the same name"));
+          return FALSE;
+        }
+      else
+        {
+          property_page_set_normal (page);
+          return TRUE;
+        }
+    }
+}
+
+static void
+property_page_set_controls_sensitivity (PropertyPage *page,
+					gboolean      sensitive)
+{
+  gtk_widget_set_sensitive (page->box_share_content, sensitive);
+
+  if (sensitive)
+    {
+      gboolean guest_ok_allowed;
+      shares_supports_guest_ok (&guest_ok_allowed, NULL);
+      gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, guest_ok_allowed);
+    }
+  else
+    gtk_widget_set_sensitive (page->checkbutton_share_guest_ok, FALSE);
+}
+
+static void
+property_page_check_sensitivity (PropertyPage *page)
+{
+  gboolean enabled;
+  gboolean apply_is_sensitive;
+
+  enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder));
+  property_page_set_controls_sensitivity (page, enabled);
+
+  if (enabled)
+    apply_is_sensitive = page->is_dirty || !page->was_initially_shared;
+  else
+    apply_is_sensitive = page->was_initially_shared;
+
+  gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
+}
+
+static void
+modify_share_name_text_entry  (GtkEditable *editable,
+			       gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  /* This function does simple validation on the share name and sets the error
+   * label; just let it run and ignore the result value.
+   */
+  property_page_share_name_is_valid (page);
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+modify_share_comment_text_entry  (GtkEditable *editable,
+				  gpointer user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+  property_page_check_sensitivity (page);
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+on_checkbutton_share_folder_toggled    (GtkToggleButton *togglebutton,
+                                        gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_rw_ro_toggled    (GtkToggleButton *togglebutton,
+				 gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+on_checkbutton_guest_ok_toggled    (GtkToggleButton *togglebutton,
+				    gpointer         user_data)
+{
+  PropertyPage *page;
+
+  page = user_data;
+
+  page->is_dirty = TRUE;
+
+  property_page_check_sensitivity (page);
+}
+
+static void
+free_property_page_cb (gpointer data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  g_free (page->path);
+  g_object_unref (page->fileinfo);
+  g_object_unref (page->ui);
+
+  g_free (page);
+}
+
+static void
+button_apply_clicked_cb (GtkButton *button,
+			 gpointer   data)
+{
+  PropertyPage *page;
+
+  page = data;
+
+  if (property_page_commit (page))
+    {
+      if (page->standalone_window)
+	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+static PropertyPage *
+create_property_page (CajaFileInfo *fileinfo)
+{
+  PropertyPage *page;
+  GError *error;
+  ShareInfo *share_info;
+  char *share_name;
+  gboolean free_share_name;
+  const char *comment;
+  char *apply_button_label;
+
+  page = g_new0 (PropertyPage, 1);
+
+  page->path = get_fullpath_from_fileinfo(fileinfo);
+  page->fileinfo = g_object_ref (fileinfo);
+
+  error = NULL;
+  if (!shares_get_share_info_for_path (page->path, &share_info, &error))
+    {
+      /* We'll assume that there is no share for that path, but we'll still
+       * bring up an error dialog.
+       */
+      GtkWidget *message;
+
+      message = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+					_("There was an error while getting the sharing information"));
+      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", error->message);
+      gtk_widget_show (message);
+
+      share_info = NULL;
+      g_error_free (error);
+      error = NULL;
+    }
+
+
+  page->ui = gtk_builder_new ();
+#ifdef ENABLE_NLS
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
+  g_assert (gtk_builder_add_from_file (page->ui,
+              INTERFACES_DIR"/share-dialog.ui", &error));
+
+  page->main = GTK_WIDGET (gtk_builder_get_object (page->ui, "vbox1"));
+  g_assert (page->main != NULL);
+
+  g_object_set_data_full (G_OBJECT (page->main),
+			  "PropertyPage",
+			  page,
+			  free_property_page_cb);
+
+  page->checkbutton_share_folder = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_folder"));
+  page->box_share_content = GTK_WIDGET (gtk_builder_get_object (page->ui,"box_share_content"));
+  page->checkbutton_share_rw_ro = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_rw_ro"));
+  page->checkbutton_share_guest_ok = GTK_WIDGET (gtk_builder_get_object (page->ui,"checkbutton_share_guest_ok"));
+  page->entry_share_name = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_name"));
+  page->entry_share_comment = GTK_WIDGET (gtk_builder_get_object (page->ui,"entry_share_comment"));
+  page->label_status = GTK_WIDGET (gtk_builder_get_object (page->ui,"label_status"));
+  page->button_cancel = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_cancel"));
+  page->button_apply = GTK_WIDGET (gtk_builder_get_object (page->ui,"button_apply"));
+
+  /* Sanity check so that we don't screw up the Glade file */
+  g_assert (page->checkbutton_share_folder != NULL
+	    && page->box_share_content != NULL
+	    && page->checkbutton_share_rw_ro != NULL
+	    && page->checkbutton_share_guest_ok != NULL
+	    && page->entry_share_name != NULL
+	    && page->entry_share_comment != NULL
+	    && page->label_status != NULL
+	    && page->button_cancel != NULL
+	    && page->button_apply != NULL);
+
+  if (share_info)<--- First condition
+    {
+      page->was_initially_shared = TRUE;
+      page->was_writable = share_info->is_writable;
+    }
+
+  /* Share name */
+
+  if (share_info)<--- Second condition
+    {
+      share_name = share_info->share_name;
+      free_share_name = FALSE;
+    }
+  else
+    {
+      share_name = g_filename_display_basename (page->path);
+      free_share_name = TRUE;
+    }
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_name), share_name);
+
+  if (free_share_name)
+    g_free (share_name);
+
+  /* Comment */
+
+  if (share_info == NULL || share_info->comment == NULL)
+    comment = "";
+  else
+    comment = share_info->comment;
+
+  gtk_entry_set_text (GTK_ENTRY (page->entry_share_comment), comment);
+
+  /* Share toggle */
+
+  if (share_info)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), TRUE);
+  else
+    {
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_folder), FALSE);
+    }
+
+  /* Share name */
+
+  if (g_utf8_strlen(gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)), -1) > 12)
+    property_page_set_warning (page);
+
+  /* Permissions */
+  if (share_info != NULL && share_info->is_writable)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro), FALSE);
+
+  /* Guest access */
+  if (share_info != NULL && share_info->guest_ok)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), TRUE);
+  else
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok), FALSE);
+
+  /* Apply button */
+
+  if (share_info)
+    apply_button_label = _("Modify _Share");
+  else
+    apply_button_label = _("Create _Share");
+
+  gtk_button_set_label (GTK_BUTTON (page->button_apply), apply_button_label);
+  gtk_button_set_use_underline (GTK_BUTTON (page->button_apply), TRUE);
+  gtk_button_set_image (GTK_BUTTON (page->button_apply), gtk_image_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON));
+
+  gtk_widget_set_sensitive (page->button_apply, FALSE);
+
+  /* Sensitivity */
+
+  property_page_check_sensitivity (page);
+
+  /* Signal handlers */
+
+  g_signal_connect (page->checkbutton_share_folder, "toggled",
+                    G_CALLBACK (on_checkbutton_share_folder_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_rw_ro, "toggled",
+                    G_CALLBACK (on_checkbutton_rw_ro_toggled),
+                    page);
+
+  g_signal_connect (page->checkbutton_share_guest_ok, "toggled",
+                    G_CALLBACK (on_checkbutton_guest_ok_toggled),
+                    page);
+
+  g_signal_connect (page->entry_share_name, "changed",
+                    G_CALLBACK (modify_share_name_text_entry),
+                    page);
+
+  g_signal_connect (page->entry_share_comment, "changed",
+		    G_CALLBACK (modify_share_comment_text_entry),
+		    page);
+
+  g_signal_connect (page->button_apply, "clicked",
+		    G_CALLBACK (button_apply_clicked_cb), page);
+
+  if (share_info != NULL)
+    shares_free_share_info (share_info);
+
+  return page;
+}
+
+/* Implementation of the CajaInfoProvider interface */
+
+/* caja_info_provider_update_file_info
+ * This function is called by Caja when it wants the extension to
+ * fill in data about the file.  It passes a CajaFileInfo object,
+ * which the extension can use to read data from the file, and which
+ * the extension should add data to.
+ *
+ * If the data can be added immediately (without doing blocking IO),
+ * the extension can do so, and return CAJA_OPERATION_COMPLETE.
+ * In this case the 'update_complete' and 'handle' parameters can be
+ * ignored.
+ *
+ * If waiting for the deata would block the UI, the extension should
+ * perform the task asynchronously, and return
+ * CAJA_OPERATION_IN_PROGRESS.  The function must also set the
+ * 'handle' pointer to a value unique to the object, and invoke the
+ * 'update_complete' closure when the update is done.
+ *
+ * If the extension encounters an error, it should return
+ * CAJA_OPERATION_FAILED.
+ */
+typedef struct {
+  gboolean cancelled;
+  CajaInfoProvider *provider;
+  CajaFileInfo *file;
+  GClosure *update_complete;
+} CajaShareHandle;
+
+static CajaShareStatus
+get_share_status_and_free_share_info (ShareInfo *share_info)
+{
+  CajaShareStatus result;
+
+  if (!share_info)
+    result = CAJA_SHARE_NOT_SHARED;
+  else
+    {
+      if (share_info->is_writable)
+	result = CAJA_SHARE_SHARED_RW;
+      else
+	result = CAJA_SHARE_SHARED_RO;
+
+      shares_free_share_info (share_info);
+    }
+
+  return result;
+}
+
+
+/*--------------------------------------------------------------------------*/
+static void
+get_share_info_for_file_info (CajaFileInfo *file, ShareInfo **share_info, gboolean *is_shareable)
+{
+  char		*uri;
+  char		*local_path = NULL;
+  GFile         *f;
+
+  *share_info = NULL;
+  *is_shareable = FALSE;
+
+  uri = caja_file_info_get_uri (file);
+  f = caja_file_info_get_location(file);
+  if (!uri)
+    goto out;
+
+#define NETWORK_SHARE_PREFIX "network:///share-"
+
+  if (g_str_has_prefix (uri, NETWORK_SHARE_PREFIX))
+    {
+      const char *share_name;
+
+      share_name = uri + strlen (NETWORK_SHARE_PREFIX);
+
+      /* FIXME: NULL GError */
+      if (!shares_get_share_info_for_share_name (share_name, share_info, NULL))
+        {
+          *share_info = NULL;
+          *is_shareable = TRUE; /* it *has* the prefix, anyway... we are just unsynchronized with what mate-vfs thinks */
+        }
+      else
+        {
+          *is_shareable = TRUE;
+        }
+
+      goto out;
+    }
+
+  if (!caja_file_info_is_directory(file))
+    goto out;
+
+  local_path = g_file_get_path(f);
+  if (!local_path || !g_file_is_native(f))
+    goto out;
+
+  /* FIXME: NULL GError */
+  if (!shares_get_share_info_for_path (local_path, share_info, NULL))
+    goto out;
+
+  *is_shareable = TRUE;
+
+ out:
+
+  g_object_unref(f);
+  g_free (uri);
+  g_free (local_path);
+}
+
+/*--------------------------------------------------------------------------*/
+static CajaShareStatus
+file_get_share_status_file(CajaFileInfo *file)
+{
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  get_share_info_for_file_info (file, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return CAJA_SHARE_NOT_SHARED;
+
+  return get_share_status_and_free_share_info (share_info);
+}
+
+static CajaOperationResult
+caja_share_update_file_info (CajaInfoProvider *provider,
+				 CajaFileInfo *file,
+				 GClosure *update_complete,
+				 CajaOperationHandle **handle)
+{
+/*   gchar *share_status = NULL; */
+
+  switch (file_get_share_status_file (file)) {
+
+  case CAJA_SHARE_SHARED_RO:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read only)"); */
+    break;
+
+  case CAJA_SHARE_SHARED_RW:
+    caja_file_info_add_emblem (file, "shared");
+/*     share_status = _("shared (read and write)"); */
+    break;
+
+  case CAJA_SHARE_NOT_SHARED:
+/*     share_status = _("not shared"); */
+    break;
+
+  default:
+    g_assert_not_reached ();
+    break;
+  }
+
+/*   caja_file_info_add_string_attribute (file, */
+/* 					   "CajaShare::share_status", */
+/* 					   share_status); */
+  return CAJA_OPERATION_COMPLETE;
+}
+
+
+static void
+caja_share_cancel_update (CajaInfoProvider *provider,
+			      CajaOperationHandle *handle)
+{
+  CajaShareHandle *share_handle;
+
+  share_handle = (CajaShareHandle*)handle;
+  share_handle->cancelled = TRUE;
+}
+
+static void
+caja_share_info_provider_iface_init (CajaInfoProviderIface *iface)
+{
+  iface->update_file_info = caja_share_update_file_info;
+  iface->cancel_update = caja_share_cancel_update;
+}
+
+/*--------------------------------------------------------------------------*/
+/* caja_property_page_provider_get_pages
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaPropertyPage
+ * items.
+ */
+static GList *
+caja_share_get_property_pages (CajaPropertyPageProvider *provider,
+				   GList *files)
+{
+  PropertyPage *page;
+  GList *pages;
+  CajaPropertyPage *np_page;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+  if (!is_shareable)
+    return NULL;
+
+  page = create_property_page (fileinfo);
+  gtk_widget_hide (page->button_cancel);
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  pages = NULL;
+  np_page = caja_property_page_new
+    ("CajaShare::property_page",
+     gtk_label_new (_("Share")),
+     page->main);
+  pages = g_list_append (pages, np_page);
+
+  return pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_property_page_provider_iface_init (CajaPropertyPageProviderIface *iface)
+{
+  iface->get_pages = caja_share_get_property_pages;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_instance_init (CajaShare *share)
+{
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_class_init (CajaShareClass *class)
+{
+  parent_class = g_type_class_peek_parent (class);
+}
+
+/* caja_menu_provider_get_file_items
+ *
+ * This function is called by Caja when it wants context menu
+ * items from the extension.
+ *
+ * This function is called in the main thread before a context menu
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated CajaMenuItem
+ * items.
+ */
+
+static void
+button_cancel_clicked_cb (GtkButton *button, gpointer data)
+{
+  GtkWidget *window;
+
+  window = GTK_WIDGET (data);
+  gtk_widget_destroy (window);
+}
+
+static void
+share_this_folder_callback (CajaMenuItem *item,
+			    gpointer user_data)
+{
+  CajaFileInfo *fileinfo;
+  PropertyPage *page;
+  GtkWidget * window;
+
+  fileinfo = CAJA_FILE_INFO (user_data);
+  g_assert (fileinfo != NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_title (GTK_WINDOW (window), _("Folder Sharing"));
+  page = create_property_page (fileinfo);
+  page->standalone_window = window;
+  g_signal_connect (page->button_cancel, "clicked",
+		    G_CALLBACK (button_cancel_clicked_cb), window);
+
+  gtk_container_add (GTK_CONTAINER (window), page->main);
+  gtk_widget_show (window);
+}
+
+static GList *
+caja_share_get_file_items (CajaMenuProvider *provider,
+			     GtkWidget *window,
+			     GList *files)
+{
+  GList *items;
+  CajaMenuItem *item;
+  CajaFileInfo *fileinfo;
+  ShareInfo *share_info;
+  gboolean is_shareable;
+
+  /* Only show the property page if 1 file is selected */
+  if (!files || files->next != NULL) {
+    return NULL;
+  }
+
+  fileinfo = CAJA_FILE_INFO (files->data);
+
+  get_share_info_for_file_info (fileinfo, &share_info, &is_shareable);
+
+  if (!is_shareable)
+    return NULL;
+
+  if (share_info)
+    shares_free_share_info (share_info);
+
+  /* We don't own a reference to the file info to keep it around, so acquire one */
+  g_object_ref (fileinfo);
+
+  /* FMQ: change the label to "Share with Windows users"? */
+  item = caja_menu_item_new ("CajaShare::share",
+				 _("Sharing Options"),
+				 _("Share this Folder"),
+				 "folder-remote");
+  g_signal_connect (item, "activate",
+		    G_CALLBACK (share_this_folder_callback),
+		    fileinfo);
+  g_object_set_data_full (G_OBJECT (item),
+			  "files",
+			  fileinfo,
+			  g_object_unref); /* Release our reference when the menu item goes away */
+
+  items = g_list_append (NULL, item);
+  return items;
+}
+
+/*--------------------------------------------------------------------------*/
+static void
+caja_share_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+	iface->get_file_items = caja_share_get_file_items;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Type registration.  Because this type is implemented in a module
+ * that can be unloaded, we separate type registration from get_type().
+ * the type_register() function will be called by the module's
+ * initialization function. */
+static GType share_type = 0;
+
+#define CAJA_TYPE_SHARE  (caja_share_get_type ())
+
+static GType
+caja_share_get_type (void)
+{
+  return share_type;
+}
+
+static void
+caja_share_register_type (GTypeModule *module)
+{
+  static const GTypeInfo info = {
+    sizeof (CajaShareClass),
+    (GBaseInitFunc) NULL,
+    (GBaseFinalizeFunc) NULL,
+    (GClassInitFunc) caja_share_class_init,
+    NULL,
+    NULL,
+    sizeof (CajaShare),
+    0,
+    (GInstanceInitFunc) caja_share_instance_init,
+  };
+
+  share_type = g_type_module_register_type (module,
+					    G_TYPE_OBJECT,
+					    "CajaShare",
+					    &info, 0);
+
+  static const GInterfaceInfo property_page_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_property_page_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_PROPERTY_PAGE_PROVIDER,
+			       &property_page_provider_iface_info);
+
+
+  static const GInterfaceInfo info_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_info_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_INFO_PROVIDER,
+			       &info_provider_iface_info);
+
+  /* Menu right clik */
+  static const GInterfaceInfo menu_provider_iface_info = {
+    (GInterfaceInitFunc) caja_share_menu_provider_iface_init,
+    NULL,
+    NULL
+  };
+
+  g_type_module_add_interface (module,
+			       share_type,
+			       CAJA_TYPE_MENU_PROVIDER,
+			       &menu_provider_iface_info);
+
+}
+
+/* Extension module functions.  These functions are defined in
+ * caja-extensions-types.h, and must be implemented by all
+ * extensions. */
+
+/* Initialization function.  In addition to any module-specific
+ * initialization, any types implemented by the module should
+ * be registered here. */
+void
+caja_module_initialize (GTypeModule  *module)
+{
+  g_print ("Initializing caja-share extension\n");
+
+  caja_share_register_type (module);
+}
+
+/* Perform module-specific shutdown. */
+void
+caja_module_shutdown   (void)
+{
+  g_print ("Shutting down caja-share extension\n");
+  /* FIXME freeing */
+}
+
+/* List all the extension types.  */
+void
+caja_module_list_types (const GType **types,
+			    int          *num_types)
+{
+  static GType type_list[1];
+
+  type_list[0] = CAJA_TYPE_SHARE;
+
+  *types = type_list;
+  *num_types = 1;
+}
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/9.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/9.html new file mode 100644 index 0000000..0c626c0 --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/9.html @@ -0,0 +1,561 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+ 29
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+ 39
+ 40
+ 41
+ 42
+ 43
+ 44
+ 45
+ 46
+ 47
+ 48
+ 49
+ 50
+ 51
+ 52
+ 53
+ 54
+ 55
+ 56
+ 57
+ 58
+ 59
+ 60
+ 61
+ 62
+ 63
+ 64
+ 65
+ 66
+ 67
+ 68
+ 69
+ 70
+ 71
+ 72
+ 73
+ 74
+ 75
+ 76
+ 77
+ 78
+ 79
+ 80
+ 81
+ 82
+ 83
+ 84
+ 85
+ 86
+ 87
+ 88
+ 89
+ 90
+ 91
+ 92
+ 93
+ 94
+ 95
+ 96
+ 97
+ 98
+ 99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
/*
+ *  Caja Wallpaper extension
+ *
+ *  Copyright (C) 2005 Adam Israel
+ *  Copyright (C) 2014 Stefano Karapetsas
+ *  Copyright (C) 2014-2021 MATE developers.
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *  Authors: Adam Israel <adam@battleaxe.net>
+ *           Stefano Karapetsas <stefano@karapetsas.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <string.h>
+#include <gio/gio.h>
+#include <libcaja-extension/caja-extension-types.h>
+#include <libcaja-extension/caja-file-info.h>
+#include <libcaja-extension/caja-menu-provider.h>
+#include "caja-wallpaper-extension.h"
+
+#define WP_SCHEMA "org.mate.background"
+#define WP_FILE_KEY "picture-filename"
+
+static GObjectClass *parent_class;
+
+static void
+set_wallpaper_callback (CajaMenuItem *item,
+              gpointer          user_data)
+{
+    GList *files;
+    GSettings *settings;
+    CajaFileInfo *file;
+    gchar *uri;
+    gchar *filename;
+
+    files = g_object_get_data (G_OBJECT (item), "files");
+    file = files->data;
+
+    uri = caja_file_info_get_uri (file);
+    filename = g_filename_from_uri(uri, NULL, NULL);
+
+    settings = g_settings_new (WP_SCHEMA);
+
+    g_settings_set_string (settings, WP_FILE_KEY, filename);
+
+    g_object_unref (settings);
+    g_free (filename);
+    g_free (uri);
+
+}
+
+static gboolean
+is_image (CajaFileInfo *file)
+{
+    gchar   *mimeType;
+    gboolean isImage;
+
+    mimeType = caja_file_info_get_mime_type (file);
+    isImage = g_str_has_prefix (mimeType, "image/");
+    g_free (mimeType);
+    return isImage;
+}
+
+
+static GList *
+caja_cwe_get_file_items (CajaMenuProvider *provider,
+                  GtkWidget            *window,
+                  GList                *files)
+{
+    GList    *items = NULL;
+    GList    *scan;
+    gboolean  one_item;
+    CajaMenuItem *item;
+
+    for (scan = files; scan; scan = scan->next) {
+        CajaFileInfo *file = scan->data;
+        gchar            *scheme;
+        gboolean          local;
+
+        scheme = caja_file_info_get_uri_scheme (file);
+        local = strncmp (scheme, "file", 4) == 0;
+        g_free (scheme);
+
+        if (!local)
+            return NULL;
+    }
+
+    one_item = (files != NULL) && (files->next == NULL);
+    if (one_item && is_image ((CajaFileInfo *)files->data) &&
+        !caja_file_info_is_directory ((CajaFileInfo *)files->data)) {
+        item = caja_menu_item_new ("CajaCwe::sendto",
+                           _("Set as wallpaper"),
+                           _("Set image as the current wallpaper"),
+                           NULL);
+        g_signal_connect (item,
+                  "activate",
+                  G_CALLBACK (set_wallpaper_callback),
+                provider);
+        g_object_set_data_full (G_OBJECT (item),
+                    "files",
+                    caja_file_info_list_copy (files),
+                    (GDestroyNotify) caja_file_info_list_free);
+        items = g_list_append (items, item);
+    }
+    return items;
+}
+
+
+static void
+caja_cwe_menu_provider_iface_init (CajaMenuProviderIface *iface)
+{
+    iface->get_file_items = caja_cwe_get_file_items;
+}
+
+
+static void
+caja_cwe_instance_init (CajaCwe *cwe)
+{
+}
+
+
+static void
+caja_cwe_class_init (CajaCweClass *class)
+{
+    parent_class = g_type_class_peek_parent (class);
+}
+
+
+static GType cwe_type = 0;
+
+
+GType
+caja_cwe_get_type (void)
+{
+    return cwe_type;
+}
+
+
+void
+caja_cwe_register_type (GTypeModule *module)
+{
+    static const GTypeInfo info = {
+        sizeof (CajaCweClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) caja_cwe_class_init,
+        NULL,
+        NULL,
+        sizeof (CajaCwe),
+        0,
+        (GInstanceInitFunc) caja_cwe_instance_init,
+    };
+
+    static const GInterfaceInfo menu_provider_iface_info = {
+        (GInterfaceInitFunc) caja_cwe_menu_provider_iface_init,
+        NULL,
+        NULL
+    };
+
+    cwe_type = g_type_module_register_type (module,
+                             G_TYPE_OBJECT,
+                             "CajaCwe",
+                             &info, 0);
+
+    g_type_module_add_interface (module,
+                     cwe_type,
+                     CAJA_TYPE_MENU_PROVIDER,
+                     &menu_provider_iface_info);
+}
+
+
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/index.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/index.html new file mode 100644 index 0000000..d4c7eee --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/index.html @@ -0,0 +1,153 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineIdCWESeverityMessage
missingIncludeinformationCppcheck cannot find all the include files (use --check-config for details)
image-converter/caja-image-converter-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
284unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
284unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
open-terminal/caja-open-terminal.c
321variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
43variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
402variableScope398styleThe scope of the variable 'w' can be reduced.
634variableScope398styleThe scope of the variable 'item' can be reduced.
sendto/caja-sendto-resources.c
10unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
10unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
121unusedStructMember563styleunion member 'Anonymous0::alignment' is never used.
121unusedStructMember563styleunion member 'Anonymous0::ptr' is never used.
sendto/plugins/caja-burn/caja-burn.c
135variableScope398styleThe scope of the variable 'fenum' can be reduced.
136variableScope398styleThe scope of the variable 'file_info' can be reduced.
137variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
59variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
65variableScope398styleThe scope of the variable 'jid' can be reduced.
203variableScope398styleThe scope of the variable 'account' can be reduced.
311variableScope398styleThe scope of the variable 'show' can be reduced.
409variableScope398styleThe scope of the variable 'value' can be reduced.
411variableScope398styleThe scope of the variable 'contact_props' can be reduced.
416variableScope398styleThe scope of the variable 'file_path' can be reduced.
sendto/plugins/pidgin/pidgin.c
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
740duplicateCondition398styleThe if condition is the same as the previous if condition
wallpaper/caja-wallpaper-extension.c
91variableScope398styleThe scope of the variable 'item' can be reduced.
+
+
+ + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/stats.html b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/stats.html new file mode 100644 index 0000000..facef4d --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/stats.html @@ -0,0 +1,114 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + + + + diff --git a/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/style.css b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/style.css new file mode 100644 index 0000000..07125f4 --- /dev/null +++ b/2021-06-20-001352-7924-cppcheck@05a180885c0d_master/style.css @@ -0,0 +1,137 @@ + +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif; + font-size: 13px; + line-height: 1.5; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +.header { + border-bottom: thin solid #aaa; +} + +.footer { + border-top: thin solid #aaa; + font-size: 90%; + margin-top: 5px; +} + +.footer ul { + list-style-type: none; + padding-left: 0; +} + +.footer > p { + margin: 4px; +} + +.wrapper { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -ms-flex-pack: justify; + justify-content: space-between; +} + +#menu, +#menu_index { + text-align: left; + width: 350px; + height: 90vh; + min-height: 200px; + overflow: auto; + position: -webkit-sticky; + position: sticky; + top: 0; + padding: 0 15px 15px 15px; +} + +#menu > a { + display: block; + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +#content, +#content_index { + background-color: #fff; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding: 0 15px 15px 15px; + width: calc(100% - 350px); + height: 100%; + overflow-x: auto; +} + +#filename { + margin-left: 10px; + font-size: 12px; + z-index: 1; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #b6b6b4; +} + +.inconclusive2 { + background-color: #b6b6b4; + display: inline-block; + margin-left: 4px; +} + +.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +.verbose .content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid #000; + background-color: #ffffcc; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +.highlighttable { + background-color: #fff; + z-index: 10; + position: relative; + margin: -10px; +} + +.linenos { + border-right: thin solid #aaa; + color: #d3d3d3; + padding-right: 6px; +} + +.d-none { + display: none; +} diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..174c3ed --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +caja-extensions.mate-desktop.dev diff --git a/index.html b/index.html new file mode 100644 index 0000000..c38c66d --- /dev/null +++ b/index.html @@ -0,0 +1,47 @@ + + + + + + caja-extensions Code Analyzer results + + +

+ mate-desktop/caja-extensions Static analyzer results +

+ GitHub + Build Status +
+Commit: 05a180885c0df3d36132b3506ff02208e86a82f2
+Compare: 5827807e577b...05a180885c0d
+Branch: master
+Time: 2021-06-20 00:13:52+00:00
+Messages:
+
+update copyright to 2021
+
+
+ + + -- cgit v1.2.1