refactor: use svg icons in GTK client (#3395)

This commit is contained in:
Charles Kerr 2022-07-03 17:14:13 -05:00 committed by GitHub
parent 834f438cd9
commit 36b70ed137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 239 additions and 20 deletions

View File

@ -40,13 +40,13 @@ add_custom_command(
transmission.gresource.xml
DEPENDS
icons/hicolor_apps_scalable_transmission.svg
icons/lock.png
icons/ratio.png
icons/turtle-blue.png
icons/turtle-grey.png
icons/utilities.png
transmission.gresource.xml
icons/lock.svg
icons/preferences-other-symbolic.svg
icons/ratio.svg
icons/turtle-silhouette.svg
icons/turtle.svg
transmission-ui.xml
transmission.gresource.xml
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@ -521,7 +521,7 @@ MainWindow::Impl::Impl(MainWindow& window, Glib::RefPtr<Gio::ActionGroup> const&
/* ratio selector */
auto* ratio_button = Gtk::make_managed<Gtk::Button>();
ratio_button->set_tooltip_text(_("Statistics"));
ratio_button->add(*Gtk::make_managed<Gtk::Image>("view-statistics", Gtk::ICON_SIZE_MENU));
ratio_button->add(*Gtk::make_managed<Gtk::Image>("ratio", Gtk::ICON_SIZE_MENU));
ratio_button->set_relief(Gtk::RELIEF_NONE);
ratio_button->signal_clicked().connect([this, ratio_button]() { onYinYangClicked(ratio_button); });
status_->add(*ratio_button);

12
gtk/icons/SOURCES.md Normal file
View File

@ -0,0 +1,12 @@
# Icon Sources
| Name | Source | Author | License |
|---|---|---|---|
| lock.svg | [fxemoji](https://github.com/mozilla/fxemoji/blob/gh-pages/svgs/objects/u1F512-lock.svg) | Mozilla Foundation | [SPDX: CC-BY-4.0](https://spdx.org/licenses/CC-BY-4.0.html) |
| ratio.svg | [forum.transmissionbt](https://forum.transmissionbt.com/viewtopic.php?p=42307#p42307) | [Jakub Steiner](https://jimmac.eu/) | [SPDX: CC-BY-SA-2.5](https://spdx.org/licenses/CC-BY-SA-2.5.html) |
| turtle-silhouette.svg | [fxemoji](https://github.com/mozilla/fxemoji/blob/gh-pages/svgs/nature/u1F422-turtle.svg) (derived from) | Mozilla Foundation | [SPDX: CC-BY-4.0](https://spdx.org/licenses/CC-BY-4.0.html) |
| turtle.svg | [fxemoji](https://github.com/mozilla/fxemoji/blob/gh-pages/svgs/nature/u1F422-turtle.svg) (derived from) | Mozilla Foundation | [SPDX: CC-BY-4.0](https://spdx.org/licenses/CC-BY-4.0.html) |
# Notes
transmission.ico created with https://www.npmjs.com/package/svg-to-ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

1
gtk/icons/lock.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path fill="#AAB8C2" d="M18 3C12.477 3 8 7.477 8 13v10h4V13c0-3.313 2.686-6 6-6s6 2.687 6 6v10h4V13c0-5.523-4.477-10-10-10z"/><path fill="#FFAC33" d="M31 32c0 2.209-1.791 4-4 4H9c-2.209 0-4-1.791-4-4V20c0-2.209 1.791-4 4-4h18c2.209 0 4 1.791 4 4v12z"/></svg>

After

Width:  |  Height:  |  Size: 320 B

View File

@ -0,0 +1,4 @@
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" xmlns:osb="http://www.openswatchbook.org/uri/2009/osb">
<path d="m12.447 0.089844c-1.9113 0-3.4609 1.5451-3.4609 3.4512 0 0.39546 0.091729 0.77896 0.21484 1.1328l-4.5098 4.5078c-0.35691-0.1241-0.74325-0.2168-1.1426-0.2168-1.9113-1e-7 -3.4609 1.5451-3.4609 3.4512 0 0.3642 0.080697 0.71925 0.18555 1.0488l1.9473-1.9414c0.19367-0.19315 0.45819-0.30859 0.71094-0.30859 0.25276 0 0.51726 0.11544 0.71094 0.30859l0.67969 0.67773c0.38735 0.3863 0.38735 1.0317 0 1.418l-2.0098 2.002c0.38238 0.14512 0.80287 0.24609 1.2363 0.24609 1.3356 0 2.4816-0.76223 3.0586-1.8672h-0.60742c-0.554 0-1-0.446-1-1v-2c0-0.554 0.446-1 1-1h2.0703l2.0527-2.0508c0.002575 2.43e-5 0.005237-3.25e-5 0.007812 0l1.1738-1.1719c0.3569 0.1241 0.74325 0.21484 1.1426 0.21484 1.9113 0 3.4609-1.5451 3.4609-3.4512 0-0.39824-0.090404-0.78276-0.21484-1.1387l-1.8848 1.8789c-0.38735 0.38628-1.0033 0.38628-1.3906 0l-0.71094-0.70898c-0.38734-0.3863-0.38734-1.0004 0-1.3867l1.8848-1.8789c-0.35691-0.12412-0.7452-0.2168-1.1445-0.2168z" color="#000000" fill="#808080" style="text-decoration-line:none;text-indent:0;text-transform:none"/>
<path d="m6.9943 11c-0.55117 0-0.99482 0.44367-0.99482 0.99481v0.0104c0 0.55114 0.44365 0.99481 0.99482 0.99481h0.0106c0.55117 0 0.99482-0.44367 0.99482-0.99481v-0.0104c0-0.55114-0.44365-0.99481-0.99482-0.99481zm2.9999-1e-5c-0.55117 0-0.99482 0.44367-0.99482 0.99481v0.0104c0 0.55114 0.44365 0.99481 0.99482 0.99481h0.0106c0.55117 0 0.99482-0.44367 0.99482-0.99481v-0.0104c0-0.55114-0.44365-0.99481-0.99482-0.99481zm3 0c-0.55117 0-0.99482 0.44367-0.99482 0.99481v0.0104c0 0.55114 0.44365 0.99481 0.99482 0.99481h0.0106c0.55117 0 0.99482-0.44367 0.99482-0.99481v-0.0104c4e-5 -0.55114-0.44361-0.99481-0.99478-0.99481z" color="#000000" color-rendering="auto" display="block" enable-background="new" fill="#808080" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="isolation:auto;mix-blend-mode:normal;paint-order:normal"/>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
gtk/icons/transmission.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<g transform="scale(-0.444, 0.444) translate(-36, -6)">
<path fill="#474747" d="M9.842 19.922c0 9.842 6.575 9.673 5.158 10.078-7 2-8.803-7.618-9.464-7.618-2.378 0-5.536-.423-5.536-2.46C0 17.883 2.46 15 6.151 15c2.379 0 3.691 2.883 3.691 4.922zM36 28.638c0 1.104-3.518-.741-5 0-2 1-2-.896-2-2s1.343-1 3-1 4 1.895 4 3z"/>
<path fill="#474747" d="M16.715 33.143c0 2.761-1.279 2.857-2.857 2.857S11 35.903 11 33.143c0-.489.085-1.029.234-1.587.69-2.59 2.754-5.556 4.052-5.556 1.578 0 1.429 4.382 1.429 7.143zm8.571 0c0 2.761 1.278 2.857 2.856 2.857C29.721 36 31 35.903 31 33.143c0-.489-.085-1.029-.234-1.587-.691-2.59-2.754-5.556-4.052-5.556-1.578 0-1.428 4.382-1.428 7.143z"/>
<path fill="#474747" d="M32 27c0 4-5.149 4-11.5 4S9 31 9 27c0-6.627 5.149-12 11.5-12S32 20.373 32 27z"/>
<path fill="#474747" d="M23.667 25.1c0 3.591-1.418 3.9-3.167 3.9s-3.167-.31-3.167-3.9S18.75 17 20.5 17s3.167 4.51 3.167 8.1zM30 24c.871 3.482-.784 4-2.533 4-1.749 0-2.533.69-2.533-2.9s-1.116-6.5.633-6.5C27.315 18.6 29 20 30 24zm-13.933 1.1c0 3.591-.785 2.9-2.534 2.9s-3.404-.518-2.533-4c1-4 3.251-5.4 5-5.4 1.75 0 .067 2.91.067 6.5z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

8
gtk/icons/turtle.svg Normal file
View File

@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
<g transform="scale(-1, 1) translate(-36, -6)">
<path fill="#99C377" d="M9.842 19.922c0 9.842 6.575 9.673 5.158 10.078-7 2-8.803-7.618-9.464-7.618-2.378 0-5.536-.423-5.536-2.46C0 17.883 2.46 15 6.151 15c2.379 0 3.691 2.883 3.691 4.922zM36 28.638c0 1.104-3.518-.741-5 0-2 1-2-.896-2-2s1.343-1 3-1 4 1.895 4 3z"/>
<path fill="#99C377" d="M16.715 33.143c0 2.761-1.279 2.857-2.857 2.857S11 35.903 11 33.143c0-.489.085-1.029.234-1.587.69-2.59 2.754-5.556 4.052-5.556 1.578 0 1.429 4.382 1.429 7.143zm8.571 0c0 2.761 1.278 2.857 2.856 2.857C29.721 36 31 35.903 31 33.143c0-.489-.085-1.029-.234-1.587-.691-2.59-2.754-5.556-4.052-5.556-1.578 0-1.428 4.382-1.428 7.143z"/>
<path fill="#6E923D" d="M32 27c0 4-5.149 4-11.5 4S9 31 9 27c0-6.627 5.149-12 11.5-12S32 20.373 32 27z"/>
<circle fill="#000" cx="5" cy="18" r="1"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/transmissionbt/transmission">
<file alias="icons/scalable/actions/lock.svg">icons/lock.svg</file>
<file alias="icons/scalable/actions/preferences-other.svg">icons/preferences-other-symbolic.svg</file>
<file alias="icons/scalable/actions/ratio.svg">icons/ratio.svg</file>
<file alias="icons/scalable/apps/transmission.svg" compressed="true" preprocess="xml-stripblanks">icons/hicolor_apps_scalable_transmission.svg</file>
<file alias="icons/16x16/actions/lock.png">icons/lock.png</file>
<file alias="icons/16x16/actions/view-statistics.png">icons/ratio.png</file>
<file alias="icons/16x16/status/alt-speed-on.png">icons/turtle-blue.png</file>
<file alias="icons/16x16/status/alt-speed-off.png">icons/turtle-grey.png</file>
<file alias="icons/16x16/actions/preferences-other.png">icons/utilities.png</file>
<file alias="icons/scalable/status/alt-speed-off.svg">icons/turtle-silhouette.svg</file>
<file alias="icons/scalable/status/alt-speed-on.svg">icons/turtle.svg</file>
<file compressed="true" preprocess="xml-stripblanks">transmission-ui.xml</file>
</gresource>
</gresources>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -1 +1 @@
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "transmission.ico"
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "./icons/transmission.ico"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 720 B

View File

@ -6,8 +6,7 @@
| lock.svg | [fxemoji](https://github.com/mozilla/fxemoji/blob/gh-pages/svgs/objects/u1F512-lock.svg) | Mozilla Foundation | [SPDX: CC-BY-4.0](https://spdx.org/licenses/CC-BY-4.0.html) |
| turtle-silhouette.svg | [fxemoji](https://github.com/mozilla/fxemoji/blob/gh-pages/svgs/nature/u1F422-turtle.svg) (derived from) | Mozilla Foundation | [SPDX: CC-BY-4.0](https://spdx.org/licenses/CC-BY-4.0.html) |
| turtle.svg | [fxemoji](https://github.com/mozilla/fxemoji/blob/gh-pages/svgs/nature/u1F422-turtle.svg) (derived from) | Mozilla Foundation | [SPDX: CC-BY-4.0](https://spdx.org/licenses/CC-BY-4.0.html) |
| yin-yang.svg | [wikimedia](https://commons.wikimedia.org/wiki/File:Yin_and_Yang_symbol.svg) | Klem | [SPDX: CC-SPDX](https://spdx.org/licenses/CC-PDDC.html) |
| yin-yang.svg | [forum.transmissionbt](https://forum.transmissionbt.com/viewtopic.php?p=42307#p42307) | [Jakub Steiner](https://jimmac.eu/) | [SPDX: CC-BY-SA-2.5](https://spdx.org/licenses/CC-BY-SA-2.5.html) |
# Notes

View File

@ -1,6 +1,193 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-40 -40 80 80">
<circle r="39"/>
<path fill="#fff" d="M0,38a38,38 0 0 1 0,-76a19,19 0 0 1 0,38a19,19 0 0 0 0,38"/>
<circle r="5" cy="19" fill="#fff"/>
<circle r="5" cy="-19"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
id="svg9434"
version="1.1"
inkscape:version="0.46+devel"
sodipodi:docname="New document 16">
<defs
id="defs9436">
<linearGradient
inkscape:collect="always"
id="linearGradient9999">
<stop
style="stop-color:#aeafac;stop-opacity:1"
offset="0"
id="stop10001" />
<stop
style="stop-color:#40413e;stop-opacity:1"
offset="1"
id="stop10003" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient9991">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop9993" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop9995" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient9968">
<stop
style="stop-color:#fcfcfc;stop-opacity:1"
offset="0"
id="stop9970" />
<stop
style="stop-color:#d3d7cf;stop-opacity:1"
offset="1"
id="stop9972" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient9958">
<stop
style="stop-color:#babdb6;stop-opacity:1"
offset="0"
id="stop9960" />
<stop
style="stop-color:#545551;stop-opacity:1"
offset="1"
id="stop9962" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective9442" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient9958"
id="linearGradient9964"
x1="7.7075844"
y1="-0.099995844"
x2="7.7075844"
y2="16.240917"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient9968"
id="radialGradient9974"
cx="7.925817"
cy="3.8924"
fx="7.925817"
fy="3.8924"
r="8.5333334"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0793799,0,0,1.0793799,-0.62915033,-0.30897821)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient9991"
id="radialGradient9997"
cx="8.0132227"
cy="5.9987407"
fx="8.0132227"
fy="5.9987407"
r="8.5333334"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(3.5600338,0.02107361,-0.00901442,1.5228365,-20.627114,-3.3039688)" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient9999"
id="radialGradient10005"
cx="7.8177705"
cy="5.1522107"
fx="7.8177705"
fy="5.1522107"
r="5"
gradientTransform="matrix(4.4249531,0.00559567,-0.00268791,2.1255406,-26.766919,-7.494981)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="-2.5637998"
inkscape:cy="6.7606103"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
borderlayer="true"
inkscape:showpageshadow="false"
inkscape:snap-nodes="false"
inkscape:snap-bbox="true"
showborder="false"
inkscape:window-width="987"
inkscape:window-height="743"
inkscape:window-x="1867"
inkscape:window-y="194"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid9444"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata9439">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1036.3622)">
<path
sodipodi:type="arc"
style="color:#000000;fill:url(#radialGradient9974);stroke:url(#linearGradient9964);stroke-width:1.06666671999999996;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;fill-opacity:1"
id="path9446"
sodipodi:cx="8"
sodipodi:cy="8"
sodipodi:rx="8"
sodipodi:ry="8"
d="M 16,8 A 8,8 0 1 1 0,8 8,8 0 1 1 16,8 z"
transform="matrix(0.9375,0,0,0.9375,0.5,1036.8622)" />
<path
style="color:#000000;fill:url(#radialGradient10005);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="M 7.5 1 C 7.4261073 1 7.354006 1.0267374 7.28125 1.03125 C 6.9461645 1.0520335 6.615496 1.1102231 6.3125 1.21875 C 6.2510359 1.2407652 6.1848192 1.2559486 6.125 1.28125 C 3.1693988 2.1008788 1 4.7834025 1 8 C 1 11.865993 4.1340068 15 8 15 C 8.1153415 15 8.2297754 15.0055 8.34375 15 C 6.4829455 14.918606 5 13.380864 5 11.5 C 5 9.7337601 6.2996271 8.207625 8 7.96875 C 9.6990013 7.7286589 11 6.2652648 11 4.5 C 11 2.7347352 9.6990013 1.2713411 8 1.03125 C 7.999374 1.0228493 8.0005937 1.0083125 8 1 C 7.8846585 1 7.7702246 0.9944845 7.65625 1 C 7.6046731 0.99774395 7.5521329 1 7.5 1 z "
transform="translate(0,1036.3622)"
id="path9982" />
<path
transform="matrix(0.8125,0,0,0.8125,1.5,1037.8622)"
d="M 16,8 A 8,8 0 1 1 0,8 8,8 0 1 1 16,8 z"
sodipodi:ry="8"
sodipodi:rx="8"
sodipodi:cy="8"
sodipodi:cx="8"
id="path9989"
style="color:#000000;fill:none;stroke:url(#radialGradient9997);stroke-width:1.23076928000000008;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
sodipodi:type="arc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 6.7 KiB