[pitivi: 1/13] Allow pitivi to run without HAL. Partly fixes #605920.
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 1/13] Allow pitivi to run without HAL. Partly fixes #605920.
- Date: Tue, 2 Mar 2010 11:13:03 +0000 (UTC)
commit 6bed954d61cd41739261b76bd157ae4e2f6301b2
Author: Alessandro Decina <alessandro d gmail com>
Date: Mon Mar 1 12:30:48 2010 +0100
Allow pitivi to run without HAL. Partly fixes #605920.
Based on a patch from Guillaume Bouchard.
pitivi/device.py | 6 +++++-
pitivi/ui/mainwindow.py | 9 ++++++---
pitivi/ui/webcam_managerdialog.py | 7 ++++---
3 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/device.py b/pitivi/device.py
index 5deb8f6..3877801 100644
--- a/pitivi/device.py
+++ b/pitivi/device.py
@@ -55,13 +55,17 @@ except:
# * sink : consumes data
#
+def have_hal():
+ bus = dbus.SystemBus()
+ return 'org.freedesktop.Hal' in bus.list_names()
+
def get_probe():
"""
Returns the default DeviceProbe for the current system.
If no suitable DeviceProbe implementation is available, returns None.
"""
- if HAVE_DBUS:
+ if HAVE_DBUS and have_hal():
return HalDeviceProbe()
return None
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index ea56d52..62d1f96 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -202,9 +202,12 @@ class PitiviMainWindow(gtk.Window, Loggable):
self.app.action_log.connect("cleaned", self._actionLogCleaned)
# if no webcams available, hide the webcam action
- self.app.deviceprobe.connect("device-added", self._deviceChangeCb)
- self.app.deviceprobe.connect("device-removed", self._deviceChangeCb)
- if len(self.app.deviceprobe.getVideoSourceDevices()) < 1:
+ if self.app.deviceprobe is not None:
+ self.app.deviceprobe.connect("device-added", self._deviceChangeCb)
+ self.app.deviceprobe.connect("device-removed", self._deviceChangeCb)
+ if len(self.app.deviceprobe.getVideoSourceDevices()) < 1:
+ self.webcam_button.set_sensitive(False)
+ else:
self.webcam_button.set_sensitive(False)
self.show()
diff --git a/pitivi/ui/webcam_managerdialog.py b/pitivi/ui/webcam_managerdialog.py
index e66c0ba..4f3c111 100644
--- a/pitivi/ui/webcam_managerdialog.py
+++ b/pitivi/ui/webcam_managerdialog.py
@@ -137,7 +137,7 @@ class WebcamManagerDialog(GladeWindow):
gst.debug("Creating initial SmartCaptureBin")
# figure out adev
probe = self.pitivi.deviceprobe
- if len(probe.getAudioSourceDevices()):
+ if probe is not None and len(probe.getAudioSourceDevices()):
adev = probe.getAudioSourceDevices()[0]
else:
adev = None
@@ -149,8 +149,9 @@ class WebcamManagerDialog(GladeWindow):
vdev = None
self._changeSelectedVideo(vdev)
- probe.connect("device-added", self._deviceAddedCb)
- probe.connect("device-removed", self._deviceRemovedCb)
+ if probe is not None:
+ probe.connect("device-added", self._deviceAddedCb)
+ probe.connect("device-removed", self._deviceRemovedCb)
if hasattr(self, "player"):
self.player.set_state(gst.STATE_NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]