[virt-tools-list] [PATCH virt-viewer] Use a USB icon in the fullscreen toolbar

Marc-André Lureau marcandre.lureau at gmail.com
Wed Mar 12 21:38:34 UTC 2014


Replace the generic GTK_STOCK_PREFERENCES with a more appropriate USB icon.

The icon was provided by Jakub Steiner <jsteiner at redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=804184
---
 icons/24x24/Makefile.am         |  11 ++-
 icons/24x24/virt-viewer-usb.svg | 204 ++++++++++++++++++++++++++++++++++++++++
 mingw-virt-viewer.spec.in       |   2 +
 src/virt-viewer-window.c        |   5 +-
 virt-viewer.spec.in             |   1 +
 5 files changed, 219 insertions(+), 4 deletions(-)
 create mode 100644 icons/24x24/virt-viewer-usb.svg

diff --git a/icons/24x24/Makefile.am b/icons/24x24/Makefile.am
index ba7d6aa..50ba421 100644
--- a/icons/24x24/Makefile.am
+++ b/icons/24x24/Makefile.am
@@ -1,7 +1,12 @@
+EXTRA_DIST =
 size = $(notdir $(PWD))
-icondir = $(datadir)/icons/hicolor/$(size)/apps/
-icon_DATA = $(PACKAGE).png
 
-EXTRA_DIST = $(icon_DATA)
+apps_icondir = $(datadir)/icons/hicolor/$(size)/apps/
+apps_icon_DATA = $(PACKAGE).png
+EXTRA_DIST += $(apps_icon_DATA)
+
+devices_icondir = $(datadir)/icons/hicolor/$(size)/devices/
+devices_icon_DATA = virt-viewer-usb.svg
+EXTRA_DIST += $(devices_icon_DATA)
 
 -include $(top_srcdir)/git.mk
diff --git a/icons/24x24/virt-viewer-usb.svg b/icons/24x24/virt-viewer-usb.svg
new file mode 100644
index 0000000..4101f6e
--- /dev/null
+++ b/icons/24x24/virt-viewer-usb.svg
@@ -0,0 +1,204 @@
+<?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="24"
+   height="24"
+   id="svg9434"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="usb.svg">
+  <defs
+     id="defs9436">
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient10012">
+      <stop
+         style="stop-color:#d3d7cf;stop-opacity:1"
+         offset="0"
+         id="stop10014" />
+      <stop
+         style="stop-color:#747671;stop-opacity:1"
+         offset="1"
+         id="stop10016" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient9985">
+      <stop
+         style="stop-color:#a6a6a6;stop-opacity:1;"
+         offset="0"
+         id="stop9987" />
+      <stop
+         style="stop-color:#eeeeec;stop-opacity:1"
+         offset="1"
+         id="stop9989" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient9977">
+      <stop
+         style="stop-color:#fafafa;stop-opacity:1;"
+         offset="0"
+         id="stop9979" />
+      <stop
+         style="stop-color:#fafafa;stop-opacity:0;"
+         offset="1"
+         id="stop9981" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient9401"
+       id="linearGradient9407"
+       x1="714.20172"
+       y1="-81.798248"
+       x2="714.20172"
+       y2="-64.777008"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(0,1)" />
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient9401">
+      <stop
+         style="stop-color:#2e5991;stop-opacity:1"
+         offset="0"
+         id="stop9403" />
+      <stop
+         style="stop-color:#4983c1;stop-opacity:1"
+         offset="1"
+         id="stop9405" />
+    </linearGradient>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient9977"
+       id="radialGradient9983"
+       cx="12.001339"
+       cy="1035.3622"
+       fx="12.001339"
+       fy="1035.3622"
+       r="11.03125"
+       gradientTransform="matrix(3.5911562,0,0,1.7223807,-31.098681,-747.92565)"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient9985"
+       id="linearGradient9991"
+       x1="13.481804"
+       y1="1057.5219"
+       x2="13.481804"
+       y2="1028.9601"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient10012"
+       id="linearGradient10018"
+       x1="20.287706"
+       y1="1029.2219"
+       x2="20.287706"
+       y2="1052.9133"
+       gradientUnits="userSpaceOnUse" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="1"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="14.456171"
+     inkscape:cy="42.877288"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:snap-nodes="false"
+     inkscape:snap-bbox="true"
+     borderlayer="true"
+     inkscape:showpageshadow="false"
+     showborder="false"
+     inkscape:window-width="1311"
+     inkscape:window-height="1189"
+     inkscape:window-x="764"
+     inkscape:window-y="173"
+     inkscape:window-maximized="0">
+    <inkscape:grid
+       type="xygrid"
+       id="grid9463"
+       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,-1028.3622)">
+    <rect
+       style="color:#000000;fill:url(#linearGradient9991);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient10018);stroke-width:0.99999994000000003;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       id="rect9973"
+       width="23.000017"
+       height="23.000017"
+       x="0.5"
+       y="1028.8622"
+       rx="2.1213202"
+       ry="2.1213202" />
+    <path
+       sodipodi:type="inkscape:offset"
+       inkscape:radius="-0.9722718"
+       inkscape:original="M 2.625 1028.875 C 1.4497886 1028.875 0.5 1029.7935 0.5 1030.9688 L 0.5 1049.75 C 0.5 1050.9252 1.4497886 1051.875 2.625 1051.875 L 21.375 1051.875 C 22.550211 1051.875 23.5 1050.9252 23.5 1049.75 L 23.5 1030.9688 C 23.5 1029.7935 22.550211 1028.875 21.375 1028.875 L 2.625 1028.875 z "
+       xlink:href="#rect9973"
+       style="color:#000000;fill:none;stroke:url(#radialGradient9983);stroke-width:0.99999994000000003;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+       id="path9975"
+       inkscape:href="#rect9973"
+       d="m 2.625,1029.8438 c -0.6686179,0 -1.15625,0.4735 -1.15625,1.125 l 0,18.7812 c 0,0.6513 0.5048954,1.1562 1.15625,1.1562 l 18.75,0 c 0.651354,0 1.15625,-0.5049 1.15625,-1.1562 l 0,-18.7812 c 0,-0.6515 -0.487633,-1.125 -1.15625,-1.125 l -18.75,0 z" />
+    <g
+       transform="translate(-703,1112.3622)"
+       style="display:inline;enable-background:new"
+       id="g9411">
+      <path
+         d="m 715,-83 -4,5 3,0 0,7.5625 -1.3125,-1.3125 C 712.86766,-72.1354 713,-72.54648 713,-73 c 0,-1.65685 -1.34315,-3 -3,-3 -1.65685,0 -3,1.34315 -3,3 0,1.65685 1.34315,3 3,3 0.45352,0 0.8646,-0.13234 1.25,-0.3125 l 2.625,2.4375 0.125,0.09375 c -1.15835,0.41551 -2,1.51118 -2,2.8125 0,1.65685 1.34315,3 3,3 1.65685,0 3,-1.34315 3,-3 0,-1.30132 -0.84165,-2.39699 -2,-2.8125 l 0,-2.78125 4.4375,-4.4375 2.5625,0 0,-4 -4,0 0,1 0,1.5625 -3,3 0,-4.5625 3,0 -4,-5 z"
+         inkscape:href="#path9368"
+         id="path9399"
+         style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#ffffff;fill-opacity:0.82488477;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
+         xlink:href="#path9368"
+         inkscape:original="M 715 -83 L 711 -78 L 714 -78 L 714 -70.4375 L 712.6875 -71.75 C 712.86766 -72.1354 713 -72.54648 713 -73 C 713 -74.65685 711.65685 -76 710 -76 C 708.34315 -76 707 -74.65685 707 -73 C 707 -71.34315 708.34315 -70 710 -70 C 710.45352 -70 710.8646 -70.13234 711.25 -70.3125 L 713.875 -67.875 L 714 -67.78125 C 712.84165 -67.36574 712 -66.27007 712 -64.96875 C 712 -63.3119 713.34315 -61.96875 715 -61.96875 C 716.65685 -61.96875 718 -63.3119 718 -64.96875 C 718 -66.27007 717.15835 -67.36574 716 -67.78125 L 716 -70.5625 L 720.4375 -75 L 723 -75 L 723 -79 L 719 -79 L 719 -78 L 719 -76.4375 L 716 -73.4375 L 716 -78 L 719 -78 L 715 -83 z "
+         inkscape:radius="0"
+         sodipodi:type="inkscape:offset"
+         transform="translate(0,0.97227174)" />
+      <path
+         sodipodi:nodetypes="cccccsssscccsssccccccccccc"
+         inkscape:connector-curvature="0"
+         id="path9368"
+         d="m 715,-83 -4,5 3,0 0,7.5625 -1.3125,-1.3125 C 712.86766,-72.1354 713,-72.54648 713,-73 c 0,-1.65685 -1.34315,-3 -3,-3 -1.65685,0 -3,1.34315 -3,3 0,1.65685 1.34315,3 3,3 0.45352,0 0.8646,-0.13234 1.25,-0.3125 l 2.61742,2.440641 0.13258,0.08709 c -1.15835,0.41551 -2,1.51118 -2,2.8125 0,1.65685 1.34315,3 3,3 1.65685,0 3,-1.34315 3,-3 0,-1.30132 -0.84165,-2.39699 -2,-2.8125 l 0,-2.777728 4.4375,-4.4375 2.5625,0 0,-4 -4,0 0,2.5625 -3,3 0,-4.5625 3,0 z"
+         style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:url(#linearGradient9407);fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" />
+      <rect
+         y="-84"
+         x="703"
+         height="24"
+         width="24"
+         id="rect9409"
+         style="color:#000000;fill:none;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    </g>
+  </g>
+</svg>
diff --git a/mingw-virt-viewer.spec.in b/mingw-virt-viewer.spec.in
index 01f8575..44d9230 100644
--- a/mingw-virt-viewer.spec.in
+++ b/mingw-virt-viewer.spec.in
@@ -123,6 +123,7 @@ rm -rf $RPM_BUILD_ROOT
 %{mingw32_datadir}/virt-viewer/ui/virt-viewer-about.xml
 %{mingw32_datadir}/virt-viewer/ui/virt-viewer-auth.xml
 %{mingw32_datadir}/icons/hicolor/*/apps/*
+%{mingw32_datadir}/icons/hicolor/*/devices/*
 
 %{mingw32_mandir}/man1/virt-viewer.1*
 %{mingw32_mandir}/man1/remote-viewer.1*
@@ -143,6 +144,7 @@ rm -rf $RPM_BUILD_ROOT
 %{mingw64_datadir}/virt-viewer/ui/virt-viewer-about.xml
 %{mingw64_datadir}/virt-viewer/ui/virt-viewer-auth.xml
 %{mingw64_datadir}/icons/hicolor/*/apps/*
+%{mingw64_datadir}/icons/hicolor/*/devices/*
 
 %{mingw64_mandir}/man1/virt-viewer.1*
 %{mingw64_mandir}/man1/remote-viewer.1*
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 84d17d2..0880213 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -1041,12 +1041,15 @@ virt_viewer_window_toolbar_setup(VirtViewerWindow *self)
     g_signal_connect(button, "clicked", G_CALLBACK(virt_viewer_window_menu_file_quit), self);
 
     /* USB Device selection */
-    button = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_PREFERENCES));
+    button = gtk_image_new_from_icon_name("virt-viewer-usb",
+                                          GTK_ICON_SIZE_INVALID);
+    button = GTK_WIDGET(gtk_tool_button_new(button, NULL));
     gtk_tool_button_set_label(GTK_TOOL_BUTTON(button), _("USB device selection"));
     gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(button), _("USB device selection"));
     gtk_toolbar_insert(GTK_TOOLBAR(priv->toolbar), GTK_TOOL_ITEM(button), 0);
     g_signal_connect(button, "clicked", G_CALLBACK(virt_viewer_window_menu_file_usb_device_selection), self);
     priv->toolbar_usb_device_selection = button;
+    gtk_widget_show_all(button);
 
     /* Send key */
     button = GTK_WIDGET(gtk_tool_button_new(NULL, NULL));
diff --git a/virt-viewer.spec.in b/virt-viewer.spec.in
index 5310b1e..6b2d86b 100644
--- a/virt-viewer.spec.in
+++ b/virt-viewer.spec.in
@@ -149,6 +149,7 @@ update-desktop-database -q %{_datadir}/applications
 %{_datadir}/%{name}/ui/virt-viewer-auth.xml
 %{_datadir}/%{name}/ui/virt-viewer-about.xml
 %{_datadir}/icons/hicolor/*/apps/*
+%{_datadir}/icons/hicolor/*/devices/*
 %{_datadir}/applications/remote-viewer.desktop
 %{_datadir}/mime/packages/virt-viewer-mime.xml
 %ghost %{_libexecdir}/spice-xpi-client
-- 
1.8.5.3




More information about the virt-tools-list mailing list