[gnome-lirc-properties] Fix number of start/stop of lircd when writing config
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-lirc-properties] Fix number of start/stop of lircd when writing config
- Date: Tue, 18 May 2010 15:36:08 +0000 (UTC)
commit 547309efe785843256d911f92b3cb802f4d72195
Author: Bastien Nocera <hadess hadess net>
Date: Tue May 18 14:22:53 2010 +0100
Fix number of start/stop of lircd when writing config
Don't restart lircd for every line in the configuration file
we're writing.
data/receivers.conf | 1 -
gnome_lirc_properties/backend.py | 25 +++++++++++++------------
2 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/data/receivers.conf b/data/receivers.conf
index 8b1e8ba..4d49b6e 100644
--- a/data/receivers.conf
+++ b/data/receivers.conf
@@ -359,7 +359,6 @@ vendor-id = 0x0bc7
lirc-driver = atilibusb
product-id = 0x0008
vendor-id = 0x0bc7
-kernel-driver = usbhid
# from drivers/lirc_atiusb/lirc_atiusb.c, line 160
[X10 Wireless Technology: Wireless Transceiver (0x0009)]
diff --git a/gnome_lirc_properties/backend.py b/gnome_lirc_properties/backend.py
index e81dbe2..af186c5 100644
--- a/gnome_lirc_properties/backend.py
+++ b/gnome_lirc_properties/backend.py
@@ -599,16 +599,7 @@ class BackendService(PolicyKitService):
print >> output, ('%s"%s"' % (match.group(0), ShellQuote.shellquote(value)))
continue
- if config.STARTUP_STYLE is 'fedora':
- output.write(line)
- value = (start_lircd is None) and 'true' or start_lircd
- start_lircd = None
- if 'true' == value:
- args = '/sbin/chkconfig', 'lirc', 'on'
- else:
- args = '/sbin/chkconfig', 'lirc', 'off'
- os.spawnv(os.P_WAIT, args[0], args)
- else:
+ if config.STARTUP_STYLE is not 'fedora':
# Deal with the START_LIRCD line:
match = self.__re_start_lircd.match(line)
@@ -624,8 +615,7 @@ class BackendService(PolicyKitService):
print >> output, (match.group(0) + ShellQuote.shellquote(value))
continue
- if config.STARTUP_STYLE is not 'fedora':
- output.write(line)
+ output.write(line)
# Write out any values that were not already in the file,
# and therefore just replaced:
@@ -647,6 +637,15 @@ class BackendService(PolicyKitService):
print >> output, '\n# Daemon settings required by gnome-lirc-properties'
print >> output, ('START_LIRCD=%s' % start_lircd)
+ if config.STARTUP_STYLE is 'fedora':
+ value = (start_lircd is None) and 'true' or start_lircd
+ start_lircd = None
+ if 'true' == value:
+ args = '/sbin/chkconfig', 'lirc', 'on'
+ else:
+ args = '/sbin/chkconfig', 'lirc', 'off'
+ os.spawnv(os.P_WAIT, args[0], args)
+
# Replace old file with new contents:
os.unlink(oldfile)
@@ -760,6 +759,7 @@ class BackendService(PolicyKitService):
if match is None:
# no statement found, create entirely new file:
+ print 'Dropping whole configuration file'
if not contents:
contents = '# This configuration has been automatically generated\n'
@@ -776,6 +776,7 @@ class BackendService(PolicyKitService):
contents += include_statement
elif match.group(1):
+ print 'Found directive, updating it'
head = contents[:match.start()]
tail = contents[match.end():]
contents = (head + include_statement + tail)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]