summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Michael Brummer <jan.brummer@tabos.org>2023-03-04 17:13:33 +0100
committerJan-Michael Brummer <jan.brummer@tabos.org>2023-03-27 16:31:58 +0200
commitab0b3357580ae01a0ec313f45ff174502a777856 (patch)
tree7ef69b2b05aeb117f33d6c3ee0414083a8c01bfc
parent0c23d7d71102b23ac9fcc98d8933a7b8756dc30d (diff)
downloadlibproxy-git-ab0b3357580ae01a0ec313f45ff174502a777856.tar.gz
Make use of G_DEFINE_BOXED_TYPE (#60)
-rw-r--r--.github/workflows/build.yml9
-rw-r--r--.github/workflows/coverity.yml3
-rw-r--r--docs/libproxy.svg562
-rw-r--r--docs/meson.build4
-rw-r--r--docs/px.toml.in12
-rw-r--r--meson.build9
-rw-r--r--meson_options.txt7
-rw-r--r--src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c1
-rw-r--r--src/backend/px-manager.c4
-rw-r--r--src/libproxy/meson.build37
-rw-r--r--src/libproxy/proxy-dbus.c109
-rw-r--r--src/libproxy/proxy.c25
-rw-r--r--src/libproxy/proxy.h91
-rw-r--r--tests/config-env-test.c1
-rw-r--r--tests/config-gnome-test.c1
-rw-r--r--tests/config-kde-test.c1
-rw-r--r--tests/config-sysconfig-test.c2
-rw-r--r--tests/px-manager-test.c2
18 files changed, 188 insertions, 692 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 13eaddd..9943727 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,7 +20,8 @@ jobs:
gi-docgen \
libpeas-dev \
gsettings-desktop-schemas-dev \
- libcurl4-openssl-dev
+ libcurl4-openssl-dev \
+ valac
- name: Build setup
run: meson setup build -Db_coverage=true -Ddbus=disabled
- name: Build
@@ -74,7 +75,8 @@ jobs:
gi-docgen \
libpeas-dev \
gsettings-desktop-schemas-dev \
- libcurl4-openssl-dev
+ libcurl4-openssl-dev \
+ valac
- name: Build setup
run: meson setup build -Db_coverage=true -Ddbus=enabled
- name: Build
@@ -94,7 +96,7 @@ jobs:
- name: Setup
run: |
pip install meson ninja
- brew install libsoup icu4c gobject-introspection duktape gcovr gi-docgen libpeas curl
+ brew install libsoup icu4c gobject-introspection duktape gcovr gi-docgen libpeas curl vala
echo 'PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/opt/gi-docgen/lib/pkgconfig' >> $GITHUB_ENV
- name: Build and Test
run: |
@@ -127,6 +129,7 @@ jobs:
mingw-w64-x86_64-libsoup3
mingw-w64-x86_64-libpeas
mingw-w64-x86_64-curl
+ mingw-w64-x86_64-vala
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml
index 20ba216..a87d066 100644
--- a/.github/workflows/coverity.yml
+++ b/.github/workflows/coverity.yml
@@ -38,6 +38,7 @@ jobs:
gi-docgen \
libpeas-dev \
gsettings-desktop-schemas-dev \
- libcurl4-openssl-dev
+ libcurl4-openssl-dev \
+ valac
- name: Build & upload the results
run: .github/coverity.sh
diff --git a/docs/libproxy.svg b/docs/libproxy.svg
index 414d9d9..70d3793 100644
--- a/docs/libproxy.svg
+++ b/docs/libproxy.svg
@@ -1,561 +1 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="200"
- height="200"
- id="svg3440">
- <defs
- id="defs3">
- <linearGradient
- id="linearGradient3101">
- <stop
- style="stop-color:#000000;stop-opacity:1"
- offset="0"
- id="stop3103" />
- <stop
- style="stop-color:#000000;stop-opacity:0"
- offset="1"
- id="stop3105" />
- </linearGradient>
- <radialGradient
- cx="17.3125"
- cy="25.53125"
- r="9.6875"
- fx="17.3125"
- fy="25.53125"
- id="radialGradient2582"
- xlink:href="#linearGradient3101"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,0.351613,87.386725,-30.171202)" />
- <linearGradient
- x1="54.509937"
- y1="41.179295"
- x2="9.5471001"
- y2="16.248501"
- id="edgeGradient"
- xlink:href="#fieldGradient"
- gradientUnits="userSpaceOnUse">
- <stop
- style="stop-color:#f98433;stop-opacity:1"
- offset="0"
- id="stop12" />
- <stop
- style="stop-color:#e37b00;stop-opacity:1"
- offset="1"
- id="stop14" />
- </linearGradient>
- <linearGradient
- x1="54.509937"
- y1="41.179295"
- x2="9.5471001"
- y2="16.248501"
- id="linearGradient2580"
- xlink:href="#edgeGradient"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- x1="52.778114"
- y1="-13.238551"
- x2="22.0144"
- y2="51.987099"
- id="fieldGradient"
- gradientUnits="userSpaceOnUse">
- <stop
- style="stop-color:#ffe1b8;stop-opacity:1"
- offset="0"
- id="stop7" />
- <stop
- style="stop-color:#ff8b00;stop-opacity:1"
- offset="1"
- id="stop9" />
- </linearGradient>
- <linearGradient
- x1="52.778114"
- y1="-13.238551"
- x2="22.0144"
- y2="51.987099"
- id="linearGradient2578"
- xlink:href="#fieldGradient"
- gradientUnits="userSpaceOnUse" />
- <radialGradient
- id="shadowGradient">
- <stop
- style="stop-color:#c0c0c0;stop-opacity:1"
- offset="0"
- id="stop17" />
- <stop
- style="stop-color:#c0c0c0;stop-opacity:1"
- offset="0.88"
- id="stop19" />
- <stop
- style="stop-color:#c0c0c0;stop-opacity:0"
- offset="1"
- id="stop21" />
- </radialGradient>
- <radialGradient
- cx="32.5"
- cy="29.5"
- r="26.5"
- fx="32.5"
- fy="29.5"
- id="radialGradient2576"
- xlink:href="#shadowGradient"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- id="linearGradient6001">
- <stop
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0"
- id="stop6003" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0"
- offset="1"
- id="stop6005" />
- </linearGradient>
- <linearGradient
- id="linearGradient4825">
- <stop
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0"
- id="stop4827" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0"
- offset="1"
- id="stop4829" />
- </linearGradient>
- <linearGradient
- id="linearGradient4126">
- <stop
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0"
- id="stop4128" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0.16494845"
- offset="1"
- id="stop4130" />
- </linearGradient>
- <linearGradient
- id="linearGradient4114">
- <stop
- style="stop-color:#000000;stop-opacity:1"
- offset="0"
- id="stop4116" />
- <stop
- style="stop-color:#000000;stop-opacity:0"
- offset="1"
- id="stop4118" />
- </linearGradient>
- <linearGradient
- id="linearGradient3962">
- <stop
- style="stop-color:#d3e9ff;stop-opacity:1"
- offset="0"
- id="stop3964" />
- <stop
- style="stop-color:#d3e9ff;stop-opacity:1"
- offset="0.15517241"
- id="stop4134" />
- <stop
- style="stop-color:#4074ae;stop-opacity:1"
- offset="0.75"
- id="stop4346" />
- <stop
- style="stop-color:#36486c;stop-opacity:1"
- offset="1"
- id="stop3966" />
- </linearGradient>
- <radialGradient
- cx="18.247644"
- cy="15.716079"
- r="29.993349"
- fx="18.247644"
- fy="15.716079"
- id="radialGradient3968"
- xlink:href="#linearGradient3962"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(4.3587763,0,0,4.2301914,-9.2955092,-11.580932)" />
- <radialGradient
- cx="15.115514"
- cy="63.965389"
- r="12.289036"
- fx="15.115514"
- fy="63.965389"
- id="radialGradient4120"
- xlink:href="#linearGradient4114"
- gradientUnits="userSpaceOnUse"
- gradientTransform="scale(1.64399,0.608276)" />
- <radialGradient
- cx="15.601279"
- cy="12.142302"
- r="43.526714"
- fx="15.601279"
- fy="12.142302"
- id="radialGradient4132"
- xlink:href="#linearGradient4126"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(4.3587763,0,0,4.2301914,-9.2955092,-11.580932)" />
- <radialGradient
- cx="12.071323"
- cy="12.493138"
- r="6.7175145"
- fx="12.071323"
- fy="12.493138"
- id="radialGradient5983"
- xlink:href="#linearGradient4825"
- gradientUnits="userSpaceOnUse" />
- <radialGradient
- cx="12.071323"
- cy="12.493138"
- r="6.7175145"
- fx="12.071323"
- fy="12.493138"
- id="radialGradient5985"
- xlink:href="#linearGradient4825"
- gradientUnits="userSpaceOnUse" />
- <radialGradient
- cx="12.071323"
- cy="12.493138"
- r="6.7175145"
- fx="12.071323"
- fy="12.493138"
- id="radialGradient5987"
- xlink:href="#linearGradient4825"
- gradientUnits="userSpaceOnUse" />
- <radialGradient
- cx="12.071323"
- cy="12.493138"
- r="6.7175145"
- fx="12.071323"
- fy="12.493138"
- id="radialGradient5989"
- xlink:href="#linearGradient4825"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- x1="-25.176178"
- y1="30.057165"
- x2="-22.252472"
- y2="21.041553"
- id="linearGradient6007"
- xlink:href="#linearGradient6001"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- x1="-25.176178"
- y1="30.057165"
- x2="-22.113543"
- y2="22.661524"
- id="linearGradient6011"
- xlink:href="#linearGradient6001"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- x1="-22.822565"
- y1="28.337734"
- x2="-22.113543"
- y2="22.661524"
- id="linearGradient6015"
- xlink:href="#linearGradient6001"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- x1="-21.658581"
- y1="15.649428"
- x2="-21.962101"
- y2="21.336346"
- id="linearGradient6019"
- xlink:href="#linearGradient6001"
- gradientUnits="userSpaceOnUse" />
- </defs>
- <g
- id="layer1">
- <path
- d="M 45.052803 38.908627 A 20.203051 7.4751287 0 1 1 4.6467018,38.908627 A 20.203051 7.4751287 0 1 1 45.052803 38.908627 z"
- transform="matrix(4.3588252,0,0,5.2591026,-9.2955098,-55.034721)"
- style="fill:url(#radialGradient4120);fill-opacity:1;stroke:none;stroke-opacity:1"
- id="path4112" />
- <path
- d="M 182.31779,87.766138 C 182.31779,133.06981 144.47402,169.79595 97.798658,169.79595 C 51.119016,169.79595 13.277388,133.06939 13.277388,87.766138 C 13.277388,42.46455 51.119016,5.7421533 97.798658,5.7421533 C 144.47402,5.7421533 182.31779,42.46455 182.31779,87.766138 L 182.31779,87.766138 z "
- style="fill:url(#radialGradient3968);fill-opacity:1;fill-rule:nonzero;stroke:#39396c;stroke-width:4.29400349;stroke-miterlimit:4;stroke-opacity:1"
- id="path3214" />
- <g
- transform="matrix(4.2819833,0,0,4.155572,-8.7677477,-10.595673)"
- style="opacity:1;fill:#204a87;fill-opacity:0.71345029;fill-rule:nonzero;stroke:none;stroke-miterlimit:4"
- id="g4136">
- <g
- style="fill:#204a87"
- id="g4138">
- <g
- style="fill:#204a87"
- id="g4142">
- <path
- d="M 44.0713,20.7144 C 44.0713,20.9771 44.0713,20.7144 44.0713,20.7144 L 43.5264,21.3316 C 43.1924,20.938 42.8174,20.607 42.4366,20.2613 L 41.6007,20.3843 L 40.837,19.521 L 40.837,20.5894 L 41.4913,21.0845 L 41.9268,21.5777 L 42.5088,20.9195 C 42.6553,21.1939 42.7998,21.4683 42.9453,21.7427 L 42.9453,22.565 L 42.29,23.3052 L 41.0908,24.1284 L 40.1826,25.0347 L 39.6006,24.3745 L 39.8916,23.6343 L 39.3105,22.9761 L 38.3291,20.8784 L 37.4932,19.9331 L 37.2744,20.1792 L 37.6025,21.3726 L 38.2197,22.0718 C 38.5722,23.0894 38.9209,24.062 39.3838,25.0347 C 40.1016,25.0347 40.7783,24.9585 41.4912,24.8687 L 41.4912,25.4449 L 40.6191,27.5841 L 39.8193,28.4884 L 39.165,29.8888 C 39.165,30.6564 39.165,31.424 39.165,32.1915 L 39.3838,33.0978 L 39.0205,33.508 L 38.2197,34.0021 L 37.3838,34.7013 L 38.0752,35.4826 L 37.1299,36.3068 L 37.3115,36.84 L 35.8935,38.4455 L 34.9492,38.4455 L 34.1494,38.9396 L 33.6396,38.9396 L 33.6396,38.2814 L 33.4228,36.963 C 33.1415,36.1368 32.8486,35.3165 32.5507,34.4962 C 32.5507,33.8907 32.5868,33.2911 32.623,32.6857 L 32.9873,31.8634 L 32.4775,30.8751 L 32.5146,29.5177 L 31.8232,28.7364 L 32.1689,27.6055 L 31.6064,26.9673 L 30.624,26.9673 L 30.2969,26.5972 L 29.3155,27.2149 L 28.9161,26.7613 L 28.0069,27.543 C 27.3897,26.8433 26.7715,26.1441 26.1534,25.4449 L 25.4268,23.7164 L 26.0811,22.7301 L 25.7178,22.319 L 26.5166,20.4254 C 27.1729,19.609 27.8584,18.8258 28.5518,18.0397 L 29.7881,17.7106 L 31.169,17.5465 L 32.1143,17.7936 L 33.459,19.15 L 33.9317,18.6158 L 34.585,18.5338 L 35.8213,18.9449 L 36.7666,18.9449 L 37.4209,18.3687 L 37.7119,17.9576 L 37.0566,17.5465 L 35.9658,17.4645 C 35.6631,17.0446 35.3818,16.6032 35.0224,16.2301 L 34.6581,16.3942 L 34.5126,17.4645 L 33.8583,16.7243 L 33.7138,15.9001 L 32.9872,15.3259 L 32.6952,15.3259 L 33.4227,16.1482 L 33.1317,16.8884 L 32.5506,17.0525 L 32.9139,16.3123 L 32.2586,15.9842 L 31.6785,15.326 L 30.5867,15.5721 L 30.4422,15.9002 L 29.7879,16.3123 L 29.4246,17.2176 L 28.5164,17.6697 L 28.116,17.2176 L 27.6805,17.2176 L 27.6805,15.7362 L 28.6258,15.2421 L 29.3524,15.2421 L 29.2059,14.6669 L 28.6258,14.0907 L 29.6063,13.8846 L 30.1512,13.2684 L 30.5867,12.5272 L 31.3875,12.5272 L 31.1687,11.952 L 31.6785,11.6229 L 31.6785,12.2811 L 32.7683,12.5272 L 33.8581,11.6229 L 33.9313,11.2108 L 34.8756,10.5531 C 34.5338,10.5956 34.192,10.6268 33.858,10.7177 L 33.858,9.9766 L 34.2213,9.1538 L 33.858,9.1538 L 33.0596,9.894 L 32.8408,10.3056 L 33.0596,10.8823 L 32.6953,11.8686 L 32.1142,11.5395 L 31.6064,10.9643 L 30.8056,11.5395 L 30.5146,10.2236 L 31.8955,9.3188 L 31.8955,8.8247 L 32.7685,8.249 L 34.1494,7.9194 L 35.0947,8.249 L 36.8388,8.5781 L 36.4033,9.0713 L 35.458,9.0713 L 36.4033,10.0586 L 37.1299,9.2363 L 37.3506,8.8745 C 37.3506,8.8745 40.1377,11.3725 41.7305,14.105 C 43.3233,16.8384 44.0713,20.0601 44.0713,20.7144 z "
- style="fill:#204a87"
- id="path4144" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4146">
- <g
- style="fill:#204a87"
- id="g4150">
- <path
- d="M 26.0703,9.2363 L 25.9971,9.7295 L 26.5069,10.0586 L 27.378,9.4829 L 26.9425,8.9892 L 26.3605,9.3188 L 26.0705,9.2363"
- style="fill:#204a87"
- id="path4152" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4154">
- <g
- style="fill:#204a87"
- id="g4158">
- <path
- d="M 26.8701,5.8633 L 24.9795,5.1226 L 22.7998,5.3692 L 20.1094,6.1094 L 19.6006,6.6035 L 21.2725,7.7549 L 21.2725,8.4131 L 20.6182,9.0713 L 21.4912,10.8003 L 22.0713,10.4702 L 22.7998,9.3188 C 23.9228,8.9716 24.9297,8.5781 25.9971,8.0844 L 26.8701,5.8632"
- style="fill:#204a87"
- id="path4160" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4162">
- <g
- style="fill:#204a87"
- id="g4166">
- <path
- d="M 28.833,12.7749 L 28.542,12.0337 L 28.0322,12.1987 L 28.1787,13.103 L 28.833,12.7749"
- style="fill:#204a87"
- id="path4168" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4170">
- <g
- style="fill:#204a87"
- id="g4174">
- <path
- d="M 29.123,12.6089 L 28.9775,13.5972 L 29.7773,13.4322 L 30.3584,12.857 L 29.8496,12.3629 C 29.6787,11.9078 29.4824,11.483 29.2685,11.0465 L 28.833,11.0465 L 28.833,11.5397 L 29.123,11.8688 L 29.123,12.609"
- style="fill:#204a87"
- id="path4176" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4178">
- <g
- style="fill:#204a87"
- id="g4182">
- <path
- d="M 18.3652,28.2422 L 17.7832,27.0899 L 16.6929,26.8433 L 16.1114,25.2808 L 14.6578,25.4449 L 13.4224,24.5406 L 12.1133,25.692 L 12.1133,25.8736 C 11.7173,25.7593 11.2305,25.7437 10.8779,25.5269 L 10.5869,24.7046 L 10.5869,23.7993 L 9.7148,23.8813 C 9.7876,23.3051 9.8598,22.7299 9.9331,22.1538 L 9.4238,22.1538 L 8.9155,22.812 L 8.4062,23.0581 L 7.6791,22.6479 L 7.6063,21.7426 L 7.7518,20.7553 L 8.8426,19.933 L 9.7147,19.933 L 9.8597,19.4389 L 10.95,19.685 L 11.7498,20.6733 L 11.8953,19.0268 L 13.2766,17.8754 L 13.7854,16.641 L 14.803,16.2299 L 15.3845,15.4076 L 16.6926,15.1596 L 17.3474,14.1733 C 16.6931,14.1733 16.0388,14.1733 15.3845,14.1733 L 16.6203,13.5971 L 17.4919,13.5971 L 18.7282,13.185 L 18.8737,12.6928 L 18.4372,12.2807 L 17.9284,12.1157 L 18.0739,11.6225 L 17.7106,10.8823 L 16.838,11.2104 L 16.9835,10.5527 L 15.9659,9.9765 L 15.1666,11.3744 L 15.2389,11.8685 L 14.4396,12.1986 L 13.9303,13.2679 L 13.7125,12.2806 L 12.3312,11.7044 L 12.1129,10.9642 L 13.9303,9.8939 L 14.7301,9.1537 L 14.8029,8.2489 L 14.3669,8.0018 L 13.7854,7.9193 L 13.4221,8.8246 C 13.4221,8.8246 12.8142,8.9437 12.6579,8.9823 C 10.6618,10.8217 6.6286,14.7924 5.6916,22.2885 C 5.7287,22.4623 6.3708,23.4701 6.3708,23.4701 L 7.8972,24.3744 L 9.4236,24.7865 L 10.0784,25.6097 L 11.0955,26.3499 L 11.677,26.2679 L 12.113,26.4642 L 12.113,26.597 L 11.5319,28.16 L 11.0954,28.8182 L 11.2409,29.1483 L 10.8776,30.3807 L 12.1862,32.7674 L 13.4943,33.9197 L 14.0763,34.742 L 14.0031,36.4705 L 14.4396,37.4568 L 14.0031,39.3494 C 14.0031,39.3494 13.9689,39.3377 14.0246,39.5271 C 14.0808,39.7166 16.3537,40.9783 16.4982,40.8709 C 16.6422,40.7615 16.7653,40.6658 16.7653,40.6658 L 16.6203,40.2556 L 17.2014,39.6794 L 17.4197,39.1032 L 18.365,38.7731 L 19.0916,36.9626 L 18.8738,36.4704 L 19.3816,35.7302 L 20.4724,35.4822 L 21.0544,34.1658 L 20.9089,32.5213 L 21.781,31.2869 L 21.9265,30.0525 C 20.7331,29.4607 19.5495,28.8513 18.365,28.242"
- style="fill:#204a87"
- id="path4184" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4186">
- <g
- style="fill:#204a87"
- id="g4190">
- <path
- d="M 16.7656,9.5649 L 17.4922,10.0586 L 18.0742,10.0586 L 18.0742,9.4829 L 17.3476,9.1538 L 16.7656,9.5649"
- style="fill:#204a87"
- id="path4192" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4194">
- <g
- style="fill:#204a87"
- id="g4198">
- <path
- d="M 14.876,8.9072 L 14.5122,9.812 L 15.2393,9.812 L 15.6031,8.9892 C 15.9166,8.7675 16.2286,8.5444 16.5479,8.331 L 17.275,8.5781 C 17.7594,8.9072 18.2438,9.2363 18.7286,9.5649 L 19.4561,8.9072 L 18.6558,8.5781 L 18.292,7.8374 L 16.9111,7.6728 L 16.8383,7.2612 L 16.184,7.4262 L 15.8936,8.002 L 15.5298,7.2613 L 15.3848,7.5904 L 15.4576,8.4132 L 14.876,8.9072"
- style="fill:#204a87"
- id="path4200" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4202">
- <g
- style="opacity:0.75;fill:#204a87"
- id="g4204">
- <path
- d=""
- style="fill:#204a87"
- id="path4206" />
- </g>
- <g
- style="fill:#204a87"
- id="g4208">
- <path
- d=""
- style="fill:#204a87"
- id="path4210" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4212">
- <g
- style="opacity:0.75;fill:#204a87"
- id="g4214">
- <path
- d=""
- style="fill:#204a87"
- id="path4216" />
- </g>
- <g
- style="fill:#204a87"
- id="g4218">
- <path
- d=""
- style="fill:#204a87"
- id="path4220" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4222">
- <g
- style="fill:#204a87"
- id="g4226">
- <path
- d="M 17.4922,6.8496 L 17.856,6.521 L 18.5831,6.3564 C 19.0811,6.1142 19.5811,5.9511 20.1095,5.7802 L 19.8195,5.2865 L 18.881,5.4213 L 18.4376,5.8632 L 17.7066,5.9692 L 17.0567,6.2744 L 16.7408,6.4272 L 16.5479,6.6855 L 17.4922,6.8496"
- style="fill:#204a87"
- id="path4228" />
- </g>
- </g>
- <g
- style="fill:#204a87"
- id="g4230">
- <g
- style="fill:#204a87"
- id="g4234">
- <path
- d="M 18.7285,14.6665 L 19.165,14.0083 L 18.5102,13.5151 L 18.7285,14.6665"
- style="fill:#204a87"
- id="path4236" />
- </g>
- </g>
- </g>
- <path
- d="M 178.02539,87.766286 C 178.02539,130.76917 142.10355,165.63017 97.79861,165.63017 C 53.489604,165.63017 17.569784,130.76878 17.569784,87.766286 C 17.569784,44.765365 53.489604,9.9079254 97.79861,9.9079254 C 142.10355,9.9079254 178.02539,44.765365 178.02539,87.766286 L 178.02539,87.766286 z "
- style="opacity:0.39560439;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient4132);stroke-width:4.29400349;stroke-miterlimit:4;stroke-opacity:1"
- id="path4122" />
- <path
- d="M -2.8284283 21.041553 A 15.733126 9.4575529 0 1 1 -34.29468,21.041553 A 15.733126 9.4575529 0 1 1 -2.8284283 21.041553 z"
- transform="matrix(4.9299793,2.5934893,-2.0772237,3.7189068,226.47586,56.288997)"
- style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6007);stroke-width:0.88164198;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path5991" />
- <path
- d="M -2.8284283 21.041553 A 15.733126 9.4575529 0 1 1 -34.29468,21.041553 A 15.733126 9.4575529 0 1 1 -2.8284283 21.041553 z"
- transform="matrix(4.0943576,-3.7186613,2.9784153,3.08856,131.55582,-30.411683)"
- style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6011);stroke-width:0.88164198;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path6009" />
- <g
- transform="matrix(-4.5583368,3.2455832,3.3443127,4.4237675,145.95063,-105.25311)"
- id="g4933">
- <path
- d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
- transform="translate(14.95026,22.93047)"
- style="opacity:1;color:#000000;fill:url(#radialGradient5987);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path4935" />
- <path
- d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
- transform="matrix(0.308271,0,0,0.308271,23.30035,31.57234)"
- style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path4937" />
- </g>
- <path
- d="M -2.8284283 21.041553 A 15.733126 9.4575529 0 1 1 -34.29468,21.041553 A 15.733126 9.4575529 0 1 1 -2.8284283 21.041553 z"
- transform="matrix(-5.5806729,-0.5336709,0.4274361,-4.2097558,-19.779028,159.84091)"
- style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6015);stroke-width:0.88164198;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path6013" />
- <path
- d="M -2.8284283 21.041553 A 15.733126 9.4575529 0 1 1 -34.29468,21.041553 A 15.733126 9.4575529 0 1 1 -2.8284283 21.041553 z"
- transform="matrix(4.0008518,-3.633623,2.9103916,3.0179253,111.15263,-40.807299)"
- style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6019);stroke-width:0.90226138;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path6017" />
- <g
- transform="matrix(-3.5144155,2.5022999,2.5784194,3.4106648,44.691323,-87.847109)"
- id="g5075">
- <path
- d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
- transform="translate(14.95026,22.93047)"
- style="opacity:1;color:#000000;fill:url(#radialGradient5983);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path5077" />
- <path
- d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
- transform="matrix(0.308271,0,0,0.308271,23.30035,31.57234)"
- style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path5079" />
- </g>
- <g
- transform="matrix(-3.5144155,2.5022999,2.5784194,3.4106648,49.544701,-144.83145)"
- id="g4945">
- <path
- d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
- transform="translate(14.95026,22.93047)"
- style="opacity:1;color:#000000;fill:url(#radialGradient5985);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path4947" />
- <path
- d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
- transform="matrix(0.308271,0,0,0.308271,23.30035,31.57234)"
- style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path4949" />
- </g>
- <g
- transform="matrix(-3.793167,2.7012522,2.7829267,3.681838,100.5688,-160.95913)"
- style="opacity:1"
- id="g4939">
- <path
- d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
- transform="translate(14.95026,22.93047)"
- style="opacity:1;color:#000000;fill:url(#radialGradient5989);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path4941" />
- <path
- d="M 18.788838 12.493138 A 6.7175145 6.7175145 0 1 1 5.3538089,12.493138 A 6.7175145 6.7175145 0 1 1 18.788838 12.493138 z"
- transform="matrix(0.308271,0,0,0.308271,23.30035,31.57234)"
- style="opacity:1;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path4943" />
- </g>
- <g
- transform="matrix(1.5343992,0,0,1.4891012,-30.406163,159.06366)"
- id="g2568">
- <circle
- cx="32.5"
- cy="29.5"
- r="26.5"
- transform="matrix(1.0648,0,0,1.064822,85.286725,-45.638932)"
- style="fill:url(#radialGradient2576);stroke:none"
- id="circle2507" />
- <circle
- cx="31"
- cy="31"
- r="25.799999"
- transform="translate(87.386725,-46.725332)"
- style="fill:url(#linearGradient2578);fill-opacity:1;stroke:url(#linearGradient2580);stroke-width:2"
- id="circle2509" />
- <path
- d="M 139.5398,1.649199 C 139.5398,5.669807 130.2701,8.929153 118.83535,8.929153 C 107.40059,8.929153 98.130893,5.669807 98.130893,1.649199 C 98.130893,-2.371408 107.40059,-5.630755 118.83535,-5.630755 C 130.2701,-5.630755 139.5398,-2.371408 139.5398,1.649199 z "
- style="opacity:0.40909089;color:#000000;fill:url(#radialGradient2582);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.10533953;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path2511" />
- <g
- transform="matrix(1.493666,0,0,1.493666,-58.658424,-4.4819926)"
- id="g2561">
- <path
- d="M 118.95834,-1.3076619 L 118.01148,-1.3076619 C 117.30351,-6.193883 116.23136,-11.061489 115.66924,-15.955634 C 115.66347,-17.613088 116.34723,-18.254019 118.50982,-18.245924 C 120.64304,-18.237939 121.30685,-17.565968 121.30057,-15.757911 C 120.71714,-10.932694 119.77837,-6.1193846 118.95834,-1.3076619 z "
- style="font-size:32px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
- id="text6373" />
- <path
- d="M 120.09165,1.8173746 C 120.09165,2.7468724 119.37928,3.5003791 118.50052,3.5003791 C 117.62176,3.5003791 116.90939,2.7468724 116.90939,1.8173746 C 116.90939,0.88787634 117.62176,0.1343702 118.50052,0.1343702 C 119.37928,0.1343702 120.09165,0.88787634 120.09165,1.8173746 L 120.09165,1.8173746 z "
- style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"
- id="path6380" />
- </g>
- </g>
- </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#2a488c"><path d="M4.96 8.635V11H1.367c-.206 0-.368.205-.368.467v1.058c0 .262.162.467.368.467h10.264c.206 0 .368-.205.368-.467v-1.058c0-.262-.162-.467-.368-.467H7.977V8.635z"/><path d="M3.8 0C2.849 0 2 .793 2 1.746v6.613c0 .953.849 1.746 1.868 1.746h5.264c1.02 0 1.868-.793 1.868-1.746V1.746C11 .793 10.151 0 9.132 0zM4 2h5c0 .317 0-.316 0 0v6H4s0 .044 0 0V2c0-.044 0 0 0 0z" style="line-height:normal;-inkscape-font-specification:'Bitstream Vera Sans';text-indent:0;text-align:start;text-decoration-line:none;text-transform:none;marker:none" color="#fff" font-weight="400" font-family="Bitstream Vera Sans" overflow="visible"/><path d="M5 2.971h3v1.003H5zm2 2.005h1v1.002H7z" style="marker:none" color="#fff" overflow="visible"/><path d="M9.229 3c.07 0 0 .209 0 .476v1.078c0 .267.07.476.16.476h4.451c.09 0 .16-.209.16-.476V3.476c0-.267-.07-.476-.16-.476-.16 0-4.585.063-4.611 0zm-3.256 8.624c.08-.06.253.039.394.223l.573.747c.142.184.191.375.112.435l-3.935 2.954c-.08.059-.253-.039-.395-.224l-.573-.746c-.141-.184-.19-.376-.111-.435 0 0 3.946-2.893 3.935-2.954z"/><path d="M7.027 11.624c-.08-.06-.253.039-.394.223l-.573.747c-.142.184-.191.375-.112.435l3.935 2.954c.08.059.253-.039.395-.224l.573-.746c.141-.184.19-.376.111-.435 0 0-3.946-2.893-3.935-2.954z"/></g></svg> \ No newline at end of file
diff --git a/docs/meson.build b/docs/meson.build
index 3981133..868743d 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -18,7 +18,7 @@ gidocgen = find_program('gi-docgen')
docs_dir = datadir / 'doc'
custom_target('px-doc',
- input: [ px_toml, px_backend_gir[0] ],
+ input: [ px_toml, libproxy_gir[0] ],
output: 'libproxy-@0@'.format(apiversion),
command: [
gidocgen,
@@ -31,7 +31,7 @@ custom_target('px-doc',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
- depend_files: [ expand_content_md_files ],
+ #depend_files: [ expand_content_md_files ],
build_by_default: true,
install: true,
install_dir: docs_dir,
diff --git a/docs/px.toml.in b/docs/px.toml.in
index 6d495f2..356bedf 100644
--- a/docs/px.toml.in
+++ b/docs/px.toml.in
@@ -8,15 +8,21 @@ repository_url = "https://github.com/janbrummer/libproxy2"
website_url = "https://janbrummer.github.io/libproxy2/"
logo_url = "libproxy.svg"
dependencies = [
- "GObject-2.0",
+ "Gio-2.0",
]
devhelp = true
search_index = true
+
+[dependencies."Gio-2.0"]
+name = "Gio"
+description = "The base type system library"
+docs_url = "https://developer.gnome.org/gio/stable"
+
[theme]
name = "basic"
-show_index_summary = true
-show_class_hierarchy = true
+show_index_summary = false
+show_class_hierarchy = false
[source-location]
# The base URL for the web UI
diff --git a/meson.build b/meson.build
index 925acbd..baf668e 100644
--- a/meson.build
+++ b/meson.build
@@ -11,6 +11,9 @@ root_dir = include_directories('.')
px_prefix = get_option('prefix')
px_libdir = join_paths(px_prefix, get_option('libdir'))
px_plugins_dir = join_paths(px_libdir, meson.project_name().to_lower(), 'plugins')
+girdir = get_option('datadir') / 'gir-1.0'
+typelibdir = get_option('libdir') / 'girepository-1.0'
+vapidir = get_option('datadir') / 'vala' / 'vapi'
config_h = configuration_data()
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
@@ -21,7 +24,9 @@ add_project_arguments(['-I' + meson.project_build_root()], language: 'c')
version_arr = meson.project_version().split('-')[0].split('.')
libproxy_version_major = version_arr[0].to_int()
libproxy_version_minor = version_arr[1].to_int()
+
apiversion = '1.0'
+package_api_name = '@0@-@1@'.format(meson.project_name(), apiversion)
libproxy_prefix = get_option('prefix')
datadir = get_option('datadir')
@@ -127,6 +132,10 @@ summary({
'C Compiler' : cc.get_id(),
}, section: 'Build environment')
+summary({
+ 'Vapi' : get_option('vapi'),
+}, section: 'Options')
+
# Install pre-commit hook
hook = run_command(join_paths(meson.project_source_root(), 'data/install-git-hook.sh'), check: false)
if hook.returncode() == 0
diff --git a/meson_options.txt b/meson_options.txt
index 8e703d7..4a212d8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -66,4 +66,11 @@ option(
type: 'boolean',
value: true,
description: 'Whether to build plugin for PAC Runner Duktape'
+)
+
+option(
+ 'vapi',
+ type: 'boolean',
+ value: true,
+ description: 'Whether to build vapi support'
) \ No newline at end of file
diff --git a/src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c b/src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c
index 5196740..5818156 100644
--- a/src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c
+++ b/src/backend/plugins/pacrunner-duktape/pacrunner-duktape.c
@@ -27,7 +27,6 @@
#else
#include <netdb.h>
#endif
-#include <glib-object.h>
#include "pacrunner-duktape.h"
#include "pacutils.h"
diff --git a/src/backend/px-manager.c b/src/backend/px-manager.c
index 223cf88..0eabf1b 100644
--- a/src/backend/px-manager.c
+++ b/src/backend/px-manager.c
@@ -338,7 +338,7 @@ get_config (PeasExtensionSet *set,
*
* Get raw proxy configuration for gien @uri.
*
- * Returns: (nullable): a newly created `GStrv` containing configuration data for @uri.
+ * Returns: (transfer full) (nullable): a newly created `GStrv` containing configuration data for @uri.
*/
char **
px_manager_get_configuration (PxManager *self,
@@ -499,7 +499,7 @@ px_manager_expand_pac (PxManager *self,
*
* Get proxies for giben @url.
*
- * Returns: (nullable): a newly created `GStrv` containing proxy related information.
+ * Returns: (transfer full) (nullable): a newly created `GStrv` containing proxy related information.
*/
char **
px_manager_get_proxies_sync (PxManager *self,
diff --git a/src/libproxy/meson.build b/src/libproxy/meson.build
index 0368e77..e088f0c 100644
--- a/src/libproxy/meson.build
+++ b/src/libproxy/meson.build
@@ -51,24 +51,45 @@ install_headers(libproxy_headers, subdir: 'libproxy')
pkg = import('pkgconfig')
pkg.generate(
- description: 'A shared library for libproxy',
- libraries: libproxy_lib,
- name: 'libproxy',
- filebase: 'libproxy-' + api_version,
- version: meson.project_version(),
+ libraries: [libproxy_lib],
subdirs: 'libproxy',
+ version: meson.project_version(),
+ name: 'libproxy',
+ filebase: package_api_name,
+ description: 'libproxy',
requires: 'gio-2.0',
install_dir: join_paths(get_option('libdir'), 'pkgconfig')
)
gnome = import('gnome')
+
+libproxy_gir_extra_args = [
+ '--c-include=proxy.h',
+ '--quiet',
+]
+
libproxy_gir = gnome.generate_gir(
libproxy_lib,
sources: libproxy_headers + libproxy_sources,
nsversion: api_version,
- namespace: 'Libproxy',
- symbol_prefix: 'libproxy',
- identifier_prefix: 'Libproxy',
+ namespace: 'Px',
+ export_packages: package_api_name,
+ symbol_prefix: 'px',
+ identifier_prefix: 'px',
+ link_with: libproxy_lib,
includes: [ 'Gio-2.0' ],
install: true,
+ install_dir_gir: girdir,
+ install_dir_typelib: typelibdir,
+ extra_args: libproxy_gir_extra_args,
)
+
+if get_option('vapi')
+ libproxy_vapi = gnome.generate_vapi(package_api_name,
+ sources: libproxy_gir[0],
+ packages: [ 'gio-2.0' ],
+ install: true,
+ install_dir: vapidir,
+ metadata_dirs: [ meson.current_source_dir() ],
+ )
+endif
diff --git a/src/libproxy/proxy-dbus.c b/src/libproxy/proxy-dbus.c
index 8646ed5..f83e65e 100644
--- a/src/libproxy/proxy-dbus.c
+++ b/src/libproxy/proxy-dbus.c
@@ -23,27 +23,45 @@
#include "proxy.h"
+struct _pxProxyFactory {
+ GDBusProxy *proxy;
+ GCancellable *cancellable;
+};
+
/**
* SECTION:px-proxy
* @short_description: A convient helper for using proxy servers
*/
-struct px_proxy_factory {
- GDBusProxy *proxy;
- GCancellable *cancellable;
-};
+pxProxyFactory *px_proxy_factory_copy (pxProxyFactory *self);
+
+G_DEFINE_BOXED_TYPE (pxProxyFactory,
+ px_proxy_factory,
+ (GBoxedCopyFunc)px_proxy_factory_copy,
+ (GFreeFunc)px_proxy_factory_new);
+
+
+pxProxyFactory *
+px_proxy_factory_copy (pxProxyFactory *self)
+{
+ return g_slice_dup (pxProxyFactory, self);
+}
/**
* px_proxy_factory_new:
- * Creates a new proxy factory.
*
- * Returns: pointer to #px_proxy_factory
+ * Creates a new #pxProxyFactory instance. This instance should be kept
+ * around as long as possible as it contains cached data to increase
+ * performance. Memory usage should be minimal (cache is small) and the
+ * cache lifespan is handled automatically.
+ *
+ * Returns: (transfer full): A new #pxProxyFactory instance or %NULL on error
*/
-struct px_proxy_factory *
+pxProxyFactory *
px_proxy_factory_new (void)
{
g_autoptr (GError) error = NULL;
- struct px_proxy_factory *self = g_malloc0 (sizeof (struct px_proxy_factory));
+ pxProxyFactory *self = g_slice_new0 (pxProxyFactory);
self->cancellable = g_cancellable_new ();
self->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
@@ -60,9 +78,65 @@ px_proxy_factory_new (void)
return self;
}
+/**
+ * px_proxy_factory_get_proxies:
+ * @self: a #pxProxyFactory
+ * @url: Get proxxies for specificed URL
+ *
+ * Get which proxies to use for the specified URL.
+ *
+ * A NULL-terminated array of proxy strings is returned.
+ * If the first proxy fails, the second should be tried, etc...
+ * Don't forget to free the strings/array when you are done.
+ * If an unrecoverable error occurs, this function returns NULL.
+ *
+ * Regarding performance: this method always blocks and may be called
+ * in a separate thread (is thread-safe). In most cases, the time
+ * required to complete this function call is simply the time required
+ * to read the configuration (i.e. from gconf, kconfig, etc).
+ *
+ * In the case of PAC, if no valid PAC is found in the cache (i.e.
+ * configuration has changed, cache is invalid, etc), the PAC file is
+ * downloaded and inserted into the cache. This is the most expensive
+ * operation as the PAC is retrieved over the network. Once a PAC exists
+ * in the cache, it is merely a javascript invocation to evaluate the PAC.
+ * One should note that DNS can be called from within a PAC during
+ * javascript invocation.
+ *
+ * In the case of WPAD, WPAD is used to automatically locate a PAC on the
+ * network. Currently, we only use DNS for this, but other methods may
+ * be implemented in the future. Once the PAC is located, normal PAC
+ * performance (described above) applies.
+ *
+ * The format of the returned proxy strings are as follows:
+ * - http://[username:password@]proxy:port
+ * - socks://[username:password@]proxy:port
+ * - socks5://[username:password@]proxy:port
+ * - socks4://[username:password@]proxy:port
+ * - <procotol>://[username:password@]proxy:port
+ * - direct://
+ * Please note that the username and password in the above URLs are optional
+ * and should be use to authenticate the connection if present.
+ *
+ * For SOCKS proxies, when the protocol version is specified (socks4:// or
+ * socks5://), it is expected that only this version is used. When only
+ * socks:// is set, the client MUST try SOCKS version 5 protocol and, on
+ * connection failure, fallback to SOCKS version 4.
+ *
+ * Other proxying protocols may exist. It is expected that the returned
+ * configuration scheme shall match the network service name of the
+ * proxy protocol or the service name of the protocol being proxied if the
+ * previous does not exist. As an example, on Mac OS X you can configure a
+ * RTSP streaming proxy. The expected returned configuration would be:
+ * - rtsp://[username:password@]proxy:port
+ *
+ * To free the returned value, call px_proxy_factory_free_proxies.
+ *
+ * Returns: (transfer full): a list of proxies
+ */
char **
-px_proxy_factory_get_proxies (struct px_proxy_factory *self,
- const char *url)
+px_proxy_factory_get_proxies (pxProxyFactory *self,
+ const char *url)
{
g_autoptr (GVariant) result = NULL;
g_autoptr (GError) error = NULL;
@@ -112,6 +186,15 @@ px_proxy_factory_get_proxies (struct px_proxy_factory *self,
return retval;
}
+/**
+ * px_proxy_factory_free_proxies
+ * @proxies: proxy array
+ *
+ * Frees the proxy array returned by #px_proxy_factory_get_proxies when no
+ * longer used.
+ *
+ * @since 0.4.16
+ */
void
px_proxy_factory_free_proxies (char **proxies)
{
@@ -120,12 +203,12 @@ px_proxy_factory_free_proxies (char **proxies)
/**
* px_proxy_factory_free:
- * @self: a px_proxy_factory
+ * @self: a #pxProxyFactory
*
- * Free px_proxy_factory
+ * Frees the pxProxyFactory instance when no longer used.
*/
void
-px_proxy_factory_free (struct px_proxy_factory *self)
+px_proxy_factory_free (pxProxyFactory *self)
{
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
diff --git a/src/libproxy/proxy.c b/src/libproxy/proxy.c
index eeb2308..2a73667 100644
--- a/src/libproxy/proxy.c
+++ b/src/libproxy/proxy.c
@@ -31,21 +31,28 @@
* Test 123
*/
-struct px_proxy_factory {
+struct _pxProxyFactory {
PxManager *manager;
GCancellable *cancellable;
};
+pxProxyFactory *px_proxy_factory_copy (pxProxyFactory *self);
+
+G_DEFINE_BOXED_TYPE (pxProxyFactory,
+ px_proxy_factory,
+ (GBoxedCopyFunc)px_proxy_factory_copy,
+ (GFreeFunc)px_proxy_factory_new);
+
/**
* px_proxy_factory_new:
* Creates a new proxy factory.
*
* Returns: pointer to #px_proxy_factory
*/
-struct px_proxy_factory *
+pxProxyFactory *
px_proxy_factory_new (void)
{
- struct px_proxy_factory *self = g_malloc0 (sizeof (struct px_proxy_factory));
+ pxProxyFactory *self = g_slice_new0 (pxProxyFactory);
self->cancellable = g_cancellable_new ();
self->manager = px_manager_new ();
@@ -53,9 +60,15 @@ px_proxy_factory_new (void)
return self;
}
+pxProxyFactory *
+px_proxy_factory_copy (pxProxyFactory *self)
+{
+ return g_slice_dup (pxProxyFactory, self);
+}
+
char **
-px_proxy_factory_get_proxies (struct px_proxy_factory *self,
- const char *url)
+px_proxy_factory_get_proxies (pxProxyFactory *self,
+ const char *url)
{
g_auto (GStrv) result = NULL;
g_autoptr (GError) error = NULL;
@@ -82,7 +95,7 @@ px_proxy_factory_free_proxies (char **proxies)
* Free px_proxy_factory
*/
void
-px_proxy_factory_free (struct px_proxy_factory *self)
+px_proxy_factory_free (pxProxyFactory *self)
{
g_cancellable_cancel (self->cancellable);
g_clear_object (&self->cancellable);
diff --git a/src/libproxy/proxy.h b/src/libproxy/proxy.h
index be35d3c..50f9944 100644
--- a/src/libproxy/proxy.h
+++ b/src/libproxy/proxy.h
@@ -26,96 +26,17 @@
extern "C" {
#endif
-typedef struct px_proxy_factory pxProxyFactory;
+#include <gio/gio.h>
+
+typedef struct _pxProxyFactory pxProxyFactory;
+
+#define PX_TYPE_PROXY_FACTORY (px_proxy_factory_get_type ())
-/**
- * px_proxy_factory_new:
- *
- * Creates a new pxProxyFactory instance. This instance should be kept
- * around as long as possible as it contains cached data to increase
- * performance. Memory usage should be minimal (cache is small) and the
- * cache lifespan is handled automatically.
- *
- * @return A new pxProxyFactory instance or NULL on error
- */
pxProxyFactory *px_proxy_factory_new (void);
+GType px_proxy_factory_get_type (void) G_GNUC_CONST;
-/**
- * px_proxy_factory_get_proxies:
- * @self: a #pxProxyFactpry
- * @url: Get proxxies for specificed URL
- *
- * Get which proxies to use for the specified URL.
- *
- * A NULL-terminated array of proxy strings is returned.
- * If the first proxy fails, the second should be tried, etc...
- * Don't forget to free the strings/array when you are done.
- * If an unrecoverable error occurs, this function returns NULL.
- *
- * Regarding performance: this method always blocks and may be called
- * in a separate thread (is thread-safe). In most cases, the time
- * required to complete this function call is simply the time required
- * to read the configuration (i.e. from gconf, kconfig, etc).
- *
- * In the case of PAC, if no valid PAC is found in the cache (i.e.
- * configuration has changed, cache is invalid, etc), the PAC file is
- * downloaded and inserted into the cache. This is the most expensive
- * operation as the PAC is retrieved over the network. Once a PAC exists
- * in the cache, it is merely a javascript invocation to evaluate the PAC.
- * One should note that DNS can be called from within a PAC during
- * javascript invocation.
- *
- * In the case of WPAD, WPAD is used to automatically locate a PAC on the
- * network. Currently, we only use DNS for this, but other methods may
- * be implemented in the future. Once the PAC is located, normal PAC
- * performance (described above) applies.
- *
- * The format of the returned proxy strings are as follows:
- * - http://[username:password@]proxy:port
- * - socks://[username:password@]proxy:port
- * - socks5://[username:password@]proxy:port
- * - socks4://[username:password@]proxy:port
- * - <procotol>://[username:password@]proxy:port
- * - direct://
- * Please note that the username and password in the above URLs are optional
- * and should be use to authenticate the connection if present.
- *
- * For SOCKS proxies, when the protocol version is specified (socks4:// or
- * socks5://), it is expected that only this version is used. When only
- * socks:// is set, the client MUST try SOCKS version 5 protocol and, on
- * connection failure, fallback to SOCKS version 4.
- *
- * Other proxying protocols may exist. It is expected that the returned
- * configuration scheme shall match the network service name of the
- * proxy protocol or the service name of the protocol being proxied if the
- * previous does not exist. As an example, on Mac OS X you can configure a
- * RTSP streaming proxy. The expected returned configuration would be:
- * - rtsp://[username:password@]proxy:port
- *
- * To free the returned value, call px_proxy_factory_free_proxies.
- *
- * @url The URL we are trying to reach
- * @return A NULL-terminated array of proxy strings to use
- */
char **px_proxy_factory_get_proxies (pxProxyFactory *self, const char *url);
-
-/**
- * px_proxy_factory_free_proxies
- * @proxies: proxie array
- *
- * Frees the proxy array returned by px_proxy_factory_get_proxies when no
- * longer used.
- *
- * @since 0.4.16
- */
void px_proxy_factory_free_proxies (char **proxies);
-
-/**
- * px_proxy_factory_free:
- * @self: a #pxProxyFactory
- *
- * Frees the pxProxyFactory instance when no longer used.
- */
void px_proxy_factory_free (pxProxyFactory *self);
#ifdef __cplusplus
diff --git a/tests/config-env-test.c b/tests/config-env-test.c
index 34d3218..074f51b 100644
--- a/tests/config-env-test.c
+++ b/tests/config-env-test.c
@@ -23,7 +23,6 @@
#include "px-manager-helper.h"
-#include <glib.h>
typedef struct {
const char *env;
diff --git a/tests/config-gnome-test.c b/tests/config-gnome-test.c
index 7d8223d..a7940d9 100644
--- a/tests/config-gnome-test.c
+++ b/tests/config-gnome-test.c
@@ -23,7 +23,6 @@
#include "px-manager-helper.h"
-#include <glib.h>
#include <gio/gio.h>
typedef struct {
diff --git a/tests/config-kde-test.c b/tests/config-kde-test.c
index 9aba2d5..371907d 100644
--- a/tests/config-kde-test.c
+++ b/tests/config-kde-test.c
@@ -23,7 +23,6 @@
#include "px-manager-helper.h"
-#include <glib.h>
typedef struct {
const char *url;
diff --git a/tests/config-sysconfig-test.c b/tests/config-sysconfig-test.c
index 4cc0989..e2d0571 100644
--- a/tests/config-sysconfig-test.c
+++ b/tests/config-sysconfig-test.c
@@ -23,8 +23,6 @@
#include "px-manager-helper.h"
-#include <glib.h>
-
typedef struct {
const char *url;
const char *proxy;
diff --git a/tests/px-manager-test.c b/tests/px-manager-test.c
index 8e3865f..ced1fbf 100644
--- a/tests/px-manager-test.c
+++ b/tests/px-manager-test.c
@@ -22,8 +22,6 @@
#include "px-manager.h"
#include "px-manager-helper.h"
-#include <glib.h>
-
#include <libsoup/soup.h>
#define SERVER_PORT 1983