conduit r1738 - in branches/gnome-2-24: . conduit/gtkui conduit/modules/iPodModule



Author: jstowers
Date: Sun Oct  5 11:25:57 2008
New Revision: 1738
URL: http://svn.gnome.org/viewvc/conduit?rev=1738&view=rev

Log:
2008-10-05  John Stowers  <john stowers gmail com>

	* conduit/gtkui/UI.py:
	* conduit/modules/iPodModule/iPodModule.py: The gpod module fails
    to import if a different locale is used. 

	* configure.ac: Fix generation of the locale directory in defs.py
    Fixes #532854.



Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/conduit/gtkui/UI.py
   branches/gnome-2-24/conduit/modules/iPodModule/iPodModule.py
   branches/gnome-2-24/configure.ac

Modified: branches/gnome-2-24/conduit/gtkui/UI.py
==============================================================================
--- branches/gnome-2-24/conduit/gtkui/UI.py	(original)
+++ branches/gnome-2-24/conduit/gtkui/UI.py	Sun Oct  5 11:25:57 2008
@@ -39,6 +39,9 @@
 for module in gtk.glade, gettext:
     module.bindtextdomain('conduit', conduit.LOCALE_DIR)
     module.textdomain('conduit')
+    if hasattr(module, 'bind_textdomain_codeset'):
+        module.bind_textdomain_codeset('conduit','UTF-8')
+
 
 class _PreconfiguredConduitMenu(gtk.Menu):
     def __init__(self):

Modified: branches/gnome-2-24/conduit/modules/iPodModule/iPodModule.py
==============================================================================
--- branches/gnome-2-24/conduit/modules/iPodModule/iPodModule.py	(original)
+++ branches/gnome-2-24/conduit/modules/iPodModule/iPodModule.py	Sun Oct  5 11:25:57 2008
@@ -18,7 +18,6 @@
 import locale
 import weakref
 import threading
-DEFAULT_ENCODING = locale.getpreferredencoding()
 log = logging.getLogger("modules.iPod")
 
 import conduit
@@ -35,17 +34,19 @@
 
 from gettext import gettext as _
 
-MODULES = {
-    "iPodFactory" :         { "type":   "dataprovider-factory"  },
-}
-
 try:
     import gpod
-    LIBGPOD_PHOTOS = gpod.version_info >= (0,6,0)
-    log.info("Module Information: %s" % Utils.get_module_information(gpod, 'version_info'))
+    if gpod.version_info >= (0,6,0):
+        MODULES = {
+            "iPodFactory" :         { "type":   "dataprovider-factory"  },
+        }
+        log.info("Module Information: %s" % Utils.get_module_information(gpod, 'version_info'))
 except ImportError:
-    LIBGPOD_PHOTOS = False
-    log.info("iPod photo support disabled")
+    MODULES = {}
+    log.info("iPod support disabled")
+except locale.Error:
+    MODULES = {}
+    log.info("iPod support disabled (Incorrect locale)")
 
 def _string_to_unqiue_file(txt, base_uri, prefix, postfix=''):
     for i in range(1, 10000):
@@ -75,17 +76,16 @@
                     kwargs['mount'])
 
     def get_dataproviders(self, udi, **kwargs):
-        if LIBGPOD_PHOTOS:
-            #Read information about the ipod, like if it supports
-            #photos or not
-            d = gpod.itdb_device_new()
-            gpod.itdb_device_set_mountpoint(d,kwargs['mount'])
-            supportsPhotos = gpod.itdb_device_supports_photo(d)
-            gpod.itdb_device_free(d)
-            if supportsPhotos:
-                return [IPodMusicTwoWay, IPodVideoTwoWay, IPodNoteTwoWay, IPodContactsTwoWay, IPodCalendarTwoWay, IPodPhotoSink]
-
-        return [IPodMusicTwoWay, IPodVideoTwoWay, IPodNoteTwoWay, IPodContactsTwoWay, IPodCalendarTwoWay]
+        #Read information about the ipod, like if it supports
+        #photos or not
+        d = gpod.itdb_device_new()
+        gpod.itdb_device_set_mountpoint(d,kwargs['mount'])
+        supportsPhotos = gpod.itdb_device_supports_photo(d)
+        gpod.itdb_device_free(d)
+        if supportsPhotos:
+            return [IPodMusicTwoWay, IPodVideoTwoWay, IPodNoteTwoWay, IPodContactsTwoWay, IPodCalendarTwoWay, IPodPhotoSink]
+        else:
+            return [IPodMusicTwoWay, IPodVideoTwoWay, IPodNoteTwoWay, IPodContactsTwoWay, IPodCalendarTwoWay]
 
 
 class IPodBase(DataProvider.TwoWay):
@@ -544,7 +544,7 @@
         self.track['time_added'] = int(time.time())
         self.track['userdata'] = {'transferred': 0,
                                   'hostname': socket.gethostname(),
-                                  'charset': DEFAULT_ENCODING}
+                                  'charset': locale.getpreferredencoding()}
         self.track._set_userdata_utf8('filename', f.get_local_uri())
 
     #FIXME: Remove this. Use native operations from Conduit instead.
@@ -836,8 +836,8 @@
     _configurable_ = True
 
     _mediatype_ = (gpod.ITDB_MEDIATYPE_MUSICVIDEO,
-                   gpod.ITDB_MEDIATYPE_MOVIE,
-                   gpod.ITDB_MEDIATYPE_TVSHOW)
+                  gpod.ITDB_MEDIATYPE_MOVIE,
+                  gpod.ITDB_MEDIATYPE_TVSHOW)
     _mediafile_ = Video.Video
     _ipodmedia_ = IPodVideo
 

Modified: branches/gnome-2-24/configure.ac
==============================================================================
--- branches/gnome-2-24/configure.ac	(original)
+++ branches/gnome-2-24/configure.ac	Sun Oct  5 11:25:57 2008
@@ -117,7 +117,7 @@
 AS_AC_EXPAND(PYTHONDIR, $pythondir)
 AS_AC_EXPAND(BINDIR, $bindir)
 AS_AC_EXPAND(LIBDIR, $libdir)
-AS_AC_EXPAND(LOCALEDIR, $localedir)
+AS_AC_EXPAND(LOCALEDIR, $datarootdir/locale)
 AS_AC_EXPAND(PKGDATADIR, $datarootdir/$PACKAGE)
 AS_AC_EXPAND(MODULEDIR, $libdir/$PACKAGE/modules)
 



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