Changeset 571

Show
Ignore:
Timestamp:
02/25/07 19:55:43 (2 years ago)
Author:
nicfit
Message:

DBus, cdrom, and audio format configure enabling options. (#287)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/configure.ac

    r566 r571  
    8383    if $GST_INSPECT ${element} > /dev/null 2>&1; then 
    8484        have_gst_audio_format=yes 
    85         eval have_${element}=yes 
    86         AC_MSG_RESULT([yes]) 
    87     else 
    88         eval have_${element}=no 
     85        eval have_gst_${element}=yes 
     86        AC_MSG_RESULT([yes]) 
     87    else 
     88        eval have_gst_${element}=no 
    8989        AC_MSG_RESULT([no]) 
    9090    fi 
     
    9797    AC_MSG_CHECKING([checking for gstreamer ${element} plugin]) 
    9898    if $GST_INSPECT ${element} > /dev/null 2>&1; then 
    99         eval have_${element}=yes 
    100         AC_MSG_RESULT([yes]) 
    101     else 
    102         eval have_${element}=no 
     99        eval have_gst_${element}=yes 
     100        AC_MSG_RESULT([yes]) 
     101    else 
     102        eval have_gst_${element}=no 
    103103        AC_MSG_RESULT([no]) 
    104104    fi 
    105105done 
    106106# mp3 support 
    107 if test "$have_mad" = "yes"; then 
    108     ACX_CHECK_EYED3([0.6.11]) 
     107HAVE_MP3_SUPPORT="no" 
     108if test "$have_gst_mad" = "yes"; then 
     109    AC_ARG_ENABLE([mp3], 
     110                  AC_HELP_STRING([--disable-mp3], 
     111                                 [disable mp3 support (default auto)]), 
     112                  enable_mp3="$enableval", enable_mp3="yes") 
     113    if test "$enable_mp3" = "yes"; then 
     114        ACX_CHECK_EYED3([0.6.11]) 
     115        HAVE_MP3_SUPPORT="yes" 
     116    fi 
     117fi 
     118# vorbis support 
     119HAVE_OGGVORBIS_SUPPORT="no" 
     120if test "$have_gst_ogg" = "yes" && test "$have_gst_vorbisdec" = "yes"; then 
     121    AC_ARG_ENABLE([oggvorbis], 
     122                  AC_HELP_STRING([--disable-oggvorbis], 
     123                                 [disable ogg vorbis support (default auto)]), 
     124                  enable_oggvorbis="$enableval", enable_oggvorbis="yes") 
     125    if test "$enable_oggvorbis" = "yes"; then 
     126        # XXX: ogg.vorbis.__version__ (1.2) does not match my install (1.4), 
     127        #      and I don't see a member, no version checking going on 
     128        ACX_CHECK_PYVORBIS 
     129        HAVE_OGGVORBIS_SUPPORT="yes" 
     130    fi 
     131fi 
     132# CD audio support 
     133HAVE_CDROM_SUPPORT="no" 
     134if test "$have_gst_cdio" = "yes"; then 
     135    AC_ARG_ENABLE([cdrom], 
     136                  AC_HELP_STRING([--disable-cdrom], 
     137                                 [disable CDROM support (default auto)]), 
     138                  enable_cdrom="$enableval", enable_cdrom="yes") 
     139    if test "$enable_cdrom" = "yes"; then 
     140        PKG_CHECK_MODULES([hal], [hal >= 0.5.7]) 
     141        ACX_CHECK_CDDB_PY([1.4]) 
     142        AC_CHECK_PROG([have_eject], [eject], [yes], [no]) 
     143        if test "$have_eject" = "no"; then 
     144            AC_MSG_ERROR( 
     145                [The command line util 'eject' is required for CDROM support.]) 
     146        fi 
     147        HAVE_CDROM_SUPPORT="yes" 
     148    fi 
     149fi 
     150 
     151# Dbus 
     152HAVE_DBUS_SUPPORT="no" 
     153AC_ARG_WITH([dbus], 
     154  AC_HELP_STRING([--disable-dbus], 
     155                 [Disable DBus support. Note that CD audio support requires DBus. (default auto)]), 
     156                 enable_dbus="$enableval", enable_dbus="yes") 
     157if test "$enable_dbus" = "yes"; then 
     158    PKG_CHECK_MODULES([dbus], [dbus-1 >= 0.80]) 
     159    PKG_CHECK_MODULES([dbusglib], [dbus-glib-1 >= 0.72]) 
     160    ACX_CHECK_DBUS_PYTHON([0.80]) 
     161    HAVE_DBUS_SUPPORT="yes" 
     162fi 
     163# Without DBus we have not CD support 
     164if test "$HAVE_DBUS_SUPPORT" = "no" -a "$HAVE_CDROM_SUPPORT" = "yes"; then 
     165    AC_MSG_WARN([Disabling CDROM support due to lac of DBus]) 
     166    HAVE_CDROM_SUPPORT="no" 
     167fi 
     168 
     169# Although the audio formats can cope with not being supported, DBus and CD 
     170# support can be disabled entirely 
     171if test "$HAVE_DBUS_SUPPORT" = "yes"; then 
     172    AC_SUBST([DISABLE_DBUS_SUPPORT], [False]) 
    109173else 
    110 # FIXME 
    111     AC_MSG_WARN([TODO]) 
    112 fi 
    113 # vorbis support 
    114 if test "$have_ogg" = "yes" && test "$have_vorbisdec" = "yes"; then 
    115     # XXX: ogg.vorbis.__version__ (1.2) does not match my install (1.4), 
    116     #      and I don't see a member, no version checking going on 
    117     ACX_CHECK_PYVORBIS 
     174    AC_SUBST([DISABLE_DBUS_SUPPORT], [True]) 
     175fi 
     176if test "$HAVE_CDROM_SUPPORT" = "yes" -a "$HAVE_DBUS_SUPPORT" = "yes"; then 
     177    AC_SUBST([DISABLE_CDROM_SUPPORT], [False]) 
    118178else 
    119 # FIXME 
    120     AC_MSG_WARN([TODO]) 
    121 fi 
    122 # CD audio support 
    123 if test "$have_cdio" = "yes"; then 
    124     PKG_CHECK_MODULES([hal], [hal >= 0.5.7]) 
    125     ACX_CHECK_CDDB_PY([1.4]) 
    126     AC_CHECK_PROG([have_eject], [eject], [yes], [no]) 
    127     if test "$have_eject" = "no"; then 
    128         AC_MSG_ERROR( 
    129             [The command line utility 'eject' is required for CDROM support.]) 
    130     fi 
    131 else 
    132 # FIXME 
    133     AC_MSG_WARN([TODO]) 
    134 fi 
    135  
    136 # Dbus 
    137 PKG_CHECK_MODULES([dbus], [dbus-1 >= 0.80]) 
    138 PKG_CHECK_MODULES([dbusglib], [dbus-glib-1 >= 0.72]) 
    139 ACX_CHECK_DBUS_PYTHON([0.80]) 
     179    AC_SUBST([DISABLE_CDROM_SUPPORT], [True]) 
     180fi 
    140181 
    141182# Done with tests, output files 
     
    150191fi 
    151192AC_OUTPUT 
     193 
     194echo " 
     195 
     196Mesk Configuration: 
     197   mp3:         $HAVE_MP3_SUPPORT 
     198   ogg vorbis:  $HAVE_OGGVORBIS_SUPPORT 
     199   CD audio:    $HAVE_CDROM_SUPPORT 
     200   DBus:        $HAVE_DBUS_SUPPORT 
     201" 
  • trunk/src/devices.py

    r522 r571  
    2121import os 
    2222import gobject 
    23 import dbus 
    2423import mesk, mesk.audio.cdaudio 
    2524 
     
    3635    def __init__(self): 
    3736        gobject.GObject.__init__(self) 
     37        self._optical_devices = {} 
     38        self._device_mon = None 
     39 
     40        if mesk.info.DISABLE_DBUS_SUPPORT: 
     41            mesk.log.info('DeviceMgr is a stub due to DBus being disabled.') 
     42            return 
     43        else: 
     44            import dbus 
    3845 
    3946        # Init device manager 
     
    4451                                          'org.freedesktop.Hal.Manager') 
    4552 
    46         # Detect optical drives 
    47         self._optical_devices = {} 
    48         for dev_udi in self.hal_manager.FindDeviceByCapability('storage.cdrom'): 
    49             dev_obj = self.bus.get_object('org.freedesktop.Hal', dev_udi) 
    50             dev = dbus.Interface(dev_obj, 'org.freedesktop.Hal.Device'
    51  
    52             self._optical_devices[dev_udi] = dev 
    53  
    54         self._device_mon = None 
     53        if not mesk.info.DISABLE_CDROM_SUPPORT: 
     54            cdroms = self.hal_manager.FindDeviceByCapability('storage.cdrom') 
     55            # Detect optical drives 
     56            for dev_udi in cdroms: 
     57                dev_obj = self.bus.get_object('org.freedesktop.Hal', dev_udi
     58                dev = dbus.Interface(dev_obj, 'org.freedesktop.Hal.Device') 
     59 
     60                self._optical_devices[dev_udi] = dev 
     61 
    5562        if self._optical_devices: 
    5663            self._device_mon = DeviceMonitor(self._optical_devices.values()) 
  • trunk/src/main.py

    r568 r571  
    6161        for a in args: 
    6262            self.remote_opts.append(('--enqueue', a)) 
    63         # The profile is used for the GUI and to select a dbus service instance 
     63        # The profile is used for the GUI and to select a DBus service instance 
    6464        self.profile = self.opts.profile 
    6565 
     
    7171        import mesk 
    7272        self._init() 
    73         mesk.log.debug('Testing for existing instance; profile \'%s\'' % 
    74                        self.profile) 
    75         import dbus_service 
    76         mesk_running = dbus_service.is_service_running(self.profile) 
    77         if mesk_running and not self.remote_opts: 
    78             mesk.log.debug('mesk is running but no remote commands') 
    79             raise mesk.MeskException(_('Mesk is already running'), 
    80                                      _('Another instance of Mesk is using ' 
    81                                        'the profile \'%s\'.  Try again with ' 
    82                                        'a different profile name ' 
    83                                        '(-p/--profile)') % self.profile) 
    84         elif mesk_running: 
    85             mesk.log.debug('mesk is running, execting remote commands') 
    86             # Mesk is running and we have some remote control options,  
    87             # so execute the commands on the remote service and exit 
    88             import dbus 
    89             import dbus_service  # This is a local module 
    90             obj_path = dbus_service.get_object_path(self.profile) 
    91             service = dbus_service.get_service_name(self.profile) 
    92             session_bus = dbus.SessionBus() 
    93             obj = session_bus.get_object(service, obj_path) 
    94  
    95             mesk_dbus = dbus.Interface(obj, dbus_service.INTERFACE) 
    96             self._run_remote_commands(mesk_dbus) 
    97             return 
     73 
     74        if not mesk.info.DISABLE_DBUS_SUPPORT: 
     75            mesk.log.debug('Testing for existing instance; profile \'%s\'' % 
     76                           self.profile) 
     77            import dbus_service 
     78            mesk_running = dbus_service.is_service_running(self.profile) 
     79            if mesk_running and not self.remote_opts: 
     80                mesk.log.debug('mesk is running but no remote commands') 
     81                raise mesk.MeskException( 
     82                    _('Mesk is already running'), 
     83                    _('Another instance of Mesk is using the profile \'%s\'. ' 
     84                      'Try again with a different profile name ' 
     85                      '(-p/--profile)') % self.profile) 
     86            elif mesk_running: 
     87                mesk.log.debug('mesk is running, execting remote commands') 
     88                # Mesk is running and we have some remote control options,  
     89                # so execute the commands on the remote service and exit 
     90                import dbus 
     91                import dbus_service  # This is a local module 
     92                obj_path = dbus_service.get_object_path(self.profile) 
     93                service = dbus_service.get_service_name(self.profile) 
     94                session_bus = dbus.SessionBus() 
     95                obj = session_bus.get_object(service, obj_path) 
     96 
     97                mesk_dbus = dbus.Interface(obj, dbus_service.INTERFACE) 
     98                self._run_remote_commands(mesk_dbus) 
     99                return 
     100        elif self.remote_opts: 
     101            raise RemoteControlException('Remote control disabled') 
     102 
    98103 
    99104        # Gnome session management 
     
    118123 
    119124        # Main window 
    120         import dbus 
    121125        from main_window import MainWindow 
    122126        self.main_window = MainWindow(self.profile) 
  • trunk/src/main_window.py

    r570 r571  
    3333from about_dialog import AboutDialog 
    3434from playlist_control import PlaylistControl, PlaylistPropertiesDialog 
    35 from cdrom_control import CDROMControl 
    3635from album_cover_control import AlbumCoverControl 
    3736from preference_window import PreferenceWindow 
    3837from dialogs import ErrorDialog, ConfirmationWithDisableOptionDialog 
    3938from status_bar import StatusBar 
     39 
    4040import devices 
     41if mesk.info.DISABLE_CDROM_SUPPORT or mesk.info.DISABLE_DBUS_SUPPORT: 
     42    class CDROMControl: 
     43        pass  # A stub for type checks 
     44else: 
     45    from cdrom_control import CDROMControl 
    4146 
    4247class MainWindow(mesk.window.Window): 
     
    6974                                    self._on_audio_source_tag_update) 
    7075 
    71         # Initialize Dbus service 
    72         import dbus, dbus_service 
    73         name = dbus.service.BusName(dbus_service.get_service_name(self.profile), 
    74                                     bus=dbus.SessionBus()) 
    75         self.mesk_dbus = dbus_service.MeskDbusService(name, self.profile, 
    76                                                       self) 
    77         mesk.log.verbose("DBus service activated") 
     76        if not mesk.info.DISABLE_DBUS_SUPPORT: 
     77            # Initialize Dbus service 
     78            import dbus, dbus_service 
     79            service_name = dbus_service.get_service_name(self.profile) 
     80            bus_name = dbus.service.BusName(service_name, bus=dbus.SessionBus()) 
     81            self.mesk_dbus = dbus_service.MeskDbusService(bus_name, 
     82                                                          self.profile, 
     83                                                          self) 
     84            mesk.log.verbose("DBus service activated") 
     85        else: 
     86            self.mesk_dbus = None 
     87            mesk.log.info('DBus disabled') 
    7888 
    7989        self._album_cover_control = AlbumCoverControl(self.xml, 
     
    126136        # Register for device changes 
    127137        dev_mon = devices.get_mgr().get_device_monitor() 
    128         dev_mon.connect('media-changed', self._media_changed) 
     138        if dev_mon: 
     139            dev_mon.connect('media-changed', self._media_changed) 
    129140 
    130141        # Initialize plugins 
  • trunk/src/mesk/info.py.in

    r563 r571  
    2525 
    2626INSTALL_PREFIX = '@INSTALL_PREFIX@' 
     27DISABLE_CDROM_SUPPORT = @DISABLE_CDROM_SUPPORT@ 
     28DISABLE_DBUS_SUPPORT = @DISABLE_DBUS_SUPPORT@ 
    2729 
    2830GPLV2_LICENCE = \