[pitivi] Use Gtk.IconTheme instead of the obsolete Gtk.IconFactory



commit a597de30dc4171d76d1a6d745986e6db07e9351a
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sat Nov 28 00:41:38 2015 +0100

    Use Gtk.IconTheme instead of the obsolete Gtk.IconFactory
    
    Fixes https://phabricator.freedesktop.org/T3225
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D567

 data/pixmaps/Makefile.am                           |   49 +-
 .../24x24/actions/pitivi-align.svg}                |    0
 .../24x24/actions/pitivi-gapless.svg}              |    0
 .../24x24/actions/pitivi-group.svg}                |    0
 .../24x24/actions/pitivi-keyframe.svg}             |    0
 .../24x24/actions/pitivi-relink.svg}               |    0
 .../24x24/actions/pitivi-split.svg}                |    0
 .../24x24/actions/pitivi-ungroup.svg}              |    0
 .../24x24/actions/pitivi-unlink.svg}               |    0
 data/pixmaps/pitivi-keyframe.svg                   |  419 ------------
 data/pixmaps/pitivi-relink.svg                     |  668 --------------------
 data/pixmaps/pitivi-unlink.svg                     |  264 --------
 data/ui/timelinetoolbar.ui                         |   10 +-
 pitivi/mainwindow.py                               |   25 +-
 14 files changed, 30 insertions(+), 1405 deletions(-)
---
diff --git a/data/pixmaps/Makefile.am b/data/pixmaps/Makefile.am
index 3b1a040..eb8beac 100644
--- a/data/pixmaps/Makefile.am
+++ b/data/pixmaps/Makefile.am
@@ -1,27 +1,24 @@
 pixmapdir = $(pkgdatadir)/pixmaps
 pixmap_DATA = \
-       pitivi-advanced-16.png  \
-       pitivi-advanced-22.png  \
-       pitivi-advanced-24.png  \
-       pitivi-align-24.svg     \
-       pitivi-gapless-24.svg \
-       pitivi-group-24.svg  \
-       pitivi-keyframe-24.svg  \
-       pitivi-keyframe.svg     \
-       pitivi-playhead.svg     \
-       pitivi-relink-24.svg    \
-       pitivi-relink.svg       \
-       pitivi-render-16.png    \
-       pitivi-render-22.png    \
-       pitivi-render-24.png    \
-       pitivi-split-24.svg     \
-       pitivi-ungroup-24.svg   \
-       pitivi-unlink-24.svg    \
-       pitivi-unlink.svg       \
-       processing-clip.png     \
-       processing-clip.svg     \
-       trimbar-focused.png     \
-       trimbar-normal.png
+    hicolor/24x24/actions/pitivi-align.svg \
+    hicolor/24x24/actions/pitivi-gapless.svg \
+    hicolor/24x24/actions/pitivi-group.svg \
+    hicolor/24x24/actions/pitivi-keyframe.svg \
+    hicolor/24x24/actions/pitivi-relink.svg \
+    hicolor/24x24/actions/pitivi-split.svg \
+    hicolor/24x24/actions/pitivi-ungroup.svg \
+    hicolor/24x24/actions/pitivi-unlink.svg \
+    pitivi-advanced-16.png \
+    pitivi-advanced-22.png \
+    pitivi-advanced-24.png \
+    pitivi-playhead.svg \
+    pitivi-render-16.png \
+    pitivi-render-22.png \
+    pitivi-render-24.png \
+    processing-clip.png \
+    processing-clip.svg \
+    trimbar-focused.png \
+    trimbar-normal.png
 
 effectspixmapdir = $(pkgdatadir)/pixmaps/effects
 effectspixmap_DATA = \
@@ -33,7 +30,7 @@ effectspixmap_DATA = \
     effects/cogdownsample.png \
     effects/color-distance.png \
     effects/coloreffects.png \
-       effects/defaultthumbnail.svg \
+    effects/defaultthumbnail.svg \
     effects/dicetv.png \
     effects/diffuse.png \
     effects/dilate.png \
@@ -164,6 +161,6 @@ transitionspixmap_DATA = \
     transitions/windshield-v.png
 
 EXTRA_DIST = \
-       $(pixmap_DATA) \
-       $(effectspixmap_DATA) \
-       $(transitionspixmap_DATA)
+    $(pixmap_DATA) \
+    $(effectspixmap_DATA) \
+    $(transitionspixmap_DATA)
diff --git a/data/pixmaps/pitivi-align-24.svg b/data/pixmaps/hicolor/24x24/actions/pitivi-align.svg
similarity index 100%
rename from data/pixmaps/pitivi-align-24.svg
rename to data/pixmaps/hicolor/24x24/actions/pitivi-align.svg
diff --git a/data/pixmaps/pitivi-gapless-24.svg b/data/pixmaps/hicolor/24x24/actions/pitivi-gapless.svg
similarity index 100%
rename from data/pixmaps/pitivi-gapless-24.svg
rename to data/pixmaps/hicolor/24x24/actions/pitivi-gapless.svg
diff --git a/data/pixmaps/pitivi-group-24.svg b/data/pixmaps/hicolor/24x24/actions/pitivi-group.svg
similarity index 100%
rename from data/pixmaps/pitivi-group-24.svg
rename to data/pixmaps/hicolor/24x24/actions/pitivi-group.svg
diff --git a/data/pixmaps/pitivi-keyframe-24.svg b/data/pixmaps/hicolor/24x24/actions/pitivi-keyframe.svg
similarity index 100%
rename from data/pixmaps/pitivi-keyframe-24.svg
rename to data/pixmaps/hicolor/24x24/actions/pitivi-keyframe.svg
diff --git a/data/pixmaps/pitivi-relink-24.svg b/data/pixmaps/hicolor/24x24/actions/pitivi-relink.svg
similarity index 100%
rename from data/pixmaps/pitivi-relink-24.svg
rename to data/pixmaps/hicolor/24x24/actions/pitivi-relink.svg
diff --git a/data/pixmaps/pitivi-split-24.svg b/data/pixmaps/hicolor/24x24/actions/pitivi-split.svg
similarity index 100%
rename from data/pixmaps/pitivi-split-24.svg
rename to data/pixmaps/hicolor/24x24/actions/pitivi-split.svg
diff --git a/data/pixmaps/pitivi-ungroup-24.svg b/data/pixmaps/hicolor/24x24/actions/pitivi-ungroup.svg
similarity index 100%
rename from data/pixmaps/pitivi-ungroup-24.svg
rename to data/pixmaps/hicolor/24x24/actions/pitivi-ungroup.svg
diff --git a/data/pixmaps/pitivi-unlink-24.svg b/data/pixmaps/hicolor/24x24/actions/pitivi-unlink.svg
similarity index 100%
rename from data/pixmaps/pitivi-unlink-24.svg
rename to data/pixmaps/hicolor/24x24/actions/pitivi-unlink.svg
diff --git a/data/ui/timelinetoolbar.ui b/data/ui/timelinetoolbar.ui
index a610d82..3d95a2f 100644
--- a/data/ui/timelinetoolbar.ui
+++ b/data/ui/timelinetoolbar.ui
@@ -16,7 +16,7 @@
         <property name="action_name">timeline.split_clips</property>
         <property name="label" translatable="yes">Split</property>
         <property name="use_underline">True</property>
-        <property name="stock_id">pitivi-split</property>
+        <property name="icon_name">pitivi-split</property>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -46,7 +46,7 @@
         <property name="action_name">timeline.group_selected_clips</property>
         <property name="label" translatable="yes">Group</property>
         <property name="use_underline">True</property>
-        <property name="stock_id">pitivi-group</property>
+        <property name="icon_name">pitivi-group</property>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -61,7 +61,7 @@
         <property name="action_name">timeline.ungroup_selected_clips</property>
         <property name="label" translatable="yes">Ungroup</property>
         <property name="use_underline">True</property>
-        <property name="stock_id">pitivi-ungroup</property>
+        <property name="icon_name">pitivi-ungroup</property>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -106,7 +106,7 @@
         <property name="action_name">timeline.align_selected_clips</property>
         <property name="label" translatable="yes">Align</property>
         <property name="use_underline">True</property>
-        <property name="stock_id">pitivi-align</property>
+        <property name="icon_name">pitivi-align</property>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -122,7 +122,7 @@ When enabled, adjacent clips automatically move to fill gaps.</property>
         <property name="action_name">timeline.toggle_gapless_mode</property>
         <property name="label" translatable="yes">Gapless mode</property>
         <property name="use_underline">True</property>
-        <property name="stock_id">pitivi-gapless</property>
+        <property name="icon_name">pitivi-gapless</property>
       </object>
       <packing>
         <property name="expand">False</property>
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 6aa2ecd..ec48c8f 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -30,7 +30,6 @@ from hashlib import md5
 
 from gi.repository import GES
 from gi.repository import Gdk
-from gi.repository import GdkPixbuf
 from gi.repository import Gio
 from gi.repository import Gst
 from gi.repository import Gtk
@@ -132,7 +131,8 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
         self.log("Creating MainWindow")
         self.settings = app.settings
         self.prefsdialog = None
-        self.createStockIcons()
+
+        Gtk.IconTheme.get_default().append_search_path(get_pixmap_dir())
 
         self.connect("destroy", self._destroyedCb)
 
@@ -167,27 +167,6 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
         style_context.add_provider_for_screen(screen, css_provider,
                                               Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
 
-    @staticmethod
-    def createStockIcons():
-        """
-        Create the icons used by some buttons.
-        """
-        pixmaps = {
-            "pitivi-split": "pitivi-split-24.svg",
-            "pitivi-keyframe": "pitivi-keyframe-24.svg",
-            "pitivi-ungroup": "pitivi-ungroup-24.svg",
-            "pitivi-group": "pitivi-group-24.svg",
-            "pitivi-align": "pitivi-align-24.svg",
-            "pitivi-gapless": "pitivi-gapless-24.svg",
-        }
-        factory = Gtk.IconFactory()
-        pmdir = get_pixmap_dir()
-        for stockid, path in pixmaps.items():
-            pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.path.join(pmdir, path))
-            iconset = Gtk.IconSet.new_from_pixbuf(pixbuf)
-            factory.add(stockid, iconset)
-            factory.add_default()
-
     def showRenderDialog(self, project):
         """
         Shows the L{RenderDialog} for the given project Timeline.


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