From 2365bcf2d121d253c0ab7b7ce3d2da090dd3089c Mon Sep 17 00:00:00 2001 From: "raveit65 (via Travis CI)" Date: Fri, 26 Jun 2020 23:24:24 +0000 Subject: Deploy mate-desktop/caja-extensions to github.com/mate-desktop/caja-extensions.git:gh-pages --- .../index.html | 97 + .../report-598c80.html | 1018 ++++++++ .../report-b61851.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-6951da.html | 1018 ++++++++ .../report-d04d9f.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-450120.html | 1018 ++++++++ .../report-57a0bb.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-5c517c.html | 1018 ++++++++ .../report-683370.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-4457b5.html | 1018 ++++++++ .../report-e45fe9.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-02f73c.html | 1018 ++++++++ .../report-d927ba.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-064885.html | 1018 ++++++++ .../report-302aa9.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-61181b.html | 1018 ++++++++ .../report-b8d7d4.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-0125a7.html | 1018 ++++++++ .../report-3c397a.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ .../index.html | 97 + .../report-47a8f3.html | 1018 ++++++++ .../report-871a1b.html | 1018 ++++++++ .../scanview.css | 62 + .../sorttable.js | 492 ++++ .../0.html | 1574 +++++++++++ .../1.html | 1508 +++++++++++ .../10.html | 530 ++++ .../2.html | 486 ++++ .../3.html | 1874 ++++++++++++++ .../4.html | 922 +++++++ .../5.html | 566 ++++ .../6.html | 1272 +++++++++ .../7.html | 1122 ++++++++ .../8.html | 2730 ++++++++++++++++++++ .../9.html | 2186 ++++++++++++++++ .../index.html | 148 ++ .../stats.html | 101 + .../style.css | 149 ++ CNAME | 1 + index.html | 47 + 192 files changed, 178598 insertions(+) create mode 100644 2020-04-18-005919-8628-1@9cd55edc8599_master/index.html create mode 100644 2020-04-18-005919-8628-1@9cd55edc8599_master/report-598c80.html create mode 100644 2020-04-18-005919-8628-1@9cd55edc8599_master/report-b61851.html create mode 100644 2020-04-18-005919-8628-1@9cd55edc8599_master/scanview.css create mode 100644 2020-04-18-005919-8628-1@9cd55edc8599_master/sorttable.js create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/0.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/1.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/10.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/2.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/3.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/4.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/5.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/6.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/7.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/8.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/9.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/index.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/stats.html create mode 100644 2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/style.css create mode 100644 2020-04-18-210506-6150-1@be37bd1dc030_master/index.html create mode 100644 2020-04-18-210506-6150-1@be37bd1dc030_master/report-6951da.html create mode 100644 2020-04-18-210506-6150-1@be37bd1dc030_master/report-d04d9f.html create mode 100644 2020-04-18-210506-6150-1@be37bd1dc030_master/scanview.css create mode 100644 2020-04-18-210506-6150-1@be37bd1dc030_master/sorttable.js create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/0.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/1.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/10.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/2.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/3.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/4.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/5.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/6.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/7.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/8.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/9.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/index.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/stats.html create mode 100644 2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/style.css create mode 100644 2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/index.html create mode 100644 2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/report-450120.html create mode 100644 2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/report-57a0bb.html create mode 100644 2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/scanview.css create mode 100644 2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/sorttable.js create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/0.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/1.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/10.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/2.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/3.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/4.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/5.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/6.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/7.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/8.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/9.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/index.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/stats.html create mode 100644 2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/style.css create mode 100644 2020-06-21-110019-6106-1@9ead9ce3bdd6_master/index.html create mode 100644 2020-06-21-110019-6106-1@9ead9ce3bdd6_master/report-5c517c.html create mode 100644 2020-06-21-110019-6106-1@9ead9ce3bdd6_master/report-683370.html create mode 100644 2020-06-21-110019-6106-1@9ead9ce3bdd6_master/scanview.css create mode 100644 2020-06-21-110019-6106-1@9ead9ce3bdd6_master/sorttable.js create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/0.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/1.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/10.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/2.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/3.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/4.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/5.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/6.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/7.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/8.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/9.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/index.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/stats.html create mode 100644 2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/style.css create mode 100644 2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/index.html create mode 100644 2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/report-4457b5.html create mode 100644 2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/report-e45fe9.html create mode 100644 2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/scanview.css create mode 100644 2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/sorttable.js create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/0.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/1.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/10.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/2.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/3.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/4.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/5.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/6.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/7.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/8.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/9.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/index.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/stats.html create mode 100644 2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/style.css create mode 100644 2020-06-23-103637-6108-1@98f663d85b4e_master/index.html create mode 100644 2020-06-23-103637-6108-1@98f663d85b4e_master/report-02f73c.html create mode 100644 2020-06-23-103637-6108-1@98f663d85b4e_master/report-d927ba.html create mode 100644 2020-06-23-103637-6108-1@98f663d85b4e_master/scanview.css create mode 100644 2020-06-23-103637-6108-1@98f663d85b4e_master/sorttable.js create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/0.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/1.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/10.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/2.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/3.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/4.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/5.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/6.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/7.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/8.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/9.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/index.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/stats.html create mode 100644 2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/style.css create mode 100644 2020-06-23-104123-6106-1@22c7f5486c17_master/index.html create mode 100644 2020-06-23-104123-6106-1@22c7f5486c17_master/report-064885.html create mode 100644 2020-06-23-104123-6106-1@22c7f5486c17_master/report-302aa9.html create mode 100644 2020-06-23-104123-6106-1@22c7f5486c17_master/scanview.css create mode 100644 2020-06-23-104123-6106-1@22c7f5486c17_master/sorttable.js create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/0.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/1.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/10.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/2.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/3.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/4.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/5.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/6.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/7.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/8.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/9.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/index.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/stats.html create mode 100644 2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/style.css create mode 100644 2020-06-23-115720-6106-1@274d435c1798_master/index.html create mode 100644 2020-06-23-115720-6106-1@274d435c1798_master/report-61181b.html create mode 100644 2020-06-23-115720-6106-1@274d435c1798_master/report-b8d7d4.html create mode 100644 2020-06-23-115720-6106-1@274d435c1798_master/scanview.css create mode 100644 2020-06-23-115720-6106-1@274d435c1798_master/sorttable.js create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/0.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/1.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/10.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/2.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/3.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/4.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/5.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/6.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/7.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/8.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/9.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/index.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/stats.html create mode 100644 2020-06-23-115757-9686-cppcheck@274d435c1798_master/style.css create mode 100644 2020-06-23-120216-6106-1@274d435c1798_v1.25.0/index.html create mode 100644 2020-06-23-120216-6106-1@274d435c1798_v1.25.0/report-0125a7.html create mode 100644 2020-06-23-120216-6106-1@274d435c1798_v1.25.0/report-3c397a.html create mode 100644 2020-06-23-120216-6106-1@274d435c1798_v1.25.0/scanview.css create mode 100644 2020-06-23-120216-6106-1@274d435c1798_v1.25.0/sorttable.js create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/0.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/1.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/10.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/2.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/3.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/4.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/5.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/6.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/7.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/8.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/9.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/index.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/stats.html create mode 100644 2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/style.css create mode 100644 2020-06-26-232255-6106-1@a92e7aa4e086_master/index.html create mode 100644 2020-06-26-232255-6106-1@a92e7aa4e086_master/report-47a8f3.html create mode 100644 2020-06-26-232255-6106-1@a92e7aa4e086_master/report-871a1b.html create mode 100644 2020-06-26-232255-6106-1@a92e7aa4e086_master/scanview.css create mode 100644 2020-06-26-232255-6106-1@a92e7aa4e086_master/sorttable.js create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/0.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/1.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/10.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/2.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/3.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/4.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/5.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/6.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/7.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/8.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/9.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/index.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/stats.html create mode 100644 2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/style.css create mode 100644 CNAME create mode 100644 index.html diff --git a/2020-04-18-005919-8628-1@9cd55edc8599_master/index.html b/2020-04-18-005919-8628-1@9cd55edc8599_master/index.html new file mode 100644 index 0000000..b130913 --- /dev/null +++ b/2020-04-18-005919-8628-1@9cd55edc8599_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@747d133f3ca9
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Sat Apr 18 00:59:19 2020
+

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_info2931View Report
+ + diff --git a/2020-04-18-005919-8628-1@9cd55edc8599_master/report-598c80.html b/2020-04-18-005919-8628-1@9cd55edc8599_master/report-598c80.html new file mode 100644 index 0000000..2b82b46 --- /dev/null +++ b/2020-04-18-005919-8628-1@9cd55edc8599_master/report-598c80.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-04-18-005919-8628-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-04-18-005919-8628-1@9cd55edc8599_master/report-b61851.html b/2020-04-18-005919-8628-1@9cd55edc8599_master/report-b61851.html new file mode 100644 index 0000000..e571b24 --- /dev/null +++ b/2020-04-18-005919-8628-1@9cd55edc8599_master/report-b61851.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-04-18-005919-8628-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-04-18-005919-8628-1@9cd55edc8599_master/scanview.css b/2020-04-18-005919-8628-1@9cd55edc8599_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-04-18-005919-8628-1@9cd55edc8599_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/2020-04-18-005919-8628-1@9cd55edc8599_master/sorttable.js b/2020-04-18-005919-8628-1@9cd55edc8599_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-04-18-005919-8628-1@9cd55edc8599_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
#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, 
+  0213, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0213, 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, 0353, 0071, 0235, 0216, 0154, 0204, 
+  0251, 0100, 0374, 0001, 0206, 0310, 0377, 0344, 0070, 0103, 0216, 0376, 0115, 0061, 0107, 0211, 
+  0103, 0360, 0170, 0004, 0046, 0342, 0361, 0147, 0360, 0332, 0221, 0044, 0163, 0101, 0127, 0265, 
+  0143, 0343, 0357, 0050, 0024, 0116, 0110, 0140, 0222, 0214, 0300, 0127, 0361, 0170, 0035, 0175, 
+  0117, 0023, 0061, 0103, 0124, 0000, 0007, 0107, 0043, 0000, 0137, 0376, 0356, 0201, 0214, 0102, 
+  0322, 0304, 0234, 0305, 0210, 0213, 0245, 0103, 0341, 0014, 0215, 0000, 0141, 0163, 0304, 0201, 
+  0337, 0033, 0166, 0237, 0277, 0050, 0156, 0227, 0306, 0261, 0152, 0347, 0272, 0165, 0055, 0237, 
+  0040, 0111, 0021, 0360, 0057, 0153, 0033, 0046, 0002, 0305, 0001, 0246, 0041, 0107, 0152, 0300, 
+  0365, 0143, 0210, 0341, 0004, 0155, 0020, 0274, 0351, 0142, 0330, 0315, 0001, 0061, 0305, 0306, 
+  0153, 0007, 0233, 0053, 0371, 0243, 0011, 0216, 0204, 0361, 0160, 0340, 0071, 0267, 0360, 0210, 
+  0307, 0077, 0147, 0222, 0074, 0107, 0006, 0147, 0037, 0313, 0354, 0351, 0011, 0047, 0170, 0114, 
+  0244, 0014, 0367, 0074, 0105, 0165, 0103, 0012, 0041, 0015, 0036, 0130, 0230, 0046, 0300, 0277, 
+  0205, 0044, 0251, 0155, 0217, 0103, 0106, 0203, 0354, 0043, 0360, 0245, 0123, 0350, 0110, 0362, 
+  0020, 0021, 0023, 0051, 0176, 0303, 0220, 0260, 0111, 0056, 0206, 0364, 0057, 0370, 0077, 0024, 
+  0104, 0371, 0243, 0166, 0006, 0050, 0260, 0220, 0262, 0073, 0202, 0103, 0232, 0020, 0050, 0240, 
+  0104, 0142, 0004, 0226, 0110, 0222, 0177, 0123, 0275, 0071, 0012, 0306, 0244, 0226, 0315, 0062, 
+  0106, 0301, 0024, 0147, 0132, 0312, 0207, 0267, 0105, 0020, 0116, 0061, 0211, 0362, 0317, 0031, 
+  0071, 0221, 0236, 0163, 0312, 0110, 0204, 0170, 0167, 0325, 0240, 0273, 0326, 0042, 0157, 0355, 
+  0050, 0037, 0113, 0041, 0351, 0250, 0077, 0245, 0252, 0306, 0154, 0001, 0136, 0170, 0154, 0141, 
+  0365, 0353, 0332, 0267, 0346, 0310, 0024, 0321, 0314, 0040, 0237, 0140, 0032, 0020, 0364, 0220, 
+  0115, 0077, 0317, 0200, 0204, 0343, 0311, 0324, 0224, 0106, 0260, 0330, 0220, 0142, 0314, 0204, 
+  0140, 0063, 0135, 0042, 0306, 0261, 0264, 0043, 0050, 0344, 0242, 0004, 0174, 0271, 0072, 0011, 
+  0034, 0102, 0242, 0103, 0230, 0304, 0060, 0224, 0153, 0144, 0151, 0077, 0305, 0332, 0202, 0141, 
+  0326, 0123, 0000, 0071, 0202, 0153, 0152, 0051, 0124, 0134, 0052, 0305, 0240, 0233, 0352, 0333, 
+  0125, 0205, 0205, 0176, 0017, 0056, 0131, 0052, 0202, 0104, 0054, 0063, 0073, 0107, 0064, 0052, 
+  0045, 0334, 0230, 0245, 0165, 0003, 0316, 0255, 0162, 0254, 0076, 0367, 0300, 0133, 0252, 0242, 
+  0141, 0214, 0021, 0051, 0264, 0265, 0340, 0246, 0300, 0061, 0124, 0063, 0253, 0164, 0133, 0232, 
+  0040, 0232, 0222, 0162, 0024, 0042, 0374, 0204, 0222, 0040, 0102, 0017, 0060, 0045, 0302, 0234, 
+  0203, 0362, 0304, 0300, 0317, 0035, 0262, 0011, 0141, 0232, 0240, 0040, 0245, 0322, 0135, 0020, 
+  0114, 0167, 0020, 0032, 0222, 0071, 0134, 0046, 0101, 0062, 0145, 0363, 0140, 0065, 0206, 0152, 
+  0026, 0353, 0136, 0171, 0223, 0061, 0014, 0037, 0245, 0055, 0324, 0167, 0211, 0026, 0061, 0244, 
+  0221, 0371, 0120, 0037, 0060, 0041, 0346, 0124, 0061, 0113, 0160, 0156, 0330, 0156, 0225, 0120, 
+  0205, 0243, 0337, 0160, 0275, 0315, 0115, 0301, 0153, 0146, 0012, 0371, 0272, 0163, 0374, 0246, 
+  0140, 0064, 0243, 0017, 0167, 0072, 0366, 0332, 0230, 0216, 0105, 0342, 0027, 0213, 0136, 0046, 
+  0266, 0321, 0172, 0221, 0313, 0154, 0104, 0122, 0153, 0177, 0005, 0302, 0156, 0011, 0272, 0155, 
+  0163, 0165, 0101, 0316, 0316, 0346, 0320, 0326, 0322, 0252, 0035, 0123, 0354, 0020, 0127, 0230, 
+  0270, 0241, 0133, 0256, 0202, 0354, 0017, 0361, 0025, 0225, 0000, 0225, 0172, 0273, 0140, 0001, 
+  0011, 0236, 0124, 0073, 0350, 0002, 0210, 0246, 0060, 0222, 0153, 0126, 0026, 0137, 0003, 0237, 
+  0062, 0132, 0335, 0157, 0041, 0130, 0305, 0200, 0135, 0147, 0203, 0311, 0363, 0252, 0202, 0366, 
+  0015, 0200, 0153, 0012, 0136, 0041, 0200, 0062, 0000, 0017, 0142, 0030, 0105, 0065, 0263, 0245, 
+  0036, 0010, 0135, 0243, 0152, 0015, 0212, 0066, 0340, 0250, 0313, 0031, 0006, 0273, 0060, 0060, 
+  0262, 0134, 0055, 0053, 0326, 0033, 0106, 0245, 0152, 0166, 0121, 0117, 0053, 0052, 0152, 0113, 
+  0115, 0315, 0001, 0322, 0003, 0251, 0030, 0250, 0157, 0060, 0302, 0154, 0075, 0042, 0133, 0105, 
+  0047, 0201, 0052, 0034, 0360, 0354, 0333, 0074, 0106, 0003, 0165, 0274, 0115, 0102, 0266, 0073, 
+  0104, 0262, 0141, 0100, 0047, 0353, 0345, 0263, 0256, 0214, 0255, 0251, 0255, 0141, 0144, 0147, 
+  0036, 0351, 0031, 0115, 0206, 0042, 0226, 0323, 0325, 0112, 0220, 0010, 0310, 0105, 0023, 0106, 
+  0131, 0212, 0375, 0324, 0002, 0134, 0021, 0207, 0062, 0057, 0242, 0221, 0164, 0001, 0202, 0161, 
+  0123, 0176, 0145, 0301, 0351, 0166, 0257, 0145, 0301, 0252, 0156, 0360, 0332, 0030, 0171, 0275, 
+  0150, 0266, 0225, 0144, 0153, 0033, 0045, 0055, 0361, 0013, 0223, 0261, 0266, 0374, 0303, 0015, 
+  0233, 0215, 0231, 0364, 0246, 0367, 0150, 0261, 0052, 0032, 0207, 0331, 0223, 0061, 0133, 0010, 
+  0371, 0104, 0171, 0011, 0260, 0037, 0126, 0333, 0202, 0215, 0045, 0201, 0134, 0337, 0370, 0262, 
+  0371, 0260, 0024, 0233, 0100, 0041, 0024, 0062, 0222, 0316, 0314, 0364, 0056, 0371, 0141, 0201, 
+  0146, 0111, 0175, 0273, 0125, 0113, 0377, 0252, 0277, 0270, 0352, 0017, 0273, 0352, 0263, 0066, 
+  0121, 0317, 0033, 0054, 0344, 0257, 0051, 0131, 0377, 0302, 0135, 0134, 0014, 0134, 0123, 0262, 
+  0201, 0353, 0056, 0372, 0256, 0061, 0131, 0317, 0365, 0056, 0026, 0277, 0364, 0007, 0073, 0010, 
+  0347, 0112, 0114, 0314, 0373, 0353, 0113, 0272, 0236, 0173, 0151, 0116, 0170, 0345, 0111, 0102, 
+  0117, 0137, 0302, 0274, 0235, 0206, 0222, 0113, 0212, 0245, 0253, 0251, 0252, 0063, 0300, 0055, 
+  0253, 0376, 0135, 0321, 0156, 0230, 0263, 0142, 0327, 0321, 0147, 0332, 0352, 0012, 0252, 0277, 
+  0042, 0150, 0272, 0273, 0217, 0134, 0142, 0232, 0072, 0213, 0266, 0127, 0230, 0336, 0141, 0255, 
+  0060, 0177, 0251, 0050, 0361, 0110, 0326, 0220, 0362, 0220, 0067, 0306, 0013, 0104, 0022, 0033, 
+  0042, 0151, 0114, 0140, 0357, 0107, 0114, 0140, 0035, 0274, 0365, 0260, 0156, 0005, 0347, 0346, 
+  0030, 0067, 0016, 0101, 0065, 0260, 0255, 0305, 0325, 0346, 0356, 0037, 0224, 0273, 0267, 0232, 
+  0235, 0207, 0220, 0330, 0254, 0374, 0364, 0262, 0362, 0155, 0176, 0023, 0316, 0322, 0030, 0370, 
+  0145, 0065, 0041, 0273, 0232, 0035, 0137, 0302, 0177, 0027, 0143, 0272, 0136, 0017, 0214, 0103, 
+  0251, 0167, 0371, 0154, 0347, 0052, 0340, 0076, 0372, 0202, 0327, 0027, 0337, 0200, 0277, 0366, 
+  0376, 0344, 0076, 0316, 0147, 0233, 0135, 0330, 0354, 0102, 0043, 0273, 0100, 0074, 0224, 0063, 
+  0330, 0072, 0144, 0233, 0136, 0374, 0360, 0364, 0242, 0147, 0323, 0213, 0343, 0334, 0032, 0224, 
+  0203, 0027, 0154, 0366, 0276, 0073, 0203, 0067, 0252, 0017, 0273, 0057, 0150, 0063, 0020, 0233, 
+  0201, 0234, 0150, 0006, 0162, 0042, 0041, 0333, 0077, 0070, 0022, 0323, 0317, 0166, 0002, 0037, 
+  0137, 0316, 0361, 0066, 0205, 0236, 0147, 0232, 0076, 0225, 0044, 0332, 0263, 0111, 0364, 0236, 
+  0246, 0040, 0326, 0043, 0327, 0170, 0344, 0077, 0120, 0166, 0004, 0313, 0272, 0144, 0235, 0031, 
+  0174, 0176, 0330, 0056, 0171, 0252, 0124, 0175, 0052, 0076, 0371, 0334, 0372, 0344, 0372, 0031, 
+  0175, 0141, 0175, 0262, 0175, 0155, 0342, 0220, 0135, 0362, 0245, 0255, 0153, 0276, 0153, 0135, 
+  0323, 0373, 0250, 0272, 0146, 0065, 0246, 0025, 0304, 0345, 0204, 0245, 0104, 0253, 0227, 0013, 
+  0263, 0323, 0102, 0317, 0146, 0250, 0167, 0032, 0250, 0312, 0377, 0354, 0327, 0111, 0240, 0122, 
+  0337, 0242, 0056, 0052, 0160, 0356, 0152, 0316, 0216, 0052, 0236, 0120, 0010, 0216, 0145, 0244, 
+  0200, 0112, 0337, 0327, 0174, 0155, 0262, 0352, 0167, 0256, 0102, 0014, 0340, 0250, 0373, 0056, 
+  0106, 0140, 0314, 0110, 0004, 0272, 0145, 0052, 0255, 0346, 0157, 0254, 0327, 0366, 0016, 0177, 
+  0032, 0237, 0134, 0073, 0260, 0303, 0310, 0366, 0024, 0240, 0143, 0117, 0001, 0152, 0006, 0143, 
+  0366, 0024, 0240, 0075, 0005, 0170, 0042, 0133, 0175, 0060, 0216, 0021, 0215, 0336, 0155, 0227, 
+  0357, 0132, 0261, 0267, 0373, 0173, 0247, 0266, 0277, 0147, 0067, 0341, 0016, 0245, 0274, 0260, 
+  0166, 0102, 0050, 0223, 0044, 0320, 0075, 0030, 0164, 0010, 0166, 0052, 0324, 0131, 0306, 0002, 
+  0267, 0164, 0226, 0337, 0227, 0026, 0331, 0162, 0331, 0321, 0355, 0311, 0235, 0110, 0271, 0114, 
+  0060, 0107, 0052, 0032, 0071, 0352, 0222, 0076, 0353, 0227, 0367, 0165, 0053, 0316, 0036, 0066, 
+  0152, 0277, 0152, 0266, 0133, 0212, 0260, 0025, 0371, 0142, 0252, 0156, 0232, 0064, 0010, 0175, 
+  0365, 0255, 0163, 0165, 0101, 0046, 0246, 0216, 0352, 0143, 0127, 0160, 0333, 0116, 0122, 0232, 
+  0260, 0151, 0030, 0363, 0266, 0022, 0357, 0266, 0021, 0353, 0266, 0031, 0347, 0226, 0274, 0303, 
+  0266, 0235, 0123, 0351, 0232, 0206, 0175, 0165, 0330, 0226, 0330, 0017, 0263, 0304, 0176, 0053, 
+  0203, 0221, 0254, 0215, 0055, 0260, 0357, 0115, 0201, 0375, 0160, 0257, 0127, 0064, 0271, 0235, 
+  0260, 0126, 0336, 0372, 0333, 0025, 0067, 0145, 0334, 0274, 0155, 0072, 0277, 0251, 0270, 0063, 
+  0307, 0321, 0004, 0211, 0227, 0051, 0265, 0371, 0330, 0221, 0331, 0144, 0314, 0150, 0042, 0107, 
+  0323, 0351, 0003, 0177, 0165, 0353, 0257, 0234, 0212, 0353, 0215, 0352, 0111, 0057, 0237, 0111, 
+  0275, 0102, 0322, 0067, 0017, 0223, 0315, 0013, 0302, 0207, 0335, 0265, 0377, 0072, 0360, 0077, 
+  0355, 0112, 0320, 0056, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 
+  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"
+  "\213\007\000\000\137\144\153\207\010\000\000\000\213\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\353\071\235\216\154\204"
+  "\251\100\374\001\206\310\377\344\070\103\216\376\115\061\107\211"
+  "\103\360\170\004\046\342\361\147\360\332\221\044\163\101\127\265"
+  "\143\343\357\050\024\116\110\140\222\214\300\127\361\170\035\175"
+  "\117\023\061\103\124\000\007\107\043\000\137\376\356\201\214\102"
+  "\322\304\234\305\210\213\245\103\341\014\215\000\141\163\304\201"
+  "\337\033\166\237\277\050\156\227\306\261\152\347\272\165\055\237"
+  "\040\111\021\360\057\153\033\046\002\305\001\246\041\107\152\300"
+  "\365\143\210\341\004\155\020\274\351\142\330\315\001\061\305\306"
+  "\153\007\233\053\371\243\011\216\204\361\160\340\071\267\360\210"
+  "\307\077\147\222\074\107\006\147\037\313\354\351\011\047\170\114"
+  "\244\014\367\074\105\165\103\012\041\015\036\130\230\046\300\277"
+  "\205\044\251\155\217\103\106\203\354\043\360\245\123\350\110\362"
+  "\020\021\023\051\176\303\220\260\111\056\206\364\057\370\077\024"
+  "\104\371\243\166\006\050\260\220\262\073\202\103\232\020\050\240"
+  "\104\142\004\226\110\222\177\123\275\071\012\306\244\226\315\062"
+  "\106\301\024\147\132\312\207\267\105\020\116\061\211\362\317\031"
+  "\071\221\236\163\312\110\204\170\167\325\240\273\326\042\157\355"
+  "\050\037\113\041\351\250\077\245\252\306\154\001\136\170\154\141"
+  "\365\353\332\267\346\310\024\321\314\040\237\140\032\020\364\220"
+  "\115\077\317\200\204\343\311\324\224\106\260\330\220\142\314\204"
+  "\140\063\135\042\306\261\264\043\050\344\242\004\174\271\072\011"
+  "\034\102\242\103\230\304\060\224\153\144\151\077\305\332\202\141"
+  "\326\123\000\071\202\153\152\051\124\134\052\305\240\233\352\333"
+  "\125\205\205\176\017\056\131\052\202\104\054\063\073\107\064\052"
+  "\045\334\230\245\165\003\316\255\162\254\076\367\300\133\252\242"
+  "\141\214\021\051\264\265\340\246\300\061\124\063\253\164\133\232"
+  "\040\232\222\162\024\042\374\204\222\040\102\017\060\045\302\234"
+  "\203\362\304\300\317\035\262\011\141\232\240\040\245\322\135\020"
+  "\114\167\020\032\222\071\134\046\101\062\145\363\140\065\206\152"
+  "\026\353\136\171\223\061\014\037\245\055\324\167\211\026\061\244"
+  "\221\371\120\037\060\041\346\124\061\113\160\156\330\156\225\120"
+  "\205\243\337\160\275\315\115\301\153\146\012\371\272\163\374\246"
+  "\140\064\243\017\167\072\366\332\230\216\105\342\027\213\136\046"
+  "\266\321\172\221\313\154\104\122\153\177\005\302\156\011\272\155"
+  "\163\165\101\316\316\346\320\326\322\252\035\123\354\020\127\230"
+  "\270\241\133\256\202\354\017\361\025\225\000\225\172\273\140\001"
+  "\011\236\124\073\350\002\210\246\060\222\153\126\026\137\003\237"
+  "\062\132\335\157\041\130\305\200\135\147\203\311\363\252\202\366"
+  "\015\200\153\012\136\041\200\062\000\017\142\030\105\065\263\245"
+  "\036\010\135\243\152\015\212\066\340\250\313\031\006\273\060\060"
+  "\262\134\055\053\326\033\106\245\152\166\121\117\053\052\152\113"
+  "\115\315\001\322\003\251\030\250\157\060\302\154\075\042\133\105"
+  "\047\201\052\034\360\354\333\074\106\003\165\274\115\102\266\073"
+  "\104\262\141\100\047\353\345\263\256\214\255\251\255\141\144\147"
+  "\036\351\031\115\206\042\226\323\325\112\220\010\310\105\023\106"
+  "\131\212\375\324\002\134\021\207\062\057\242\221\164\001\202\161"
+  "\123\176\145\301\351\166\257\145\301\252\156\360\332\030\171\275"
+  "\150\266\225\144\153\033\045\055\361\013\223\261\266\374\303\015"
+  "\233\215\231\364\246\367\150\261\052\032\207\331\223\061\133\010"
+  "\371\104\171\011\260\037\126\333\202\215\045\201\134\337\370\262"
+  "\371\260\024\233\100\041\024\062\222\316\314\364\056\371\141\201"
+  "\146\111\175\273\125\113\377\252\277\270\352\017\273\352\263\066"
+  "\121\317\033\054\344\257\051\131\377\302\135\134\014\134\123\262"
+  "\201\353\056\372\256\061\131\317\365\056\026\277\364\007\073\010"
+  "\347\112\114\314\373\353\113\272\236\173\151\116\170\345\111\102"
+  "\117\137\302\274\235\206\222\113\212\245\253\251\252\063\300\055"
+  "\253\376\135\321\156\230\263\142\327\321\147\332\352\012\252\277"
+  "\042\150\272\273\217\134\142\232\072\213\266\127\230\336\141\255"
+  "\060\177\251\050\361\110\326\220\362\220\067\306\013\104\022\033"
+  "\042\151\114\140\357\107\114\140\035\274\365\260\156\005\347\346"
+  "\030\067\016\101\065\260\255\305\325\346\356\037\224\273\267\232"
+  "\235\207\220\330\254\374\364\262\362\155\176\023\316\322\030\370"
+  "\145\065\041\273\232\035\137\302\177\027\143\272\136\017\214\103"
+  "\251\167\371\154\347\052\340\076\372\202\327\027\337\200\277\366"
+  "\376\344\076\316\147\233\135\330\354\102\043\273\100\074\224\063"
+  "\330\072\144\233\136\374\360\364\242\147\323\213\343\334\032\224"
+  "\203\027\154\366\276\073\203\067\252\017\273\057\150\063\020\233"
+  "\201\234\150\006\162\042\041\333\077\070\022\323\317\166\002\037"
+  "\137\316\361\066\205\236\147\232\076\225\044\332\263\111\364\236"
+  "\246\040\326\043\327\170\344\077\120\166\004\313\272\144\235\031"
+  "\174\176\330\056\171\252\124\175\052\076\371\334\372\344\372\031"
+  "\175\141\175\262\175\155\342\220\135\362\245\255\153\276\153\135"
+  "\323\373\250\272\146\065\246\025\304\345\204\245\104\253\227\013"
+  "\263\323\102\317\146\250\167\032\250\312\377\354\327\111\240\122"
+  "\337\242\056\052\160\356\152\316\216\052\236\120\010\216\145\244"
+  "\200\112\337\327\174\155\262\352\167\256\102\014\340\250\373\056"
+  "\106\140\314\110\004\272\145\052\255\346\157\254\327\366\016\177"
+  "\032\237\134\073\260\303\310\366\024\240\143\117\001\152\006\143"
+  "\366\024\240\075\005\170\042\133\175\060\216\021\215\336\155\227"
+  "\357\132\261\267\373\173\247\266\277\147\067\341\016\245\274\260"
+  "\166\102\050\223\044\320\075\030\164\010\166\052\324\131\306\002"
+  "\267\164\226\337\227\026\331\162\331\321\355\311\235\110\271\114"
+  "\060\107\052\032\071\352\222\076\353\227\367\165\053\316\036\066"
+  "\152\277\152\266\133\212\260\025\371\142\252\156\232\064\010\175"
+  "\365\255\163\165\101\046\246\216\352\143\127\160\333\116\122\232"
+  "\260\151\030\363\266\022\357\266\021\353\266\031\347\226\274\303"
+  "\266\235\123\351\232\206\175\165\330\226\330\017\263\304\176\053"
+  "\203\221\254\215\055\260\357\115\201\375\160\257\127\064\271\235"
+  "\260\126\336\372\333\025\067\145\334\274\155\072\277\251\270\063"
+  "\307\321\004\211\227\051\265\371\330\221\331\144\314\150\042\107"
+  "\323\351\003\177\165\353\257\234\212\353\215\352\111\057\237\111"
+  "\275\102\322\067\017\223\315\013\302\207\335\265\377\072\360\077"
+  "\355\112\320\056\000\050\165\165\141\171\051\143\141\152\141\057"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/1.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/10.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/2.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/3.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/4.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/4.html new file mode 100644 index 0000000..df1c99c --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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[1720]; 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, 
+  0267, 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, 0006, 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, 0026, 0354, 0002, 0015, 0262, 0171, 0062, 0374, 0016, 0324, 0004, 0224, 0023, 0255, 
+  0047, 0350, 0306, 0334, 0377, 0275, 0040, 0063, 0100, 0001, 0213, 0046, 0210, 0245, 0237, 0103, 
+  0224, 0316, 0263, 0063, 0143, 0045, 0143, 0120, 0146, 0035, 0010, 0262, 0200, 0011, 0132, 0062, 
+  0315, 0102, 0016, 0150, 0172, 0253, 0022, 0030, 0017, 0236, 0376, 0165, 0117, 0246, 0104, 0340, 
+  0073, 0111, 0023, 0215, 0246, 0327, 0204, 0353, 0332, 0371, 0214, 0112, 0201, 0323, 0117, 0064, 
+  0215, 0054, 0330, 0002, 0204, 0351, 0151, 0020, 0121, 0021, 0156, 0074, 0310, 0167, 0337, 0214, 
+  0220, 0321, 0117, 0046, 0304, 0312, 0240, 0147, 0301, 0051, 0160, 0037, 0052, 0276, 0062, 0302, 
+  0345, 0054, 0047, 0203, 0222, 0357, 0004, 0247, 0154, 0060, 0022, 0107, 0371, 0170, 0067, 0273, 
+  0064, 0314, 0130, 0006, 0004, 0106, 0021, 0241, 0071, 0061, 0304, 0262, 0143, 0202, 0326, 0140, 
+  0301, 0277, 0331, 0325, 0202, 0133, 0331, 0357, 0367, 0273, 0021, 0231, 0143, 0355, 0165, 0014, 
+  0170, 0156, 0225, 0327, 0302, 0145, 0064, 0355, 0001, 0320, 0071, 0343, 0121, 0376, 0235, 0202, 
+  0163, 0253, 0342, 0163, 0311, 0043, 0120, 0203, 0315, 0204, 0301, 0316, 0214, 0174, 0166, 0220, 
+  0031, 0203, 0040, 0274, 0227, 0375, 0264, 0102, 0016, 0345, 0003, 0332, 0342, 0330, 0343, 0362, 
+  0347, 0235, 0177, 0375, 0331, 0351, 0202, 0131, 0020, 0065, 0143, 0002, 0163, 0270, 0263, 0204, 
+  0015, 0107, 0036, 0040, 0212, 0315, 0346, 0276, 0060, 0106, 0306, 0236, 0020, 0241, 0064, 0106, 
+  0056, 0232, 0002, 0111, 0305, 0254, 0074, 0211, 0261, 0336, 0003, 0115, 0255, 0033, 0061, 0214, 
+  0022, 0336, 0004, 0120, 0307, 0204, 0132, 0147, 0126, 0272, 0216, 0133, 0132, 0204, 0246, 0053, 
+  0141, 0242, 0200, 0354, 0210, 0305, 0051, 0270, 0304, 0222, 0041, 0212, 0342, 0153, 0053, 0102, 
+  0027, 0034, 0047, 0153, 0231, 0030, 0254, 0315, 0072, 0365, 0020, 0016, 0165, 0056, 0122, 0122, 
+  0034, 0053, 0337, 0360, 0223, 0075, 0247, 0336, 0000, 0207, 0371, 0320, 0113, 0130, 0327, 0146, 
+  0102, 0340, 0116, 0063, 0305, 0137, 0034, 0216, 0245, 0032, 0131, 0245, 0333, 0153, 0310, 0112, 
+  0137, 0120, 0005, 0024, 0330, 0022, 0064, 0216, 0340, 0216, 0044, 0334, 0370, 0143, 0310, 0074, 
+  0071, 0232, 0346, 0016, 0335, 0007, 0060, 0321, 0200, 0023, 0141, 0235, 0006, 0147, 0242, 0005, 
+  0321, 0204, 0257, 0310, 0132, 0143, 0075, 0227, 0053, 0274, 0331, 0103, 0065, 0212, 0135, 0257, 
+  0136, 0104, 0114, 0350, 0275, 0265, 0210, 0372, 0045, 0341, 0041, 0046, 0042, 0362, 0337, 0352, 
+  0035, 0343, 0334, 0037, 0052, 0226, 0232, 0345, 0346, 0175, 0121, 0105, 0224, 0163, 0367, 0005, 
+  0007, 0174, 0210, 0101, 0244, 0361, 0242, 0013, 0163, 0370, 0126, 0141, 0250, 0157, 0323, 0026, 
+  0206, 0147, 0145, 0166, 0052, 0363, 0260, 0013, 0145, 0166, 0221, 0357, 0046, 0275, 0214, 0154, 
+  0257, 0230, 0223, 0323, 0354, 0005, 0022, 0223, 0050, 0312, 0302, 0354, 0125, 0163, 0010, 0172, 
+  0217, 0323, 0334, 0253, 0072, 0252, 0371, 0172, 0011, 0007, 0123, 0367, 0030, 0272, 0357, 0031, 
+  0352, 0022, 0262, 0326, 0066, 0333, 0125, 0032, 0320, 0070, 0377, 0151, 0221, 0003, 0371, 0070, 
+  0313, 0153, 0225, 0045, 0330, 0257, 0342, 0320, 0052, 0031, 0124, 0352, 0217, 0361, 0003, 0341, 
+  0154, 0126, 0035, 0106, 0034, 0054, 0232, 0223, 0310, 0072, 0243, 0134, 0037, 0205, 0024, 0325, 
+  0353, 0072, 0231, 0345, 0146, 0330, 0247, 0164, 0063, 0151, 0055, 0202, 0134, 0363, 0017, 0140, 
+  0334, 0241, 0314, 0163, 0062, 0320, 0026, 0013, 0170, 0153, 0312, 0303, 0121, 0055, 0174, 0051, 
+  0043, 0334, 0314, 0270, 0121, 0054, 0102, 0145, 0323, 0017, 0344, 0105, 0027, 0374, 0250, 0053, 
+  0160, 0256, 0332, 0040, 0120, 0126, 0257, 0266, 0026, 0330, 0012, 0003, 0225, 0074, 0131, 0010, 
+  0137, 0044, 0225, 0262, 0161, 0313, 0347, 0213, 0134, 0204, 0062, 0365, 0174, 0131, 0062, 0044, 
+  0343, 0324, 0335, 0150, 0114, 0323, 0321, 0160, 0317, 0037, 0166, 0056, 0275, 0256, 0044, 0350, 
+  0302, 0063, 0157, 0032, 0377, 0353, 0163, 0216, 0146, 0371, 0107, 0255, 0231, 0021, 0143, 0010, 
+  0235, 0127, 0046, 0010, 0325, 0130, 0254, 0106, 0156, 0221, 0134, 0064, 0045, 0251, 0166, 0277, 
+  0316, 0124, 0372, 0120, 0275, 0372, 0104, 0155, 0155, 0370, 0117, 0236, 0055, 0157, 0323, 0154, 
+  0043, 0161, 0236, 0100, 0237, 0262, 0132, 0155, 0142, 0215, 0066, 0104, 0231, 0266, 0110, 0252, 
+  0313, 0210, 0000, 0023, 0375, 0147, 0133, 0324, 0236, 0105, 0147, 0245, 0037, 0024, 0260, 0220, 
+  0202, 0121, 0274, 0142, 0321, 0014, 0154, 0070, 0173, 0351, 0036, 0216, 0312, 0252, 0056, 0336, 
+  0227, 0125, 0235, 0115, 0250, 0322, 0204, 0014, 0226, 0257, 0157, 0102, 0247, 0244, 0351, 0303, 
+  0343, 0326, 0364, 0155, 0112, 0062, 0267, 0176, 0306, 0072, 0034, 0133, 0011, 0121, 0243, 0067, 
+  0236, 0110, 0237, 0262, 0366, 0173, 0325, 0165, 0376, 0254, 0054, 0071, 0260, 0150, 0055, 0274, 
+  0323, 0312, 0212, 0136, 0115, 0253, 0253, 0231, 0122, 0001, 0134, 0016, 0130, 0012, 0264, 0071, 
+  0261, 0110, 0053, 0325, 0047, 0277, 0327, 0254, 0022, 0255, 0212, 0024, 0307, 0125, 0205, 0226, 
+  0072, 0363, 0257, 0240, 0015, 0023, 0231, 0265, 0324, 0042, 0265, 0112, 0240, 0130, 0230, 0030, 
+  0320, 0245, 0122, 0333, 0116, 0331, 0054, 0274, 0202, 0354, 0344, 0053, 0130, 0022, 0236, 0330, 
+  0237, 0241, 0065, 0031, 0064, 0050, 0223, 0151, 0065, 0176, 0157, 0301, 0166, 0327, 0341, 0364, 
+  0156, 0233, 0234, 0130, 0277, 0376, 0334, 0202, 0072, 0267, 0240, 0332, 0267, 0240, 0076, 0127, 
+  0366, 0061, 0336, 0146, 0007, 0252, 0165, 0222, 0121, 0332, 0110, 0376, 0161, 0035, 0250, 0071, 
+  0320, 0302, 0211, 0134, 0166, 0114, 0100, 0323, 0321, 0322, 0143, 0271, 0103, 0152, 0353, 0024, 
+  0075, 0244, 0347, 0377, 0255, 0353, 0203, 0256, 0323, 0311, 0103, 0320, 0354, 0037, 0351, 0375, 
+  0374, 0322, 0254, 0303, 0026, 0104, 0244, 0310, 0012, 0063, 0021, 0131, 0365, 0065, 0122, 0035, 
+  0107, 0055, 0326, 0070, 0352, 0036, 0036, 0201, 0017, 0216, 0306, 0307, 0122, 0312, 0235, 0160, 
+  0275, 0346, 0347, 0001, 0075, 0212, 0264, 0075, 0106, 0375, 0045, 0214, 0132, 0357, 0370, 0100, 
+  0310, 0176, 0327, 0341, 0351, 0210, 0175, 0035, 0372, 0250, 0216, 0272, 0361, 0115, 0255, 0270, 
+  0271, 0045, 0167, 0146, 0315, 0335, 0130, 0164, 0047, 0126, 0335, 0320, 0262, 0033, 0326, 0372, 
+  0355, 0225, 0367, 0351, 0040, 0351, 0026, 0036, 0314, 0156, 0034, 0157, 0166, 0222, 0364, 0132, 
+  0152, 0174, 0260, 0224, 0323, 0153, 0202, 0113, 0300, 0351, 0241, 0346, 0157, 0136, 0170, 0230, 
+  0201, 0205, 0256, 0237, 0267, 0231, 0071, 0355, 0377, 0361, 0070, 0036, 0144, 0137, 0315, 0101, 
+  0154, 0314, 0356, 0207, 0217, 0243, 0126, 0160, 0263, 0166, 0313, 0075, 0370, 0203, 0075, 0262, 
+  0270, 0051, 0114, 0076, 0117, 0237, 0235, 0104, 0233, 0273, 0106, 0077, 0316, 0111, 0274, 0243, 
+  0324, 0352, 0334, 0117, 0174, 0143, 0375, 0104, 0033, 0246, 0142, 0005, 0132, 0237, 0373, 0211, 
+  0307, 0324, 0117, 0074, 0335, 0053, 0223, 0076, 0067, 0001, 0153, 0351, 0355, 0362, 0046, 0143, 
+  0176, 0353, 0302, 0020, 0223, 0150, 0034, 0326, 0336, 0154, 0324, 0040, 0322, 0275, 0055, 0301, 
+  0223, 0011, 0215, 0057, 0067, 0066, 0354, 0364, 0356, 0074, 0240, 0332, 0354, 0175, 0163, 0131, 
+  0370, 0070, 0173, 0277, 0215, 0333, 0045, 0125, 0057, 0227, 0262, 0027, 0110, 0075, 0120, 0112, 
+  0252, 0327, 0270, 0016, 0375, 0326, 0017, 0013, 0166, 0057, 0035, 0345, 0052, 0124, 0026, 0342, 
+  0116, 0133, 0205, 0312, 0143, 0134, 0366, 0317, 0233, 0124, 0245, 0367, 0026, 0047, 0056, 0333, 
+  0306, 0211, 0042, 0215, 0305, 0327, 0212, 0371, 0113, 0267, 0336, 0346, 0052, 0305, 0026, 0242, 
+  0060, 0034, 0330, 0034, 0051, 0226, 0102, 0333, 0335, 0364, 0176, 0107, 0323, 0302, 0253, 0061, 
+  0233, 0270, 0354, 0116, 0255, 0107, 0160, 0151, 0265, 0373, 0371, 0225, 0215, 0023, 0374, 0305, 
+  0240, 0056, 0076, 0122, 0265, 0165, 0340, 0363, 0103, 0343, 0377, 0001, 0224, 0300, 0104, 0026, 
+  0000, 0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1720]; 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"
+  "\267\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\006\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\026\354\002\015\262\171\062\374\016\324\004\224\023\255"
+  "\047\350\306\334\377\275\040\063\100\001\213\046\210\245\237\103"
+  "\224\316\263\063\143\045\143\120\146\035\010\262\200\011\132\062"
+  "\315\102\016\150\172\253\022\030\017\236\376\165\117\246\104\340"
+  "\073\111\023\215\246\327\204\353\332\371\214\112\201\323\117\064"
+  "\215\054\330\002\204\351\151\020\121\021\156\074\310\167\337\214"
+  "\220\321\117\046\304\312\240\147\301\051\160\037\052\276\062\302"
+  "\345\054\047\203\222\357\004\247\154\060\022\107\371\170\067\273"
+  "\064\314\130\006\004\106\021\241\071\061\304\262\143\202\326\140"
+  "\301\277\331\325\202\133\331\357\367\273\021\231\143\355\165\014"
+  "\170\156\225\327\302\145\064\355\001\320\071\343\121\376\235\202"
+  "\163\253\342\163\311\043\120\203\315\204\301\316\214\174\166\220"
+  "\031\203\040\274\227\375\264\102\016\345\003\332\342\330\343\362"
+  "\347\235\177\375\331\351\202\131\020\065\143\002\163\270\263\204"
+  "\015\107\036\040\212\315\346\276\060\106\306\236\020\241\064\106"
+  "\056\232\002\111\305\254\074\211\261\336\003\115\255\033\061\214"
+  "\022\336\004\120\307\204\132\147\126\272\216\133\132\204\246\053"
+  "\141\242\200\354\210\305\051\270\304\222\041\212\342\153\053\102"
+  "\027\034\047\153\231\030\254\315\072\365\020\016\165\056\122\122"
+  "\034\053\337\360\223\075\247\336\000\207\371\320\113\130\327\146"
+  "\102\340\116\063\305\137\034\216\245\032\131\245\333\153\310\112"
+  "\137\120\005\024\330\022\064\216\340\216\044\334\370\143\310\074"
+  "\071\232\346\016\335\007\060\321\200\023\141\235\006\147\242\005"
+  "\321\204\257\310\132\143\075\227\053\274\331\103\065\212\135\257"
+  "\136\104\114\350\275\265\210\372\045\341\041\046\042\362\337\352"
+  "\035\343\334\037\052\226\232\345\346\175\121\105\224\163\367\005"
+  "\007\174\210\101\244\361\242\013\163\370\126\141\250\157\323\026"
+  "\206\147\145\166\052\363\260\013\145\166\221\357\046\275\214\154"
+  "\257\230\223\323\354\005\022\223\050\312\302\354\125\163\010\172"
+  "\217\323\334\253\072\252\371\172\011\007\123\367\030\272\357\031"
+  "\352\022\262\326\066\333\125\032\320\070\377\151\221\003\371\070"
+  "\313\153\225\045\330\257\342\320\052\031\124\352\217\361\003\341"
+  "\154\126\035\106\034\054\232\223\310\072\243\134\037\205\024\325"
+  "\353\072\231\345\146\330\247\164\063\151\055\202\134\363\017\140"
+  "\334\241\314\163\062\320\026\013\170\153\312\303\121\055\174\051"
+  "\043\334\314\270\121\054\102\145\323\017\344\105\027\374\250\053"
+  "\160\256\332\040\120\126\257\266\026\330\012\003\225\074\131\010"
+  "\137\044\225\262\161\313\347\213\134\204\062\365\174\131\062\044"
+  "\343\324\335\150\114\323\321\160\317\037\166\056\275\256\044\350"
+  "\302\063\157\032\377\353\163\216\146\371\107\255\231\021\143\010"
+  "\235\127\046\010\325\130\254\106\156\221\134\064\045\251\166\277"
+  "\316\124\372\120\275\372\104\155\155\370\117\236\055\157\323\154"
+  "\043\161\236\100\237\262\132\155\142\215\066\104\231\266\110\252"
+  "\313\210\000\023\375\147\133\324\236\105\147\245\037\024\260\220"
+  "\202\121\274\142\321\014\154\070\173\351\036\216\312\252\056\336"
+  "\227\125\235\115\250\322\204\014\226\257\157\102\247\244\351\303"
+  "\343\326\364\155\112\062\267\176\306\072\034\133\011\121\243\067"
+  "\236\110\237\262\366\173\325\165\376\254\054\071\260\150\055\274"
+  "\323\312\212\136\115\253\253\231\122\001\134\016\130\012\264\071"
+  "\261\110\053\325\047\277\327\254\022\255\212\024\307\125\205\226"
+  "\072\363\257\240\015\023\231\265\324\042\265\112\240\130\230\030"
+  "\320\245\122\333\116\331\054\274\202\354\344\053\130\022\236\330"
+  "\237\241\065\031\064\050\223\151\065\176\157\301\166\327\341\364"
+  "\156\233\234\130\277\376\334\202\072\267\240\332\267\240\076\127"
+  "\366\061\336\146\007\252\165\222\121\332\110\376\161\035\250\071"
+  "\320\302\211\134\166\114\100\323\321\322\143\271\103\152\353\024"
+  "\075\244\347\377\255\353\203\256\323\311\103\320\354\037\351\375"
+  "\374\322\254\303\026\104\244\310\012\063\021\131\365\065\122\035"
+  "\107\055\326\070\352\036\036\201\017\216\306\307\122\312\235\160"
+  "\275\346\347\001\075\212\264\075\106\375\045\214\132\357\370\100"
+  "\310\176\327\341\351\210\175\035\372\250\216\272\361\115\255\270"
+  "\271\045\167\146\315\335\130\164\047\126\335\320\262\033\326\372"
+  "\355\225\367\351\040\351\026\036\314\156\034\157\166\222\364\132"
+  "\152\174\260\224\323\153\202\113\300\351\241\346\157\136\170\230"
+  "\201\205\256\237\267\231\071\355\377\361\070\036\144\137\315\101"
+  "\154\314\356\207\217\243\126\160\263\166\313\075\370\203\075\262"
+  "\270\051\114\076\117\237\235\104\233\273\106\077\316\111\274\243"
+  "\324\352\334\117\174\143\375\104\033\246\142\005\132\237\373\211"
+  "\307\324\117\074\335\053\223\076\067\001\153\351\355\362\046\143"
+  "\176\353\302\020\223\150\034\326\336\154\324\040\322\275\055\301"
+  "\223\011\215\057\067\066\354\364\356\074\240\332\354\175\163\131"
+  "\370\070\173\277\215\333\045\125\057\227\262\027\110\075\120\112"
+  "\252\327\270\016\375\326\017\013\166\057\035\345\052\124\026\342"
+  "\116\133\205\312\143\134\366\317\233\124\245\367\026\047\056\333"
+  "\306\211\042\215\305\327\212\371\113\267\336\346\052\305\026\242"
+  "\060\034\330\034\051\226\102\333\335\364\176\107\323\302\253\061"
+  "\233\270\354\116\255\107\160\151\265\373\371\225\215\023\374\305"
+  "\240\056\076\122\265\165\340\363\103\343\377\001\224\300\104\026"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/5.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/6.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/7.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/8.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/9.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/index.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/stats.html b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/style.css b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-04-18-005956-2464-cppcheck@9cd55edc8599_master/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-04-18-210506-6150-1@be37bd1dc030_master/index.html b/2020-04-18-210506-6150-1@be37bd1dc030_master/index.html new file mode 100644 index 0000000..bffd144 --- /dev/null +++ b/2020-04-18-210506-6150-1@be37bd1dc030_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@b2c5a58fe97f
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Sat Apr 18 21:05:06 2020
+

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_info2931View Report
+ + diff --git a/2020-04-18-210506-6150-1@be37bd1dc030_master/report-6951da.html b/2020-04-18-210506-6150-1@be37bd1dc030_master/report-6951da.html new file mode 100644 index 0000000..2d2e217 --- /dev/null +++ b/2020-04-18-210506-6150-1@be37bd1dc030_master/report-6951da.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-04-18-210506-6150-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-04-18-210506-6150-1@be37bd1dc030_master/report-d04d9f.html b/2020-04-18-210506-6150-1@be37bd1dc030_master/report-d04d9f.html new file mode 100644 index 0000000..fcc54dd --- /dev/null +++ b/2020-04-18-210506-6150-1@be37bd1dc030_master/report-d04d9f.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-04-18-210506-6150-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-04-18-210506-6150-1@be37bd1dc030_master/scanview.css b/2020-04-18-210506-6150-1@be37bd1dc030_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-04-18-210506-6150-1@be37bd1dc030_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/2020-04-18-210506-6150-1@be37bd1dc030_master/sorttable.js b/2020-04-18-210506-6150-1@be37bd1dc030_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-04-18-210506-6150-1@be37bd1dc030_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
#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, 
+  0213, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0213, 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, 0353, 0071, 0235, 0216, 0154, 0204, 
+  0251, 0100, 0374, 0001, 0206, 0310, 0377, 0344, 0070, 0103, 0216, 0376, 0115, 0061, 0107, 0211, 
+  0103, 0360, 0170, 0004, 0046, 0342, 0361, 0147, 0360, 0332, 0221, 0044, 0163, 0101, 0127, 0265, 
+  0143, 0343, 0357, 0050, 0024, 0116, 0110, 0140, 0222, 0214, 0300, 0127, 0361, 0170, 0035, 0175, 
+  0117, 0023, 0061, 0103, 0124, 0000, 0007, 0107, 0043, 0000, 0137, 0376, 0356, 0201, 0214, 0102, 
+  0322, 0304, 0234, 0305, 0210, 0213, 0245, 0103, 0341, 0014, 0215, 0000, 0141, 0163, 0304, 0201, 
+  0337, 0033, 0166, 0237, 0277, 0050, 0156, 0227, 0306, 0261, 0152, 0347, 0272, 0165, 0055, 0237, 
+  0040, 0111, 0021, 0360, 0057, 0153, 0033, 0046, 0002, 0305, 0001, 0246, 0041, 0107, 0152, 0300, 
+  0365, 0143, 0210, 0341, 0004, 0155, 0020, 0274, 0351, 0142, 0330, 0315, 0001, 0061, 0305, 0306, 
+  0153, 0007, 0233, 0053, 0371, 0243, 0011, 0216, 0204, 0361, 0160, 0340, 0071, 0267, 0360, 0210, 
+  0307, 0077, 0147, 0222, 0074, 0107, 0006, 0147, 0037, 0313, 0354, 0351, 0011, 0047, 0170, 0114, 
+  0244, 0014, 0367, 0074, 0105, 0165, 0103, 0012, 0041, 0015, 0036, 0130, 0230, 0046, 0300, 0277, 
+  0205, 0044, 0251, 0155, 0217, 0103, 0106, 0203, 0354, 0043, 0360, 0245, 0123, 0350, 0110, 0362, 
+  0020, 0021, 0023, 0051, 0176, 0303, 0220, 0260, 0111, 0056, 0206, 0364, 0057, 0370, 0077, 0024, 
+  0104, 0371, 0243, 0166, 0006, 0050, 0260, 0220, 0262, 0073, 0202, 0103, 0232, 0020, 0050, 0240, 
+  0104, 0142, 0004, 0226, 0110, 0222, 0177, 0123, 0275, 0071, 0012, 0306, 0244, 0226, 0315, 0062, 
+  0106, 0301, 0024, 0147, 0132, 0312, 0207, 0267, 0105, 0020, 0116, 0061, 0211, 0362, 0317, 0031, 
+  0071, 0221, 0236, 0163, 0312, 0110, 0204, 0170, 0167, 0325, 0240, 0273, 0326, 0042, 0157, 0355, 
+  0050, 0037, 0113, 0041, 0351, 0250, 0077, 0245, 0252, 0306, 0154, 0001, 0136, 0170, 0154, 0141, 
+  0365, 0353, 0332, 0267, 0346, 0310, 0024, 0321, 0314, 0040, 0237, 0140, 0032, 0020, 0364, 0220, 
+  0115, 0077, 0317, 0200, 0204, 0343, 0311, 0324, 0224, 0106, 0260, 0330, 0220, 0142, 0314, 0204, 
+  0140, 0063, 0135, 0042, 0306, 0261, 0264, 0043, 0050, 0344, 0242, 0004, 0174, 0271, 0072, 0011, 
+  0034, 0102, 0242, 0103, 0230, 0304, 0060, 0224, 0153, 0144, 0151, 0077, 0305, 0332, 0202, 0141, 
+  0326, 0123, 0000, 0071, 0202, 0153, 0152, 0051, 0124, 0134, 0052, 0305, 0240, 0233, 0352, 0333, 
+  0125, 0205, 0205, 0176, 0017, 0056, 0131, 0052, 0202, 0104, 0054, 0063, 0073, 0107, 0064, 0052, 
+  0045, 0334, 0230, 0245, 0165, 0003, 0316, 0255, 0162, 0254, 0076, 0367, 0300, 0133, 0252, 0242, 
+  0141, 0214, 0021, 0051, 0264, 0265, 0340, 0246, 0300, 0061, 0124, 0063, 0253, 0164, 0133, 0232, 
+  0040, 0232, 0222, 0162, 0024, 0042, 0374, 0204, 0222, 0040, 0102, 0017, 0060, 0045, 0302, 0234, 
+  0203, 0362, 0304, 0300, 0317, 0035, 0262, 0011, 0141, 0232, 0240, 0040, 0245, 0322, 0135, 0020, 
+  0114, 0167, 0020, 0032, 0222, 0071, 0134, 0046, 0101, 0062, 0145, 0363, 0140, 0065, 0206, 0152, 
+  0026, 0353, 0136, 0171, 0223, 0061, 0014, 0037, 0245, 0055, 0324, 0167, 0211, 0026, 0061, 0244, 
+  0221, 0371, 0120, 0037, 0060, 0041, 0346, 0124, 0061, 0113, 0160, 0156, 0330, 0156, 0225, 0120, 
+  0205, 0243, 0337, 0160, 0275, 0315, 0115, 0301, 0153, 0146, 0012, 0371, 0272, 0163, 0374, 0246, 
+  0140, 0064, 0243, 0017, 0167, 0072, 0366, 0332, 0230, 0216, 0105, 0342, 0027, 0213, 0136, 0046, 
+  0266, 0321, 0172, 0221, 0313, 0154, 0104, 0122, 0153, 0177, 0005, 0302, 0156, 0011, 0272, 0155, 
+  0163, 0165, 0101, 0316, 0316, 0346, 0320, 0326, 0322, 0252, 0035, 0123, 0354, 0020, 0127, 0230, 
+  0270, 0241, 0133, 0256, 0202, 0354, 0017, 0361, 0025, 0225, 0000, 0225, 0172, 0273, 0140, 0001, 
+  0011, 0236, 0124, 0073, 0350, 0002, 0210, 0246, 0060, 0222, 0153, 0126, 0026, 0137, 0003, 0237, 
+  0062, 0132, 0335, 0157, 0041, 0130, 0305, 0200, 0135, 0147, 0203, 0311, 0363, 0252, 0202, 0366, 
+  0015, 0200, 0153, 0012, 0136, 0041, 0200, 0062, 0000, 0017, 0142, 0030, 0105, 0065, 0263, 0245, 
+  0036, 0010, 0135, 0243, 0152, 0015, 0212, 0066, 0340, 0250, 0313, 0031, 0006, 0273, 0060, 0060, 
+  0262, 0134, 0055, 0053, 0326, 0033, 0106, 0245, 0152, 0166, 0121, 0117, 0053, 0052, 0152, 0113, 
+  0115, 0315, 0001, 0322, 0003, 0251, 0030, 0250, 0157, 0060, 0302, 0154, 0075, 0042, 0133, 0105, 
+  0047, 0201, 0052, 0034, 0360, 0354, 0333, 0074, 0106, 0003, 0165, 0274, 0115, 0102, 0266, 0073, 
+  0104, 0262, 0141, 0100, 0047, 0353, 0345, 0263, 0256, 0214, 0255, 0251, 0255, 0141, 0144, 0147, 
+  0036, 0351, 0031, 0115, 0206, 0042, 0226, 0323, 0325, 0112, 0220, 0010, 0310, 0105, 0023, 0106, 
+  0131, 0212, 0375, 0324, 0002, 0134, 0021, 0207, 0062, 0057, 0242, 0221, 0164, 0001, 0202, 0161, 
+  0123, 0176, 0145, 0301, 0351, 0166, 0257, 0145, 0301, 0252, 0156, 0360, 0332, 0030, 0171, 0275, 
+  0150, 0266, 0225, 0144, 0153, 0033, 0045, 0055, 0361, 0013, 0223, 0261, 0266, 0374, 0303, 0015, 
+  0233, 0215, 0231, 0364, 0246, 0367, 0150, 0261, 0052, 0032, 0207, 0331, 0223, 0061, 0133, 0010, 
+  0371, 0104, 0171, 0011, 0260, 0037, 0126, 0333, 0202, 0215, 0045, 0201, 0134, 0337, 0370, 0262, 
+  0371, 0260, 0024, 0233, 0100, 0041, 0024, 0062, 0222, 0316, 0314, 0364, 0056, 0371, 0141, 0201, 
+  0146, 0111, 0175, 0273, 0125, 0113, 0377, 0252, 0277, 0270, 0352, 0017, 0273, 0352, 0263, 0066, 
+  0121, 0317, 0033, 0054, 0344, 0257, 0051, 0131, 0377, 0302, 0135, 0134, 0014, 0134, 0123, 0262, 
+  0201, 0353, 0056, 0372, 0256, 0061, 0131, 0317, 0365, 0056, 0026, 0277, 0364, 0007, 0073, 0010, 
+  0347, 0112, 0114, 0314, 0373, 0353, 0113, 0272, 0236, 0173, 0151, 0116, 0170, 0345, 0111, 0102, 
+  0117, 0137, 0302, 0274, 0235, 0206, 0222, 0113, 0212, 0245, 0253, 0251, 0252, 0063, 0300, 0055, 
+  0253, 0376, 0135, 0321, 0156, 0230, 0263, 0142, 0327, 0321, 0147, 0332, 0352, 0012, 0252, 0277, 
+  0042, 0150, 0272, 0273, 0217, 0134, 0142, 0232, 0072, 0213, 0266, 0127, 0230, 0336, 0141, 0255, 
+  0060, 0177, 0251, 0050, 0361, 0110, 0326, 0220, 0362, 0220, 0067, 0306, 0013, 0104, 0022, 0033, 
+  0042, 0151, 0114, 0140, 0357, 0107, 0114, 0140, 0035, 0274, 0365, 0260, 0156, 0005, 0347, 0346, 
+  0030, 0067, 0016, 0101, 0065, 0260, 0255, 0305, 0325, 0346, 0356, 0037, 0224, 0273, 0267, 0232, 
+  0235, 0207, 0220, 0330, 0254, 0374, 0364, 0262, 0362, 0155, 0176, 0023, 0316, 0322, 0030, 0370, 
+  0145, 0065, 0041, 0273, 0232, 0035, 0137, 0302, 0177, 0027, 0143, 0272, 0136, 0017, 0214, 0103, 
+  0251, 0167, 0371, 0154, 0347, 0052, 0340, 0076, 0372, 0202, 0327, 0027, 0337, 0200, 0277, 0366, 
+  0376, 0344, 0076, 0316, 0147, 0233, 0135, 0330, 0354, 0102, 0043, 0273, 0100, 0074, 0224, 0063, 
+  0330, 0072, 0144, 0233, 0136, 0374, 0360, 0364, 0242, 0147, 0323, 0213, 0343, 0334, 0032, 0224, 
+  0203, 0027, 0154, 0366, 0276, 0073, 0203, 0067, 0252, 0017, 0273, 0057, 0150, 0063, 0020, 0233, 
+  0201, 0234, 0150, 0006, 0162, 0042, 0041, 0333, 0077, 0070, 0022, 0323, 0317, 0166, 0002, 0037, 
+  0137, 0316, 0361, 0066, 0205, 0236, 0147, 0232, 0076, 0225, 0044, 0332, 0263, 0111, 0364, 0236, 
+  0246, 0040, 0326, 0043, 0327, 0170, 0344, 0077, 0120, 0166, 0004, 0313, 0272, 0144, 0235, 0031, 
+  0174, 0176, 0330, 0056, 0171, 0252, 0124, 0175, 0052, 0076, 0371, 0334, 0372, 0344, 0372, 0031, 
+  0175, 0141, 0175, 0262, 0175, 0155, 0342, 0220, 0135, 0362, 0245, 0255, 0153, 0276, 0153, 0135, 
+  0323, 0373, 0250, 0272, 0146, 0065, 0246, 0025, 0304, 0345, 0204, 0245, 0104, 0253, 0227, 0013, 
+  0263, 0323, 0102, 0317, 0146, 0250, 0167, 0032, 0250, 0312, 0377, 0354, 0327, 0111, 0240, 0122, 
+  0337, 0242, 0056, 0052, 0160, 0356, 0152, 0316, 0216, 0052, 0236, 0120, 0010, 0216, 0145, 0244, 
+  0200, 0112, 0337, 0327, 0174, 0155, 0262, 0352, 0167, 0256, 0102, 0014, 0340, 0250, 0373, 0056, 
+  0106, 0140, 0314, 0110, 0004, 0272, 0145, 0052, 0255, 0346, 0157, 0254, 0327, 0366, 0016, 0177, 
+  0032, 0237, 0134, 0073, 0260, 0303, 0310, 0366, 0024, 0240, 0143, 0117, 0001, 0152, 0006, 0143, 
+  0366, 0024, 0240, 0075, 0005, 0170, 0042, 0133, 0175, 0060, 0216, 0021, 0215, 0336, 0155, 0227, 
+  0357, 0132, 0261, 0267, 0373, 0173, 0247, 0266, 0277, 0147, 0067, 0341, 0016, 0245, 0274, 0260, 
+  0166, 0102, 0050, 0223, 0044, 0320, 0075, 0030, 0164, 0010, 0166, 0052, 0324, 0131, 0306, 0002, 
+  0267, 0164, 0226, 0337, 0227, 0026, 0331, 0162, 0331, 0321, 0355, 0311, 0235, 0110, 0271, 0114, 
+  0060, 0107, 0052, 0032, 0071, 0352, 0222, 0076, 0353, 0227, 0367, 0165, 0053, 0316, 0036, 0066, 
+  0152, 0277, 0152, 0266, 0133, 0212, 0260, 0025, 0371, 0142, 0252, 0156, 0232, 0064, 0010, 0175, 
+  0365, 0255, 0163, 0165, 0101, 0046, 0246, 0216, 0352, 0143, 0127, 0160, 0333, 0116, 0122, 0232, 
+  0260, 0151, 0030, 0363, 0266, 0022, 0357, 0266, 0021, 0353, 0266, 0031, 0347, 0226, 0274, 0303, 
+  0266, 0235, 0123, 0351, 0232, 0206, 0175, 0165, 0330, 0226, 0330, 0017, 0263, 0304, 0176, 0053, 
+  0203, 0221, 0254, 0215, 0055, 0260, 0357, 0115, 0201, 0375, 0160, 0257, 0127, 0064, 0271, 0235, 
+  0260, 0126, 0336, 0372, 0333, 0025, 0067, 0145, 0334, 0274, 0155, 0072, 0277, 0251, 0270, 0063, 
+  0307, 0321, 0004, 0211, 0227, 0051, 0265, 0371, 0330, 0221, 0331, 0144, 0314, 0150, 0042, 0107, 
+  0323, 0351, 0003, 0177, 0165, 0353, 0257, 0234, 0212, 0353, 0215, 0352, 0111, 0057, 0237, 0111, 
+  0275, 0102, 0322, 0067, 0017, 0223, 0315, 0013, 0302, 0207, 0335, 0265, 0377, 0072, 0360, 0077, 
+  0355, 0112, 0320, 0056, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 
+  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"
+  "\213\007\000\000\137\144\153\207\010\000\000\000\213\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\353\071\235\216\154\204"
+  "\251\100\374\001\206\310\377\344\070\103\216\376\115\061\107\211"
+  "\103\360\170\004\046\342\361\147\360\332\221\044\163\101\127\265"
+  "\143\343\357\050\024\116\110\140\222\214\300\127\361\170\035\175"
+  "\117\023\061\103\124\000\007\107\043\000\137\376\356\201\214\102"
+  "\322\304\234\305\210\213\245\103\341\014\215\000\141\163\304\201"
+  "\337\033\166\237\277\050\156\227\306\261\152\347\272\165\055\237"
+  "\040\111\021\360\057\153\033\046\002\305\001\246\041\107\152\300"
+  "\365\143\210\341\004\155\020\274\351\142\330\315\001\061\305\306"
+  "\153\007\233\053\371\243\011\216\204\361\160\340\071\267\360\210"
+  "\307\077\147\222\074\107\006\147\037\313\354\351\011\047\170\114"
+  "\244\014\367\074\105\165\103\012\041\015\036\130\230\046\300\277"
+  "\205\044\251\155\217\103\106\203\354\043\360\245\123\350\110\362"
+  "\020\021\023\051\176\303\220\260\111\056\206\364\057\370\077\024"
+  "\104\371\243\166\006\050\260\220\262\073\202\103\232\020\050\240"
+  "\104\142\004\226\110\222\177\123\275\071\012\306\244\226\315\062"
+  "\106\301\024\147\132\312\207\267\105\020\116\061\211\362\317\031"
+  "\071\221\236\163\312\110\204\170\167\325\240\273\326\042\157\355"
+  "\050\037\113\041\351\250\077\245\252\306\154\001\136\170\154\141"
+  "\365\353\332\267\346\310\024\321\314\040\237\140\032\020\364\220"
+  "\115\077\317\200\204\343\311\324\224\106\260\330\220\142\314\204"
+  "\140\063\135\042\306\261\264\043\050\344\242\004\174\271\072\011"
+  "\034\102\242\103\230\304\060\224\153\144\151\077\305\332\202\141"
+  "\326\123\000\071\202\153\152\051\124\134\052\305\240\233\352\333"
+  "\125\205\205\176\017\056\131\052\202\104\054\063\073\107\064\052"
+  "\045\334\230\245\165\003\316\255\162\254\076\367\300\133\252\242"
+  "\141\214\021\051\264\265\340\246\300\061\124\063\253\164\133\232"
+  "\040\232\222\162\024\042\374\204\222\040\102\017\060\045\302\234"
+  "\203\362\304\300\317\035\262\011\141\232\240\040\245\322\135\020"
+  "\114\167\020\032\222\071\134\046\101\062\145\363\140\065\206\152"
+  "\026\353\136\171\223\061\014\037\245\055\324\167\211\026\061\244"
+  "\221\371\120\037\060\041\346\124\061\113\160\156\330\156\225\120"
+  "\205\243\337\160\275\315\115\301\153\146\012\371\272\163\374\246"
+  "\140\064\243\017\167\072\366\332\230\216\105\342\027\213\136\046"
+  "\266\321\172\221\313\154\104\122\153\177\005\302\156\011\272\155"
+  "\163\165\101\316\316\346\320\326\322\252\035\123\354\020\127\230"
+  "\270\241\133\256\202\354\017\361\025\225\000\225\172\273\140\001"
+  "\011\236\124\073\350\002\210\246\060\222\153\126\026\137\003\237"
+  "\062\132\335\157\041\130\305\200\135\147\203\311\363\252\202\366"
+  "\015\200\153\012\136\041\200\062\000\017\142\030\105\065\263\245"
+  "\036\010\135\243\152\015\212\066\340\250\313\031\006\273\060\060"
+  "\262\134\055\053\326\033\106\245\152\166\121\117\053\052\152\113"
+  "\115\315\001\322\003\251\030\250\157\060\302\154\075\042\133\105"
+  "\047\201\052\034\360\354\333\074\106\003\165\274\115\102\266\073"
+  "\104\262\141\100\047\353\345\263\256\214\255\251\255\141\144\147"
+  "\036\351\031\115\206\042\226\323\325\112\220\010\310\105\023\106"
+  "\131\212\375\324\002\134\021\207\062\057\242\221\164\001\202\161"
+  "\123\176\145\301\351\166\257\145\301\252\156\360\332\030\171\275"
+  "\150\266\225\144\153\033\045\055\361\013\223\261\266\374\303\015"
+  "\233\215\231\364\246\367\150\261\052\032\207\331\223\061\133\010"
+  "\371\104\171\011\260\037\126\333\202\215\045\201\134\337\370\262"
+  "\371\260\024\233\100\041\024\062\222\316\314\364\056\371\141\201"
+  "\146\111\175\273\125\113\377\252\277\270\352\017\273\352\263\066"
+  "\121\317\033\054\344\257\051\131\377\302\135\134\014\134\123\262"
+  "\201\353\056\372\256\061\131\317\365\056\026\277\364\007\073\010"
+  "\347\112\114\314\373\353\113\272\236\173\151\116\170\345\111\102"
+  "\117\137\302\274\235\206\222\113\212\245\253\251\252\063\300\055"
+  "\253\376\135\321\156\230\263\142\327\321\147\332\352\012\252\277"
+  "\042\150\272\273\217\134\142\232\072\213\266\127\230\336\141\255"
+  "\060\177\251\050\361\110\326\220\362\220\067\306\013\104\022\033"
+  "\042\151\114\140\357\107\114\140\035\274\365\260\156\005\347\346"
+  "\030\067\016\101\065\260\255\305\325\346\356\037\224\273\267\232"
+  "\235\207\220\330\254\374\364\262\362\155\176\023\316\322\030\370"
+  "\145\065\041\273\232\035\137\302\177\027\143\272\136\017\214\103"
+  "\251\167\371\154\347\052\340\076\372\202\327\027\337\200\277\366"
+  "\376\344\076\316\147\233\135\330\354\102\043\273\100\074\224\063"
+  "\330\072\144\233\136\374\360\364\242\147\323\213\343\334\032\224"
+  "\203\027\154\366\276\073\203\067\252\017\273\057\150\063\020\233"
+  "\201\234\150\006\162\042\041\333\077\070\022\323\317\166\002\037"
+  "\137\316\361\066\205\236\147\232\076\225\044\332\263\111\364\236"
+  "\246\040\326\043\327\170\344\077\120\166\004\313\272\144\235\031"
+  "\174\176\330\056\171\252\124\175\052\076\371\334\372\344\372\031"
+  "\175\141\175\262\175\155\342\220\135\362\245\255\153\276\153\135"
+  "\323\373\250\272\146\065\246\025\304\345\204\245\104\253\227\013"
+  "\263\323\102\317\146\250\167\032\250\312\377\354\327\111\240\122"
+  "\337\242\056\052\160\356\152\316\216\052\236\120\010\216\145\244"
+  "\200\112\337\327\174\155\262\352\167\256\102\014\340\250\373\056"
+  "\106\140\314\110\004\272\145\052\255\346\157\254\327\366\016\177"
+  "\032\237\134\073\260\303\310\366\024\240\143\117\001\152\006\143"
+  "\366\024\240\075\005\170\042\133\175\060\216\021\215\336\155\227"
+  "\357\132\261\267\373\173\247\266\277\147\067\341\016\245\274\260"
+  "\166\102\050\223\044\320\075\030\164\010\166\052\324\131\306\002"
+  "\267\164\226\337\227\026\331\162\331\321\355\311\235\110\271\114"
+  "\060\107\052\032\071\352\222\076\353\227\367\165\053\316\036\066"
+  "\152\277\152\266\133\212\260\025\371\142\252\156\232\064\010\175"
+  "\365\255\163\165\101\046\246\216\352\143\127\160\333\116\122\232"
+  "\260\151\030\363\266\022\357\266\021\353\266\031\347\226\274\303"
+  "\266\235\123\351\232\206\175\165\330\226\330\017\263\304\176\053"
+  "\203\221\254\215\055\260\357\115\201\375\160\257\127\064\271\235"
+  "\260\126\336\372\333\025\067\145\334\274\155\072\277\251\270\063"
+  "\307\321\004\211\227\051\265\371\330\221\331\144\314\150\042\107"
+  "\323\351\003\177\165\353\257\234\212\353\215\352\111\057\237\111"
+  "\275\102\322\067\017\223\315\013\302\207\335\265\377\072\360\077"
+  "\355\112\320\056\000\050\165\165\141\171\051\143\141\152\141\057"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/1.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/10.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/2.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/3.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/4.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/4.html new file mode 100644 index 0000000..df1c99c --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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[1720]; 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, 
+  0267, 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, 0006, 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, 0026, 0354, 0002, 0015, 0262, 0171, 0062, 0374, 0016, 0324, 0004, 0224, 0023, 0255, 
+  0047, 0350, 0306, 0334, 0377, 0275, 0040, 0063, 0100, 0001, 0213, 0046, 0210, 0245, 0237, 0103, 
+  0224, 0316, 0263, 0063, 0143, 0045, 0143, 0120, 0146, 0035, 0010, 0262, 0200, 0011, 0132, 0062, 
+  0315, 0102, 0016, 0150, 0172, 0253, 0022, 0030, 0017, 0236, 0376, 0165, 0117, 0246, 0104, 0340, 
+  0073, 0111, 0023, 0215, 0246, 0327, 0204, 0353, 0332, 0371, 0214, 0112, 0201, 0323, 0117, 0064, 
+  0215, 0054, 0330, 0002, 0204, 0351, 0151, 0020, 0121, 0021, 0156, 0074, 0310, 0167, 0337, 0214, 
+  0220, 0321, 0117, 0046, 0304, 0312, 0240, 0147, 0301, 0051, 0160, 0037, 0052, 0276, 0062, 0302, 
+  0345, 0054, 0047, 0203, 0222, 0357, 0004, 0247, 0154, 0060, 0022, 0107, 0371, 0170, 0067, 0273, 
+  0064, 0314, 0130, 0006, 0004, 0106, 0021, 0241, 0071, 0061, 0304, 0262, 0143, 0202, 0326, 0140, 
+  0301, 0277, 0331, 0325, 0202, 0133, 0331, 0357, 0367, 0273, 0021, 0231, 0143, 0355, 0165, 0014, 
+  0170, 0156, 0225, 0327, 0302, 0145, 0064, 0355, 0001, 0320, 0071, 0343, 0121, 0376, 0235, 0202, 
+  0163, 0253, 0342, 0163, 0311, 0043, 0120, 0203, 0315, 0204, 0301, 0316, 0214, 0174, 0166, 0220, 
+  0031, 0203, 0040, 0274, 0227, 0375, 0264, 0102, 0016, 0345, 0003, 0332, 0342, 0330, 0343, 0362, 
+  0347, 0235, 0177, 0375, 0331, 0351, 0202, 0131, 0020, 0065, 0143, 0002, 0163, 0270, 0263, 0204, 
+  0015, 0107, 0036, 0040, 0212, 0315, 0346, 0276, 0060, 0106, 0306, 0236, 0020, 0241, 0064, 0106, 
+  0056, 0232, 0002, 0111, 0305, 0254, 0074, 0211, 0261, 0336, 0003, 0115, 0255, 0033, 0061, 0214, 
+  0022, 0336, 0004, 0120, 0307, 0204, 0132, 0147, 0126, 0272, 0216, 0133, 0132, 0204, 0246, 0053, 
+  0141, 0242, 0200, 0354, 0210, 0305, 0051, 0270, 0304, 0222, 0041, 0212, 0342, 0153, 0053, 0102, 
+  0027, 0034, 0047, 0153, 0231, 0030, 0254, 0315, 0072, 0365, 0020, 0016, 0165, 0056, 0122, 0122, 
+  0034, 0053, 0337, 0360, 0223, 0075, 0247, 0336, 0000, 0207, 0371, 0320, 0113, 0130, 0327, 0146, 
+  0102, 0340, 0116, 0063, 0305, 0137, 0034, 0216, 0245, 0032, 0131, 0245, 0333, 0153, 0310, 0112, 
+  0137, 0120, 0005, 0024, 0330, 0022, 0064, 0216, 0340, 0216, 0044, 0334, 0370, 0143, 0310, 0074, 
+  0071, 0232, 0346, 0016, 0335, 0007, 0060, 0321, 0200, 0023, 0141, 0235, 0006, 0147, 0242, 0005, 
+  0321, 0204, 0257, 0310, 0132, 0143, 0075, 0227, 0053, 0274, 0331, 0103, 0065, 0212, 0135, 0257, 
+  0136, 0104, 0114, 0350, 0275, 0265, 0210, 0372, 0045, 0341, 0041, 0046, 0042, 0362, 0337, 0352, 
+  0035, 0343, 0334, 0037, 0052, 0226, 0232, 0345, 0346, 0175, 0121, 0105, 0224, 0163, 0367, 0005, 
+  0007, 0174, 0210, 0101, 0244, 0361, 0242, 0013, 0163, 0370, 0126, 0141, 0250, 0157, 0323, 0026, 
+  0206, 0147, 0145, 0166, 0052, 0363, 0260, 0013, 0145, 0166, 0221, 0357, 0046, 0275, 0214, 0154, 
+  0257, 0230, 0223, 0323, 0354, 0005, 0022, 0223, 0050, 0312, 0302, 0354, 0125, 0163, 0010, 0172, 
+  0217, 0323, 0334, 0253, 0072, 0252, 0371, 0172, 0011, 0007, 0123, 0367, 0030, 0272, 0357, 0031, 
+  0352, 0022, 0262, 0326, 0066, 0333, 0125, 0032, 0320, 0070, 0377, 0151, 0221, 0003, 0371, 0070, 
+  0313, 0153, 0225, 0045, 0330, 0257, 0342, 0320, 0052, 0031, 0124, 0352, 0217, 0361, 0003, 0341, 
+  0154, 0126, 0035, 0106, 0034, 0054, 0232, 0223, 0310, 0072, 0243, 0134, 0037, 0205, 0024, 0325, 
+  0353, 0072, 0231, 0345, 0146, 0330, 0247, 0164, 0063, 0151, 0055, 0202, 0134, 0363, 0017, 0140, 
+  0334, 0241, 0314, 0163, 0062, 0320, 0026, 0013, 0170, 0153, 0312, 0303, 0121, 0055, 0174, 0051, 
+  0043, 0334, 0314, 0270, 0121, 0054, 0102, 0145, 0323, 0017, 0344, 0105, 0027, 0374, 0250, 0053, 
+  0160, 0256, 0332, 0040, 0120, 0126, 0257, 0266, 0026, 0330, 0012, 0003, 0225, 0074, 0131, 0010, 
+  0137, 0044, 0225, 0262, 0161, 0313, 0347, 0213, 0134, 0204, 0062, 0365, 0174, 0131, 0062, 0044, 
+  0343, 0324, 0335, 0150, 0114, 0323, 0321, 0160, 0317, 0037, 0166, 0056, 0275, 0256, 0044, 0350, 
+  0302, 0063, 0157, 0032, 0377, 0353, 0163, 0216, 0146, 0371, 0107, 0255, 0231, 0021, 0143, 0010, 
+  0235, 0127, 0046, 0010, 0325, 0130, 0254, 0106, 0156, 0221, 0134, 0064, 0045, 0251, 0166, 0277, 
+  0316, 0124, 0372, 0120, 0275, 0372, 0104, 0155, 0155, 0370, 0117, 0236, 0055, 0157, 0323, 0154, 
+  0043, 0161, 0236, 0100, 0237, 0262, 0132, 0155, 0142, 0215, 0066, 0104, 0231, 0266, 0110, 0252, 
+  0313, 0210, 0000, 0023, 0375, 0147, 0133, 0324, 0236, 0105, 0147, 0245, 0037, 0024, 0260, 0220, 
+  0202, 0121, 0274, 0142, 0321, 0014, 0154, 0070, 0173, 0351, 0036, 0216, 0312, 0252, 0056, 0336, 
+  0227, 0125, 0235, 0115, 0250, 0322, 0204, 0014, 0226, 0257, 0157, 0102, 0247, 0244, 0351, 0303, 
+  0343, 0326, 0364, 0155, 0112, 0062, 0267, 0176, 0306, 0072, 0034, 0133, 0011, 0121, 0243, 0067, 
+  0236, 0110, 0237, 0262, 0366, 0173, 0325, 0165, 0376, 0254, 0054, 0071, 0260, 0150, 0055, 0274, 
+  0323, 0312, 0212, 0136, 0115, 0253, 0253, 0231, 0122, 0001, 0134, 0016, 0130, 0012, 0264, 0071, 
+  0261, 0110, 0053, 0325, 0047, 0277, 0327, 0254, 0022, 0255, 0212, 0024, 0307, 0125, 0205, 0226, 
+  0072, 0363, 0257, 0240, 0015, 0023, 0231, 0265, 0324, 0042, 0265, 0112, 0240, 0130, 0230, 0030, 
+  0320, 0245, 0122, 0333, 0116, 0331, 0054, 0274, 0202, 0354, 0344, 0053, 0130, 0022, 0236, 0330, 
+  0237, 0241, 0065, 0031, 0064, 0050, 0223, 0151, 0065, 0176, 0157, 0301, 0166, 0327, 0341, 0364, 
+  0156, 0233, 0234, 0130, 0277, 0376, 0334, 0202, 0072, 0267, 0240, 0332, 0267, 0240, 0076, 0127, 
+  0366, 0061, 0336, 0146, 0007, 0252, 0165, 0222, 0121, 0332, 0110, 0376, 0161, 0035, 0250, 0071, 
+  0320, 0302, 0211, 0134, 0166, 0114, 0100, 0323, 0321, 0322, 0143, 0271, 0103, 0152, 0353, 0024, 
+  0075, 0244, 0347, 0377, 0255, 0353, 0203, 0256, 0323, 0311, 0103, 0320, 0354, 0037, 0351, 0375, 
+  0374, 0322, 0254, 0303, 0026, 0104, 0244, 0310, 0012, 0063, 0021, 0131, 0365, 0065, 0122, 0035, 
+  0107, 0055, 0326, 0070, 0352, 0036, 0036, 0201, 0017, 0216, 0306, 0307, 0122, 0312, 0235, 0160, 
+  0275, 0346, 0347, 0001, 0075, 0212, 0264, 0075, 0106, 0375, 0045, 0214, 0132, 0357, 0370, 0100, 
+  0310, 0176, 0327, 0341, 0351, 0210, 0175, 0035, 0372, 0250, 0216, 0272, 0361, 0115, 0255, 0270, 
+  0271, 0045, 0167, 0146, 0315, 0335, 0130, 0164, 0047, 0126, 0335, 0320, 0262, 0033, 0326, 0372, 
+  0355, 0225, 0367, 0351, 0040, 0351, 0026, 0036, 0314, 0156, 0034, 0157, 0166, 0222, 0364, 0132, 
+  0152, 0174, 0260, 0224, 0323, 0153, 0202, 0113, 0300, 0351, 0241, 0346, 0157, 0136, 0170, 0230, 
+  0201, 0205, 0256, 0237, 0267, 0231, 0071, 0355, 0377, 0361, 0070, 0036, 0144, 0137, 0315, 0101, 
+  0154, 0314, 0356, 0207, 0217, 0243, 0126, 0160, 0263, 0166, 0313, 0075, 0370, 0203, 0075, 0262, 
+  0270, 0051, 0114, 0076, 0117, 0237, 0235, 0104, 0233, 0273, 0106, 0077, 0316, 0111, 0274, 0243, 
+  0324, 0352, 0334, 0117, 0174, 0143, 0375, 0104, 0033, 0246, 0142, 0005, 0132, 0237, 0373, 0211, 
+  0307, 0324, 0117, 0074, 0335, 0053, 0223, 0076, 0067, 0001, 0153, 0351, 0355, 0362, 0046, 0143, 
+  0176, 0353, 0302, 0020, 0223, 0150, 0034, 0326, 0336, 0154, 0324, 0040, 0322, 0275, 0055, 0301, 
+  0223, 0011, 0215, 0057, 0067, 0066, 0354, 0364, 0356, 0074, 0240, 0332, 0354, 0175, 0163, 0131, 
+  0370, 0070, 0173, 0277, 0215, 0333, 0045, 0125, 0057, 0227, 0262, 0027, 0110, 0075, 0120, 0112, 
+  0252, 0327, 0270, 0016, 0375, 0326, 0017, 0013, 0166, 0057, 0035, 0345, 0052, 0124, 0026, 0342, 
+  0116, 0133, 0205, 0312, 0143, 0134, 0366, 0317, 0233, 0124, 0245, 0367, 0026, 0047, 0056, 0333, 
+  0306, 0211, 0042, 0215, 0305, 0327, 0212, 0371, 0113, 0267, 0336, 0346, 0052, 0305, 0026, 0242, 
+  0060, 0034, 0330, 0034, 0051, 0226, 0102, 0333, 0335, 0364, 0176, 0107, 0323, 0302, 0253, 0061, 
+  0233, 0270, 0354, 0116, 0255, 0107, 0160, 0151, 0265, 0373, 0371, 0225, 0215, 0023, 0374, 0305, 
+  0240, 0056, 0076, 0122, 0265, 0165, 0340, 0363, 0103, 0343, 0377, 0001, 0224, 0300, 0104, 0026, 
+  0000, 0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1720]; 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"
+  "\267\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\006\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\026\354\002\015\262\171\062\374\016\324\004\224\023\255"
+  "\047\350\306\334\377\275\040\063\100\001\213\046\210\245\237\103"
+  "\224\316\263\063\143\045\143\120\146\035\010\262\200\011\132\062"
+  "\315\102\016\150\172\253\022\030\017\236\376\165\117\246\104\340"
+  "\073\111\023\215\246\327\204\353\332\371\214\112\201\323\117\064"
+  "\215\054\330\002\204\351\151\020\121\021\156\074\310\167\337\214"
+  "\220\321\117\046\304\312\240\147\301\051\160\037\052\276\062\302"
+  "\345\054\047\203\222\357\004\247\154\060\022\107\371\170\067\273"
+  "\064\314\130\006\004\106\021\241\071\061\304\262\143\202\326\140"
+  "\301\277\331\325\202\133\331\357\367\273\021\231\143\355\165\014"
+  "\170\156\225\327\302\145\064\355\001\320\071\343\121\376\235\202"
+  "\163\253\342\163\311\043\120\203\315\204\301\316\214\174\166\220"
+  "\031\203\040\274\227\375\264\102\016\345\003\332\342\330\343\362"
+  "\347\235\177\375\331\351\202\131\020\065\143\002\163\270\263\204"
+  "\015\107\036\040\212\315\346\276\060\106\306\236\020\241\064\106"
+  "\056\232\002\111\305\254\074\211\261\336\003\115\255\033\061\214"
+  "\022\336\004\120\307\204\132\147\126\272\216\133\132\204\246\053"
+  "\141\242\200\354\210\305\051\270\304\222\041\212\342\153\053\102"
+  "\027\034\047\153\231\030\254\315\072\365\020\016\165\056\122\122"
+  "\034\053\337\360\223\075\247\336\000\207\371\320\113\130\327\146"
+  "\102\340\116\063\305\137\034\216\245\032\131\245\333\153\310\112"
+  "\137\120\005\024\330\022\064\216\340\216\044\334\370\143\310\074"
+  "\071\232\346\016\335\007\060\321\200\023\141\235\006\147\242\005"
+  "\321\204\257\310\132\143\075\227\053\274\331\103\065\212\135\257"
+  "\136\104\114\350\275\265\210\372\045\341\041\046\042\362\337\352"
+  "\035\343\334\037\052\226\232\345\346\175\121\105\224\163\367\005"
+  "\007\174\210\101\244\361\242\013\163\370\126\141\250\157\323\026"
+  "\206\147\145\166\052\363\260\013\145\166\221\357\046\275\214\154"
+  "\257\230\223\323\354\005\022\223\050\312\302\354\125\163\010\172"
+  "\217\323\334\253\072\252\371\172\011\007\123\367\030\272\357\031"
+  "\352\022\262\326\066\333\125\032\320\070\377\151\221\003\371\070"
+  "\313\153\225\045\330\257\342\320\052\031\124\352\217\361\003\341"
+  "\154\126\035\106\034\054\232\223\310\072\243\134\037\205\024\325"
+  "\353\072\231\345\146\330\247\164\063\151\055\202\134\363\017\140"
+  "\334\241\314\163\062\320\026\013\170\153\312\303\121\055\174\051"
+  "\043\334\314\270\121\054\102\145\323\017\344\105\027\374\250\053"
+  "\160\256\332\040\120\126\257\266\026\330\012\003\225\074\131\010"
+  "\137\044\225\262\161\313\347\213\134\204\062\365\174\131\062\044"
+  "\343\324\335\150\114\323\321\160\317\037\166\056\275\256\044\350"
+  "\302\063\157\032\377\353\163\216\146\371\107\255\231\021\143\010"
+  "\235\127\046\010\325\130\254\106\156\221\134\064\045\251\166\277"
+  "\316\124\372\120\275\372\104\155\155\370\117\236\055\157\323\154"
+  "\043\161\236\100\237\262\132\155\142\215\066\104\231\266\110\252"
+  "\313\210\000\023\375\147\133\324\236\105\147\245\037\024\260\220"
+  "\202\121\274\142\321\014\154\070\173\351\036\216\312\252\056\336"
+  "\227\125\235\115\250\322\204\014\226\257\157\102\247\244\351\303"
+  "\343\326\364\155\112\062\267\176\306\072\034\133\011\121\243\067"
+  "\236\110\237\262\366\173\325\165\376\254\054\071\260\150\055\274"
+  "\323\312\212\136\115\253\253\231\122\001\134\016\130\012\264\071"
+  "\261\110\053\325\047\277\327\254\022\255\212\024\307\125\205\226"
+  "\072\363\257\240\015\023\231\265\324\042\265\112\240\130\230\030"
+  "\320\245\122\333\116\331\054\274\202\354\344\053\130\022\236\330"
+  "\237\241\065\031\064\050\223\151\065\176\157\301\166\327\341\364"
+  "\156\233\234\130\277\376\334\202\072\267\240\332\267\240\076\127"
+  "\366\061\336\146\007\252\165\222\121\332\110\376\161\035\250\071"
+  "\320\302\211\134\166\114\100\323\321\322\143\271\103\152\353\024"
+  "\075\244\347\377\255\353\203\256\323\311\103\320\354\037\351\375"
+  "\374\322\254\303\026\104\244\310\012\063\021\131\365\065\122\035"
+  "\107\055\326\070\352\036\036\201\017\216\306\307\122\312\235\160"
+  "\275\346\347\001\075\212\264\075\106\375\045\214\132\357\370\100"
+  "\310\176\327\341\351\210\175\035\372\250\216\272\361\115\255\270"
+  "\271\045\167\146\315\335\130\164\047\126\335\320\262\033\326\372"
+  "\355\225\367\351\040\351\026\036\314\156\034\157\166\222\364\132"
+  "\152\174\260\224\323\153\202\113\300\351\241\346\157\136\170\230"
+  "\201\205\256\237\267\231\071\355\377\361\070\036\144\137\315\101"
+  "\154\314\356\207\217\243\126\160\263\166\313\075\370\203\075\262"
+  "\270\051\114\076\117\237\235\104\233\273\106\077\316\111\274\243"
+  "\324\352\334\117\174\143\375\104\033\246\142\005\132\237\373\211"
+  "\307\324\117\074\335\053\223\076\067\001\153\351\355\362\046\143"
+  "\176\353\302\020\223\150\034\326\336\154\324\040\322\275\055\301"
+  "\223\011\215\057\067\066\354\364\356\074\240\332\354\175\163\131"
+  "\370\070\173\277\215\333\045\125\057\227\262\027\110\075\120\112"
+  "\252\327\270\016\375\326\017\013\166\057\035\345\052\124\026\342"
+  "\116\133\205\312\143\134\366\317\233\124\245\367\026\047\056\333"
+  "\306\211\042\215\305\327\212\371\113\267\336\346\052\305\026\242"
+  "\060\034\330\034\051\226\102\333\335\364\176\107\323\302\253\061"
+  "\233\270\354\116\255\107\160\151\265\373\371\225\215\023\374\305"
+  "\240\056\076\122\265\165\340\363\103\343\377\001\224\300\104\026"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/5.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/6.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/7.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/8.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/9.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/index.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/stats.html b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/style.css b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-04-18-210541-6870-cppcheck@be37bd1dc030_master/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/index.html b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/index.html new file mode 100644 index 0000000..d950695 --- /dev/null +++ b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@50ff58bb94fa
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Tue May 19 21:49:47 2020
+

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_info2931View Report
+ + diff --git a/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/report-450120.html b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/report-450120.html new file mode 100644 index 0000000..bb2009e --- /dev/null +++ b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/report-450120.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-05-19-214947-6057-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/report-57a0bb.html b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/report-57a0bb.html new file mode 100644 index 0000000..2af6e14 --- /dev/null +++ b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/report-57a0bb.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-05-19-214947-6057-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/scanview.css b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/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/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/sorttable.js b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-05-19-214947-6057-1@e7dbc883de67_mailer_evo/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
#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, 
+  0213, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0213, 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, 0353, 0071, 0235, 0216, 0154, 0204, 
+  0251, 0100, 0374, 0001, 0206, 0310, 0377, 0344, 0070, 0103, 0216, 0376, 0115, 0061, 0107, 0211, 
+  0103, 0360, 0170, 0004, 0046, 0342, 0361, 0147, 0360, 0332, 0221, 0044, 0163, 0101, 0127, 0265, 
+  0143, 0343, 0357, 0050, 0024, 0116, 0110, 0140, 0222, 0214, 0300, 0127, 0361, 0170, 0035, 0175, 
+  0117, 0023, 0061, 0103, 0124, 0000, 0007, 0107, 0043, 0000, 0137, 0376, 0356, 0201, 0214, 0102, 
+  0322, 0304, 0234, 0305, 0210, 0213, 0245, 0103, 0341, 0014, 0215, 0000, 0141, 0163, 0304, 0201, 
+  0337, 0033, 0166, 0237, 0277, 0050, 0156, 0227, 0306, 0261, 0152, 0347, 0272, 0165, 0055, 0237, 
+  0040, 0111, 0021, 0360, 0057, 0153, 0033, 0046, 0002, 0305, 0001, 0246, 0041, 0107, 0152, 0300, 
+  0365, 0143, 0210, 0341, 0004, 0155, 0020, 0274, 0351, 0142, 0330, 0315, 0001, 0061, 0305, 0306, 
+  0153, 0007, 0233, 0053, 0371, 0243, 0011, 0216, 0204, 0361, 0160, 0340, 0071, 0267, 0360, 0210, 
+  0307, 0077, 0147, 0222, 0074, 0107, 0006, 0147, 0037, 0313, 0354, 0351, 0011, 0047, 0170, 0114, 
+  0244, 0014, 0367, 0074, 0105, 0165, 0103, 0012, 0041, 0015, 0036, 0130, 0230, 0046, 0300, 0277, 
+  0205, 0044, 0251, 0155, 0217, 0103, 0106, 0203, 0354, 0043, 0360, 0245, 0123, 0350, 0110, 0362, 
+  0020, 0021, 0023, 0051, 0176, 0303, 0220, 0260, 0111, 0056, 0206, 0364, 0057, 0370, 0077, 0024, 
+  0104, 0371, 0243, 0166, 0006, 0050, 0260, 0220, 0262, 0073, 0202, 0103, 0232, 0020, 0050, 0240, 
+  0104, 0142, 0004, 0226, 0110, 0222, 0177, 0123, 0275, 0071, 0012, 0306, 0244, 0226, 0315, 0062, 
+  0106, 0301, 0024, 0147, 0132, 0312, 0207, 0267, 0105, 0020, 0116, 0061, 0211, 0362, 0317, 0031, 
+  0071, 0221, 0236, 0163, 0312, 0110, 0204, 0170, 0167, 0325, 0240, 0273, 0326, 0042, 0157, 0355, 
+  0050, 0037, 0113, 0041, 0351, 0250, 0077, 0245, 0252, 0306, 0154, 0001, 0136, 0170, 0154, 0141, 
+  0365, 0353, 0332, 0267, 0346, 0310, 0024, 0321, 0314, 0040, 0237, 0140, 0032, 0020, 0364, 0220, 
+  0115, 0077, 0317, 0200, 0204, 0343, 0311, 0324, 0224, 0106, 0260, 0330, 0220, 0142, 0314, 0204, 
+  0140, 0063, 0135, 0042, 0306, 0261, 0264, 0043, 0050, 0344, 0242, 0004, 0174, 0271, 0072, 0011, 
+  0034, 0102, 0242, 0103, 0230, 0304, 0060, 0224, 0153, 0144, 0151, 0077, 0305, 0332, 0202, 0141, 
+  0326, 0123, 0000, 0071, 0202, 0153, 0152, 0051, 0124, 0134, 0052, 0305, 0240, 0233, 0352, 0333, 
+  0125, 0205, 0205, 0176, 0017, 0056, 0131, 0052, 0202, 0104, 0054, 0063, 0073, 0107, 0064, 0052, 
+  0045, 0334, 0230, 0245, 0165, 0003, 0316, 0255, 0162, 0254, 0076, 0367, 0300, 0133, 0252, 0242, 
+  0141, 0214, 0021, 0051, 0264, 0265, 0340, 0246, 0300, 0061, 0124, 0063, 0253, 0164, 0133, 0232, 
+  0040, 0232, 0222, 0162, 0024, 0042, 0374, 0204, 0222, 0040, 0102, 0017, 0060, 0045, 0302, 0234, 
+  0203, 0362, 0304, 0300, 0317, 0035, 0262, 0011, 0141, 0232, 0240, 0040, 0245, 0322, 0135, 0020, 
+  0114, 0167, 0020, 0032, 0222, 0071, 0134, 0046, 0101, 0062, 0145, 0363, 0140, 0065, 0206, 0152, 
+  0026, 0353, 0136, 0171, 0223, 0061, 0014, 0037, 0245, 0055, 0324, 0167, 0211, 0026, 0061, 0244, 
+  0221, 0371, 0120, 0037, 0060, 0041, 0346, 0124, 0061, 0113, 0160, 0156, 0330, 0156, 0225, 0120, 
+  0205, 0243, 0337, 0160, 0275, 0315, 0115, 0301, 0153, 0146, 0012, 0371, 0272, 0163, 0374, 0246, 
+  0140, 0064, 0243, 0017, 0167, 0072, 0366, 0332, 0230, 0216, 0105, 0342, 0027, 0213, 0136, 0046, 
+  0266, 0321, 0172, 0221, 0313, 0154, 0104, 0122, 0153, 0177, 0005, 0302, 0156, 0011, 0272, 0155, 
+  0163, 0165, 0101, 0316, 0316, 0346, 0320, 0326, 0322, 0252, 0035, 0123, 0354, 0020, 0127, 0230, 
+  0270, 0241, 0133, 0256, 0202, 0354, 0017, 0361, 0025, 0225, 0000, 0225, 0172, 0273, 0140, 0001, 
+  0011, 0236, 0124, 0073, 0350, 0002, 0210, 0246, 0060, 0222, 0153, 0126, 0026, 0137, 0003, 0237, 
+  0062, 0132, 0335, 0157, 0041, 0130, 0305, 0200, 0135, 0147, 0203, 0311, 0363, 0252, 0202, 0366, 
+  0015, 0200, 0153, 0012, 0136, 0041, 0200, 0062, 0000, 0017, 0142, 0030, 0105, 0065, 0263, 0245, 
+  0036, 0010, 0135, 0243, 0152, 0015, 0212, 0066, 0340, 0250, 0313, 0031, 0006, 0273, 0060, 0060, 
+  0262, 0134, 0055, 0053, 0326, 0033, 0106, 0245, 0152, 0166, 0121, 0117, 0053, 0052, 0152, 0113, 
+  0115, 0315, 0001, 0322, 0003, 0251, 0030, 0250, 0157, 0060, 0302, 0154, 0075, 0042, 0133, 0105, 
+  0047, 0201, 0052, 0034, 0360, 0354, 0333, 0074, 0106, 0003, 0165, 0274, 0115, 0102, 0266, 0073, 
+  0104, 0262, 0141, 0100, 0047, 0353, 0345, 0263, 0256, 0214, 0255, 0251, 0255, 0141, 0144, 0147, 
+  0036, 0351, 0031, 0115, 0206, 0042, 0226, 0323, 0325, 0112, 0220, 0010, 0310, 0105, 0023, 0106, 
+  0131, 0212, 0375, 0324, 0002, 0134, 0021, 0207, 0062, 0057, 0242, 0221, 0164, 0001, 0202, 0161, 
+  0123, 0176, 0145, 0301, 0351, 0166, 0257, 0145, 0301, 0252, 0156, 0360, 0332, 0030, 0171, 0275, 
+  0150, 0266, 0225, 0144, 0153, 0033, 0045, 0055, 0361, 0013, 0223, 0261, 0266, 0374, 0303, 0015, 
+  0233, 0215, 0231, 0364, 0246, 0367, 0150, 0261, 0052, 0032, 0207, 0331, 0223, 0061, 0133, 0010, 
+  0371, 0104, 0171, 0011, 0260, 0037, 0126, 0333, 0202, 0215, 0045, 0201, 0134, 0337, 0370, 0262, 
+  0371, 0260, 0024, 0233, 0100, 0041, 0024, 0062, 0222, 0316, 0314, 0364, 0056, 0371, 0141, 0201, 
+  0146, 0111, 0175, 0273, 0125, 0113, 0377, 0252, 0277, 0270, 0352, 0017, 0273, 0352, 0263, 0066, 
+  0121, 0317, 0033, 0054, 0344, 0257, 0051, 0131, 0377, 0302, 0135, 0134, 0014, 0134, 0123, 0262, 
+  0201, 0353, 0056, 0372, 0256, 0061, 0131, 0317, 0365, 0056, 0026, 0277, 0364, 0007, 0073, 0010, 
+  0347, 0112, 0114, 0314, 0373, 0353, 0113, 0272, 0236, 0173, 0151, 0116, 0170, 0345, 0111, 0102, 
+  0117, 0137, 0302, 0274, 0235, 0206, 0222, 0113, 0212, 0245, 0253, 0251, 0252, 0063, 0300, 0055, 
+  0253, 0376, 0135, 0321, 0156, 0230, 0263, 0142, 0327, 0321, 0147, 0332, 0352, 0012, 0252, 0277, 
+  0042, 0150, 0272, 0273, 0217, 0134, 0142, 0232, 0072, 0213, 0266, 0127, 0230, 0336, 0141, 0255, 
+  0060, 0177, 0251, 0050, 0361, 0110, 0326, 0220, 0362, 0220, 0067, 0306, 0013, 0104, 0022, 0033, 
+  0042, 0151, 0114, 0140, 0357, 0107, 0114, 0140, 0035, 0274, 0365, 0260, 0156, 0005, 0347, 0346, 
+  0030, 0067, 0016, 0101, 0065, 0260, 0255, 0305, 0325, 0346, 0356, 0037, 0224, 0273, 0267, 0232, 
+  0235, 0207, 0220, 0330, 0254, 0374, 0364, 0262, 0362, 0155, 0176, 0023, 0316, 0322, 0030, 0370, 
+  0145, 0065, 0041, 0273, 0232, 0035, 0137, 0302, 0177, 0027, 0143, 0272, 0136, 0017, 0214, 0103, 
+  0251, 0167, 0371, 0154, 0347, 0052, 0340, 0076, 0372, 0202, 0327, 0027, 0337, 0200, 0277, 0366, 
+  0376, 0344, 0076, 0316, 0147, 0233, 0135, 0330, 0354, 0102, 0043, 0273, 0100, 0074, 0224, 0063, 
+  0330, 0072, 0144, 0233, 0136, 0374, 0360, 0364, 0242, 0147, 0323, 0213, 0343, 0334, 0032, 0224, 
+  0203, 0027, 0154, 0366, 0276, 0073, 0203, 0067, 0252, 0017, 0273, 0057, 0150, 0063, 0020, 0233, 
+  0201, 0234, 0150, 0006, 0162, 0042, 0041, 0333, 0077, 0070, 0022, 0323, 0317, 0166, 0002, 0037, 
+  0137, 0316, 0361, 0066, 0205, 0236, 0147, 0232, 0076, 0225, 0044, 0332, 0263, 0111, 0364, 0236, 
+  0246, 0040, 0326, 0043, 0327, 0170, 0344, 0077, 0120, 0166, 0004, 0313, 0272, 0144, 0235, 0031, 
+  0174, 0176, 0330, 0056, 0171, 0252, 0124, 0175, 0052, 0076, 0371, 0334, 0372, 0344, 0372, 0031, 
+  0175, 0141, 0175, 0262, 0175, 0155, 0342, 0220, 0135, 0362, 0245, 0255, 0153, 0276, 0153, 0135, 
+  0323, 0373, 0250, 0272, 0146, 0065, 0246, 0025, 0304, 0345, 0204, 0245, 0104, 0253, 0227, 0013, 
+  0263, 0323, 0102, 0317, 0146, 0250, 0167, 0032, 0250, 0312, 0377, 0354, 0327, 0111, 0240, 0122, 
+  0337, 0242, 0056, 0052, 0160, 0356, 0152, 0316, 0216, 0052, 0236, 0120, 0010, 0216, 0145, 0244, 
+  0200, 0112, 0337, 0327, 0174, 0155, 0262, 0352, 0167, 0256, 0102, 0014, 0340, 0250, 0373, 0056, 
+  0106, 0140, 0314, 0110, 0004, 0272, 0145, 0052, 0255, 0346, 0157, 0254, 0327, 0366, 0016, 0177, 
+  0032, 0237, 0134, 0073, 0260, 0303, 0310, 0366, 0024, 0240, 0143, 0117, 0001, 0152, 0006, 0143, 
+  0366, 0024, 0240, 0075, 0005, 0170, 0042, 0133, 0175, 0060, 0216, 0021, 0215, 0336, 0155, 0227, 
+  0357, 0132, 0261, 0267, 0373, 0173, 0247, 0266, 0277, 0147, 0067, 0341, 0016, 0245, 0274, 0260, 
+  0166, 0102, 0050, 0223, 0044, 0320, 0075, 0030, 0164, 0010, 0166, 0052, 0324, 0131, 0306, 0002, 
+  0267, 0164, 0226, 0337, 0227, 0026, 0331, 0162, 0331, 0321, 0355, 0311, 0235, 0110, 0271, 0114, 
+  0060, 0107, 0052, 0032, 0071, 0352, 0222, 0076, 0353, 0227, 0367, 0165, 0053, 0316, 0036, 0066, 
+  0152, 0277, 0152, 0266, 0133, 0212, 0260, 0025, 0371, 0142, 0252, 0156, 0232, 0064, 0010, 0175, 
+  0365, 0255, 0163, 0165, 0101, 0046, 0246, 0216, 0352, 0143, 0127, 0160, 0333, 0116, 0122, 0232, 
+  0260, 0151, 0030, 0363, 0266, 0022, 0357, 0266, 0021, 0353, 0266, 0031, 0347, 0226, 0274, 0303, 
+  0266, 0235, 0123, 0351, 0232, 0206, 0175, 0165, 0330, 0226, 0330, 0017, 0263, 0304, 0176, 0053, 
+  0203, 0221, 0254, 0215, 0055, 0260, 0357, 0115, 0201, 0375, 0160, 0257, 0127, 0064, 0271, 0235, 
+  0260, 0126, 0336, 0372, 0333, 0025, 0067, 0145, 0334, 0274, 0155, 0072, 0277, 0251, 0270, 0063, 
+  0307, 0321, 0004, 0211, 0227, 0051, 0265, 0371, 0330, 0221, 0331, 0144, 0314, 0150, 0042, 0107, 
+  0323, 0351, 0003, 0177, 0165, 0353, 0257, 0234, 0212, 0353, 0215, 0352, 0111, 0057, 0237, 0111, 
+  0275, 0102, 0322, 0067, 0017, 0223, 0315, 0013, 0302, 0207, 0335, 0265, 0377, 0072, 0360, 0077, 
+  0355, 0112, 0320, 0056, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 
+  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"
+  "\213\007\000\000\137\144\153\207\010\000\000\000\213\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\353\071\235\216\154\204"
+  "\251\100\374\001\206\310\377\344\070\103\216\376\115\061\107\211"
+  "\103\360\170\004\046\342\361\147\360\332\221\044\163\101\127\265"
+  "\143\343\357\050\024\116\110\140\222\214\300\127\361\170\035\175"
+  "\117\023\061\103\124\000\007\107\043\000\137\376\356\201\214\102"
+  "\322\304\234\305\210\213\245\103\341\014\215\000\141\163\304\201"
+  "\337\033\166\237\277\050\156\227\306\261\152\347\272\165\055\237"
+  "\040\111\021\360\057\153\033\046\002\305\001\246\041\107\152\300"
+  "\365\143\210\341\004\155\020\274\351\142\330\315\001\061\305\306"
+  "\153\007\233\053\371\243\011\216\204\361\160\340\071\267\360\210"
+  "\307\077\147\222\074\107\006\147\037\313\354\351\011\047\170\114"
+  "\244\014\367\074\105\165\103\012\041\015\036\130\230\046\300\277"
+  "\205\044\251\155\217\103\106\203\354\043\360\245\123\350\110\362"
+  "\020\021\023\051\176\303\220\260\111\056\206\364\057\370\077\024"
+  "\104\371\243\166\006\050\260\220\262\073\202\103\232\020\050\240"
+  "\104\142\004\226\110\222\177\123\275\071\012\306\244\226\315\062"
+  "\106\301\024\147\132\312\207\267\105\020\116\061\211\362\317\031"
+  "\071\221\236\163\312\110\204\170\167\325\240\273\326\042\157\355"
+  "\050\037\113\041\351\250\077\245\252\306\154\001\136\170\154\141"
+  "\365\353\332\267\346\310\024\321\314\040\237\140\032\020\364\220"
+  "\115\077\317\200\204\343\311\324\224\106\260\330\220\142\314\204"
+  "\140\063\135\042\306\261\264\043\050\344\242\004\174\271\072\011"
+  "\034\102\242\103\230\304\060\224\153\144\151\077\305\332\202\141"
+  "\326\123\000\071\202\153\152\051\124\134\052\305\240\233\352\333"
+  "\125\205\205\176\017\056\131\052\202\104\054\063\073\107\064\052"
+  "\045\334\230\245\165\003\316\255\162\254\076\367\300\133\252\242"
+  "\141\214\021\051\264\265\340\246\300\061\124\063\253\164\133\232"
+  "\040\232\222\162\024\042\374\204\222\040\102\017\060\045\302\234"
+  "\203\362\304\300\317\035\262\011\141\232\240\040\245\322\135\020"
+  "\114\167\020\032\222\071\134\046\101\062\145\363\140\065\206\152"
+  "\026\353\136\171\223\061\014\037\245\055\324\167\211\026\061\244"
+  "\221\371\120\037\060\041\346\124\061\113\160\156\330\156\225\120"
+  "\205\243\337\160\275\315\115\301\153\146\012\371\272\163\374\246"
+  "\140\064\243\017\167\072\366\332\230\216\105\342\027\213\136\046"
+  "\266\321\172\221\313\154\104\122\153\177\005\302\156\011\272\155"
+  "\163\165\101\316\316\346\320\326\322\252\035\123\354\020\127\230"
+  "\270\241\133\256\202\354\017\361\025\225\000\225\172\273\140\001"
+  "\011\236\124\073\350\002\210\246\060\222\153\126\026\137\003\237"
+  "\062\132\335\157\041\130\305\200\135\147\203\311\363\252\202\366"
+  "\015\200\153\012\136\041\200\062\000\017\142\030\105\065\263\245"
+  "\036\010\135\243\152\015\212\066\340\250\313\031\006\273\060\060"
+  "\262\134\055\053\326\033\106\245\152\166\121\117\053\052\152\113"
+  "\115\315\001\322\003\251\030\250\157\060\302\154\075\042\133\105"
+  "\047\201\052\034\360\354\333\074\106\003\165\274\115\102\266\073"
+  "\104\262\141\100\047\353\345\263\256\214\255\251\255\141\144\147"
+  "\036\351\031\115\206\042\226\323\325\112\220\010\310\105\023\106"
+  "\131\212\375\324\002\134\021\207\062\057\242\221\164\001\202\161"
+  "\123\176\145\301\351\166\257\145\301\252\156\360\332\030\171\275"
+  "\150\266\225\144\153\033\045\055\361\013\223\261\266\374\303\015"
+  "\233\215\231\364\246\367\150\261\052\032\207\331\223\061\133\010"
+  "\371\104\171\011\260\037\126\333\202\215\045\201\134\337\370\262"
+  "\371\260\024\233\100\041\024\062\222\316\314\364\056\371\141\201"
+  "\146\111\175\273\125\113\377\252\277\270\352\017\273\352\263\066"
+  "\121\317\033\054\344\257\051\131\377\302\135\134\014\134\123\262"
+  "\201\353\056\372\256\061\131\317\365\056\026\277\364\007\073\010"
+  "\347\112\114\314\373\353\113\272\236\173\151\116\170\345\111\102"
+  "\117\137\302\274\235\206\222\113\212\245\253\251\252\063\300\055"
+  "\253\376\135\321\156\230\263\142\327\321\147\332\352\012\252\277"
+  "\042\150\272\273\217\134\142\232\072\213\266\127\230\336\141\255"
+  "\060\177\251\050\361\110\326\220\362\220\067\306\013\104\022\033"
+  "\042\151\114\140\357\107\114\140\035\274\365\260\156\005\347\346"
+  "\030\067\016\101\065\260\255\305\325\346\356\037\224\273\267\232"
+  "\235\207\220\330\254\374\364\262\362\155\176\023\316\322\030\370"
+  "\145\065\041\273\232\035\137\302\177\027\143\272\136\017\214\103"
+  "\251\167\371\154\347\052\340\076\372\202\327\027\337\200\277\366"
+  "\376\344\076\316\147\233\135\330\354\102\043\273\100\074\224\063"
+  "\330\072\144\233\136\374\360\364\242\147\323\213\343\334\032\224"
+  "\203\027\154\366\276\073\203\067\252\017\273\057\150\063\020\233"
+  "\201\234\150\006\162\042\041\333\077\070\022\323\317\166\002\037"
+  "\137\316\361\066\205\236\147\232\076\225\044\332\263\111\364\236"
+  "\246\040\326\043\327\170\344\077\120\166\004\313\272\144\235\031"
+  "\174\176\330\056\171\252\124\175\052\076\371\334\372\344\372\031"
+  "\175\141\175\262\175\155\342\220\135\362\245\255\153\276\153\135"
+  "\323\373\250\272\146\065\246\025\304\345\204\245\104\253\227\013"
+  "\263\323\102\317\146\250\167\032\250\312\377\354\327\111\240\122"
+  "\337\242\056\052\160\356\152\316\216\052\236\120\010\216\145\244"
+  "\200\112\337\327\174\155\262\352\167\256\102\014\340\250\373\056"
+  "\106\140\314\110\004\272\145\052\255\346\157\254\327\366\016\177"
+  "\032\237\134\073\260\303\310\366\024\240\143\117\001\152\006\143"
+  "\366\024\240\075\005\170\042\133\175\060\216\021\215\336\155\227"
+  "\357\132\261\267\373\173\247\266\277\147\067\341\016\245\274\260"
+  "\166\102\050\223\044\320\075\030\164\010\166\052\324\131\306\002"
+  "\267\164\226\337\227\026\331\162\331\321\355\311\235\110\271\114"
+  "\060\107\052\032\071\352\222\076\353\227\367\165\053\316\036\066"
+  "\152\277\152\266\133\212\260\025\371\142\252\156\232\064\010\175"
+  "\365\255\163\165\101\046\246\216\352\143\127\160\333\116\122\232"
+  "\260\151\030\363\266\022\357\266\021\353\266\031\347\226\274\303"
+  "\266\235\123\351\232\206\175\165\330\226\330\017\263\304\176\053"
+  "\203\221\254\215\055\260\357\115\201\375\160\257\127\064\271\235"
+  "\260\126\336\372\333\025\067\145\334\274\155\072\277\251\270\063"
+  "\307\321\004\211\227\051\265\371\330\221\331\144\314\150\042\107"
+  "\323\351\003\177\165\353\257\234\212\353\215\352\111\057\237\111"
+  "\275\102\322\067\017\223\315\013\302\207\335\265\377\072\360\077"
+  "\355\112\320\056\000\050\165\165\141\171\051\143\141\152\141\057"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/1.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/10.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/2.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/3.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/4.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/4.html new file mode 100644 index 0000000..df1c99c --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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[1720]; 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, 
+  0267, 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, 0006, 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, 0026, 0354, 0002, 0015, 0262, 0171, 0062, 0374, 0016, 0324, 0004, 0224, 0023, 0255, 
+  0047, 0350, 0306, 0334, 0377, 0275, 0040, 0063, 0100, 0001, 0213, 0046, 0210, 0245, 0237, 0103, 
+  0224, 0316, 0263, 0063, 0143, 0045, 0143, 0120, 0146, 0035, 0010, 0262, 0200, 0011, 0132, 0062, 
+  0315, 0102, 0016, 0150, 0172, 0253, 0022, 0030, 0017, 0236, 0376, 0165, 0117, 0246, 0104, 0340, 
+  0073, 0111, 0023, 0215, 0246, 0327, 0204, 0353, 0332, 0371, 0214, 0112, 0201, 0323, 0117, 0064, 
+  0215, 0054, 0330, 0002, 0204, 0351, 0151, 0020, 0121, 0021, 0156, 0074, 0310, 0167, 0337, 0214, 
+  0220, 0321, 0117, 0046, 0304, 0312, 0240, 0147, 0301, 0051, 0160, 0037, 0052, 0276, 0062, 0302, 
+  0345, 0054, 0047, 0203, 0222, 0357, 0004, 0247, 0154, 0060, 0022, 0107, 0371, 0170, 0067, 0273, 
+  0064, 0314, 0130, 0006, 0004, 0106, 0021, 0241, 0071, 0061, 0304, 0262, 0143, 0202, 0326, 0140, 
+  0301, 0277, 0331, 0325, 0202, 0133, 0331, 0357, 0367, 0273, 0021, 0231, 0143, 0355, 0165, 0014, 
+  0170, 0156, 0225, 0327, 0302, 0145, 0064, 0355, 0001, 0320, 0071, 0343, 0121, 0376, 0235, 0202, 
+  0163, 0253, 0342, 0163, 0311, 0043, 0120, 0203, 0315, 0204, 0301, 0316, 0214, 0174, 0166, 0220, 
+  0031, 0203, 0040, 0274, 0227, 0375, 0264, 0102, 0016, 0345, 0003, 0332, 0342, 0330, 0343, 0362, 
+  0347, 0235, 0177, 0375, 0331, 0351, 0202, 0131, 0020, 0065, 0143, 0002, 0163, 0270, 0263, 0204, 
+  0015, 0107, 0036, 0040, 0212, 0315, 0346, 0276, 0060, 0106, 0306, 0236, 0020, 0241, 0064, 0106, 
+  0056, 0232, 0002, 0111, 0305, 0254, 0074, 0211, 0261, 0336, 0003, 0115, 0255, 0033, 0061, 0214, 
+  0022, 0336, 0004, 0120, 0307, 0204, 0132, 0147, 0126, 0272, 0216, 0133, 0132, 0204, 0246, 0053, 
+  0141, 0242, 0200, 0354, 0210, 0305, 0051, 0270, 0304, 0222, 0041, 0212, 0342, 0153, 0053, 0102, 
+  0027, 0034, 0047, 0153, 0231, 0030, 0254, 0315, 0072, 0365, 0020, 0016, 0165, 0056, 0122, 0122, 
+  0034, 0053, 0337, 0360, 0223, 0075, 0247, 0336, 0000, 0207, 0371, 0320, 0113, 0130, 0327, 0146, 
+  0102, 0340, 0116, 0063, 0305, 0137, 0034, 0216, 0245, 0032, 0131, 0245, 0333, 0153, 0310, 0112, 
+  0137, 0120, 0005, 0024, 0330, 0022, 0064, 0216, 0340, 0216, 0044, 0334, 0370, 0143, 0310, 0074, 
+  0071, 0232, 0346, 0016, 0335, 0007, 0060, 0321, 0200, 0023, 0141, 0235, 0006, 0147, 0242, 0005, 
+  0321, 0204, 0257, 0310, 0132, 0143, 0075, 0227, 0053, 0274, 0331, 0103, 0065, 0212, 0135, 0257, 
+  0136, 0104, 0114, 0350, 0275, 0265, 0210, 0372, 0045, 0341, 0041, 0046, 0042, 0362, 0337, 0352, 
+  0035, 0343, 0334, 0037, 0052, 0226, 0232, 0345, 0346, 0175, 0121, 0105, 0224, 0163, 0367, 0005, 
+  0007, 0174, 0210, 0101, 0244, 0361, 0242, 0013, 0163, 0370, 0126, 0141, 0250, 0157, 0323, 0026, 
+  0206, 0147, 0145, 0166, 0052, 0363, 0260, 0013, 0145, 0166, 0221, 0357, 0046, 0275, 0214, 0154, 
+  0257, 0230, 0223, 0323, 0354, 0005, 0022, 0223, 0050, 0312, 0302, 0354, 0125, 0163, 0010, 0172, 
+  0217, 0323, 0334, 0253, 0072, 0252, 0371, 0172, 0011, 0007, 0123, 0367, 0030, 0272, 0357, 0031, 
+  0352, 0022, 0262, 0326, 0066, 0333, 0125, 0032, 0320, 0070, 0377, 0151, 0221, 0003, 0371, 0070, 
+  0313, 0153, 0225, 0045, 0330, 0257, 0342, 0320, 0052, 0031, 0124, 0352, 0217, 0361, 0003, 0341, 
+  0154, 0126, 0035, 0106, 0034, 0054, 0232, 0223, 0310, 0072, 0243, 0134, 0037, 0205, 0024, 0325, 
+  0353, 0072, 0231, 0345, 0146, 0330, 0247, 0164, 0063, 0151, 0055, 0202, 0134, 0363, 0017, 0140, 
+  0334, 0241, 0314, 0163, 0062, 0320, 0026, 0013, 0170, 0153, 0312, 0303, 0121, 0055, 0174, 0051, 
+  0043, 0334, 0314, 0270, 0121, 0054, 0102, 0145, 0323, 0017, 0344, 0105, 0027, 0374, 0250, 0053, 
+  0160, 0256, 0332, 0040, 0120, 0126, 0257, 0266, 0026, 0330, 0012, 0003, 0225, 0074, 0131, 0010, 
+  0137, 0044, 0225, 0262, 0161, 0313, 0347, 0213, 0134, 0204, 0062, 0365, 0174, 0131, 0062, 0044, 
+  0343, 0324, 0335, 0150, 0114, 0323, 0321, 0160, 0317, 0037, 0166, 0056, 0275, 0256, 0044, 0350, 
+  0302, 0063, 0157, 0032, 0377, 0353, 0163, 0216, 0146, 0371, 0107, 0255, 0231, 0021, 0143, 0010, 
+  0235, 0127, 0046, 0010, 0325, 0130, 0254, 0106, 0156, 0221, 0134, 0064, 0045, 0251, 0166, 0277, 
+  0316, 0124, 0372, 0120, 0275, 0372, 0104, 0155, 0155, 0370, 0117, 0236, 0055, 0157, 0323, 0154, 
+  0043, 0161, 0236, 0100, 0237, 0262, 0132, 0155, 0142, 0215, 0066, 0104, 0231, 0266, 0110, 0252, 
+  0313, 0210, 0000, 0023, 0375, 0147, 0133, 0324, 0236, 0105, 0147, 0245, 0037, 0024, 0260, 0220, 
+  0202, 0121, 0274, 0142, 0321, 0014, 0154, 0070, 0173, 0351, 0036, 0216, 0312, 0252, 0056, 0336, 
+  0227, 0125, 0235, 0115, 0250, 0322, 0204, 0014, 0226, 0257, 0157, 0102, 0247, 0244, 0351, 0303, 
+  0343, 0326, 0364, 0155, 0112, 0062, 0267, 0176, 0306, 0072, 0034, 0133, 0011, 0121, 0243, 0067, 
+  0236, 0110, 0237, 0262, 0366, 0173, 0325, 0165, 0376, 0254, 0054, 0071, 0260, 0150, 0055, 0274, 
+  0323, 0312, 0212, 0136, 0115, 0253, 0253, 0231, 0122, 0001, 0134, 0016, 0130, 0012, 0264, 0071, 
+  0261, 0110, 0053, 0325, 0047, 0277, 0327, 0254, 0022, 0255, 0212, 0024, 0307, 0125, 0205, 0226, 
+  0072, 0363, 0257, 0240, 0015, 0023, 0231, 0265, 0324, 0042, 0265, 0112, 0240, 0130, 0230, 0030, 
+  0320, 0245, 0122, 0333, 0116, 0331, 0054, 0274, 0202, 0354, 0344, 0053, 0130, 0022, 0236, 0330, 
+  0237, 0241, 0065, 0031, 0064, 0050, 0223, 0151, 0065, 0176, 0157, 0301, 0166, 0327, 0341, 0364, 
+  0156, 0233, 0234, 0130, 0277, 0376, 0334, 0202, 0072, 0267, 0240, 0332, 0267, 0240, 0076, 0127, 
+  0366, 0061, 0336, 0146, 0007, 0252, 0165, 0222, 0121, 0332, 0110, 0376, 0161, 0035, 0250, 0071, 
+  0320, 0302, 0211, 0134, 0166, 0114, 0100, 0323, 0321, 0322, 0143, 0271, 0103, 0152, 0353, 0024, 
+  0075, 0244, 0347, 0377, 0255, 0353, 0203, 0256, 0323, 0311, 0103, 0320, 0354, 0037, 0351, 0375, 
+  0374, 0322, 0254, 0303, 0026, 0104, 0244, 0310, 0012, 0063, 0021, 0131, 0365, 0065, 0122, 0035, 
+  0107, 0055, 0326, 0070, 0352, 0036, 0036, 0201, 0017, 0216, 0306, 0307, 0122, 0312, 0235, 0160, 
+  0275, 0346, 0347, 0001, 0075, 0212, 0264, 0075, 0106, 0375, 0045, 0214, 0132, 0357, 0370, 0100, 
+  0310, 0176, 0327, 0341, 0351, 0210, 0175, 0035, 0372, 0250, 0216, 0272, 0361, 0115, 0255, 0270, 
+  0271, 0045, 0167, 0146, 0315, 0335, 0130, 0164, 0047, 0126, 0335, 0320, 0262, 0033, 0326, 0372, 
+  0355, 0225, 0367, 0351, 0040, 0351, 0026, 0036, 0314, 0156, 0034, 0157, 0166, 0222, 0364, 0132, 
+  0152, 0174, 0260, 0224, 0323, 0153, 0202, 0113, 0300, 0351, 0241, 0346, 0157, 0136, 0170, 0230, 
+  0201, 0205, 0256, 0237, 0267, 0231, 0071, 0355, 0377, 0361, 0070, 0036, 0144, 0137, 0315, 0101, 
+  0154, 0314, 0356, 0207, 0217, 0243, 0126, 0160, 0263, 0166, 0313, 0075, 0370, 0203, 0075, 0262, 
+  0270, 0051, 0114, 0076, 0117, 0237, 0235, 0104, 0233, 0273, 0106, 0077, 0316, 0111, 0274, 0243, 
+  0324, 0352, 0334, 0117, 0174, 0143, 0375, 0104, 0033, 0246, 0142, 0005, 0132, 0237, 0373, 0211, 
+  0307, 0324, 0117, 0074, 0335, 0053, 0223, 0076, 0067, 0001, 0153, 0351, 0355, 0362, 0046, 0143, 
+  0176, 0353, 0302, 0020, 0223, 0150, 0034, 0326, 0336, 0154, 0324, 0040, 0322, 0275, 0055, 0301, 
+  0223, 0011, 0215, 0057, 0067, 0066, 0354, 0364, 0356, 0074, 0240, 0332, 0354, 0175, 0163, 0131, 
+  0370, 0070, 0173, 0277, 0215, 0333, 0045, 0125, 0057, 0227, 0262, 0027, 0110, 0075, 0120, 0112, 
+  0252, 0327, 0270, 0016, 0375, 0326, 0017, 0013, 0166, 0057, 0035, 0345, 0052, 0124, 0026, 0342, 
+  0116, 0133, 0205, 0312, 0143, 0134, 0366, 0317, 0233, 0124, 0245, 0367, 0026, 0047, 0056, 0333, 
+  0306, 0211, 0042, 0215, 0305, 0327, 0212, 0371, 0113, 0267, 0336, 0346, 0052, 0305, 0026, 0242, 
+  0060, 0034, 0330, 0034, 0051, 0226, 0102, 0333, 0335, 0364, 0176, 0107, 0323, 0302, 0253, 0061, 
+  0233, 0270, 0354, 0116, 0255, 0107, 0160, 0151, 0265, 0373, 0371, 0225, 0215, 0023, 0374, 0305, 
+  0240, 0056, 0076, 0122, 0265, 0165, 0340, 0363, 0103, 0343, 0377, 0001, 0224, 0300, 0104, 0026, 
+  0000, 0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1720]; 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"
+  "\267\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\006\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\026\354\002\015\262\171\062\374\016\324\004\224\023\255"
+  "\047\350\306\334\377\275\040\063\100\001\213\046\210\245\237\103"
+  "\224\316\263\063\143\045\143\120\146\035\010\262\200\011\132\062"
+  "\315\102\016\150\172\253\022\030\017\236\376\165\117\246\104\340"
+  "\073\111\023\215\246\327\204\353\332\371\214\112\201\323\117\064"
+  "\215\054\330\002\204\351\151\020\121\021\156\074\310\167\337\214"
+  "\220\321\117\046\304\312\240\147\301\051\160\037\052\276\062\302"
+  "\345\054\047\203\222\357\004\247\154\060\022\107\371\170\067\273"
+  "\064\314\130\006\004\106\021\241\071\061\304\262\143\202\326\140"
+  "\301\277\331\325\202\133\331\357\367\273\021\231\143\355\165\014"
+  "\170\156\225\327\302\145\064\355\001\320\071\343\121\376\235\202"
+  "\163\253\342\163\311\043\120\203\315\204\301\316\214\174\166\220"
+  "\031\203\040\274\227\375\264\102\016\345\003\332\342\330\343\362"
+  "\347\235\177\375\331\351\202\131\020\065\143\002\163\270\263\204"
+  "\015\107\036\040\212\315\346\276\060\106\306\236\020\241\064\106"
+  "\056\232\002\111\305\254\074\211\261\336\003\115\255\033\061\214"
+  "\022\336\004\120\307\204\132\147\126\272\216\133\132\204\246\053"
+  "\141\242\200\354\210\305\051\270\304\222\041\212\342\153\053\102"
+  "\027\034\047\153\231\030\254\315\072\365\020\016\165\056\122\122"
+  "\034\053\337\360\223\075\247\336\000\207\371\320\113\130\327\146"
+  "\102\340\116\063\305\137\034\216\245\032\131\245\333\153\310\112"
+  "\137\120\005\024\330\022\064\216\340\216\044\334\370\143\310\074"
+  "\071\232\346\016\335\007\060\321\200\023\141\235\006\147\242\005"
+  "\321\204\257\310\132\143\075\227\053\274\331\103\065\212\135\257"
+  "\136\104\114\350\275\265\210\372\045\341\041\046\042\362\337\352"
+  "\035\343\334\037\052\226\232\345\346\175\121\105\224\163\367\005"
+  "\007\174\210\101\244\361\242\013\163\370\126\141\250\157\323\026"
+  "\206\147\145\166\052\363\260\013\145\166\221\357\046\275\214\154"
+  "\257\230\223\323\354\005\022\223\050\312\302\354\125\163\010\172"
+  "\217\323\334\253\072\252\371\172\011\007\123\367\030\272\357\031"
+  "\352\022\262\326\066\333\125\032\320\070\377\151\221\003\371\070"
+  "\313\153\225\045\330\257\342\320\052\031\124\352\217\361\003\341"
+  "\154\126\035\106\034\054\232\223\310\072\243\134\037\205\024\325"
+  "\353\072\231\345\146\330\247\164\063\151\055\202\134\363\017\140"
+  "\334\241\314\163\062\320\026\013\170\153\312\303\121\055\174\051"
+  "\043\334\314\270\121\054\102\145\323\017\344\105\027\374\250\053"
+  "\160\256\332\040\120\126\257\266\026\330\012\003\225\074\131\010"
+  "\137\044\225\262\161\313\347\213\134\204\062\365\174\131\062\044"
+  "\343\324\335\150\114\323\321\160\317\037\166\056\275\256\044\350"
+  "\302\063\157\032\377\353\163\216\146\371\107\255\231\021\143\010"
+  "\235\127\046\010\325\130\254\106\156\221\134\064\045\251\166\277"
+  "\316\124\372\120\275\372\104\155\155\370\117\236\055\157\323\154"
+  "\043\161\236\100\237\262\132\155\142\215\066\104\231\266\110\252"
+  "\313\210\000\023\375\147\133\324\236\105\147\245\037\024\260\220"
+  "\202\121\274\142\321\014\154\070\173\351\036\216\312\252\056\336"
+  "\227\125\235\115\250\322\204\014\226\257\157\102\247\244\351\303"
+  "\343\326\364\155\112\062\267\176\306\072\034\133\011\121\243\067"
+  "\236\110\237\262\366\173\325\165\376\254\054\071\260\150\055\274"
+  "\323\312\212\136\115\253\253\231\122\001\134\016\130\012\264\071"
+  "\261\110\053\325\047\277\327\254\022\255\212\024\307\125\205\226"
+  "\072\363\257\240\015\023\231\265\324\042\265\112\240\130\230\030"
+  "\320\245\122\333\116\331\054\274\202\354\344\053\130\022\236\330"
+  "\237\241\065\031\064\050\223\151\065\176\157\301\166\327\341\364"
+  "\156\233\234\130\277\376\334\202\072\267\240\332\267\240\076\127"
+  "\366\061\336\146\007\252\165\222\121\332\110\376\161\035\250\071"
+  "\320\302\211\134\166\114\100\323\321\322\143\271\103\152\353\024"
+  "\075\244\347\377\255\353\203\256\323\311\103\320\354\037\351\375"
+  "\374\322\254\303\026\104\244\310\012\063\021\131\365\065\122\035"
+  "\107\055\326\070\352\036\036\201\017\216\306\307\122\312\235\160"
+  "\275\346\347\001\075\212\264\075\106\375\045\214\132\357\370\100"
+  "\310\176\327\341\351\210\175\035\372\250\216\272\361\115\255\270"
+  "\271\045\167\146\315\335\130\164\047\126\335\320\262\033\326\372"
+  "\355\225\367\351\040\351\026\036\314\156\034\157\166\222\364\132"
+  "\152\174\260\224\323\153\202\113\300\351\241\346\157\136\170\230"
+  "\201\205\256\237\267\231\071\355\377\361\070\036\144\137\315\101"
+  "\154\314\356\207\217\243\126\160\263\166\313\075\370\203\075\262"
+  "\270\051\114\076\117\237\235\104\233\273\106\077\316\111\274\243"
+  "\324\352\334\117\174\143\375\104\033\246\142\005\132\237\373\211"
+  "\307\324\117\074\335\053\223\076\067\001\153\351\355\362\046\143"
+  "\176\353\302\020\223\150\034\326\336\154\324\040\322\275\055\301"
+  "\223\011\215\057\067\066\354\364\356\074\240\332\354\175\163\131"
+  "\370\070\173\277\215\333\045\125\057\227\262\027\110\075\120\112"
+  "\252\327\270\016\375\326\017\013\166\057\035\345\052\124\026\342"
+  "\116\133\205\312\143\134\366\317\233\124\245\367\026\047\056\333"
+  "\306\211\042\215\305\327\212\371\113\267\336\346\052\305\026\242"
+  "\060\034\330\034\051\226\102\333\335\364\176\107\323\302\253\061"
+  "\233\270\354\116\255\107\160\151\265\373\371\225\215\023\374\305"
+  "\240\056\076\122\265\165\340\363\103\343\377\001\224\300\104\026"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/5.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/6.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/7.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/8.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/9.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/index.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/stats.html b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/style.css b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-05-19-215023-2683-cppcheck@e7dbc883de67_mailer_evo/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/index.html b/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/index.html new file mode 100644 index 0000000..833d984 --- /dev/null +++ b/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@aa862337b730
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Sun Jun 21 11:00:19 2020
+

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_info2931View Report
+ + diff --git a/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/report-5c517c.html b/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/report-5c517c.html new file mode 100644 index 0000000..fc6810e --- /dev/null +++ b/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/report-5c517c.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-21-110019-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/report-683370.html b/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/report-683370.html new file mode 100644 index 0000000..fc74902 --- /dev/null +++ b/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/report-683370.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-21-110019-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/scanview.css b/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-06-21-110019-6106-1@9ead9ce3bdd6_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/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/sorttable.js b/2020-06-21-110019-6106-1@9ead9ce3bdd6_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-06-21-110019-6106-1@9ead9ce3bdd6_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
#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, 
+  0213, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0213, 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, 0353, 0071, 0235, 0216, 0154, 0204, 
+  0251, 0100, 0374, 0001, 0206, 0310, 0377, 0344, 0070, 0103, 0216, 0376, 0115, 0061, 0107, 0211, 
+  0103, 0360, 0170, 0004, 0046, 0342, 0361, 0147, 0360, 0332, 0221, 0044, 0163, 0101, 0127, 0265, 
+  0143, 0343, 0357, 0050, 0024, 0116, 0110, 0140, 0222, 0214, 0300, 0127, 0361, 0170, 0035, 0175, 
+  0117, 0023, 0061, 0103, 0124, 0000, 0007, 0107, 0043, 0000, 0137, 0376, 0356, 0201, 0214, 0102, 
+  0322, 0304, 0234, 0305, 0210, 0213, 0245, 0103, 0341, 0014, 0215, 0000, 0141, 0163, 0304, 0201, 
+  0337, 0033, 0166, 0237, 0277, 0050, 0156, 0227, 0306, 0261, 0152, 0347, 0272, 0165, 0055, 0237, 
+  0040, 0111, 0021, 0360, 0057, 0153, 0033, 0046, 0002, 0305, 0001, 0246, 0041, 0107, 0152, 0300, 
+  0365, 0143, 0210, 0341, 0004, 0155, 0020, 0274, 0351, 0142, 0330, 0315, 0001, 0061, 0305, 0306, 
+  0153, 0007, 0233, 0053, 0371, 0243, 0011, 0216, 0204, 0361, 0160, 0340, 0071, 0267, 0360, 0210, 
+  0307, 0077, 0147, 0222, 0074, 0107, 0006, 0147, 0037, 0313, 0354, 0351, 0011, 0047, 0170, 0114, 
+  0244, 0014, 0367, 0074, 0105, 0165, 0103, 0012, 0041, 0015, 0036, 0130, 0230, 0046, 0300, 0277, 
+  0205, 0044, 0251, 0155, 0217, 0103, 0106, 0203, 0354, 0043, 0360, 0245, 0123, 0350, 0110, 0362, 
+  0020, 0021, 0023, 0051, 0176, 0303, 0220, 0260, 0111, 0056, 0206, 0364, 0057, 0370, 0077, 0024, 
+  0104, 0371, 0243, 0166, 0006, 0050, 0260, 0220, 0262, 0073, 0202, 0103, 0232, 0020, 0050, 0240, 
+  0104, 0142, 0004, 0226, 0110, 0222, 0177, 0123, 0275, 0071, 0012, 0306, 0244, 0226, 0315, 0062, 
+  0106, 0301, 0024, 0147, 0132, 0312, 0207, 0267, 0105, 0020, 0116, 0061, 0211, 0362, 0317, 0031, 
+  0071, 0221, 0236, 0163, 0312, 0110, 0204, 0170, 0167, 0325, 0240, 0273, 0326, 0042, 0157, 0355, 
+  0050, 0037, 0113, 0041, 0351, 0250, 0077, 0245, 0252, 0306, 0154, 0001, 0136, 0170, 0154, 0141, 
+  0365, 0353, 0332, 0267, 0346, 0310, 0024, 0321, 0314, 0040, 0237, 0140, 0032, 0020, 0364, 0220, 
+  0115, 0077, 0317, 0200, 0204, 0343, 0311, 0324, 0224, 0106, 0260, 0330, 0220, 0142, 0314, 0204, 
+  0140, 0063, 0135, 0042, 0306, 0261, 0264, 0043, 0050, 0344, 0242, 0004, 0174, 0271, 0072, 0011, 
+  0034, 0102, 0242, 0103, 0230, 0304, 0060, 0224, 0153, 0144, 0151, 0077, 0305, 0332, 0202, 0141, 
+  0326, 0123, 0000, 0071, 0202, 0153, 0152, 0051, 0124, 0134, 0052, 0305, 0240, 0233, 0352, 0333, 
+  0125, 0205, 0205, 0176, 0017, 0056, 0131, 0052, 0202, 0104, 0054, 0063, 0073, 0107, 0064, 0052, 
+  0045, 0334, 0230, 0245, 0165, 0003, 0316, 0255, 0162, 0254, 0076, 0367, 0300, 0133, 0252, 0242, 
+  0141, 0214, 0021, 0051, 0264, 0265, 0340, 0246, 0300, 0061, 0124, 0063, 0253, 0164, 0133, 0232, 
+  0040, 0232, 0222, 0162, 0024, 0042, 0374, 0204, 0222, 0040, 0102, 0017, 0060, 0045, 0302, 0234, 
+  0203, 0362, 0304, 0300, 0317, 0035, 0262, 0011, 0141, 0232, 0240, 0040, 0245, 0322, 0135, 0020, 
+  0114, 0167, 0020, 0032, 0222, 0071, 0134, 0046, 0101, 0062, 0145, 0363, 0140, 0065, 0206, 0152, 
+  0026, 0353, 0136, 0171, 0223, 0061, 0014, 0037, 0245, 0055, 0324, 0167, 0211, 0026, 0061, 0244, 
+  0221, 0371, 0120, 0037, 0060, 0041, 0346, 0124, 0061, 0113, 0160, 0156, 0330, 0156, 0225, 0120, 
+  0205, 0243, 0337, 0160, 0275, 0315, 0115, 0301, 0153, 0146, 0012, 0371, 0272, 0163, 0374, 0246, 
+  0140, 0064, 0243, 0017, 0167, 0072, 0366, 0332, 0230, 0216, 0105, 0342, 0027, 0213, 0136, 0046, 
+  0266, 0321, 0172, 0221, 0313, 0154, 0104, 0122, 0153, 0177, 0005, 0302, 0156, 0011, 0272, 0155, 
+  0163, 0165, 0101, 0316, 0316, 0346, 0320, 0326, 0322, 0252, 0035, 0123, 0354, 0020, 0127, 0230, 
+  0270, 0241, 0133, 0256, 0202, 0354, 0017, 0361, 0025, 0225, 0000, 0225, 0172, 0273, 0140, 0001, 
+  0011, 0236, 0124, 0073, 0350, 0002, 0210, 0246, 0060, 0222, 0153, 0126, 0026, 0137, 0003, 0237, 
+  0062, 0132, 0335, 0157, 0041, 0130, 0305, 0200, 0135, 0147, 0203, 0311, 0363, 0252, 0202, 0366, 
+  0015, 0200, 0153, 0012, 0136, 0041, 0200, 0062, 0000, 0017, 0142, 0030, 0105, 0065, 0263, 0245, 
+  0036, 0010, 0135, 0243, 0152, 0015, 0212, 0066, 0340, 0250, 0313, 0031, 0006, 0273, 0060, 0060, 
+  0262, 0134, 0055, 0053, 0326, 0033, 0106, 0245, 0152, 0166, 0121, 0117, 0053, 0052, 0152, 0113, 
+  0115, 0315, 0001, 0322, 0003, 0251, 0030, 0250, 0157, 0060, 0302, 0154, 0075, 0042, 0133, 0105, 
+  0047, 0201, 0052, 0034, 0360, 0354, 0333, 0074, 0106, 0003, 0165, 0274, 0115, 0102, 0266, 0073, 
+  0104, 0262, 0141, 0100, 0047, 0353, 0345, 0263, 0256, 0214, 0255, 0251, 0255, 0141, 0144, 0147, 
+  0036, 0351, 0031, 0115, 0206, 0042, 0226, 0323, 0325, 0112, 0220, 0010, 0310, 0105, 0023, 0106, 
+  0131, 0212, 0375, 0324, 0002, 0134, 0021, 0207, 0062, 0057, 0242, 0221, 0164, 0001, 0202, 0161, 
+  0123, 0176, 0145, 0301, 0351, 0166, 0257, 0145, 0301, 0252, 0156, 0360, 0332, 0030, 0171, 0275, 
+  0150, 0266, 0225, 0144, 0153, 0033, 0045, 0055, 0361, 0013, 0223, 0261, 0266, 0374, 0303, 0015, 
+  0233, 0215, 0231, 0364, 0246, 0367, 0150, 0261, 0052, 0032, 0207, 0331, 0223, 0061, 0133, 0010, 
+  0371, 0104, 0171, 0011, 0260, 0037, 0126, 0333, 0202, 0215, 0045, 0201, 0134, 0337, 0370, 0262, 
+  0371, 0260, 0024, 0233, 0100, 0041, 0024, 0062, 0222, 0316, 0314, 0364, 0056, 0371, 0141, 0201, 
+  0146, 0111, 0175, 0273, 0125, 0113, 0377, 0252, 0277, 0270, 0352, 0017, 0273, 0352, 0263, 0066, 
+  0121, 0317, 0033, 0054, 0344, 0257, 0051, 0131, 0377, 0302, 0135, 0134, 0014, 0134, 0123, 0262, 
+  0201, 0353, 0056, 0372, 0256, 0061, 0131, 0317, 0365, 0056, 0026, 0277, 0364, 0007, 0073, 0010, 
+  0347, 0112, 0114, 0314, 0373, 0353, 0113, 0272, 0236, 0173, 0151, 0116, 0170, 0345, 0111, 0102, 
+  0117, 0137, 0302, 0274, 0235, 0206, 0222, 0113, 0212, 0245, 0253, 0251, 0252, 0063, 0300, 0055, 
+  0253, 0376, 0135, 0321, 0156, 0230, 0263, 0142, 0327, 0321, 0147, 0332, 0352, 0012, 0252, 0277, 
+  0042, 0150, 0272, 0273, 0217, 0134, 0142, 0232, 0072, 0213, 0266, 0127, 0230, 0336, 0141, 0255, 
+  0060, 0177, 0251, 0050, 0361, 0110, 0326, 0220, 0362, 0220, 0067, 0306, 0013, 0104, 0022, 0033, 
+  0042, 0151, 0114, 0140, 0357, 0107, 0114, 0140, 0035, 0274, 0365, 0260, 0156, 0005, 0347, 0346, 
+  0030, 0067, 0016, 0101, 0065, 0260, 0255, 0305, 0325, 0346, 0356, 0037, 0224, 0273, 0267, 0232, 
+  0235, 0207, 0220, 0330, 0254, 0374, 0364, 0262, 0362, 0155, 0176, 0023, 0316, 0322, 0030, 0370, 
+  0145, 0065, 0041, 0273, 0232, 0035, 0137, 0302, 0177, 0027, 0143, 0272, 0136, 0017, 0214, 0103, 
+  0251, 0167, 0371, 0154, 0347, 0052, 0340, 0076, 0372, 0202, 0327, 0027, 0337, 0200, 0277, 0366, 
+  0376, 0344, 0076, 0316, 0147, 0233, 0135, 0330, 0354, 0102, 0043, 0273, 0100, 0074, 0224, 0063, 
+  0330, 0072, 0144, 0233, 0136, 0374, 0360, 0364, 0242, 0147, 0323, 0213, 0343, 0334, 0032, 0224, 
+  0203, 0027, 0154, 0366, 0276, 0073, 0203, 0067, 0252, 0017, 0273, 0057, 0150, 0063, 0020, 0233, 
+  0201, 0234, 0150, 0006, 0162, 0042, 0041, 0333, 0077, 0070, 0022, 0323, 0317, 0166, 0002, 0037, 
+  0137, 0316, 0361, 0066, 0205, 0236, 0147, 0232, 0076, 0225, 0044, 0332, 0263, 0111, 0364, 0236, 
+  0246, 0040, 0326, 0043, 0327, 0170, 0344, 0077, 0120, 0166, 0004, 0313, 0272, 0144, 0235, 0031, 
+  0174, 0176, 0330, 0056, 0171, 0252, 0124, 0175, 0052, 0076, 0371, 0334, 0372, 0344, 0372, 0031, 
+  0175, 0141, 0175, 0262, 0175, 0155, 0342, 0220, 0135, 0362, 0245, 0255, 0153, 0276, 0153, 0135, 
+  0323, 0373, 0250, 0272, 0146, 0065, 0246, 0025, 0304, 0345, 0204, 0245, 0104, 0253, 0227, 0013, 
+  0263, 0323, 0102, 0317, 0146, 0250, 0167, 0032, 0250, 0312, 0377, 0354, 0327, 0111, 0240, 0122, 
+  0337, 0242, 0056, 0052, 0160, 0356, 0152, 0316, 0216, 0052, 0236, 0120, 0010, 0216, 0145, 0244, 
+  0200, 0112, 0337, 0327, 0174, 0155, 0262, 0352, 0167, 0256, 0102, 0014, 0340, 0250, 0373, 0056, 
+  0106, 0140, 0314, 0110, 0004, 0272, 0145, 0052, 0255, 0346, 0157, 0254, 0327, 0366, 0016, 0177, 
+  0032, 0237, 0134, 0073, 0260, 0303, 0310, 0366, 0024, 0240, 0143, 0117, 0001, 0152, 0006, 0143, 
+  0366, 0024, 0240, 0075, 0005, 0170, 0042, 0133, 0175, 0060, 0216, 0021, 0215, 0336, 0155, 0227, 
+  0357, 0132, 0261, 0267, 0373, 0173, 0247, 0266, 0277, 0147, 0067, 0341, 0016, 0245, 0274, 0260, 
+  0166, 0102, 0050, 0223, 0044, 0320, 0075, 0030, 0164, 0010, 0166, 0052, 0324, 0131, 0306, 0002, 
+  0267, 0164, 0226, 0337, 0227, 0026, 0331, 0162, 0331, 0321, 0355, 0311, 0235, 0110, 0271, 0114, 
+  0060, 0107, 0052, 0032, 0071, 0352, 0222, 0076, 0353, 0227, 0367, 0165, 0053, 0316, 0036, 0066, 
+  0152, 0277, 0152, 0266, 0133, 0212, 0260, 0025, 0371, 0142, 0252, 0156, 0232, 0064, 0010, 0175, 
+  0365, 0255, 0163, 0165, 0101, 0046, 0246, 0216, 0352, 0143, 0127, 0160, 0333, 0116, 0122, 0232, 
+  0260, 0151, 0030, 0363, 0266, 0022, 0357, 0266, 0021, 0353, 0266, 0031, 0347, 0226, 0274, 0303, 
+  0266, 0235, 0123, 0351, 0232, 0206, 0175, 0165, 0330, 0226, 0330, 0017, 0263, 0304, 0176, 0053, 
+  0203, 0221, 0254, 0215, 0055, 0260, 0357, 0115, 0201, 0375, 0160, 0257, 0127, 0064, 0271, 0235, 
+  0260, 0126, 0336, 0372, 0333, 0025, 0067, 0145, 0334, 0274, 0155, 0072, 0277, 0251, 0270, 0063, 
+  0307, 0321, 0004, 0211, 0227, 0051, 0265, 0371, 0330, 0221, 0331, 0144, 0314, 0150, 0042, 0107, 
+  0323, 0351, 0003, 0177, 0165, 0353, 0257, 0234, 0212, 0353, 0215, 0352, 0111, 0057, 0237, 0111, 
+  0275, 0102, 0322, 0067, 0017, 0223, 0315, 0013, 0302, 0207, 0335, 0265, 0377, 0072, 0360, 0077, 
+  0355, 0112, 0320, 0056, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 
+  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"
+  "\213\007\000\000\137\144\153\207\010\000\000\000\213\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\353\071\235\216\154\204"
+  "\251\100\374\001\206\310\377\344\070\103\216\376\115\061\107\211"
+  "\103\360\170\004\046\342\361\147\360\332\221\044\163\101\127\265"
+  "\143\343\357\050\024\116\110\140\222\214\300\127\361\170\035\175"
+  "\117\023\061\103\124\000\007\107\043\000\137\376\356\201\214\102"
+  "\322\304\234\305\210\213\245\103\341\014\215\000\141\163\304\201"
+  "\337\033\166\237\277\050\156\227\306\261\152\347\272\165\055\237"
+  "\040\111\021\360\057\153\033\046\002\305\001\246\041\107\152\300"
+  "\365\143\210\341\004\155\020\274\351\142\330\315\001\061\305\306"
+  "\153\007\233\053\371\243\011\216\204\361\160\340\071\267\360\210"
+  "\307\077\147\222\074\107\006\147\037\313\354\351\011\047\170\114"
+  "\244\014\367\074\105\165\103\012\041\015\036\130\230\046\300\277"
+  "\205\044\251\155\217\103\106\203\354\043\360\245\123\350\110\362"
+  "\020\021\023\051\176\303\220\260\111\056\206\364\057\370\077\024"
+  "\104\371\243\166\006\050\260\220\262\073\202\103\232\020\050\240"
+  "\104\142\004\226\110\222\177\123\275\071\012\306\244\226\315\062"
+  "\106\301\024\147\132\312\207\267\105\020\116\061\211\362\317\031"
+  "\071\221\236\163\312\110\204\170\167\325\240\273\326\042\157\355"
+  "\050\037\113\041\351\250\077\245\252\306\154\001\136\170\154\141"
+  "\365\353\332\267\346\310\024\321\314\040\237\140\032\020\364\220"
+  "\115\077\317\200\204\343\311\324\224\106\260\330\220\142\314\204"
+  "\140\063\135\042\306\261\264\043\050\344\242\004\174\271\072\011"
+  "\034\102\242\103\230\304\060\224\153\144\151\077\305\332\202\141"
+  "\326\123\000\071\202\153\152\051\124\134\052\305\240\233\352\333"
+  "\125\205\205\176\017\056\131\052\202\104\054\063\073\107\064\052"
+  "\045\334\230\245\165\003\316\255\162\254\076\367\300\133\252\242"
+  "\141\214\021\051\264\265\340\246\300\061\124\063\253\164\133\232"
+  "\040\232\222\162\024\042\374\204\222\040\102\017\060\045\302\234"
+  "\203\362\304\300\317\035\262\011\141\232\240\040\245\322\135\020"
+  "\114\167\020\032\222\071\134\046\101\062\145\363\140\065\206\152"
+  "\026\353\136\171\223\061\014\037\245\055\324\167\211\026\061\244"
+  "\221\371\120\037\060\041\346\124\061\113\160\156\330\156\225\120"
+  "\205\243\337\160\275\315\115\301\153\146\012\371\272\163\374\246"
+  "\140\064\243\017\167\072\366\332\230\216\105\342\027\213\136\046"
+  "\266\321\172\221\313\154\104\122\153\177\005\302\156\011\272\155"
+  "\163\165\101\316\316\346\320\326\322\252\035\123\354\020\127\230"
+  "\270\241\133\256\202\354\017\361\025\225\000\225\172\273\140\001"
+  "\011\236\124\073\350\002\210\246\060\222\153\126\026\137\003\237"
+  "\062\132\335\157\041\130\305\200\135\147\203\311\363\252\202\366"
+  "\015\200\153\012\136\041\200\062\000\017\142\030\105\065\263\245"
+  "\036\010\135\243\152\015\212\066\340\250\313\031\006\273\060\060"
+  "\262\134\055\053\326\033\106\245\152\166\121\117\053\052\152\113"
+  "\115\315\001\322\003\251\030\250\157\060\302\154\075\042\133\105"
+  "\047\201\052\034\360\354\333\074\106\003\165\274\115\102\266\073"
+  "\104\262\141\100\047\353\345\263\256\214\255\251\255\141\144\147"
+  "\036\351\031\115\206\042\226\323\325\112\220\010\310\105\023\106"
+  "\131\212\375\324\002\134\021\207\062\057\242\221\164\001\202\161"
+  "\123\176\145\301\351\166\257\145\301\252\156\360\332\030\171\275"
+  "\150\266\225\144\153\033\045\055\361\013\223\261\266\374\303\015"
+  "\233\215\231\364\246\367\150\261\052\032\207\331\223\061\133\010"
+  "\371\104\171\011\260\037\126\333\202\215\045\201\134\337\370\262"
+  "\371\260\024\233\100\041\024\062\222\316\314\364\056\371\141\201"
+  "\146\111\175\273\125\113\377\252\277\270\352\017\273\352\263\066"
+  "\121\317\033\054\344\257\051\131\377\302\135\134\014\134\123\262"
+  "\201\353\056\372\256\061\131\317\365\056\026\277\364\007\073\010"
+  "\347\112\114\314\373\353\113\272\236\173\151\116\170\345\111\102"
+  "\117\137\302\274\235\206\222\113\212\245\253\251\252\063\300\055"
+  "\253\376\135\321\156\230\263\142\327\321\147\332\352\012\252\277"
+  "\042\150\272\273\217\134\142\232\072\213\266\127\230\336\141\255"
+  "\060\177\251\050\361\110\326\220\362\220\067\306\013\104\022\033"
+  "\042\151\114\140\357\107\114\140\035\274\365\260\156\005\347\346"
+  "\030\067\016\101\065\260\255\305\325\346\356\037\224\273\267\232"
+  "\235\207\220\330\254\374\364\262\362\155\176\023\316\322\030\370"
+  "\145\065\041\273\232\035\137\302\177\027\143\272\136\017\214\103"
+  "\251\167\371\154\347\052\340\076\372\202\327\027\337\200\277\366"
+  "\376\344\076\316\147\233\135\330\354\102\043\273\100\074\224\063"
+  "\330\072\144\233\136\374\360\364\242\147\323\213\343\334\032\224"
+  "\203\027\154\366\276\073\203\067\252\017\273\057\150\063\020\233"
+  "\201\234\150\006\162\042\041\333\077\070\022\323\317\166\002\037"
+  "\137\316\361\066\205\236\147\232\076\225\044\332\263\111\364\236"
+  "\246\040\326\043\327\170\344\077\120\166\004\313\272\144\235\031"
+  "\174\176\330\056\171\252\124\175\052\076\371\334\372\344\372\031"
+  "\175\141\175\262\175\155\342\220\135\362\245\255\153\276\153\135"
+  "\323\373\250\272\146\065\246\025\304\345\204\245\104\253\227\013"
+  "\263\323\102\317\146\250\167\032\250\312\377\354\327\111\240\122"
+  "\337\242\056\052\160\356\152\316\216\052\236\120\010\216\145\244"
+  "\200\112\337\327\174\155\262\352\167\256\102\014\340\250\373\056"
+  "\106\140\314\110\004\272\145\052\255\346\157\254\327\366\016\177"
+  "\032\237\134\073\260\303\310\366\024\240\143\117\001\152\006\143"
+  "\366\024\240\075\005\170\042\133\175\060\216\021\215\336\155\227"
+  "\357\132\261\267\373\173\247\266\277\147\067\341\016\245\274\260"
+  "\166\102\050\223\044\320\075\030\164\010\166\052\324\131\306\002"
+  "\267\164\226\337\227\026\331\162\331\321\355\311\235\110\271\114"
+  "\060\107\052\032\071\352\222\076\353\227\367\165\053\316\036\066"
+  "\152\277\152\266\133\212\260\025\371\142\252\156\232\064\010\175"
+  "\365\255\163\165\101\046\246\216\352\143\127\160\333\116\122\232"
+  "\260\151\030\363\266\022\357\266\021\353\266\031\347\226\274\303"
+  "\266\235\123\351\232\206\175\165\330\226\330\017\263\304\176\053"
+  "\203\221\254\215\055\260\357\115\201\375\160\257\127\064\271\235"
+  "\260\126\336\372\333\025\067\145\334\274\155\072\277\251\270\063"
+  "\307\321\004\211\227\051\265\371\330\221\331\144\314\150\042\107"
+  "\323\351\003\177\165\353\257\234\212\353\215\352\111\057\237\111"
+  "\275\102\322\067\017\223\315\013\302\207\335\265\377\072\360\077"
+  "\355\112\320\056\000\050\165\165\141\171\051\143\141\152\141\057"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/1.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/10.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/2.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/3.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/4.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/4.html new file mode 100644 index 0000000..df1c99c --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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[1720]; 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, 
+  0267, 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, 0006, 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, 0026, 0354, 0002, 0015, 0262, 0171, 0062, 0374, 0016, 0324, 0004, 0224, 0023, 0255, 
+  0047, 0350, 0306, 0334, 0377, 0275, 0040, 0063, 0100, 0001, 0213, 0046, 0210, 0245, 0237, 0103, 
+  0224, 0316, 0263, 0063, 0143, 0045, 0143, 0120, 0146, 0035, 0010, 0262, 0200, 0011, 0132, 0062, 
+  0315, 0102, 0016, 0150, 0172, 0253, 0022, 0030, 0017, 0236, 0376, 0165, 0117, 0246, 0104, 0340, 
+  0073, 0111, 0023, 0215, 0246, 0327, 0204, 0353, 0332, 0371, 0214, 0112, 0201, 0323, 0117, 0064, 
+  0215, 0054, 0330, 0002, 0204, 0351, 0151, 0020, 0121, 0021, 0156, 0074, 0310, 0167, 0337, 0214, 
+  0220, 0321, 0117, 0046, 0304, 0312, 0240, 0147, 0301, 0051, 0160, 0037, 0052, 0276, 0062, 0302, 
+  0345, 0054, 0047, 0203, 0222, 0357, 0004, 0247, 0154, 0060, 0022, 0107, 0371, 0170, 0067, 0273, 
+  0064, 0314, 0130, 0006, 0004, 0106, 0021, 0241, 0071, 0061, 0304, 0262, 0143, 0202, 0326, 0140, 
+  0301, 0277, 0331, 0325, 0202, 0133, 0331, 0357, 0367, 0273, 0021, 0231, 0143, 0355, 0165, 0014, 
+  0170, 0156, 0225, 0327, 0302, 0145, 0064, 0355, 0001, 0320, 0071, 0343, 0121, 0376, 0235, 0202, 
+  0163, 0253, 0342, 0163, 0311, 0043, 0120, 0203, 0315, 0204, 0301, 0316, 0214, 0174, 0166, 0220, 
+  0031, 0203, 0040, 0274, 0227, 0375, 0264, 0102, 0016, 0345, 0003, 0332, 0342, 0330, 0343, 0362, 
+  0347, 0235, 0177, 0375, 0331, 0351, 0202, 0131, 0020, 0065, 0143, 0002, 0163, 0270, 0263, 0204, 
+  0015, 0107, 0036, 0040, 0212, 0315, 0346, 0276, 0060, 0106, 0306, 0236, 0020, 0241, 0064, 0106, 
+  0056, 0232, 0002, 0111, 0305, 0254, 0074, 0211, 0261, 0336, 0003, 0115, 0255, 0033, 0061, 0214, 
+  0022, 0336, 0004, 0120, 0307, 0204, 0132, 0147, 0126, 0272, 0216, 0133, 0132, 0204, 0246, 0053, 
+  0141, 0242, 0200, 0354, 0210, 0305, 0051, 0270, 0304, 0222, 0041, 0212, 0342, 0153, 0053, 0102, 
+  0027, 0034, 0047, 0153, 0231, 0030, 0254, 0315, 0072, 0365, 0020, 0016, 0165, 0056, 0122, 0122, 
+  0034, 0053, 0337, 0360, 0223, 0075, 0247, 0336, 0000, 0207, 0371, 0320, 0113, 0130, 0327, 0146, 
+  0102, 0340, 0116, 0063, 0305, 0137, 0034, 0216, 0245, 0032, 0131, 0245, 0333, 0153, 0310, 0112, 
+  0137, 0120, 0005, 0024, 0330, 0022, 0064, 0216, 0340, 0216, 0044, 0334, 0370, 0143, 0310, 0074, 
+  0071, 0232, 0346, 0016, 0335, 0007, 0060, 0321, 0200, 0023, 0141, 0235, 0006, 0147, 0242, 0005, 
+  0321, 0204, 0257, 0310, 0132, 0143, 0075, 0227, 0053, 0274, 0331, 0103, 0065, 0212, 0135, 0257, 
+  0136, 0104, 0114, 0350, 0275, 0265, 0210, 0372, 0045, 0341, 0041, 0046, 0042, 0362, 0337, 0352, 
+  0035, 0343, 0334, 0037, 0052, 0226, 0232, 0345, 0346, 0175, 0121, 0105, 0224, 0163, 0367, 0005, 
+  0007, 0174, 0210, 0101, 0244, 0361, 0242, 0013, 0163, 0370, 0126, 0141, 0250, 0157, 0323, 0026, 
+  0206, 0147, 0145, 0166, 0052, 0363, 0260, 0013, 0145, 0166, 0221, 0357, 0046, 0275, 0214, 0154, 
+  0257, 0230, 0223, 0323, 0354, 0005, 0022, 0223, 0050, 0312, 0302, 0354, 0125, 0163, 0010, 0172, 
+  0217, 0323, 0334, 0253, 0072, 0252, 0371, 0172, 0011, 0007, 0123, 0367, 0030, 0272, 0357, 0031, 
+  0352, 0022, 0262, 0326, 0066, 0333, 0125, 0032, 0320, 0070, 0377, 0151, 0221, 0003, 0371, 0070, 
+  0313, 0153, 0225, 0045, 0330, 0257, 0342, 0320, 0052, 0031, 0124, 0352, 0217, 0361, 0003, 0341, 
+  0154, 0126, 0035, 0106, 0034, 0054, 0232, 0223, 0310, 0072, 0243, 0134, 0037, 0205, 0024, 0325, 
+  0353, 0072, 0231, 0345, 0146, 0330, 0247, 0164, 0063, 0151, 0055, 0202, 0134, 0363, 0017, 0140, 
+  0334, 0241, 0314, 0163, 0062, 0320, 0026, 0013, 0170, 0153, 0312, 0303, 0121, 0055, 0174, 0051, 
+  0043, 0334, 0314, 0270, 0121, 0054, 0102, 0145, 0323, 0017, 0344, 0105, 0027, 0374, 0250, 0053, 
+  0160, 0256, 0332, 0040, 0120, 0126, 0257, 0266, 0026, 0330, 0012, 0003, 0225, 0074, 0131, 0010, 
+  0137, 0044, 0225, 0262, 0161, 0313, 0347, 0213, 0134, 0204, 0062, 0365, 0174, 0131, 0062, 0044, 
+  0343, 0324, 0335, 0150, 0114, 0323, 0321, 0160, 0317, 0037, 0166, 0056, 0275, 0256, 0044, 0350, 
+  0302, 0063, 0157, 0032, 0377, 0353, 0163, 0216, 0146, 0371, 0107, 0255, 0231, 0021, 0143, 0010, 
+  0235, 0127, 0046, 0010, 0325, 0130, 0254, 0106, 0156, 0221, 0134, 0064, 0045, 0251, 0166, 0277, 
+  0316, 0124, 0372, 0120, 0275, 0372, 0104, 0155, 0155, 0370, 0117, 0236, 0055, 0157, 0323, 0154, 
+  0043, 0161, 0236, 0100, 0237, 0262, 0132, 0155, 0142, 0215, 0066, 0104, 0231, 0266, 0110, 0252, 
+  0313, 0210, 0000, 0023, 0375, 0147, 0133, 0324, 0236, 0105, 0147, 0245, 0037, 0024, 0260, 0220, 
+  0202, 0121, 0274, 0142, 0321, 0014, 0154, 0070, 0173, 0351, 0036, 0216, 0312, 0252, 0056, 0336, 
+  0227, 0125, 0235, 0115, 0250, 0322, 0204, 0014, 0226, 0257, 0157, 0102, 0247, 0244, 0351, 0303, 
+  0343, 0326, 0364, 0155, 0112, 0062, 0267, 0176, 0306, 0072, 0034, 0133, 0011, 0121, 0243, 0067, 
+  0236, 0110, 0237, 0262, 0366, 0173, 0325, 0165, 0376, 0254, 0054, 0071, 0260, 0150, 0055, 0274, 
+  0323, 0312, 0212, 0136, 0115, 0253, 0253, 0231, 0122, 0001, 0134, 0016, 0130, 0012, 0264, 0071, 
+  0261, 0110, 0053, 0325, 0047, 0277, 0327, 0254, 0022, 0255, 0212, 0024, 0307, 0125, 0205, 0226, 
+  0072, 0363, 0257, 0240, 0015, 0023, 0231, 0265, 0324, 0042, 0265, 0112, 0240, 0130, 0230, 0030, 
+  0320, 0245, 0122, 0333, 0116, 0331, 0054, 0274, 0202, 0354, 0344, 0053, 0130, 0022, 0236, 0330, 
+  0237, 0241, 0065, 0031, 0064, 0050, 0223, 0151, 0065, 0176, 0157, 0301, 0166, 0327, 0341, 0364, 
+  0156, 0233, 0234, 0130, 0277, 0376, 0334, 0202, 0072, 0267, 0240, 0332, 0267, 0240, 0076, 0127, 
+  0366, 0061, 0336, 0146, 0007, 0252, 0165, 0222, 0121, 0332, 0110, 0376, 0161, 0035, 0250, 0071, 
+  0320, 0302, 0211, 0134, 0166, 0114, 0100, 0323, 0321, 0322, 0143, 0271, 0103, 0152, 0353, 0024, 
+  0075, 0244, 0347, 0377, 0255, 0353, 0203, 0256, 0323, 0311, 0103, 0320, 0354, 0037, 0351, 0375, 
+  0374, 0322, 0254, 0303, 0026, 0104, 0244, 0310, 0012, 0063, 0021, 0131, 0365, 0065, 0122, 0035, 
+  0107, 0055, 0326, 0070, 0352, 0036, 0036, 0201, 0017, 0216, 0306, 0307, 0122, 0312, 0235, 0160, 
+  0275, 0346, 0347, 0001, 0075, 0212, 0264, 0075, 0106, 0375, 0045, 0214, 0132, 0357, 0370, 0100, 
+  0310, 0176, 0327, 0341, 0351, 0210, 0175, 0035, 0372, 0250, 0216, 0272, 0361, 0115, 0255, 0270, 
+  0271, 0045, 0167, 0146, 0315, 0335, 0130, 0164, 0047, 0126, 0335, 0320, 0262, 0033, 0326, 0372, 
+  0355, 0225, 0367, 0351, 0040, 0351, 0026, 0036, 0314, 0156, 0034, 0157, 0166, 0222, 0364, 0132, 
+  0152, 0174, 0260, 0224, 0323, 0153, 0202, 0113, 0300, 0351, 0241, 0346, 0157, 0136, 0170, 0230, 
+  0201, 0205, 0256, 0237, 0267, 0231, 0071, 0355, 0377, 0361, 0070, 0036, 0144, 0137, 0315, 0101, 
+  0154, 0314, 0356, 0207, 0217, 0243, 0126, 0160, 0263, 0166, 0313, 0075, 0370, 0203, 0075, 0262, 
+  0270, 0051, 0114, 0076, 0117, 0237, 0235, 0104, 0233, 0273, 0106, 0077, 0316, 0111, 0274, 0243, 
+  0324, 0352, 0334, 0117, 0174, 0143, 0375, 0104, 0033, 0246, 0142, 0005, 0132, 0237, 0373, 0211, 
+  0307, 0324, 0117, 0074, 0335, 0053, 0223, 0076, 0067, 0001, 0153, 0351, 0355, 0362, 0046, 0143, 
+  0176, 0353, 0302, 0020, 0223, 0150, 0034, 0326, 0336, 0154, 0324, 0040, 0322, 0275, 0055, 0301, 
+  0223, 0011, 0215, 0057, 0067, 0066, 0354, 0364, 0356, 0074, 0240, 0332, 0354, 0175, 0163, 0131, 
+  0370, 0070, 0173, 0277, 0215, 0333, 0045, 0125, 0057, 0227, 0262, 0027, 0110, 0075, 0120, 0112, 
+  0252, 0327, 0270, 0016, 0375, 0326, 0017, 0013, 0166, 0057, 0035, 0345, 0052, 0124, 0026, 0342, 
+  0116, 0133, 0205, 0312, 0143, 0134, 0366, 0317, 0233, 0124, 0245, 0367, 0026, 0047, 0056, 0333, 
+  0306, 0211, 0042, 0215, 0305, 0327, 0212, 0371, 0113, 0267, 0336, 0346, 0052, 0305, 0026, 0242, 
+  0060, 0034, 0330, 0034, 0051, 0226, 0102, 0333, 0335, 0364, 0176, 0107, 0323, 0302, 0253, 0061, 
+  0233, 0270, 0354, 0116, 0255, 0107, 0160, 0151, 0265, 0373, 0371, 0225, 0215, 0023, 0374, 0305, 
+  0240, 0056, 0076, 0122, 0265, 0165, 0340, 0363, 0103, 0343, 0377, 0001, 0224, 0300, 0104, 0026, 
+  0000, 0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1720]; 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"
+  "\267\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\006\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\026\354\002\015\262\171\062\374\016\324\004\224\023\255"
+  "\047\350\306\334\377\275\040\063\100\001\213\046\210\245\237\103"
+  "\224\316\263\063\143\045\143\120\146\035\010\262\200\011\132\062"
+  "\315\102\016\150\172\253\022\030\017\236\376\165\117\246\104\340"
+  "\073\111\023\215\246\327\204\353\332\371\214\112\201\323\117\064"
+  "\215\054\330\002\204\351\151\020\121\021\156\074\310\167\337\214"
+  "\220\321\117\046\304\312\240\147\301\051\160\037\052\276\062\302"
+  "\345\054\047\203\222\357\004\247\154\060\022\107\371\170\067\273"
+  "\064\314\130\006\004\106\021\241\071\061\304\262\143\202\326\140"
+  "\301\277\331\325\202\133\331\357\367\273\021\231\143\355\165\014"
+  "\170\156\225\327\302\145\064\355\001\320\071\343\121\376\235\202"
+  "\163\253\342\163\311\043\120\203\315\204\301\316\214\174\166\220"
+  "\031\203\040\274\227\375\264\102\016\345\003\332\342\330\343\362"
+  "\347\235\177\375\331\351\202\131\020\065\143\002\163\270\263\204"
+  "\015\107\036\040\212\315\346\276\060\106\306\236\020\241\064\106"
+  "\056\232\002\111\305\254\074\211\261\336\003\115\255\033\061\214"
+  "\022\336\004\120\307\204\132\147\126\272\216\133\132\204\246\053"
+  "\141\242\200\354\210\305\051\270\304\222\041\212\342\153\053\102"
+  "\027\034\047\153\231\030\254\315\072\365\020\016\165\056\122\122"
+  "\034\053\337\360\223\075\247\336\000\207\371\320\113\130\327\146"
+  "\102\340\116\063\305\137\034\216\245\032\131\245\333\153\310\112"
+  "\137\120\005\024\330\022\064\216\340\216\044\334\370\143\310\074"
+  "\071\232\346\016\335\007\060\321\200\023\141\235\006\147\242\005"
+  "\321\204\257\310\132\143\075\227\053\274\331\103\065\212\135\257"
+  "\136\104\114\350\275\265\210\372\045\341\041\046\042\362\337\352"
+  "\035\343\334\037\052\226\232\345\346\175\121\105\224\163\367\005"
+  "\007\174\210\101\244\361\242\013\163\370\126\141\250\157\323\026"
+  "\206\147\145\166\052\363\260\013\145\166\221\357\046\275\214\154"
+  "\257\230\223\323\354\005\022\223\050\312\302\354\125\163\010\172"
+  "\217\323\334\253\072\252\371\172\011\007\123\367\030\272\357\031"
+  "\352\022\262\326\066\333\125\032\320\070\377\151\221\003\371\070"
+  "\313\153\225\045\330\257\342\320\052\031\124\352\217\361\003\341"
+  "\154\126\035\106\034\054\232\223\310\072\243\134\037\205\024\325"
+  "\353\072\231\345\146\330\247\164\063\151\055\202\134\363\017\140"
+  "\334\241\314\163\062\320\026\013\170\153\312\303\121\055\174\051"
+  "\043\334\314\270\121\054\102\145\323\017\344\105\027\374\250\053"
+  "\160\256\332\040\120\126\257\266\026\330\012\003\225\074\131\010"
+  "\137\044\225\262\161\313\347\213\134\204\062\365\174\131\062\044"
+  "\343\324\335\150\114\323\321\160\317\037\166\056\275\256\044\350"
+  "\302\063\157\032\377\353\163\216\146\371\107\255\231\021\143\010"
+  "\235\127\046\010\325\130\254\106\156\221\134\064\045\251\166\277"
+  "\316\124\372\120\275\372\104\155\155\370\117\236\055\157\323\154"
+  "\043\161\236\100\237\262\132\155\142\215\066\104\231\266\110\252"
+  "\313\210\000\023\375\147\133\324\236\105\147\245\037\024\260\220"
+  "\202\121\274\142\321\014\154\070\173\351\036\216\312\252\056\336"
+  "\227\125\235\115\250\322\204\014\226\257\157\102\247\244\351\303"
+  "\343\326\364\155\112\062\267\176\306\072\034\133\011\121\243\067"
+  "\236\110\237\262\366\173\325\165\376\254\054\071\260\150\055\274"
+  "\323\312\212\136\115\253\253\231\122\001\134\016\130\012\264\071"
+  "\261\110\053\325\047\277\327\254\022\255\212\024\307\125\205\226"
+  "\072\363\257\240\015\023\231\265\324\042\265\112\240\130\230\030"
+  "\320\245\122\333\116\331\054\274\202\354\344\053\130\022\236\330"
+  "\237\241\065\031\064\050\223\151\065\176\157\301\166\327\341\364"
+  "\156\233\234\130\277\376\334\202\072\267\240\332\267\240\076\127"
+  "\366\061\336\146\007\252\165\222\121\332\110\376\161\035\250\071"
+  "\320\302\211\134\166\114\100\323\321\322\143\271\103\152\353\024"
+  "\075\244\347\377\255\353\203\256\323\311\103\320\354\037\351\375"
+  "\374\322\254\303\026\104\244\310\012\063\021\131\365\065\122\035"
+  "\107\055\326\070\352\036\036\201\017\216\306\307\122\312\235\160"
+  "\275\346\347\001\075\212\264\075\106\375\045\214\132\357\370\100"
+  "\310\176\327\341\351\210\175\035\372\250\216\272\361\115\255\270"
+  "\271\045\167\146\315\335\130\164\047\126\335\320\262\033\326\372"
+  "\355\225\367\351\040\351\026\036\314\156\034\157\166\222\364\132"
+  "\152\174\260\224\323\153\202\113\300\351\241\346\157\136\170\230"
+  "\201\205\256\237\267\231\071\355\377\361\070\036\144\137\315\101"
+  "\154\314\356\207\217\243\126\160\263\166\313\075\370\203\075\262"
+  "\270\051\114\076\117\237\235\104\233\273\106\077\316\111\274\243"
+  "\324\352\334\117\174\143\375\104\033\246\142\005\132\237\373\211"
+  "\307\324\117\074\335\053\223\076\067\001\153\351\355\362\046\143"
+  "\176\353\302\020\223\150\034\326\336\154\324\040\322\275\055\301"
+  "\223\011\215\057\067\066\354\364\356\074\240\332\354\175\163\131"
+  "\370\070\173\277\215\333\045\125\057\227\262\027\110\075\120\112"
+  "\252\327\270\016\375\326\017\013\166\057\035\345\052\124\026\342"
+  "\116\133\205\312\143\134\366\317\233\124\245\367\026\047\056\333"
+  "\306\211\042\215\305\327\212\371\113\267\336\346\052\305\026\242"
+  "\060\034\330\034\051\226\102\333\335\364\176\107\323\302\253\061"
+  "\233\270\354\116\255\107\160\151\265\373\371\225\215\023\374\305"
+  "\240\056\076\122\265\165\340\363\103\343\377\001\224\300\104\026"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/5.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/6.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/7.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/8.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/9.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/index.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/stats.html b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/style.css b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-06-21-110055-2570-cppcheck@9ead9ce3bdd6_master/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/index.html b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/index.html new file mode 100644 index 0000000..75d9d3a --- /dev/null +++ b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@50a4f3b18c13
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Mon Jun 22 16:02:22 2020
+

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_info2931View Report
SecurityPotential insecure memory buffer bounds restriction in call 'strcpy'caja-open-terminal.cappend_sftp_info2941View Report
+ + diff --git a/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/report-4457b5.html b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/report-4457b5.html new file mode 100644 index 0000000..916093f --- /dev/null +++ b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/report-4457b5.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-22-160222-6107-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/report-e45fe9.html b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/report-e45fe9.html new file mode 100644 index 0000000..407088c --- /dev/null +++ b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/report-e45fe9.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-22-160222-6107-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/scanview.css b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/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/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/sorttable.js b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-06-22-160222-6107-1@2f92f67a71ac_travis-ci/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
#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, 
+  0213, 0007, 0000, 0000, 0137, 0144, 0153, 0207, 0010, 0000, 0000, 0000, 0213, 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, 0353, 0071, 0235, 0216, 0154, 0204, 
+  0251, 0100, 0374, 0001, 0206, 0310, 0377, 0344, 0070, 0103, 0216, 0376, 0115, 0061, 0107, 0211, 
+  0103, 0360, 0170, 0004, 0046, 0342, 0361, 0147, 0360, 0332, 0221, 0044, 0163, 0101, 0127, 0265, 
+  0143, 0343, 0357, 0050, 0024, 0116, 0110, 0140, 0222, 0214, 0300, 0127, 0361, 0170, 0035, 0175, 
+  0117, 0023, 0061, 0103, 0124, 0000, 0007, 0107, 0043, 0000, 0137, 0376, 0356, 0201, 0214, 0102, 
+  0322, 0304, 0234, 0305, 0210, 0213, 0245, 0103, 0341, 0014, 0215, 0000, 0141, 0163, 0304, 0201, 
+  0337, 0033, 0166, 0237, 0277, 0050, 0156, 0227, 0306, 0261, 0152, 0347, 0272, 0165, 0055, 0237, 
+  0040, 0111, 0021, 0360, 0057, 0153, 0033, 0046, 0002, 0305, 0001, 0246, 0041, 0107, 0152, 0300, 
+  0365, 0143, 0210, 0341, 0004, 0155, 0020, 0274, 0351, 0142, 0330, 0315, 0001, 0061, 0305, 0306, 
+  0153, 0007, 0233, 0053, 0371, 0243, 0011, 0216, 0204, 0361, 0160, 0340, 0071, 0267, 0360, 0210, 
+  0307, 0077, 0147, 0222, 0074, 0107, 0006, 0147, 0037, 0313, 0354, 0351, 0011, 0047, 0170, 0114, 
+  0244, 0014, 0367, 0074, 0105, 0165, 0103, 0012, 0041, 0015, 0036, 0130, 0230, 0046, 0300, 0277, 
+  0205, 0044, 0251, 0155, 0217, 0103, 0106, 0203, 0354, 0043, 0360, 0245, 0123, 0350, 0110, 0362, 
+  0020, 0021, 0023, 0051, 0176, 0303, 0220, 0260, 0111, 0056, 0206, 0364, 0057, 0370, 0077, 0024, 
+  0104, 0371, 0243, 0166, 0006, 0050, 0260, 0220, 0262, 0073, 0202, 0103, 0232, 0020, 0050, 0240, 
+  0104, 0142, 0004, 0226, 0110, 0222, 0177, 0123, 0275, 0071, 0012, 0306, 0244, 0226, 0315, 0062, 
+  0106, 0301, 0024, 0147, 0132, 0312, 0207, 0267, 0105, 0020, 0116, 0061, 0211, 0362, 0317, 0031, 
+  0071, 0221, 0236, 0163, 0312, 0110, 0204, 0170, 0167, 0325, 0240, 0273, 0326, 0042, 0157, 0355, 
+  0050, 0037, 0113, 0041, 0351, 0250, 0077, 0245, 0252, 0306, 0154, 0001, 0136, 0170, 0154, 0141, 
+  0365, 0353, 0332, 0267, 0346, 0310, 0024, 0321, 0314, 0040, 0237, 0140, 0032, 0020, 0364, 0220, 
+  0115, 0077, 0317, 0200, 0204, 0343, 0311, 0324, 0224, 0106, 0260, 0330, 0220, 0142, 0314, 0204, 
+  0140, 0063, 0135, 0042, 0306, 0261, 0264, 0043, 0050, 0344, 0242, 0004, 0174, 0271, 0072, 0011, 
+  0034, 0102, 0242, 0103, 0230, 0304, 0060, 0224, 0153, 0144, 0151, 0077, 0305, 0332, 0202, 0141, 
+  0326, 0123, 0000, 0071, 0202, 0153, 0152, 0051, 0124, 0134, 0052, 0305, 0240, 0233, 0352, 0333, 
+  0125, 0205, 0205, 0176, 0017, 0056, 0131, 0052, 0202, 0104, 0054, 0063, 0073, 0107, 0064, 0052, 
+  0045, 0334, 0230, 0245, 0165, 0003, 0316, 0255, 0162, 0254, 0076, 0367, 0300, 0133, 0252, 0242, 
+  0141, 0214, 0021, 0051, 0264, 0265, 0340, 0246, 0300, 0061, 0124, 0063, 0253, 0164, 0133, 0232, 
+  0040, 0232, 0222, 0162, 0024, 0042, 0374, 0204, 0222, 0040, 0102, 0017, 0060, 0045, 0302, 0234, 
+  0203, 0362, 0304, 0300, 0317, 0035, 0262, 0011, 0141, 0232, 0240, 0040, 0245, 0322, 0135, 0020, 
+  0114, 0167, 0020, 0032, 0222, 0071, 0134, 0046, 0101, 0062, 0145, 0363, 0140, 0065, 0206, 0152, 
+  0026, 0353, 0136, 0171, 0223, 0061, 0014, 0037, 0245, 0055, 0324, 0167, 0211, 0026, 0061, 0244, 
+  0221, 0371, 0120, 0037, 0060, 0041, 0346, 0124, 0061, 0113, 0160, 0156, 0330, 0156, 0225, 0120, 
+  0205, 0243, 0337, 0160, 0275, 0315, 0115, 0301, 0153, 0146, 0012, 0371, 0272, 0163, 0374, 0246, 
+  0140, 0064, 0243, 0017, 0167, 0072, 0366, 0332, 0230, 0216, 0105, 0342, 0027, 0213, 0136, 0046, 
+  0266, 0321, 0172, 0221, 0313, 0154, 0104, 0122, 0153, 0177, 0005, 0302, 0156, 0011, 0272, 0155, 
+  0163, 0165, 0101, 0316, 0316, 0346, 0320, 0326, 0322, 0252, 0035, 0123, 0354, 0020, 0127, 0230, 
+  0270, 0241, 0133, 0256, 0202, 0354, 0017, 0361, 0025, 0225, 0000, 0225, 0172, 0273, 0140, 0001, 
+  0011, 0236, 0124, 0073, 0350, 0002, 0210, 0246, 0060, 0222, 0153, 0126, 0026, 0137, 0003, 0237, 
+  0062, 0132, 0335, 0157, 0041, 0130, 0305, 0200, 0135, 0147, 0203, 0311, 0363, 0252, 0202, 0366, 
+  0015, 0200, 0153, 0012, 0136, 0041, 0200, 0062, 0000, 0017, 0142, 0030, 0105, 0065, 0263, 0245, 
+  0036, 0010, 0135, 0243, 0152, 0015, 0212, 0066, 0340, 0250, 0313, 0031, 0006, 0273, 0060, 0060, 
+  0262, 0134, 0055, 0053, 0326, 0033, 0106, 0245, 0152, 0166, 0121, 0117, 0053, 0052, 0152, 0113, 
+  0115, 0315, 0001, 0322, 0003, 0251, 0030, 0250, 0157, 0060, 0302, 0154, 0075, 0042, 0133, 0105, 
+  0047, 0201, 0052, 0034, 0360, 0354, 0333, 0074, 0106, 0003, 0165, 0274, 0115, 0102, 0266, 0073, 
+  0104, 0262, 0141, 0100, 0047, 0353, 0345, 0263, 0256, 0214, 0255, 0251, 0255, 0141, 0144, 0147, 
+  0036, 0351, 0031, 0115, 0206, 0042, 0226, 0323, 0325, 0112, 0220, 0010, 0310, 0105, 0023, 0106, 
+  0131, 0212, 0375, 0324, 0002, 0134, 0021, 0207, 0062, 0057, 0242, 0221, 0164, 0001, 0202, 0161, 
+  0123, 0176, 0145, 0301, 0351, 0166, 0257, 0145, 0301, 0252, 0156, 0360, 0332, 0030, 0171, 0275, 
+  0150, 0266, 0225, 0144, 0153, 0033, 0045, 0055, 0361, 0013, 0223, 0261, 0266, 0374, 0303, 0015, 
+  0233, 0215, 0231, 0364, 0246, 0367, 0150, 0261, 0052, 0032, 0207, 0331, 0223, 0061, 0133, 0010, 
+  0371, 0104, 0171, 0011, 0260, 0037, 0126, 0333, 0202, 0215, 0045, 0201, 0134, 0337, 0370, 0262, 
+  0371, 0260, 0024, 0233, 0100, 0041, 0024, 0062, 0222, 0316, 0314, 0364, 0056, 0371, 0141, 0201, 
+  0146, 0111, 0175, 0273, 0125, 0113, 0377, 0252, 0277, 0270, 0352, 0017, 0273, 0352, 0263, 0066, 
+  0121, 0317, 0033, 0054, 0344, 0257, 0051, 0131, 0377, 0302, 0135, 0134, 0014, 0134, 0123, 0262, 
+  0201, 0353, 0056, 0372, 0256, 0061, 0131, 0317, 0365, 0056, 0026, 0277, 0364, 0007, 0073, 0010, 
+  0347, 0112, 0114, 0314, 0373, 0353, 0113, 0272, 0236, 0173, 0151, 0116, 0170, 0345, 0111, 0102, 
+  0117, 0137, 0302, 0274, 0235, 0206, 0222, 0113, 0212, 0245, 0253, 0251, 0252, 0063, 0300, 0055, 
+  0253, 0376, 0135, 0321, 0156, 0230, 0263, 0142, 0327, 0321, 0147, 0332, 0352, 0012, 0252, 0277, 
+  0042, 0150, 0272, 0273, 0217, 0134, 0142, 0232, 0072, 0213, 0266, 0127, 0230, 0336, 0141, 0255, 
+  0060, 0177, 0251, 0050, 0361, 0110, 0326, 0220, 0362, 0220, 0067, 0306, 0013, 0104, 0022, 0033, 
+  0042, 0151, 0114, 0140, 0357, 0107, 0114, 0140, 0035, 0274, 0365, 0260, 0156, 0005, 0347, 0346, 
+  0030, 0067, 0016, 0101, 0065, 0260, 0255, 0305, 0325, 0346, 0356, 0037, 0224, 0273, 0267, 0232, 
+  0235, 0207, 0220, 0330, 0254, 0374, 0364, 0262, 0362, 0155, 0176, 0023, 0316, 0322, 0030, 0370, 
+  0145, 0065, 0041, 0273, 0232, 0035, 0137, 0302, 0177, 0027, 0143, 0272, 0136, 0017, 0214, 0103, 
+  0251, 0167, 0371, 0154, 0347, 0052, 0340, 0076, 0372, 0202, 0327, 0027, 0337, 0200, 0277, 0366, 
+  0376, 0344, 0076, 0316, 0147, 0233, 0135, 0330, 0354, 0102, 0043, 0273, 0100, 0074, 0224, 0063, 
+  0330, 0072, 0144, 0233, 0136, 0374, 0360, 0364, 0242, 0147, 0323, 0213, 0343, 0334, 0032, 0224, 
+  0203, 0027, 0154, 0366, 0276, 0073, 0203, 0067, 0252, 0017, 0273, 0057, 0150, 0063, 0020, 0233, 
+  0201, 0234, 0150, 0006, 0162, 0042, 0041, 0333, 0077, 0070, 0022, 0323, 0317, 0166, 0002, 0037, 
+  0137, 0316, 0361, 0066, 0205, 0236, 0147, 0232, 0076, 0225, 0044, 0332, 0263, 0111, 0364, 0236, 
+  0246, 0040, 0326, 0043, 0327, 0170, 0344, 0077, 0120, 0166, 0004, 0313, 0272, 0144, 0235, 0031, 
+  0174, 0176, 0330, 0056, 0171, 0252, 0124, 0175, 0052, 0076, 0371, 0334, 0372, 0344, 0372, 0031, 
+  0175, 0141, 0175, 0262, 0175, 0155, 0342, 0220, 0135, 0362, 0245, 0255, 0153, 0276, 0153, 0135, 
+  0323, 0373, 0250, 0272, 0146, 0065, 0246, 0025, 0304, 0345, 0204, 0245, 0104, 0253, 0227, 0013, 
+  0263, 0323, 0102, 0317, 0146, 0250, 0167, 0032, 0250, 0312, 0377, 0354, 0327, 0111, 0240, 0122, 
+  0337, 0242, 0056, 0052, 0160, 0356, 0152, 0316, 0216, 0052, 0236, 0120, 0010, 0216, 0145, 0244, 
+  0200, 0112, 0337, 0327, 0174, 0155, 0262, 0352, 0167, 0256, 0102, 0014, 0340, 0250, 0373, 0056, 
+  0106, 0140, 0314, 0110, 0004, 0272, 0145, 0052, 0255, 0346, 0157, 0254, 0327, 0366, 0016, 0177, 
+  0032, 0237, 0134, 0073, 0260, 0303, 0310, 0366, 0024, 0240, 0143, 0117, 0001, 0152, 0006, 0143, 
+  0366, 0024, 0240, 0075, 0005, 0170, 0042, 0133, 0175, 0060, 0216, 0021, 0215, 0336, 0155, 0227, 
+  0357, 0132, 0261, 0267, 0373, 0173, 0247, 0266, 0277, 0147, 0067, 0341, 0016, 0245, 0274, 0260, 
+  0166, 0102, 0050, 0223, 0044, 0320, 0075, 0030, 0164, 0010, 0166, 0052, 0324, 0131, 0306, 0002, 
+  0267, 0164, 0226, 0337, 0227, 0026, 0331, 0162, 0331, 0321, 0355, 0311, 0235, 0110, 0271, 0114, 
+  0060, 0107, 0052, 0032, 0071, 0352, 0222, 0076, 0353, 0227, 0367, 0165, 0053, 0316, 0036, 0066, 
+  0152, 0277, 0152, 0266, 0133, 0212, 0260, 0025, 0371, 0142, 0252, 0156, 0232, 0064, 0010, 0175, 
+  0365, 0255, 0163, 0165, 0101, 0046, 0246, 0216, 0352, 0143, 0127, 0160, 0333, 0116, 0122, 0232, 
+  0260, 0151, 0030, 0363, 0266, 0022, 0357, 0266, 0021, 0353, 0266, 0031, 0347, 0226, 0274, 0303, 
+  0266, 0235, 0123, 0351, 0232, 0206, 0175, 0165, 0330, 0226, 0330, 0017, 0263, 0304, 0176, 0053, 
+  0203, 0221, 0254, 0215, 0055, 0260, 0357, 0115, 0201, 0375, 0160, 0257, 0127, 0064, 0271, 0235, 
+  0260, 0126, 0336, 0372, 0333, 0025, 0067, 0145, 0334, 0274, 0155, 0072, 0277, 0251, 0270, 0063, 
+  0307, 0321, 0004, 0211, 0227, 0051, 0265, 0371, 0330, 0221, 0331, 0144, 0314, 0150, 0042, 0107, 
+  0323, 0351, 0003, 0177, 0165, 0353, 0257, 0234, 0212, 0353, 0215, 0352, 0111, 0057, 0237, 0111, 
+  0275, 0102, 0322, 0067, 0017, 0223, 0315, 0013, 0302, 0207, 0335, 0265, 0377, 0072, 0360, 0077, 
+  0355, 0112, 0320, 0056, 0000, 0050, 0165, 0165, 0141, 0171, 0051, 0143, 0141, 0152, 0141, 0057, 
+  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"
+  "\213\007\000\000\137\144\153\207\010\000\000\000\213\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\353\071\235\216\154\204"
+  "\251\100\374\001\206\310\377\344\070\103\216\376\115\061\107\211"
+  "\103\360\170\004\046\342\361\147\360\332\221\044\163\101\127\265"
+  "\143\343\357\050\024\116\110\140\222\214\300\127\361\170\035\175"
+  "\117\023\061\103\124\000\007\107\043\000\137\376\356\201\214\102"
+  "\322\304\234\305\210\213\245\103\341\014\215\000\141\163\304\201"
+  "\337\033\166\237\277\050\156\227\306\261\152\347\272\165\055\237"
+  "\040\111\021\360\057\153\033\046\002\305\001\246\041\107\152\300"
+  "\365\143\210\341\004\155\020\274\351\142\330\315\001\061\305\306"
+  "\153\007\233\053\371\243\011\216\204\361\160\340\071\267\360\210"
+  "\307\077\147\222\074\107\006\147\037\313\354\351\011\047\170\114"
+  "\244\014\367\074\105\165\103\012\041\015\036\130\230\046\300\277"
+  "\205\044\251\155\217\103\106\203\354\043\360\245\123\350\110\362"
+  "\020\021\023\051\176\303\220\260\111\056\206\364\057\370\077\024"
+  "\104\371\243\166\006\050\260\220\262\073\202\103\232\020\050\240"
+  "\104\142\004\226\110\222\177\123\275\071\012\306\244\226\315\062"
+  "\106\301\024\147\132\312\207\267\105\020\116\061\211\362\317\031"
+  "\071\221\236\163\312\110\204\170\167\325\240\273\326\042\157\355"
+  "\050\037\113\041\351\250\077\245\252\306\154\001\136\170\154\141"
+  "\365\353\332\267\346\310\024\321\314\040\237\140\032\020\364\220"
+  "\115\077\317\200\204\343\311\324\224\106\260\330\220\142\314\204"
+  "\140\063\135\042\306\261\264\043\050\344\242\004\174\271\072\011"
+  "\034\102\242\103\230\304\060\224\153\144\151\077\305\332\202\141"
+  "\326\123\000\071\202\153\152\051\124\134\052\305\240\233\352\333"
+  "\125\205\205\176\017\056\131\052\202\104\054\063\073\107\064\052"
+  "\045\334\230\245\165\003\316\255\162\254\076\367\300\133\252\242"
+  "\141\214\021\051\264\265\340\246\300\061\124\063\253\164\133\232"
+  "\040\232\222\162\024\042\374\204\222\040\102\017\060\045\302\234"
+  "\203\362\304\300\317\035\262\011\141\232\240\040\245\322\135\020"
+  "\114\167\020\032\222\071\134\046\101\062\145\363\140\065\206\152"
+  "\026\353\136\171\223\061\014\037\245\055\324\167\211\026\061\244"
+  "\221\371\120\037\060\041\346\124\061\113\160\156\330\156\225\120"
+  "\205\243\337\160\275\315\115\301\153\146\012\371\272\163\374\246"
+  "\140\064\243\017\167\072\366\332\230\216\105\342\027\213\136\046"
+  "\266\321\172\221\313\154\104\122\153\177\005\302\156\011\272\155"
+  "\163\165\101\316\316\346\320\326\322\252\035\123\354\020\127\230"
+  "\270\241\133\256\202\354\017\361\025\225\000\225\172\273\140\001"
+  "\011\236\124\073\350\002\210\246\060\222\153\126\026\137\003\237"
+  "\062\132\335\157\041\130\305\200\135\147\203\311\363\252\202\366"
+  "\015\200\153\012\136\041\200\062\000\017\142\030\105\065\263\245"
+  "\036\010\135\243\152\015\212\066\340\250\313\031\006\273\060\060"
+  "\262\134\055\053\326\033\106\245\152\166\121\117\053\052\152\113"
+  "\115\315\001\322\003\251\030\250\157\060\302\154\075\042\133\105"
+  "\047\201\052\034\360\354\333\074\106\003\165\274\115\102\266\073"
+  "\104\262\141\100\047\353\345\263\256\214\255\251\255\141\144\147"
+  "\036\351\031\115\206\042\226\323\325\112\220\010\310\105\023\106"
+  "\131\212\375\324\002\134\021\207\062\057\242\221\164\001\202\161"
+  "\123\176\145\301\351\166\257\145\301\252\156\360\332\030\171\275"
+  "\150\266\225\144\153\033\045\055\361\013\223\261\266\374\303\015"
+  "\233\215\231\364\246\367\150\261\052\032\207\331\223\061\133\010"
+  "\371\104\171\011\260\037\126\333\202\215\045\201\134\337\370\262"
+  "\371\260\024\233\100\041\024\062\222\316\314\364\056\371\141\201"
+  "\146\111\175\273\125\113\377\252\277\270\352\017\273\352\263\066"
+  "\121\317\033\054\344\257\051\131\377\302\135\134\014\134\123\262"
+  "\201\353\056\372\256\061\131\317\365\056\026\277\364\007\073\010"
+  "\347\112\114\314\373\353\113\272\236\173\151\116\170\345\111\102"
+  "\117\137\302\274\235\206\222\113\212\245\253\251\252\063\300\055"
+  "\253\376\135\321\156\230\263\142\327\321\147\332\352\012\252\277"
+  "\042\150\272\273\217\134\142\232\072\213\266\127\230\336\141\255"
+  "\060\177\251\050\361\110\326\220\362\220\067\306\013\104\022\033"
+  "\042\151\114\140\357\107\114\140\035\274\365\260\156\005\347\346"
+  "\030\067\016\101\065\260\255\305\325\346\356\037\224\273\267\232"
+  "\235\207\220\330\254\374\364\262\362\155\176\023\316\322\030\370"
+  "\145\065\041\273\232\035\137\302\177\027\143\272\136\017\214\103"
+  "\251\167\371\154\347\052\340\076\372\202\327\027\337\200\277\366"
+  "\376\344\076\316\147\233\135\330\354\102\043\273\100\074\224\063"
+  "\330\072\144\233\136\374\360\364\242\147\323\213\343\334\032\224"
+  "\203\027\154\366\276\073\203\067\252\017\273\057\150\063\020\233"
+  "\201\234\150\006\162\042\041\333\077\070\022\323\317\166\002\037"
+  "\137\316\361\066\205\236\147\232\076\225\044\332\263\111\364\236"
+  "\246\040\326\043\327\170\344\077\120\166\004\313\272\144\235\031"
+  "\174\176\330\056\171\252\124\175\052\076\371\334\372\344\372\031"
+  "\175\141\175\262\175\155\342\220\135\362\245\255\153\276\153\135"
+  "\323\373\250\272\146\065\246\025\304\345\204\245\104\253\227\013"
+  "\263\323\102\317\146\250\167\032\250\312\377\354\327\111\240\122"
+  "\337\242\056\052\160\356\152\316\216\052\236\120\010\216\145\244"
+  "\200\112\337\327\174\155\262\352\167\256\102\014\340\250\373\056"
+  "\106\140\314\110\004\272\145\052\255\346\157\254\327\366\016\177"
+  "\032\237\134\073\260\303\310\366\024\240\143\117\001\152\006\143"
+  "\366\024\240\075\005\170\042\133\175\060\216\021\215\336\155\227"
+  "\357\132\261\267\373\173\247\266\277\147\067\341\016\245\274\260"
+  "\166\102\050\223\044\320\075\030\164\010\166\052\324\131\306\002"
+  "\267\164\226\337\227\026\331\162\331\321\355\311\235\110\271\114"
+  "\060\107\052\032\071\352\222\076\353\227\367\165\053\316\036\066"
+  "\152\277\152\266\133\212\260\025\371\142\252\156\232\064\010\175"
+  "\365\255\163\165\101\046\246\216\352\143\127\160\333\116\122\232"
+  "\260\151\030\363\266\022\357\266\021\353\266\031\347\226\274\303"
+  "\266\235\123\351\232\206\175\165\330\226\330\017\263\304\176\053"
+  "\203\221\254\215\055\260\357\115\201\375\160\257\127\064\271\235"
+  "\260\126\336\372\333\025\067\145\334\274\155\072\277\251\270\063"
+  "\307\321\004\211\227\051\265\371\330\221\331\144\314\150\042\107"
+  "\323\351\003\177\165\353\257\234\212\353\215\352\111\057\237\111"
+  "\275\102\322\067\017\223\315\013\302\207\335\265\377\072\360\077"
+  "\355\112\320\056\000\050\165\165\141\171\051\143\141\152\141\057"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/1.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/10.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/2.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/3.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/4.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/4.html new file mode 100644 index 0000000..df1c99c --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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[1720]; 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, 
+  0267, 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, 0006, 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, 0026, 0354, 0002, 0015, 0262, 0171, 0062, 0374, 0016, 0324, 0004, 0224, 0023, 0255, 
+  0047, 0350, 0306, 0334, 0377, 0275, 0040, 0063, 0100, 0001, 0213, 0046, 0210, 0245, 0237, 0103, 
+  0224, 0316, 0263, 0063, 0143, 0045, 0143, 0120, 0146, 0035, 0010, 0262, 0200, 0011, 0132, 0062, 
+  0315, 0102, 0016, 0150, 0172, 0253, 0022, 0030, 0017, 0236, 0376, 0165, 0117, 0246, 0104, 0340, 
+  0073, 0111, 0023, 0215, 0246, 0327, 0204, 0353, 0332, 0371, 0214, 0112, 0201, 0323, 0117, 0064, 
+  0215, 0054, 0330, 0002, 0204, 0351, 0151, 0020, 0121, 0021, 0156, 0074, 0310, 0167, 0337, 0214, 
+  0220, 0321, 0117, 0046, 0304, 0312, 0240, 0147, 0301, 0051, 0160, 0037, 0052, 0276, 0062, 0302, 
+  0345, 0054, 0047, 0203, 0222, 0357, 0004, 0247, 0154, 0060, 0022, 0107, 0371, 0170, 0067, 0273, 
+  0064, 0314, 0130, 0006, 0004, 0106, 0021, 0241, 0071, 0061, 0304, 0262, 0143, 0202, 0326, 0140, 
+  0301, 0277, 0331, 0325, 0202, 0133, 0331, 0357, 0367, 0273, 0021, 0231, 0143, 0355, 0165, 0014, 
+  0170, 0156, 0225, 0327, 0302, 0145, 0064, 0355, 0001, 0320, 0071, 0343, 0121, 0376, 0235, 0202, 
+  0163, 0253, 0342, 0163, 0311, 0043, 0120, 0203, 0315, 0204, 0301, 0316, 0214, 0174, 0166, 0220, 
+  0031, 0203, 0040, 0274, 0227, 0375, 0264, 0102, 0016, 0345, 0003, 0332, 0342, 0330, 0343, 0362, 
+  0347, 0235, 0177, 0375, 0331, 0351, 0202, 0131, 0020, 0065, 0143, 0002, 0163, 0270, 0263, 0204, 
+  0015, 0107, 0036, 0040, 0212, 0315, 0346, 0276, 0060, 0106, 0306, 0236, 0020, 0241, 0064, 0106, 
+  0056, 0232, 0002, 0111, 0305, 0254, 0074, 0211, 0261, 0336, 0003, 0115, 0255, 0033, 0061, 0214, 
+  0022, 0336, 0004, 0120, 0307, 0204, 0132, 0147, 0126, 0272, 0216, 0133, 0132, 0204, 0246, 0053, 
+  0141, 0242, 0200, 0354, 0210, 0305, 0051, 0270, 0304, 0222, 0041, 0212, 0342, 0153, 0053, 0102, 
+  0027, 0034, 0047, 0153, 0231, 0030, 0254, 0315, 0072, 0365, 0020, 0016, 0165, 0056, 0122, 0122, 
+  0034, 0053, 0337, 0360, 0223, 0075, 0247, 0336, 0000, 0207, 0371, 0320, 0113, 0130, 0327, 0146, 
+  0102, 0340, 0116, 0063, 0305, 0137, 0034, 0216, 0245, 0032, 0131, 0245, 0333, 0153, 0310, 0112, 
+  0137, 0120, 0005, 0024, 0330, 0022, 0064, 0216, 0340, 0216, 0044, 0334, 0370, 0143, 0310, 0074, 
+  0071, 0232, 0346, 0016, 0335, 0007, 0060, 0321, 0200, 0023, 0141, 0235, 0006, 0147, 0242, 0005, 
+  0321, 0204, 0257, 0310, 0132, 0143, 0075, 0227, 0053, 0274, 0331, 0103, 0065, 0212, 0135, 0257, 
+  0136, 0104, 0114, 0350, 0275, 0265, 0210, 0372, 0045, 0341, 0041, 0046, 0042, 0362, 0337, 0352, 
+  0035, 0343, 0334, 0037, 0052, 0226, 0232, 0345, 0346, 0175, 0121, 0105, 0224, 0163, 0367, 0005, 
+  0007, 0174, 0210, 0101, 0244, 0361, 0242, 0013, 0163, 0370, 0126, 0141, 0250, 0157, 0323, 0026, 
+  0206, 0147, 0145, 0166, 0052, 0363, 0260, 0013, 0145, 0166, 0221, 0357, 0046, 0275, 0214, 0154, 
+  0257, 0230, 0223, 0323, 0354, 0005, 0022, 0223, 0050, 0312, 0302, 0354, 0125, 0163, 0010, 0172, 
+  0217, 0323, 0334, 0253, 0072, 0252, 0371, 0172, 0011, 0007, 0123, 0367, 0030, 0272, 0357, 0031, 
+  0352, 0022, 0262, 0326, 0066, 0333, 0125, 0032, 0320, 0070, 0377, 0151, 0221, 0003, 0371, 0070, 
+  0313, 0153, 0225, 0045, 0330, 0257, 0342, 0320, 0052, 0031, 0124, 0352, 0217, 0361, 0003, 0341, 
+  0154, 0126, 0035, 0106, 0034, 0054, 0232, 0223, 0310, 0072, 0243, 0134, 0037, 0205, 0024, 0325, 
+  0353, 0072, 0231, 0345, 0146, 0330, 0247, 0164, 0063, 0151, 0055, 0202, 0134, 0363, 0017, 0140, 
+  0334, 0241, 0314, 0163, 0062, 0320, 0026, 0013, 0170, 0153, 0312, 0303, 0121, 0055, 0174, 0051, 
+  0043, 0334, 0314, 0270, 0121, 0054, 0102, 0145, 0323, 0017, 0344, 0105, 0027, 0374, 0250, 0053, 
+  0160, 0256, 0332, 0040, 0120, 0126, 0257, 0266, 0026, 0330, 0012, 0003, 0225, 0074, 0131, 0010, 
+  0137, 0044, 0225, 0262, 0161, 0313, 0347, 0213, 0134, 0204, 0062, 0365, 0174, 0131, 0062, 0044, 
+  0343, 0324, 0335, 0150, 0114, 0323, 0321, 0160, 0317, 0037, 0166, 0056, 0275, 0256, 0044, 0350, 
+  0302, 0063, 0157, 0032, 0377, 0353, 0163, 0216, 0146, 0371, 0107, 0255, 0231, 0021, 0143, 0010, 
+  0235, 0127, 0046, 0010, 0325, 0130, 0254, 0106, 0156, 0221, 0134, 0064, 0045, 0251, 0166, 0277, 
+  0316, 0124, 0372, 0120, 0275, 0372, 0104, 0155, 0155, 0370, 0117, 0236, 0055, 0157, 0323, 0154, 
+  0043, 0161, 0236, 0100, 0237, 0262, 0132, 0155, 0142, 0215, 0066, 0104, 0231, 0266, 0110, 0252, 
+  0313, 0210, 0000, 0023, 0375, 0147, 0133, 0324, 0236, 0105, 0147, 0245, 0037, 0024, 0260, 0220, 
+  0202, 0121, 0274, 0142, 0321, 0014, 0154, 0070, 0173, 0351, 0036, 0216, 0312, 0252, 0056, 0336, 
+  0227, 0125, 0235, 0115, 0250, 0322, 0204, 0014, 0226, 0257, 0157, 0102, 0247, 0244, 0351, 0303, 
+  0343, 0326, 0364, 0155, 0112, 0062, 0267, 0176, 0306, 0072, 0034, 0133, 0011, 0121, 0243, 0067, 
+  0236, 0110, 0237, 0262, 0366, 0173, 0325, 0165, 0376, 0254, 0054, 0071, 0260, 0150, 0055, 0274, 
+  0323, 0312, 0212, 0136, 0115, 0253, 0253, 0231, 0122, 0001, 0134, 0016, 0130, 0012, 0264, 0071, 
+  0261, 0110, 0053, 0325, 0047, 0277, 0327, 0254, 0022, 0255, 0212, 0024, 0307, 0125, 0205, 0226, 
+  0072, 0363, 0257, 0240, 0015, 0023, 0231, 0265, 0324, 0042, 0265, 0112, 0240, 0130, 0230, 0030, 
+  0320, 0245, 0122, 0333, 0116, 0331, 0054, 0274, 0202, 0354, 0344, 0053, 0130, 0022, 0236, 0330, 
+  0237, 0241, 0065, 0031, 0064, 0050, 0223, 0151, 0065, 0176, 0157, 0301, 0166, 0327, 0341, 0364, 
+  0156, 0233, 0234, 0130, 0277, 0376, 0334, 0202, 0072, 0267, 0240, 0332, 0267, 0240, 0076, 0127, 
+  0366, 0061, 0336, 0146, 0007, 0252, 0165, 0222, 0121, 0332, 0110, 0376, 0161, 0035, 0250, 0071, 
+  0320, 0302, 0211, 0134, 0166, 0114, 0100, 0323, 0321, 0322, 0143, 0271, 0103, 0152, 0353, 0024, 
+  0075, 0244, 0347, 0377, 0255, 0353, 0203, 0256, 0323, 0311, 0103, 0320, 0354, 0037, 0351, 0375, 
+  0374, 0322, 0254, 0303, 0026, 0104, 0244, 0310, 0012, 0063, 0021, 0131, 0365, 0065, 0122, 0035, 
+  0107, 0055, 0326, 0070, 0352, 0036, 0036, 0201, 0017, 0216, 0306, 0307, 0122, 0312, 0235, 0160, 
+  0275, 0346, 0347, 0001, 0075, 0212, 0264, 0075, 0106, 0375, 0045, 0214, 0132, 0357, 0370, 0100, 
+  0310, 0176, 0327, 0341, 0351, 0210, 0175, 0035, 0372, 0250, 0216, 0272, 0361, 0115, 0255, 0270, 
+  0271, 0045, 0167, 0146, 0315, 0335, 0130, 0164, 0047, 0126, 0335, 0320, 0262, 0033, 0326, 0372, 
+  0355, 0225, 0367, 0351, 0040, 0351, 0026, 0036, 0314, 0156, 0034, 0157, 0166, 0222, 0364, 0132, 
+  0152, 0174, 0260, 0224, 0323, 0153, 0202, 0113, 0300, 0351, 0241, 0346, 0157, 0136, 0170, 0230, 
+  0201, 0205, 0256, 0237, 0267, 0231, 0071, 0355, 0377, 0361, 0070, 0036, 0144, 0137, 0315, 0101, 
+  0154, 0314, 0356, 0207, 0217, 0243, 0126, 0160, 0263, 0166, 0313, 0075, 0370, 0203, 0075, 0262, 
+  0270, 0051, 0114, 0076, 0117, 0237, 0235, 0104, 0233, 0273, 0106, 0077, 0316, 0111, 0274, 0243, 
+  0324, 0352, 0334, 0117, 0174, 0143, 0375, 0104, 0033, 0246, 0142, 0005, 0132, 0237, 0373, 0211, 
+  0307, 0324, 0117, 0074, 0335, 0053, 0223, 0076, 0067, 0001, 0153, 0351, 0355, 0362, 0046, 0143, 
+  0176, 0353, 0302, 0020, 0223, 0150, 0034, 0326, 0336, 0154, 0324, 0040, 0322, 0275, 0055, 0301, 
+  0223, 0011, 0215, 0057, 0067, 0066, 0354, 0364, 0356, 0074, 0240, 0332, 0354, 0175, 0163, 0131, 
+  0370, 0070, 0173, 0277, 0215, 0333, 0045, 0125, 0057, 0227, 0262, 0027, 0110, 0075, 0120, 0112, 
+  0252, 0327, 0270, 0016, 0375, 0326, 0017, 0013, 0166, 0057, 0035, 0345, 0052, 0124, 0026, 0342, 
+  0116, 0133, 0205, 0312, 0143, 0134, 0366, 0317, 0233, 0124, 0245, 0367, 0026, 0047, 0056, 0333, 
+  0306, 0211, 0042, 0215, 0305, 0327, 0212, 0371, 0113, 0267, 0336, 0346, 0052, 0305, 0026, 0242, 
+  0060, 0034, 0330, 0034, 0051, 0226, 0102, 0333, 0335, 0364, 0176, 0107, 0323, 0302, 0253, 0061, 
+  0233, 0270, 0354, 0116, 0255, 0107, 0160, 0151, 0265, 0373, 0371, 0225, 0215, 0023, 0374, 0305, 
+  0240, 0056, 0076, 0122, 0265, 0165, 0340, 0363, 0103, 0343, 0377, 0001, 0224, 0300, 0104, 0026, 
+  0000, 0050, 0165, 0165, 0141, 0171, 0051
+} };
+#else /* _MSC_VER */
+static const SECTION union { const guint8 data[1720]; 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"
+  "\267\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\006\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\026\354\002\015\262\171\062\374\016\324\004\224\023\255"
+  "\047\350\306\334\377\275\040\063\100\001\213\046\210\245\237\103"
+  "\224\316\263\063\143\045\143\120\146\035\010\262\200\011\132\062"
+  "\315\102\016\150\172\253\022\030\017\236\376\165\117\246\104\340"
+  "\073\111\023\215\246\327\204\353\332\371\214\112\201\323\117\064"
+  "\215\054\330\002\204\351\151\020\121\021\156\074\310\167\337\214"
+  "\220\321\117\046\304\312\240\147\301\051\160\037\052\276\062\302"
+  "\345\054\047\203\222\357\004\247\154\060\022\107\371\170\067\273"
+  "\064\314\130\006\004\106\021\241\071\061\304\262\143\202\326\140"
+  "\301\277\331\325\202\133\331\357\367\273\021\231\143\355\165\014"
+  "\170\156\225\327\302\145\064\355\001\320\071\343\121\376\235\202"
+  "\163\253\342\163\311\043\120\203\315\204\301\316\214\174\166\220"
+  "\031\203\040\274\227\375\264\102\016\345\003\332\342\330\343\362"
+  "\347\235\177\375\331\351\202\131\020\065\143\002\163\270\263\204"
+  "\015\107\036\040\212\315\346\276\060\106\306\236\020\241\064\106"
+  "\056\232\002\111\305\254\074\211\261\336\003\115\255\033\061\214"
+  "\022\336\004\120\307\204\132\147\126\272\216\133\132\204\246\053"
+  "\141\242\200\354\210\305\051\270\304\222\041\212\342\153\053\102"
+  "\027\034\047\153\231\030\254\315\072\365\020\016\165\056\122\122"
+  "\034\053\337\360\223\075\247\336\000\207\371\320\113\130\327\146"
+  "\102\340\116\063\305\137\034\216\245\032\131\245\333\153\310\112"
+  "\137\120\005\024\330\022\064\216\340\216\044\334\370\143\310\074"
+  "\071\232\346\016\335\007\060\321\200\023\141\235\006\147\242\005"
+  "\321\204\257\310\132\143\075\227\053\274\331\103\065\212\135\257"
+  "\136\104\114\350\275\265\210\372\045\341\041\046\042\362\337\352"
+  "\035\343\334\037\052\226\232\345\346\175\121\105\224\163\367\005"
+  "\007\174\210\101\244\361\242\013\163\370\126\141\250\157\323\026"
+  "\206\147\145\166\052\363\260\013\145\166\221\357\046\275\214\154"
+  "\257\230\223\323\354\005\022\223\050\312\302\354\125\163\010\172"
+  "\217\323\334\253\072\252\371\172\011\007\123\367\030\272\357\031"
+  "\352\022\262\326\066\333\125\032\320\070\377\151\221\003\371\070"
+  "\313\153\225\045\330\257\342\320\052\031\124\352\217\361\003\341"
+  "\154\126\035\106\034\054\232\223\310\072\243\134\037\205\024\325"
+  "\353\072\231\345\146\330\247\164\063\151\055\202\134\363\017\140"
+  "\334\241\314\163\062\320\026\013\170\153\312\303\121\055\174\051"
+  "\043\334\314\270\121\054\102\145\323\017\344\105\027\374\250\053"
+  "\160\256\332\040\120\126\257\266\026\330\012\003\225\074\131\010"
+  "\137\044\225\262\161\313\347\213\134\204\062\365\174\131\062\044"
+  "\343\324\335\150\114\323\321\160\317\037\166\056\275\256\044\350"
+  "\302\063\157\032\377\353\163\216\146\371\107\255\231\021\143\010"
+  "\235\127\046\010\325\130\254\106\156\221\134\064\045\251\166\277"
+  "\316\124\372\120\275\372\104\155\155\370\117\236\055\157\323\154"
+  "\043\161\236\100\237\262\132\155\142\215\066\104\231\266\110\252"
+  "\313\210\000\023\375\147\133\324\236\105\147\245\037\024\260\220"
+  "\202\121\274\142\321\014\154\070\173\351\036\216\312\252\056\336"
+  "\227\125\235\115\250\322\204\014\226\257\157\102\247\244\351\303"
+  "\343\326\364\155\112\062\267\176\306\072\034\133\011\121\243\067"
+  "\236\110\237\262\366\173\325\165\376\254\054\071\260\150\055\274"
+  "\323\312\212\136\115\253\253\231\122\001\134\016\130\012\264\071"
+  "\261\110\053\325\047\277\327\254\022\255\212\024\307\125\205\226"
+  "\072\363\257\240\015\023\231\265\324\042\265\112\240\130\230\030"
+  "\320\245\122\333\116\331\054\274\202\354\344\053\130\022\236\330"
+  "\237\241\065\031\064\050\223\151\065\176\157\301\166\327\341\364"
+  "\156\233\234\130\277\376\334\202\072\267\240\332\267\240\076\127"
+  "\366\061\336\146\007\252\165\222\121\332\110\376\161\035\250\071"
+  "\320\302\211\134\166\114\100\323\321\322\143\271\103\152\353\024"
+  "\075\244\347\377\255\353\203\256\323\311\103\320\354\037\351\375"
+  "\374\322\254\303\026\104\244\310\012\063\021\131\365\065\122\035"
+  "\107\055\326\070\352\036\036\201\017\216\306\307\122\312\235\160"
+  "\275\346\347\001\075\212\264\075\106\375\045\214\132\357\370\100"
+  "\310\176\327\341\351\210\175\035\372\250\216\272\361\115\255\270"
+  "\271\045\167\146\315\335\130\164\047\126\335\320\262\033\326\372"
+  "\355\225\367\351\040\351\026\036\314\156\034\157\166\222\364\132"
+  "\152\174\260\224\323\153\202\113\300\351\241\346\157\136\170\230"
+  "\201\205\256\237\267\231\071\355\377\361\070\036\144\137\315\101"
+  "\154\314\356\207\217\243\126\160\263\166\313\075\370\203\075\262"
+  "\270\051\114\076\117\237\235\104\233\273\106\077\316\111\274\243"
+  "\324\352\334\117\174\143\375\104\033\246\142\005\132\237\373\211"
+  "\307\324\117\074\335\053\223\076\067\001\153\351\355\362\046\143"
+  "\176\353\302\020\223\150\034\326\336\154\324\040\322\275\055\301"
+  "\223\011\215\057\067\066\354\364\356\074\240\332\354\175\163\131"
+  "\370\070\173\277\215\333\045\125\057\227\262\027\110\075\120\112"
+  "\252\327\270\016\375\326\017\013\166\057\035\345\052\124\026\342"
+  "\116\133\205\312\143\134\366\317\233\124\245\367\026\047\056\333"
+  "\306\211\042\215\305\327\212\371\113\267\336\346\052\305\026\242"
+  "\060\034\330\034\051\226\102\333\335\364\176\107\323\302\253\061"
+  "\233\270\354\116\255\107\160\151\265\373\371\225\215\023\374\305"
+  "\240\056\076\122\265\165\340\363\103\343\377\001\224\300\104\026"
+  "\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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/5.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/6.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/7.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/8.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/9.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/index.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/stats.html b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/style.css b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-06-22-160258-8495-cppcheck@2f92f67a71ac_travis-ci/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-06-23-103637-6108-1@98f663d85b4e_master/index.html b/2020-06-23-103637-6108-1@98f663d85b4e_master/index.html new file mode 100644 index 0000000..16a3da4 --- /dev/null +++ b/2020-06-23-103637-6108-1@98f663d85b4e_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@b18fea608792
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Tue Jun 23 10:36:37 2020
+

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_info2931View Report
+ + diff --git a/2020-06-23-103637-6108-1@98f663d85b4e_master/report-02f73c.html b/2020-06-23-103637-6108-1@98f663d85b4e_master/report-02f73c.html new file mode 100644 index 0000000..598b1cf --- /dev/null +++ b/2020-06-23-103637-6108-1@98f663d85b4e_master/report-02f73c.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-23-103637-6108-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-23-103637-6108-1@98f663d85b4e_master/report-d927ba.html b/2020-06-23-103637-6108-1@98f663d85b4e_master/report-d927ba.html new file mode 100644 index 0000000..29cda4b --- /dev/null +++ b/2020-06-23-103637-6108-1@98f663d85b4e_master/report-d927ba.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-23-103637-6108-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-23-103637-6108-1@98f663d85b4e_master/scanview.css b/2020-06-23-103637-6108-1@98f663d85b4e_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-06-23-103637-6108-1@98f663d85b4e_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/2020-06-23-103637-6108-1@98f663d85b4e_master/sorttable.js b/2020-06-23-103637-6108-1@98f663d85b4e_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-06-23-103637-6108-1@98f663d85b4e_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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/1.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/10.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/2.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/3.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/4.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/4.html new file mode 100644 index 0000000..f1a853b --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/5.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/6.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/7.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/8.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/9.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/index.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/stats.html b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/style.css b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-06-23-103715-9086-cppcheck@98f663d85b4e_master/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-06-23-104123-6106-1@22c7f5486c17_master/index.html b/2020-06-23-104123-6106-1@22c7f5486c17_master/index.html new file mode 100644 index 0000000..b3b2ef9 --- /dev/null +++ b/2020-06-23-104123-6106-1@22c7f5486c17_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@5a5eb23f5906
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Tue Jun 23 10:41:23 2020
+

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_info2931View Report
+ + diff --git a/2020-06-23-104123-6106-1@22c7f5486c17_master/report-064885.html b/2020-06-23-104123-6106-1@22c7f5486c17_master/report-064885.html new file mode 100644 index 0000000..e0b1e1a --- /dev/null +++ b/2020-06-23-104123-6106-1@22c7f5486c17_master/report-064885.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-23-104123-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-23-104123-6106-1@22c7f5486c17_master/report-302aa9.html b/2020-06-23-104123-6106-1@22c7f5486c17_master/report-302aa9.html new file mode 100644 index 0000000..07d5782 --- /dev/null +++ b/2020-06-23-104123-6106-1@22c7f5486c17_master/report-302aa9.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-23-104123-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-23-104123-6106-1@22c7f5486c17_master/scanview.css b/2020-06-23-104123-6106-1@22c7f5486c17_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-06-23-104123-6106-1@22c7f5486c17_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/2020-06-23-104123-6106-1@22c7f5486c17_master/sorttable.js b/2020-06-23-104123-6106-1@22c7f5486c17_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-06-23-104123-6106-1@22c7f5486c17_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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/1.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/10.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/2.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/3.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/4.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/4.html new file mode 100644 index 0000000..f1a853b --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/5.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/6.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/7.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/8.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/9.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/index.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/stats.html b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/style.css b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-06-23-104158-2134-cppcheck@22c7f5486c17_master/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-06-23-115720-6106-1@274d435c1798_master/index.html b/2020-06-23-115720-6106-1@274d435c1798_master/index.html new file mode 100644 index 0000000..6a6692c --- /dev/null +++ b/2020-06-23-115720-6106-1@274d435c1798_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@b443b85b1d19
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Tue Jun 23 11:57:20 2020
+

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_info2931View Report
+ + diff --git a/2020-06-23-115720-6106-1@274d435c1798_master/report-61181b.html b/2020-06-23-115720-6106-1@274d435c1798_master/report-61181b.html new file mode 100644 index 0000000..c1acfc6 --- /dev/null +++ b/2020-06-23-115720-6106-1@274d435c1798_master/report-61181b.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-23-115720-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-23-115720-6106-1@274d435c1798_master/report-b8d7d4.html b/2020-06-23-115720-6106-1@274d435c1798_master/report-b8d7d4.html new file mode 100644 index 0000000..0f83ed0 --- /dev/null +++ b/2020-06-23-115720-6106-1@274d435c1798_master/report-b8d7d4.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-23-115720-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-23-115720-6106-1@274d435c1798_master/scanview.css b/2020-06-23-115720-6106-1@274d435c1798_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-06-23-115720-6106-1@274d435c1798_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/2020-06-23-115720-6106-1@274d435c1798_master/sorttable.js b/2020-06-23-115720-6106-1@274d435c1798_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-06-23-115720-6106-1@274d435c1798_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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/1.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/10.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/2.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/3.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/4.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/4.html new file mode 100644 index 0000000..f1a853b --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/5.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/6.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/7.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/8.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-06-23-115757-9686-cppcheck@274d435c1798_master/9.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-06-23-115757-9686-cppcheck@274d435c1798_master/index.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-06-23-115757-9686-cppcheck@274d435c1798_master/stats.html b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-06-23-115757-9686-cppcheck@274d435c1798_master/style.css b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-06-23-115757-9686-cppcheck@274d435c1798_master/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/index.html b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/index.html new file mode 100644 index 0000000..df8a60e --- /dev/null +++ b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@8d5c901d8bac
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Tue Jun 23 12:02:16 2020
+

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_info2931View Report
+ + diff --git a/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/report-0125a7.html b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/report-0125a7.html new file mode 100644 index 0000000..b206450 --- /dev/null +++ b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/report-0125a7.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-23-120216-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/report-3c397a.html b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/report-3c397a.html new file mode 100644 index 0000000..d254870 --- /dev/null +++ b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/report-3c397a.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-23-120216-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/scanview.css b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/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/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/sorttable.js b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-06-23-120216-6106-1@274d435c1798_v1.25.0/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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/1.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/10.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/2.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/3.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/4.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/4.html new file mode 100644 index 0000000..f1a853b --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/5.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/6.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/7.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/8.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/9.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/index.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/stats.html b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/style.css b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-06-23-120253-7886-cppcheck@274d435c1798_v1.25.0/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} diff --git a/2020-06-26-232255-6106-1@a92e7aa4e086_master/index.html b/2020-06-26-232255-6106-1@a92e7aa4e086_master/index.html new file mode 100644 index 0000000..2a26569 --- /dev/null +++ b/2020-06-26-232255-6106-1@a92e7aa4e086_master/index.html @@ -0,0 +1,97 @@ + + +rootdir - scan-build results + + + + + + +

rootdir - scan-build results

+ + + + + + + +
User:root@14c69734cf7a
Working Directory:/rootdir
Command Line:make -j 2
Clang Version:clang version 9.0.1 (Fedora 9.0.1-2.fc31) +
Date:Fri Jun 26 23:22:55 2020
+

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_info2931View Report
+ + diff --git a/2020-06-26-232255-6106-1@a92e7aa4e086_master/report-47a8f3.html b/2020-06-26-232255-6106-1@a92e7aa4e086_master/report-47a8f3.html new file mode 100644 index 0000000..ecb7888 --- /dev/null +++ b/2020-06-26-232255-6106-1@a92e7aa4e086_master/report-47a8f3.html @@ -0,0 +1,1018 @@ + + + +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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-26-232255-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 strcpy (*terminal_exec + strlen (*terminal_exec), " -e ");
294 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
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-26-232255-6106-1@a92e7aa4e086_master/report-871a1b.html b/2020-06-26-232255-6106-1@a92e7aa4e086_master/report-871a1b.html new file mode 100644 index 0000000..42ccec8 --- /dev/null +++ b/2020-06-26-232255-6106-1@a92e7aa4e086_master/report-871a1b.html @@ -0,0 +1,1018 @@ + + + +caja-open-terminal.c + + + + + + + + + + + + + + + + + + + + + + + + + + +

Bug Summary

+ + + + +
File:caja-open-terminal.c
Warning:line 293, 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 -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 -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir /usr/lib64/clang/9.0.1 -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -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/libdrm -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/fribidi -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/gio-unix-2.0 -I /usr/include/libdrm -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/9.0.1/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 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option -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/2020-06-26-232255-6106-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> /* for GETTEXT_PACKAGE */
26#endif
27
28#include "caja-open-terminal.h"
29
30#include <libcaja-extension/caja-menu-provider.h>
31#include <libcaja-extension/caja-configurable.h>
32
33#include <glib/gi18n-lib.h>
34#include <gtk/gtkicontheme.h>
35#include <gtk/gtkwidget.h>
36#include <gtk/gtkmain.h>
37
38#include <libmate-desktop/mate-desktop-item.h>
39#include <gio/gio.h>
40
41#include <errno(*__errno_location ()).h>
42#include <fcntl.h>
43#include <string.h> /* for strcmp, strdup, ... */
44#include <unistd.h> /* for chdir */
45#include <stdlib.h> /* for atoi */
46#include <sys/stat.h>
47
48#define COT_SCHEMA"org.mate.caja-open-terminal" "org.mate.caja-open-terminal"
49#define COT_DESKTOP_KEY"desktop-opens-home-dir" "desktop-opens-home-dir"
50#define CAJA_SCHEMA"org.mate.caja.preferences" "org.mate.caja.preferences"
51#define CAJA_DESKTOP_KEY"desktop-is-home-dir" "desktop-is-home-dir"
52#define TERM_SCHEMA"org.mate.applications-terminal" "org.mate.applications-terminal"
53#define TERM_EXEC_KEY"exec" "exec"
54
55static void caja_open_terminal_instance_init (CajaOpenTerminal *cvs);
56static void caja_open_terminal_class_init (CajaOpenTerminalClass *class);
57
58static GType terminal_type = 0;
59
60typedef enum {
61 FILE_INFO_LOCAL,
62 FILE_INFO_DESKTOP,
63 FILE_INFO_SFTP,
64 FILE_INFO_OTHER
65} TerminalFileInfo;
66
67static TerminalFileInfo
68get_terminal_file_info (CajaFileInfo *file_info)
69{
70 TerminalFileInfo ret;
71 char *uri;
72 char *uri_scheme;
73
74 uri = caja_file_info_get_activation_uri (file_info);
75 uri_scheme = g_uri_parse_scheme (uri);
76
77 if (strcmp (uri_scheme, "file") == 0) {
78 ret = FILE_INFO_LOCAL;
79 } else if (strcmp (uri_scheme, "x-caja-desktop") == 0) {
80 ret = FILE_INFO_DESKTOP;
81 } else if (strcmp (uri_scheme, "sftp") == 0 ||
82 strcmp (uri_scheme, "ssh") == 0) {
83 ret = FILE_INFO_SFTP;
84 } else {
85 ret = FILE_INFO_OTHER;
86 }
87
88 g_free (uri_scheme);
89 g_free (uri);
90
91 return ret;
92}
93
94char *
95lookup_in_data_dir (const char *basename,
96 const char *data_dir)
97{
98 char *path;
99
100 path = g_build_filename (data_dir, basename, NULL((void*)0));
101 if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
102 g_free (path);
103 return NULL((void*)0);
104 }
105
106 return path;
107}
108
109static char *
110lookup_in_data_dirs (const char *basename)
111{
112 const char * const *system_data_dirs;
113 const char *user_data_dir;
114 char *retval;
115 int i;
116
117 user_data_dir = g_get_user_data_dir ();
118 system_data_dirs = g_get_system_data_dirs ();
119
120 if ((retval = lookup_in_data_dir (basename, user_data_dir))) {
121 return retval;
122 }
123
124 for (i = 0; system_data_dirs[i]; i++) {
125 if ((retval = lookup_in_data_dir (basename, system_data_dirs[i])))
126 return retval;
127 }
128
129 return NULL((void*)0);
130}
131
132static inline gboolean
133desktop_opens_home_dir (void)
134{
135 gboolean result;
136 GSettings* settings;
137
138 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
139 result = g_settings_get_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir");
140 g_object_unref (settings);
141 return result;
142}
143
144static inline gboolean
145set_desktop_opens_home_dir (gboolean val)
146{
147 gboolean result;
148 GSettings* settings;
149
150 settings = g_settings_new (COT_SCHEMA"org.mate.caja-open-terminal");
151 result = g_settings_set_boolean (settings, COT_DESKTOP_KEY"desktop-opens-home-dir", val);
152 g_object_unref (settings);
153 return result;
154}
155
156static inline gboolean
157desktop_is_home_dir (void)
158{
159 gboolean result;
160 GSettings* settings;
161
162 settings = g_settings_new (CAJA_SCHEMA"org.mate.caja.preferences");
163 result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY"desktop-is-home-dir");
164 g_object_unref (settings);
165 return result;
166}
167
168static inline gchar*
169default_terminal_application (void)
170{
171 gchar *result;
172 GSettings* settings;
173
174 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
175 result = g_settings_get_string (settings, TERM_EXEC_KEY"exec");
176 g_object_unref (settings);
177
178 if (result == NULL((void*)0) || strlen (result) == 0) {
179 g_free (result);
180 result = g_strdup ("mate-terminal");
181 }
182
183 return result;
184}
185
186static inline gboolean
187set_default_terminal_application (const gchar* exec)
188{
189 gboolean result;
190 GSettings* settings;
191
192 settings = g_settings_new (TERM_SCHEMA"org.mate.applications-terminal");
193 result = g_settings_set_string (settings, TERM_EXEC_KEY"exec", exec);
194 g_object_unref (settings);
195 return result;
196}
197
198static void
199parse_sftp_uri (GFile *file, char **host, guint *port, char **user,
200 char **path)
201{
202 char *uri = g_file_get_uri (file);
203 char *u, *h, *s, *p;
204 char *h_end;
205
206 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", 206, ((const char
*) (__func__)), "uri != NULL"); } while (0)
;
207
208 u = strchr(uri, ':');
209 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", 209, ((const char
*) (__func__)), "u != NULL"); } while (0)
;
210 u += 3; /* Skip over :// to userid */
211
212 p = strchr (u, '/');
213 h = strchr(u, '@');
214
215 if (h && ((p == NULL((void*)0)) || (h < p))) {
216 *h='\0';
217 h++;
218 } else {
219 h = u;
220 u = NULL((void*)0);
221 }
222
223 s = strchr(h, ':');
224
225 if (s && (p == NULL((void*)0) || s < p)) {
226 h_end = s;
227 *s = '\0';
228 s++;
229 } else {
230 h_end = p;
231 s = NULL((void*)0);
232 }
233
234 if (h_end == NULL((void*)0)) {
235 h_end = h + strlen(h);
236 }
237
238 *user = g_strdup(u);
239 *port = s == NULL((void*)0) ? 0 : atoi(s); /* FIXME: getservbyname ? */
240 *path = g_uri_unescape_string (p, "/");
241 *h_end = '\0';
242 *host = g_strdup(h);
243
244 g_free (uri);
245}
246
247static void
248append_sftp_info (char **terminal_exec,
249 CajaFileInfo *file_info)
250{
251 GFile *vfs_uri;
252 char *host_name, *path, *user_name;
253 char *user_host, *cmd, *quoted_cmd;
254 char *host_port_switch;
255 char *quoted_path;
256 char *remote_cmd;
257 char *quoted_remote_cmd;
258 guint host_port;
259
260 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", 260, ((const char
*) (__func__)), "terminal_exec != NULL"); } while (0)
;
261 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", 261, ((const char
*) (__func__)), "file_info != NULL"); } while (0)
;
262
263
264 vfs_uri = g_file_new_for_uri (caja_file_info_get_activation_uri (file_info));
265 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", 265, ((const char
*) (__func__)), "vfs_uri != NULL"); } while (0)
;
266
267 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
268 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", 268, ((const char
*) (__func__)), "g_file_has_uri_scheme(vfs_uri, \"sftp\")==TRUE || g_file_has_uri_scheme(vfs_uri, \"ssh\")==TRUE"
); } while (0)
;
269
270 parse_sftp_uri (vfs_uri, &host_name, &host_port, &user_name, &path);
271
272 if (host_port == 0) {
273 host_port_switch = g_strdup ("");
274 } else {
275 host_port_switch = g_strdup_printf ("-p %d", host_port);
276 }
277
278 if (user_name != NULL((void*)0)) {
279 user_host = g_strdup_printf ("%s@%s", user_name, host_name);
280 } else {
281 user_host = g_strdup (host_name);
282 }
283
284 quoted_path = g_shell_quote (path);
285 remote_cmd = g_strdup_printf ("cd %s && $SHELL -l", quoted_path);
286 quoted_remote_cmd = g_shell_quote (remote_cmd);
287
288 cmd = g_strdup_printf ("ssh %s %s -t %s", user_host, host_port_switch, quoted_remote_cmd);
289 quoted_cmd = g_shell_quote (cmd);
290 g_free (cmd);
291
292 *terminal_exec = g_realloc (*terminal_exec, strlen (*terminal_exec) + strlen (quoted_cmd) + 4 + 1);
293 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
294 strcpy (*terminal_exec + strlen (*terminal_exec), quoted_cmd);
295
296 g_free (host_name);
297 g_free (user_name);
298 g_free (host_port_switch);
299 g_free (path);
300 g_free (quoted_path);
301
302 g_free (remote_cmd);
303 g_free (quoted_remote_cmd);
304 g_free (quoted_cmd);
305 g_free (user_host);
306 g_object_unref (vfs_uri);
307}
308
309static void
310open_terminal_callback (CajaMenuItem *item,
311 CajaFileInfo *file_info)
312{
313 GdkDisplay *display;
314 const gchar *display_str;
315 const gchar *old_display_str;
316 gchar *uri;
317 gchar **argv, *terminal_exec;
318 gchar *working_directory;
319 gchar *dfile;
320 MateDesktopItem *ditem;
321 GdkScreen *screen;
322
323 terminal_exec = default_terminal_application();
324
325 switch (get_terminal_file_info (file_info)) {
326 case FILE_INFO_LOCAL:
327 uri = caja_file_info_get_activation_uri (file_info);
328 if (uri != NULL((void*)0)) {
329 working_directory = g_filename_from_uri (uri, NULL((void*)0), NULL((void*)0));
330 } else {
331 working_directory = g_strdup (g_get_home_dir ());
332 }
333 g_free (uri);
334 break;
335
336 case FILE_INFO_DESKTOP:
337 if (desktop_is_home_dir () || desktop_opens_home_dir ()) {
338 working_directory = g_strdup (g_get_home_dir ());
339 } else {
340 working_directory = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
341 }
342 break;
343
344 case FILE_INFO_SFTP:
345 working_directory = NULL((void*)0);
346 append_sftp_info (&terminal_exec, file_info);
347 break;
348
349 case FILE_INFO_OTHER:
350 default:
351 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 351, ((const char*) (__func__)), ((void*)0)); } while (0)
;
352 }
353
354 if (g_str_has_prefix (terminal_exec, "mate-terminal")) {
355 dfile = lookup_in_data_dirs ("applications/mate-terminal.desktop");
356 } else {
357 dfile = NULL((void*)0);
358 }
359
360 g_shell_parse_argv (terminal_exec, NULL((void*)0), &argv, NULL((void*)0));
361
362 display_str = NULL((void*)0);
363 old_display_str = g_getenv ("DISPLAY");
364
365 screen = g_object_get_data (G_OBJECT (item)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
item)), (((GType) ((20) << (2))))))))
, "CajaOpenTerminal::screen");
366 display = gdk_screen_get_display (screen);
367 if (screen != NULL((void*)0)) {
368 display_str = gdk_display_get_name (display);
369 g_setenv ("DISPLAY", display_str, TRUE(!(0)));
370 }
371
372 if (dfile != NULL((void*)0)) {
373 int orig_cwd = -1;
374
375 do {
376 orig_cwd = open (".", O_RDONLY00);
377 } while (orig_cwd == -1 && errno(*__errno_location ()) == EINTR4);
378
379 if (orig_cwd == -1) {
380 g_message ("CajaOpenTerminal: Failed to open current Caja working directory.");
381 } else if (working_directory != NULL((void*)0)) {
382
383 if (chdir (working_directory) == -1) {
384 int ret;
385
386 g_message ("CajaOpenTerminal: Failed to change Caja working directory to \"%s\".",
387 working_directory);
388
389 do {
390 ret = close (orig_cwd);
391 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
392
393 if (ret == -1) {
394 g_message ("CajaOpenTerminal: Failed to close() current Caja working directory.");
395 }
396
397 orig_cwd = -1;
398 }
399 }
400
401 ditem = mate_desktop_item_new_from_file (dfile, 0, NULL((void*)0));
402
403 mate_desktop_item_set_string (ditem, "Exec", terminal_exec);
404 if (gtk_get_current_event_time () > 0) {
405 mate_desktop_item_set_launch_time (ditem, gtk_get_current_event_time ());
406 }
407 mate_desktop_item_launch (ditem, NULL((void*)0), MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR, NULL((void*)0));
408 mate_desktop_item_unref (ditem);
409 g_free (dfile);
410
411 if (orig_cwd != -1) {
412 int ret;
413
414 ret = fchdir (orig_cwd);
415 if (ret == -1) {
416 g_message ("CajaOpenTerminal: Failed to change back Caja working directory to original location after changing it to \"%s\".",
417 working_directory);
418 }
419
420 do {
421 ret = close (orig_cwd);
422 } while (ret == -1 && errno(*__errno_location ()) == EINTR4);
423
424 if (ret == -1) {
425 g_message ("CajaOpenTerminal: Failed to close Caja working directory.");
426 }
427 }
428 } else {
429 g_spawn_async (working_directory,
430 argv,
431 NULL((void*)0),
432 G_SPAWN_SEARCH_PATH,
433 NULL((void*)0),
434 NULL((void*)0),
435 NULL((void*)0),
436 NULL((void*)0));
437 }
438
439 g_setenv ("DISPLAY", old_display_str, TRUE(!(0)));
440
441 g_strfreev (argv);
442 g_free (terminal_exec);
443 g_free (working_directory);
444}
445
446static CajaMenuItem *
447open_terminal_menu_item_new (CajaFileInfo *file_info,
448 TerminalFileInfo terminal_file_info,
449 GdkScreen *screen,
450 gboolean is_file_item)
451{
452 CajaMenuItem *ret;
453 const char *name;
454 const char *tooltip;
455
456 switch (terminal_file_info) {
457 case FILE_INFO_LOCAL:
458 case FILE_INFO_SFTP:
459 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
460 if (is_file_item) {
461 tooltip = _("Open the currently selected folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently selected folder in a terminal"
))
;
462 } else {
463 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
464 }
465 break;
466
467 case FILE_INFO_DESKTOP:
468 if (desktop_opens_home_dir ()) {
469 name = _("Open _Terminal")((char *) g_dgettext ("caja-extensions", "Open _Terminal"));
470 tooltip = _("Open a terminal")((char *) g_dgettext ("caja-extensions", "Open a terminal"));
471 } else {
472 name = _("Open in _Terminal")((char *) g_dgettext ("caja-extensions", "Open in _Terminal")
)
;
473 tooltip = _("Open the currently open folder in a terminal")((char *) g_dgettext ("caja-extensions", "Open the currently open folder in a terminal"
))
;
474 }
475 break;
476
477 case FILE_INFO_OTHER:
478 default:
479 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 479, ((const char*) (__func__)), ((void*)0)); } while (0)
;
480 }
481
482 ret = caja_menu_item_new ("CajaOpenTerminal::open_terminal",
483 name, tooltip, "terminal");
484
485 g_object_set_data (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
,
486 "CajaOpenTerminal::screen",
487 screen);
488
489 g_object_set_data_full (G_OBJECT (ret)((((GObject*) g_type_check_instance_cast ((GTypeInstance*) ((
ret)), (((GType) ((20) << (2))))))))
, "file-info",
490 g_object_ref (file_info),
491 (GDestroyNotify) g_object_unref);
492 g_signal_connect (ret, "activate",g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
493 G_CALLBACK (open_terminal_callback),g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
494 file_info)g_signal_connect_data ((ret), ("activate"), (((GCallback) (open_terminal_callback
))), (file_info), ((void*)0), (GConnectFlags) 0)
;
495
496 return ret;
497}
498
499static GList *
500caja_open_terminal_get_background_items (CajaMenuProvider *provider,
501 GtkWidget *window,
502 CajaFileInfo *file_info)
503{
504 CajaMenuItem *item;
505 TerminalFileInfo terminal_file_info;
506
507 terminal_file_info = get_terminal_file_info (file_info);
508 switch (terminal_file_info) {
509 case FILE_INFO_LOCAL:
510 case FILE_INFO_DESKTOP:
511 case FILE_INFO_SFTP:
512 item = open_terminal_menu_item_new (file_info, terminal_file_info, gtk_widget_get_screen (window), FALSE(0));
513 return g_list_append (NULL((void*)0), item);
514
515 case FILE_INFO_OTHER:
516 return NULL((void*)0);
517
518 default:
519 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 519, ((const char*) (__func__)), ((void*)0)); } while (0)
;
520 }
521}
522
523GList *
524caja_open_terminal_get_file_items (CajaMenuProvider *provider,
525 GtkWidget *window,
526 GList *files)
527{
528 CajaMenuItem *item;
529 TerminalFileInfo terminal_file_info;
530
531 if (g_list_length (files) != 1 ||
532 (!caja_file_info_is_directory (files->data) &&
533 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_SHORTCUT &&
534 caja_file_info_get_file_type (files->data) != G_FILE_TYPE_MOUNTABLE)) {
535 return NULL((void*)0);
536 }
537
538 terminal_file_info = get_terminal_file_info (files->data);
539 switch (terminal_file_info) {
540 case FILE_INFO_LOCAL:
541 case FILE_INFO_SFTP:
542 item = open_terminal_menu_item_new (files->data, terminal_file_info, gtk_widget_get_screen (window), TRUE(!(0)));
543 return g_list_append (NULL((void*)0), item);
544
545 case FILE_INFO_DESKTOP:
546 case FILE_INFO_OTHER:
547 return NULL((void*)0);
548
549 default:
550 g_assert_not_reached ()do { g_assertion_message_expr ("Caja-Open-Terminal", "caja-open-terminal.c"
, 550, ((const char*) (__func__)), ((void*)0)); } while (0)
;
551 }
552}
553
554static void
555caja_open_terminal_run_config (CajaConfigurable *provider)
556{
557 GtkWidget *extconf_dialog, *extconf_content, *extconf_desktophomedir, *extconf_inform1, *extconf_inform2, *extconf_exec;
558 gchar * terminal;
559
560 extconf_dialog = gtk_dialog_new ();
561 extconf_content = gtk_dialog_get_content_area (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
562
563 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"
))
);
564 extconf_exec = gtk_entry_new ();
565 extconf_inform1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
566 extconf_inform2 = gtk_label_new (_("Terminal application:")((char *) g_dgettext ("caja-extensions", "Terminal application:"
))
);
567
568 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 ());
569
570 terminal = default_terminal_application();
571 gtk_entry_set_text (GTK_ENTRY (extconf_exec)((((GtkEntry*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_exec)), ((gtk_entry_get_type ()))))))
, terminal);
572 g_free (terminal);
573
574 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_inform2);
575 gtk_widget_show (extconf_inform2);
576 gtk_container_add (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, extconf_exec);
577 gtk_widget_show (extconf_exec);
578 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);
579
580 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_desktophomedir);
581 gtk_widget_show (extconf_desktophomedir);
582 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_inform1);
583 gtk_widget_show (extconf_inform1);
584 gtk_container_add (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, extconf_exec);
585 gtk_widget_show (extconf_exec);
586 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));
587
588 gtk_container_set_border_width (GTK_CONTAINER (extconf_inform1)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_inform1)), ((gtk_container_get_type ()))))))
, 6);
589 gtk_container_set_border_width (GTK_CONTAINER (extconf_dialog)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_dialog)), ((gtk_container_get_type ()))))))
, 6);
590 gtk_container_set_border_width (GTK_CONTAINER (extconf_content)((((GtkContainer*) g_type_check_instance_cast ((GTypeInstance
*) ((extconf_content)), ((gtk_container_get_type ()))))))
, 6);
591
592 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"
))
);
593 gtk_dialog_run (GTK_DIALOG (extconf_dialog)((((GtkDialog*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_dialog_get_type ()))))))
);
594
595 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 ()))))))
));
596 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 (
)))))))
));
597
598 gtk_widget_destroy (GTK_WIDGET (extconf_dialog)((((GtkWidget*) g_type_check_instance_cast ((GTypeInstance*) (
(extconf_dialog)), ((gtk_widget_get_type ()))))))
);
599}
600
601static void
602caja_open_terminal_menu_provider_iface_init (CajaMenuProviderIface *iface)
603{
604 iface->get_background_items = caja_open_terminal_get_background_items;
605 iface->get_file_items = caja_open_terminal_get_file_items;
606}
607
608static void
609caja_open_terminal_configurable_iface_init (CajaConfigurableIface *iface)
610{
611 iface->run_config = caja_open_terminal_run_config;
612}
613
614static void
615caja_open_terminal_instance_init (CajaOpenTerminal *cvs)
616{
617}
618
619static void
620caja_open_terminal_class_init (CajaOpenTerminalClass *class)
621{
622}
623
624GType
625caja_open_terminal_get_type (void)
626{
627 return terminal_type;
628}
629
630void
631caja_open_terminal_register_type (GTypeModule *module)
632{
633 static const GTypeInfo info = {
634 sizeof (CajaOpenTerminalClass),
635 (GBaseInitFunc) NULL((void*)0),
636 (GBaseFinalizeFunc) NULL((void*)0),
637 (GClassInitFunc) caja_open_terminal_class_init,
638 NULL((void*)0),
639 NULL((void*)0),
640 sizeof (CajaOpenTerminal),
641 0,
642 (GInstanceInitFunc) caja_open_terminal_instance_init,
643 };
644
645 static const GInterfaceInfo menu_provider_iface_info = {
646 (GInterfaceInitFunc) caja_open_terminal_menu_provider_iface_init,
647 NULL((void*)0),
648 NULL((void*)0)
649 };
650
651 static const GInterfaceInfo configurable_iface_info = {
652 (GInterfaceInitFunc) caja_open_terminal_configurable_iface_init,
653 NULL((void*)0),
654 NULL((void*)0)
655 };
656
657 terminal_type = g_type_module_register_type (module,
658 G_TYPE_OBJECT((GType) ((20) << (2))),
659 "CajaOpenTerminal",
660 &info, 0);
661
662 g_type_module_add_interface (module,
663 terminal_type,
664 CAJA_TYPE_MENU_PROVIDER(caja_menu_provider_get_type ()),
665 &menu_provider_iface_info);
666
667 g_type_module_add_interface (module,
668 terminal_type,
669 CAJA_TYPE_CONFIGURABLE(caja_configurable_get_type ()),
670 &configurable_iface_info);
671}
diff --git a/2020-06-26-232255-6106-1@a92e7aa4e086_master/scanview.css b/2020-06-26-232255-6106-1@a92e7aa4e086_master/scanview.css new file mode 100644 index 0000000..cf8a5a6 --- /dev/null +++ b/2020-06-26-232255-6106-1@a92e7aa4e086_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/2020-06-26-232255-6106-1@a92e7aa4e086_master/sorttable.js b/2020-06-26-232255-6106-1@a92e7aa4e086_master/sorttable.js new file mode 100644 index 0000000..32faa07 --- /dev/null +++ b/2020-06-26-232255-6106-1@a92e7aa4e086_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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/1.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/1.html new file mode 100644 index 0000000..827b9b1 --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/1.html @@ -0,0 +1,1508 @@ + + + + + + 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
/*
+ *  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> /* for GETTEXT_PACKAGE */
+#endif
+
+#include "caja-open-terminal.h"
+
+#include <libcaja-extension/caja-menu-provider.h>
+#include <libcaja-extension/caja-configurable.h>
+
+#include <glib/gi18n-lib.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;
+}
+
+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);<--- Assignment 'uri=g_file_get_uri(file)', assigned value is 0
+	char *u, *h, *s, *p;
+	char *h_end;
+
+	g_assert (uri != NULL);<--- Assuming that condition 'uri!=NULL' is not redundant
+
+	u = strchr(uri, ':');<--- Null pointer dereference<--- Assignment 'u=strchr(uri,':')', assigned value is 0
+	g_assert (u != NULL);<--- Assuming that condition 'u!=NULL' is not redundant
+	u += 3;  /* Skip over :// to userid */<--- Null pointer addition<--- Compound assignment '+=', assigned value is 3
+
+	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 ();
+	}
+}
+
+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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/10.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/10.html new file mode 100644 index 0000000..aaf588e --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/10.html @@ -0,0 +1,530 @@ + + + + + + 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
/*
+ *  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>
+ */
+
+#include <config.h>
+#include <string.h>
+#include <gio/gio.h>
+#include <glib/gi18n-lib.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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/2.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/2.html new file mode 100644 index 0000000..383742c --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/2.html @@ -0,0 +1,486 @@ + + + + + + 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
/*
+ *  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>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/3.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/3.html new file mode 100644 index 0000000..9eec01d --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/3.html @@ -0,0 +1,1874 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <stdlib.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 UNINSTALLED_SOURCE "caja-sendto-command.c"
+
+#define SOEXT           ("." G_MODULE_SUFFIX)
+#define SOEXT_LEN       (strlen (SOEXT))
+
+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_foreach (file_list, (GFunc) g_free, NULL);
+			g_list_free (file_list);
+			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,
+					COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description),
+					-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 *settings,
+		     GParamSpec *spec,
+		     GtkWidget *widget)
+{
+	gboolean show_images;
+
+	g_object_get (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;
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/4.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/4.html new file mode 100644 index 0000000..f1a853b --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/4.html @@ -0,0 +1,922 @@ + + + + + + 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
#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 };
+extern 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 sane 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 Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
+ * with an underscore but symbols on x64 are not.
+ */
+#ifdef _WIN64
+#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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/5.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/5.html new file mode 100644 index 0000000..a153ad5 --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/5.html @@ -0,0 +1,566 @@ + + + + + + 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>
+ */
+
+#include "config.h"
+#include <string.h>
+#include <glib/gi18n-lib.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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/6.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/6.html new file mode 100644 index 0000000..f3ae982 --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/6.html @@ -0,0 +1,1272 @@ + + + + + + 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.
+ *
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	/* 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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/7.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/7.html new file mode 100644 index 0000000..f117eb7 --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/7.html @@ -0,0 +1,1122 @@ + + + + + + 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
/* -*- 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>
+ */
+
+#include "config.h"
+#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");
+
+	bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+	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;<--- Shadowed declaration
+	int i, j;<--- Shadowed declaration
+
+	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 accounts;<--- Shadow variable
+
+		dat = g_ptr_array_index (contacts_group, 0);
+
+		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);
+
+		gint i;<--- Shadow variable
+		for (i = 0; i < accounts; ++i) {
+			dat = g_ptr_array_index (contacts_group, i);
+
+			icon = get_buddy_icon(dat->id);
+
+			if (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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/8.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/8.html new file mode 100644 index 0000000..5d7a721 --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/8.html @@ -0,0 +1,2730 @@ + + + + + + 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
+1288
/* 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 <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 <glib/gi18n-lib.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 ();
+  gtk_builder_set_translation_domain (page->ui, GETTEXT_PACKAGE);
+  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");*/
+
+  bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+
+  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/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/9.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/9.html new file mode 100644 index 0000000..8cae30b --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/9.html @@ -0,0 +1,2186 @@ + + + + + + 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
#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+#  define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+#  define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10	/* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+	int real_argc;
+	int i;
+	char **real_argv;
+	gboolean retval;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+	GKeyFile *key_file;
+	GError *real_error;
+
+	g_assert (argc > 0);
+	g_assert (argv != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (ret_key_file)
+		*ret_key_file = NULL;
+
+	/* Build command line */
+
+	real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+	real_argv = g_new (char *, real_argc);
+
+	real_argv[0] = NET_USERSHARE_ARGV0;
+	real_argv[1] = "usershare";
+
+	for (i = 0; i < argc; i++) {
+		g_assert (argv[i] != NULL);
+		real_argv[i + 2] = argv[i];
+	}
+
+	real_argv[real_argc - 1] = NULL;
+
+	/* Launch */
+
+	stdout_contents = NULL;
+	stderr_contents = NULL;
+	/*
+	{
+		char **p;
+
+		g_message ("------------------------------------------");
+
+		for (p = real_argv; *p; p++)
+			g_message ("spawn arg \"%s\"", *p);
+
+		g_message ("end of spawn args; SPAWNING\n");
+	}
+	*/
+	real_error = NULL;
+	retval = g_spawn_sync (NULL,			/* cwd */
+			       real_argv,
+			       NULL, 			/* envp */
+			       G_SPAWN_SEARCH_PATH,
+			       NULL, 			/* GSpawnChildSetupFunc */
+			       NULL,			/* user_data */
+			       &stdout_contents,
+			       &stderr_contents,
+			       &exit_status,
+			       &real_error);
+
+	/* g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message); */
+
+	if (!retval) {
+		g_propagate_error (error, real_error);
+		goto out;
+	}
+
+	if (!WIFEXITED (exit_status)) {
+		g_message ("WIFEXITED(%d) was false!", exit_status);
+		retval = FALSE;
+
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_message ("Child got signal %d", signal_num);
+
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s returned with signal %d"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2],
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("%s %s %s failed for an unknown reason"),
+				     real_argv[0],
+				     real_argv[1],
+				     real_argv[2]);
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+
+	/* g_message ("exit code %d", exit_code); */
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		retval = FALSE;
+		goto out;
+	}
+
+	if (ret_key_file) {
+	  /* g_message ("caller wants GKeyFile"); */
+
+		*ret_key_file = NULL;
+
+		/* FIXME: jeallison@novell.com says the output of "net usershare" is nearly always
+		 * in UTF-8, but that it can be configured in the master smb.conf.  We assume
+		 * UTF-8 for now.
+		 */
+
+		if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+			g_message ("stdout of net usershare was not in valid UTF-8");
+			g_set_error (error,
+				     G_SPAWN_ERROR,
+				     G_SPAWN_ERROR_FAILED,
+				     _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+			retval = FALSE;
+			goto out;
+		}
+
+		key_file = g_key_file_new ();
+
+		real_error = NULL;
+		if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+			g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+			g_propagate_error (error, real_error);
+			g_key_file_free (key_file);
+			retval = FALSE;
+			goto out;
+		}
+
+		retval = TRUE;
+		*ret_key_file = key_file;
+	} else
+		retval = TRUE;
+
+	/* g_message ("success from calling net usershare and parsing its output"); */
+
+ out:
+	g_free (real_argv);
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	/* g_message ("------------------------------------------"); */
+
+	return retval;
+}
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+	if (path_share_info_hash == NULL) {
+		g_assert (share_name_share_info_hash == NULL);
+
+		path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	} else
+		g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+	ensure_hashes ();
+	return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_insert (path_share_info_hash, info->path, info);
+	g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+	ensure_hashes ();
+	g_hash_table_remove (path_share_info_hash, info->path);
+	g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+			  gpointer value,
+			  gpointer data)
+{
+	ShareInfo *info;
+
+	info = value;
+	shares_free_share_info (info);
+
+	return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+				gpointer value,
+				gpointer data)
+{
+	/* The ShareInfo was already freed in remove_from_path_hash_cb() */
+	return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+	ensure_hashes ();
+	g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+	g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+	GError *error;
+	char *str;
+
+	error = NULL;
+	str = NULL;
+
+	if (g_key_file_has_key (key_file, group, key, &error)) {
+		str = g_key_file_get_string (key_file, group, key, &error);
+		if (!str) {
+			g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+				  && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+			g_error_free (error);
+		}
+	} else {
+		g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+		g_error_free (error);
+	}
+
+	return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+	char *path;
+	char *comment;
+	char *acl;
+	gboolean is_writable;
+	char *guest_ok_str;
+	gboolean guest_ok;
+	ShareInfo *info;
+	ShareInfo *old_info;
+
+	/* Remove the old share based on the name */
+
+	old_info = lookup_share_by_share_name (group);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Start parsing, and remove the old share based on the path */
+
+	path = get_string_from_key_file (key_file, group, KEY_PATH);
+	if (!path) {<--- Assuming that condition '!path' is not redundant
+		g_message ("group '%s' doesn't have a '%s' key!  Ignoring group.", group, KEY_PATH);
+		return;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (old_info) {
+		remove_share_info_from_hashes (old_info);
+		shares_free_share_info (old_info);
+	}
+
+	/* Finish parsing */
+
+	comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+	acl = get_string_from_key_file (key_file, group, KEY_ACL);
+	if (acl) {
+		if (strstr (acl, "Everyone:R"))
+			is_writable = FALSE;
+		else if (strstr (acl, "Everyone:F"))
+			is_writable = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is read-only",
+				   group, KEY_ACL, acl);
+			is_writable = FALSE;
+		}
+
+		g_free (acl);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is read-only.", group, KEY_ACL);
+		is_writable = FALSE;
+	}
+
+	guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+	if (guest_ok_str) {
+		if (strcmp (guest_ok_str, "n") == 0)
+			guest_ok = FALSE;
+		else if (strcmp (guest_ok_str, "y") == 0)
+			guest_ok = TRUE;
+		else {
+			g_message ("unknown format for key '%s/%s' as it contains '%s'.  Assuming that the share is not guest accessible.",
+				   group, KEY_GUEST_OK, guest_ok_str);
+			guest_ok = FALSE;
+		}
+
+		g_free (guest_ok_str);
+	} else {
+		g_message ("group '%s' doesn't have a '%s' key!  Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+		guest_ok = FALSE;
+	}
+
+	g_assert (path != NULL);<--- Argument 'path!=NULL' to function g_assert is always 1
+	g_assert (group != NULL);
+
+	info = g_new (ShareInfo, 1);
+	info->path = path;
+	info->share_name = g_strdup (group);
+	info->comment = comment;
+	info->is_writable = is_writable;
+	info->guest_ok = guest_ok;
+
+	add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+	gsize num_groups;
+	char **group_names;
+	gsize i;
+
+	group_names = g_key_file_get_groups (key_file, &num_groups);
+
+	/* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+	 * which have invalid data (i.e. no path).  We could probably accumulate a
+	 * GError with the list of invalid groups and propagate it upwards.
+	 */
+	for (i = 0; i < num_groups; i++) {
+		g_assert (group_names[i] != NULL);
+		add_key_group_to_hashes (key_file, group_names[i]);
+	}
+
+	g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+	GKeyFile *key_file;
+	char *argv[1];
+	GError *real_error;
+
+	free_all_shares ();
+
+	if (throw_error_on_refresh) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		return FALSE;
+	}
+
+	argv[0] = "info";
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+		g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	g_assert (key_file != NULL);
+
+	replace_shares_from_key_file (key_file);
+	g_key_file_free (key_file);
+
+	return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+	gboolean retval;
+
+	if (refresh_timestamp_update_counter == 0) {
+		time_t new_timestamp;
+
+		refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+		new_timestamp = time (NULL);
+		if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+		  /* g_message ("REFRESHING SHARES"); */
+			retval = refresh_shares (error);
+		} else
+			retval = TRUE;
+
+		refresh_timestamp = new_timestamp;
+	} else {
+		refresh_timestamp_update_counter--;
+		retval = TRUE;
+	}
+
+	return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+	ShareInfo *copy;
+
+	if (!info)
+		return NULL;
+
+	copy = g_new (ShareInfo, 1);
+	copy->path = g_strdup (info->path);
+	copy->share_name = g_strdup (info->share_name);
+	copy->comment = g_strdup (info->comment);
+	copy->is_writable = info->is_writable;
+	copy->guest_ok = info->guest_ok;
+
+	return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+	gboolean retval;
+	gboolean result;
+	char *stdout_contents;
+	char *stderr_contents;
+	int exit_status;
+	int exit_code;
+
+	*supports_guest_ok_ret = FALSE;
+
+	result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+					    &stdout_contents,
+					    &stderr_contents,
+					    &exit_status,
+					    error);
+	if (!result)
+		return FALSE;
+
+	retval = FALSE;
+
+	if (!WIFEXITED (exit_status)) {
+		if (WIFSIGNALED (exit_status)) {
+			int signal_num;
+
+			signal_num = WTERMSIG (exit_status);
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm returned with signal %d"),
+				     signal_num);
+		} else
+			g_set_error (error,
+				     SHARES_ERROR,
+				     SHARES_ERROR_FAILED,
+				     _("Samba's testparm failed for an unknown reason"));
+
+		goto out;
+	}
+
+	exit_code = WEXITSTATUS (exit_status);
+	if (exit_code != 0) {
+		char *str;
+		char *message;
+
+		/* stderr_contents is in the system locale encoding, not UTF-8 */
+
+		str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+		if (str && str[0])
+			message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+		else
+			message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+		g_free (str);
+
+		g_set_error (error,
+			     G_SPAWN_ERROR,
+			     G_SPAWN_ERROR_FAILED,
+			     "%s",
+			     message);
+
+		g_free (message);
+
+		goto out;
+	}
+
+	retval = TRUE;
+	*supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+	g_free (stdout_contents);
+	g_free (stderr_contents);
+
+	return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+	char *argv[7];
+	int argc;
+	ShareInfo *copy;
+	GKeyFile *key_file;
+	GError *real_error;
+	gboolean supports_success;
+	gboolean supports_guest_ok;
+	gboolean net_usershare_success;
+
+	/*	g_message ("add_share() start"); */
+
+	if (throw_error_on_add) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Failed"));
+		g_message ("add_share() end FAIL");
+		return FALSE;
+	}
+
+	supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+	if (!supports_success)
+		return FALSE;
+
+	argv[0] = "add";
+	argv[1] = "-l";
+	argv[2] = info->share_name;
+	argv[3] = info->path;
+	argv[4] = info->comment;
+	argv[5] = info->is_writable ? "Everyone:F" : g_strdup_printf ("Everyone:R,%s:F", g_get_user_name ());
+
+	if (supports_guest_ok) {
+		argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+		argc = 7;
+	} else
+		argc = 6;
+
+	real_error = NULL;
+	net_usershare_success = net_usershare_run (argc, argv, &key_file, &real_error);
+	if (!info->is_writable) g_free (argv[5]);
+
+	if (!net_usershare_success) {
+		g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		return FALSE;
+	}
+
+	replace_shares_from_key_file (key_file);
+
+	copy = copy_share_info (info);
+	add_share_info_to_hashes (copy);
+
+	/* g_message ("add_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+	ShareInfo *old_info;
+	char *argv[2];
+	GError *real_error;
+
+	/* g_message ("remove_share() start"); */
+
+	if (throw_error_on_remove) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	old_info = lookup_share_by_path (path);
+	if (!old_info) {
+		char *display_name;
+
+		display_name = g_filename_display_name (path);
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_NONEXISTENT,
+			     _("Cannot remove the share for path %s: that path is not shared"),
+			     display_name);
+		g_free (display_name);
+
+		g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+		return FALSE;
+	}
+
+	argv[0] = "delete";
+	argv[1] = old_info->share_name;
+
+	real_error = NULL;
+	if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+		g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+		g_propagate_error (error, real_error);
+		g_message ("remove_share() end FAIL");
+		return FALSE;
+	}
+
+	remove_share_info_from_hashes (old_info);
+	shares_free_share_info (old_info);
+
+	/* g_message ("remove_share() end SUCCESS"); */
+
+	return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	ShareInfo *old_info;
+
+ 	/* g_message ("modify_share() start"); */
+
+	old_info = lookup_share_by_path (old_path);
+	if (old_info == NULL) {
+	  /*g_message ("modify_share() end; calling add_share() instead");*/
+		return add_share (info, error);
+	}
+
+	g_assert (old_info != NULL);
+
+	if (strcmp (info->path, old_info->path) != 0) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+		g_message ("modify_share() end FAIL: tried to change the path in a share!");
+		return FALSE;
+	}
+
+	if (throw_error_on_modify) {
+		g_set_error (error,
+			     SHARES_ERROR,
+			     SHARES_ERROR_FAILED,
+			     "Failed");
+		g_message ("modify_share() end FAIL");
+		return FALSE;
+	}
+
+	/* Although "net usershare add" will modify an existing share if it has the same share name
+	 * as the one that gets passed in, our semantics are different.  We have a one-to-one mapping
+	 * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+	 * to share names.  So, we must first remove the old share and then add the new/modified one.
+	 */
+
+	if (!remove_share (old_path, error)) {
+		g_message ("modify_share() end FAIL: error when removing old share");
+		return FALSE;
+	}
+
+	/* g_message ("modify_share() end: will call add_share() with the new share info"); */
+	return add_share (info, error);
+}
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+	static GQuark quark;
+
+	if (quark == 0)
+		quark = g_quark_from_string ("caja-share-error-quark"); /* not from_static_string since we are a module */
+
+	return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+	g_assert (info != NULL);
+
+	g_free (info->path);
+	g_free (info->share_name);
+	g_free (info->comment);
+	g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+	g_assert (ret_is_shared != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_is_shared = FALSE;
+		return FALSE;
+	}
+
+	*ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared.  You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path:  its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (path != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_path (path);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+	g_assert (share_name != NULL);
+	g_assert (ret_exists != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_exists = FALSE;
+		return FALSE;
+	}
+
+	*ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+	return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name.  You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+	ShareInfo *info;
+
+	g_assert (share_name != NULL);
+	g_assert (ret_share_info != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_share_info = NULL;
+		return FALSE;
+	}
+
+	info = lookup_share_by_share_name (share_name);
+	*ret_share_info = copy_share_info (info);
+
+	return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares.  To add a share, pass %NULL for @old_path,
+ * and a non-null @info.  To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path.  To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise.  If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+	g_assert ((old_path == NULL && info != NULL)
+		  || (old_path != NULL && info == NULL)
+		  || (old_path != NULL && info != NULL));
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error))
+		return FALSE;
+
+	if (old_path == NULL)
+		return add_share (info, error);
+	else if (info == NULL)
+		return remove_share (old_path, error);
+	else
+		return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+	ShareInfo *info;
+	ShareInfo *copy;
+	GSList **list;
+
+	info = value;
+	list = data;
+
+	copy = copy_share_info (info);
+	*list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures.  Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise.  If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+	g_assert (ret_info_list != NULL);
+	g_assert (error == NULL || *error == NULL);
+
+	if (!refresh_if_needed (error)) {
+		*ret_info_list = NULL;
+		return FALSE;
+	}
+
+	*ret_info_list = NULL;
+	g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+	return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+	GSList *l;
+
+	for (l = list; l; l = l->next) {
+		shares_free_share_info (l->data);
+	}
+
+	g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+		  gboolean error_on_add,
+		  gboolean error_on_modify,
+		  gboolean error_on_remove)
+{
+	throw_error_on_refresh = error_on_refresh;
+	throw_error_on_add = error_on_add;
+	throw_error_on_modify = error_on_modify;
+	throw_error_on_remove = error_on_remove;
+}
+
+
+
+ + + diff --git a/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/index.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/index.html new file mode 100644 index 0000000..467e899 --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/index.html @@ -0,0 +1,148 @@ + + + + + + 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
208nullPointerRedundantCheck476warningEither the condition 'uri!=NULL' is redundant or there is possible null pointer dereference: uri.
210nullPointerArithmeticRedundantCheck682warningEither the condition 'u!=NULL' is redundant or there is pointer arithmetic with NULL pointer.
320variableScope398styleThe scope of the variable 'ditem' can be reduced.
sendto/caja-nste.c
40variableScope398styleThe scope of the variable 'uri' can be reduced.
sendto/caja-sendto-command.c
401variableScope398styleThe scope of the variable 'w' can be reduced.
422variableScope398styleThe scope of the variable 'pixbuf' can be reduced.
629variableScope398styleThe 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
134variableScope398styleThe scope of the variable 'fenum' can be reduced.
135variableScope398styleThe scope of the variable 'file_info' can be reduced.
136variableScope398styleThe scope of the variable 'child' can be reduced.
sendto/plugins/gajim/gajim.c
56variableScope398styleThe scope of the variable 'existing_contact' can be reduced.
62variableScope398styleThe scope of the variable 'jid' can be reduced.
200variableScope398styleThe 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
233shadowVariable398styleLocal variable 'accounts' shadows outer variable
242shadowVariable398styleLocal variable 'i' shadows outer variable
376variableScope398styleThe scope of the variable 'file' can be reduced.
377variableScope398styleThe scope of the variable 'file_path' can be reduced.
share/caja-share.c
738duplicateCondition398styleThe if condition is the same as the previous if condition
share/shares.c
392constArgument570styleArgument 'path!=NULL' to function g_assert is always 1
wallpaper/caja-wallpaper-extension.c
86variableScope398styleThe scope of the variable 'item' can be reduced.
+
+ + + diff --git a/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/stats.html b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/stats.html new file mode 100644 index 0000000..bf7d631 --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/stats.html @@ -0,0 +1,101 @@ + + + + + + Cppcheck - HTML report - caja-extensions + + + + + + + +
+

Top 10 files for warning severity, total findings: 2
+   2  open-terminal/caja-open-terminal.c
+

+

Top 10 files for style severity, total findings: 30
+   7  sendto/plugins/gajim/gajim.c
+   4  sendto/plugins/pidgin/pidgin.c
+   4  sendto/caja-sendto-resources.c
+   4  image-converter/caja-image-converter-resources.c
+   3  sendto/plugins/caja-burn/caja-burn.c
+   3  sendto/caja-sendto-command.c
+   1  wallpaper/caja-wallpaper-extension.c
+   1  share/shares.c
+   1  share/caja-share.c
+   1  sendto/caja-nste.c
+

+ +
+ + + diff --git a/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/style.css b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/style.css new file mode 100644 index 0000000..c39571c --- /dev/null +++ b/2020-06-26-232334-2631-cppcheck@a92e7aa4e086_master/style.css @@ -0,0 +1,149 @@ + +body { + font: 13px Arial, Verdana, Sans-Serif; + margin: 0; + width: auto; +} + +h1 { + margin: 10px; +} + +#footer > p { + margin: 4px; +} + +.error { + background-color: #ffb7b7; +} + +.error2 { + background-color: #faa; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +.inconclusive { + background-color: #B6B6B4; +} + +.inconclusive2 { + background-color: #B6B6B4; + border: 1px dotted black; + display: inline-block; + margin-left: 4px; +} + +div.verbose { + display: inline-block; + vertical-align: top; + cursor: help; +} + +div.verbose div.content { + display: none; + position: absolute; + padding: 10px; + margin: 4px; + max-width: 40%; + white-space: pre-wrap; + border: 1px solid black; + background-color: #FFFFCC; + cursor: auto; +} + +.highlight .hll { + padding: 1px; +} + +#header { + border-bottom: thin solid #aaa; +} + +#menu { + float: left; + margin-top: 5px; + text-align: left; + width: 150px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu_index { + float: left; + margin-top: 5px; + padding-left: 5px; + text-align: left; + width: 300px; + /*height: 75%;*/ + position: fixed; + overflow: auto; + z-index: 1; +} + +#menu > a { + display: block; + margin-left: 10px; + font: 12px; + z-index: 1; +} + +#filename { + margin-left: 10px; + font: 12px; + z-index: 1; +} + +.highlighttable { + background-color:white; + z-index: 10; + position: relative; + margin: -10 px; +} + +#content { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 150px; +} + +#content_index { + background-color: white; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + float: left; + margin: 5px; + margin-left: 10px; + padding: 0 10px 10px 10px; + width: 80%; + padding-left: 300px; +} + +.linenos { + border-right: thin solid #aaa; + color: lightgray; + padding-right: 6px; +} + +#footer { + border-top: thin solid #aaa; + clear: both; + font-size: 90%; + margin-top: 5px; +} + +#footer ul { + list-style-type: none; + padding-left: 0; +} 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..5132dbe --- /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: a92e7aa4e086c7af2b866af1eb09527b5599365e
+Compare: 274d435c1798...a92e7aa4e086
+Branch: master
+Time: 2020-06-26 23:23:34+00:00
+Messages:
+
+Travis CI: enable irc notifications with tagged commits
+
+
+ + + -- cgit v1.2.1