[gtk+] Load gesture images as symbolic icons



commit b6e03dbc260a26f47a9b4a5ba609c72dd8eec440
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Nov 23 10:07:44 2015 -0500

    Load gesture images as symbolic icons
    
    This makes them recolor in the dark theme, which looks better.

 gtk/Makefile.am                                    |    4 +-
 .../{pinch.svg => gesture-pinch-symbolic.svg}      |    0
 gtk/gesture/gesture-pinch-symbolic.symbolic.png    |  Bin 0 -> 1039 bytes
 ...g => gesture-rotate-anticlockwise-symbolic.svg} |    0
 ...ture-rotate-anticlockwise-symbolic.symbolic.png |  Bin 0 -> 1464 bytes
 ...e.svg => gesture-rotate-clockwise-symbolic.svg} |    0
 .../gesture-rotate-clockwise-symbolic.symbolic.png |  Bin 0 -> 1632 bytes
 .../{stretch.svg => gesture-stretch-symbolic.svg}  |    0
 gtk/gesture/gesture-stretch-symbolic.symbolic.png  |  Bin 0 -> 977 bytes
 ... => gesture-two-finger-swipe-left-symbolic.svg} |    0
 ...ure-two-finger-swipe-left-symbolic.symbolic.png |  Bin 0 -> 764 bytes
 ...=> gesture-two-finger-swipe-right-symbolic.svg} |    0
 ...e-two-finger-swipe-right-symbolic.symbolic.png} |  Bin 940 -> 882 bytes
 gtk/gesture/pinch.png                              |  Bin 1098 -> 0 bytes
 gtk/gesture/rotate-anticlockwise.png               |  Bin 1532 -> 0 bytes
 gtk/gesture/rotate-clockwise.png                   |  Bin 1691 -> 0 bytes
 gtk/gesture/stretch.png                            |  Bin 1040 -> 0 bytes
 gtk/gesture/two-finger-swipe-left.png              |  Bin 936 -> 0 bytes
 gtk/gtkshortcutsshortcut.c                         |   23 ++++++++++++++-----
 19 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 61dcd7d..6274175 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1201,9 +1201,9 @@ gtk.gresource.xml: Makefile.am inspector/Makefile.inc
          n=`basename $$f`; \
          echo "    <file>cursor/$$n</file>" >> $@; \
        done; \
-       for f in $(srcdir)/gesture/*.png; do \
+       for f in $(srcdir)/gesture/*.symbolic.png; do \
          n=`basename $$f`; \
-         echo "    <file>gesture/$$n</file>" >> $@; \
+         echo "    <file alias='icons/64x64/actions/$$n'>gesture/$$n</file>" >> $@; \
        done; \
        for f in $(srcdir)/ui/*.ui; do \
          n=`basename $$f`; \
diff --git a/gtk/gesture/pinch.svg b/gtk/gesture/gesture-pinch-symbolic.svg
similarity index 100%
rename from gtk/gesture/pinch.svg
rename to gtk/gesture/gesture-pinch-symbolic.svg
diff --git a/gtk/gesture/gesture-pinch-symbolic.symbolic.png b/gtk/gesture/gesture-pinch-symbolic.symbolic.png
new file mode 100644
index 0000000..dbdb173
Binary files /dev/null and b/gtk/gesture/gesture-pinch-symbolic.symbolic.png differ
diff --git a/gtk/gesture/rotate-anticlockwise.svg b/gtk/gesture/gesture-rotate-anticlockwise-symbolic.svg
similarity index 100%
rename from gtk/gesture/rotate-anticlockwise.svg
rename to gtk/gesture/gesture-rotate-anticlockwise-symbolic.svg
diff --git a/gtk/gesture/gesture-rotate-anticlockwise-symbolic.symbolic.png 
b/gtk/gesture/gesture-rotate-anticlockwise-symbolic.symbolic.png
new file mode 100644
index 0000000..254ab33
Binary files /dev/null and b/gtk/gesture/gesture-rotate-anticlockwise-symbolic.symbolic.png differ
diff --git a/gtk/gesture/rotate-clockwise.svg b/gtk/gesture/gesture-rotate-clockwise-symbolic.svg
similarity index 100%
rename from gtk/gesture/rotate-clockwise.svg
rename to gtk/gesture/gesture-rotate-clockwise-symbolic.svg
diff --git a/gtk/gesture/gesture-rotate-clockwise-symbolic.symbolic.png 
b/gtk/gesture/gesture-rotate-clockwise-symbolic.symbolic.png
new file mode 100644
index 0000000..76966cb
Binary files /dev/null and b/gtk/gesture/gesture-rotate-clockwise-symbolic.symbolic.png differ
diff --git a/gtk/gesture/stretch.svg b/gtk/gesture/gesture-stretch-symbolic.svg
similarity index 100%
rename from gtk/gesture/stretch.svg
rename to gtk/gesture/gesture-stretch-symbolic.svg
diff --git a/gtk/gesture/gesture-stretch-symbolic.symbolic.png 
b/gtk/gesture/gesture-stretch-symbolic.symbolic.png
new file mode 100644
index 0000000..86fe89a
Binary files /dev/null and b/gtk/gesture/gesture-stretch-symbolic.symbolic.png differ
diff --git a/gtk/gesture/two-finger-swipe-left.svg b/gtk/gesture/gesture-two-finger-swipe-left-symbolic.svg
similarity index 100%
rename from gtk/gesture/two-finger-swipe-left.svg
rename to gtk/gesture/gesture-two-finger-swipe-left-symbolic.svg
diff --git a/gtk/gesture/gesture-two-finger-swipe-left-symbolic.symbolic.png 
b/gtk/gesture/gesture-two-finger-swipe-left-symbolic.symbolic.png
new file mode 100644
index 0000000..08dcaca
Binary files /dev/null and b/gtk/gesture/gesture-two-finger-swipe-left-symbolic.symbolic.png differ
diff --git a/gtk/gesture/two-finger-swipe-right.svg b/gtk/gesture/gesture-two-finger-swipe-right-symbolic.svg
similarity index 100%
rename from gtk/gesture/two-finger-swipe-right.svg
rename to gtk/gesture/gesture-two-finger-swipe-right-symbolic.svg
diff --git a/gtk/gesture/two-finger-swipe-right.png 
b/gtk/gesture/gesture-two-finger-swipe-right-symbolic.symbolic.png
similarity index 84%
rename from gtk/gesture/two-finger-swipe-right.png
rename to gtk/gesture/gesture-two-finger-swipe-right-symbolic.symbolic.png
index bf5737a..5bce192 100644
Binary files a/gtk/gesture/two-finger-swipe-right.png and 
b/gtk/gesture/gesture-two-finger-swipe-right-symbolic.symbolic.png differ
diff --git a/gtk/gtkshortcutsshortcut.c b/gtk/gtkshortcutsshortcut.c
index 6b5bdca..28aab42 100644
--- a/gtk/gtkshortcutsshortcut.c
+++ b/gtk/gtkshortcutsshortcut.c
@@ -189,36 +189,47 @@ gtk_shortcuts_shortcut_set_subtitle (GtkShortcutsShortcut *self,
 static void
 update_icon_from_type (GtkShortcutsShortcut *self)
 {
+  GIcon *icon;
+
   if (self->icon_set)
     return;
 
   switch (self->shortcut_type)
     {
     case GTK_SHORTCUT_GESTURE_PINCH:
-      gtk_image_set_from_resource (self->image, "/org/gtk/libgtk/gesture/pinch.png");
+      icon = g_themed_icon_new ("gesture-pinch-symbolic");
       break;
 
     case GTK_SHORTCUT_GESTURE_STRETCH:
-      gtk_image_set_from_resource (self->image, "/org/gtk/libgtk/gesture/stretch.png");
+      icon = g_themed_icon_new ("gesture-stretch-symbolic");
       break;
 
     case GTK_SHORTCUT_GESTURE_ROTATE_CLOCKWISE:
-      gtk_image_set_from_resource (self->image, "/org/gtk/libgtk/gesture/rotate-clockwise.png");
+      icon = g_themed_icon_new ("gesture-rotate-clockwise-symbolic");
       break;
 
     case GTK_SHORTCUT_GESTURE_ROTATE_COUNTERCLOCKWISE:
-      gtk_image_set_from_resource (self->image, "/org/gtk/libgtk/gesture/rotate-anticlockwise.png");
+      icon = g_themed_icon_new ("gesture-rotate-anticlockwise-symbolic");
       break;
 
     case GTK_SHORTCUT_GESTURE_TWO_FINGER_SWIPE_LEFT:
-      gtk_image_set_from_resource (self->image, "/org/gtk/libgtk/gesture/two-finger-swipe-left.png");
+      icon = g_themed_icon_new ("gesture-two-finger-swipe-left-symbolic");
       break;
 
     case GTK_SHORTCUT_GESTURE_TWO_FINGER_SWIPE_RIGHT:
-      gtk_image_set_from_resource (self->image, "/org/gtk/libgtk/gesture/two-finger-swipe-right.png");
+      icon = g_themed_icon_new ("gesture-two-finger-swipe-right-symbolic");
       break;
 
     default: ;
+      icon = NULL;
+      break;
+    }
+
+  if (icon)
+    {
+      gtk_image_set_from_gicon (self->image, icon, GTK_ICON_SIZE_DIALOG);
+      gtk_image_set_pixel_size (self->image, 64);
+      g_object_unref (icon);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]