jdahlin - in flumotion/trunk: . flumotion/ui

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Fri Dec 21 14:11:34 CET 2007


Author: jdahlin
Date: Fri Dec 21 14:11:17 2007
New Revision: 6031

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/ui/icons.py
Log:
2007-12-21  Johan Dahlin  <johan at gnome.org>

	* flumotion/ui/icons.py (register_icons): Refactor the icon registration
	to be generic and explicit. Register stock icons for all moods, to be
	used by the admin client.



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Fri Dec 21 14:11:17 2007
@@ -1,5 +1,9 @@
 2007-12-21  Johan Dahlin  <johan at gnome.org>
 
+	* flumotion/ui/icons.py (register_icons): Refactor the icon registration
+	to be generic and explicit. Register stock icons for all moods, to be
+	used by the admin client.
+
 	* flumotion/ui/simplewizard.py (SimpleWizard.__init__): Forgot to 
 	commit which should have been a part of the fix for rev 6014
 

Modified: flumotion/trunk/flumotion/ui/icons.py
==============================================================================
--- flumotion/trunk/flumotion/ui/icons.py	(original)
+++ flumotion/trunk/flumotion/ui/icons.py	Fri Dec 21 14:11:17 2007
@@ -31,21 +31,41 @@
 
 def _register_stock_icons(names):
     ifact = gtk.IconFactory()
-    sizes = {gtk.ICON_SIZE_MENU:16, gtk.ICON_SIZE_SMALL_TOOLBAR:24}
-    for name in names:
+    for stock_name, filenames in names:
         iset = gtk.IconSet()
-        for size, px in sizes.items():
+        for filename in filenames:
             isource = gtk.IconSource()
-            f = os.path.join(configure.imagedir, '%dx%d' % (px,px),
-                             name + '.png')
+            f = os.path.join(configure.imagedir, filename)
             isource.set_filename(f)
-            isource.set_size(size)
+            if filename.startswith('16x16'):
+                size = gtk.ICON_SIZE_MENU
+            elif filename.startswith('24x24'):
+                size = gtk.ICON_SIZE_SMALL_TOOLBAR
+            else:
+                size = None
+            if size:
+                isource.set_size(size)
             iset.add_source(isource)
-        ifact.add('flumotion-' + name, iset)
+        ifact.add(stock_name, iset)
     ifact.add_default()
 
 def register_icons():
     iconfile = os.path.join(configure.imagedir, 'fluendo.png')
     gtk.window_set_default_icon_from_file(iconfile)
 
-    _register_stock_icons(['wizard', 'play', 'pause', 'about'])
+    _register_stock_icons([
+        ('flumotion-wizard', ['16x16/wizard.png',
+                              '24x24/wizard.png']),
+        ('flumotion-play', ['16x16/play.png',
+                              '24x24/play.png']),
+        ('flumotion-pause', ['16x16/pause.png',
+                              '24x24/pause.png']),
+        ('flumotion-about', ['16x16/about.png',
+                              '24x24/about.png']),
+        ('flumotion-mood-happy', ['mood-happy.png']),
+        ('flumotion-mood-hungry', ['mood-hungry.png']),
+        ('flumotion-mood-lost', ['mood-lost.png']),
+        ('flumotion-mood-sad', ['mood-sad.png']),
+        ('flumotion-mood-sleeping', ['mood-sleeping.png']),
+        ('flumotion-mood-waking', ['mood-waking.png']),
+        ])


More information about the flumotion-commit mailing list