rpms/system-config-soundcard/devel system-config-soundcard-1.2.17-ok-button.patch, NONE, 1.1 system-config-soundcard.spec, 1.34, 1.35

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Mar 8 16:15:40 UTC 2006


Author: stransky

Update of /cvs/dist/rpms/system-config-soundcard/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv30640

Modified Files:
	system-config-soundcard.spec 
Added Files:
	system-config-soundcard-1.2.17-ok-button.patch 
Log Message:
added button for saving configuration

system-config-soundcard-1.2.17-ok-button.patch:
 soundcard.py        |   49 ++++++++++++++++++----------------
 soundcardBackend.py |   74 +++++++++++++++++++++++++++++++++++-----------------
 2 files changed, 76 insertions(+), 47 deletions(-)

--- NEW FILE system-config-soundcard-1.2.17-ok-button.patch ---
--- system-config-soundcard-1.2.17/src/soundcard.py.old	2006-03-08 12:30:02.000000000 +0100
+++ system-config-soundcard-1.2.17/src/soundcard.py	2006-03-08 15:44:21.000000000 +0100
@@ -376,7 +376,7 @@
         
     def refreshDeviceList(self):
 
-        selected_card = self.soundcardBackend.getDefaultCardNum()        
+        selected_card = self.soundcardBackend.getDefaultCardNum()
                 
         self.primarySubDeviceMenu = gtk.Menu()
 
@@ -406,40 +406,40 @@
         self.primarySubDeviceOptionMenu.set_menu(self.primarySubDeviceMenu)
         self.primarySubDeviceOptionMenu.show()
         
-    def closeClicked(self, *args):
-        self.apply()
+    def cancelClicked(self, *args):
+        self.apply(False)
+        gtk.main_quit()
+
+    def okayClicked(self, *args):
+        self.apply(True)
         gtk.main_quit()
 
     def changeDefaultCard(self, *args):
         self.soundcardBackend.setDefaultCard(self.primaryDeviceOptionMenu.get_history())
         self.soundcardBackend.setDefaultDevice(0)
-        self.soundcardBackend.writeConfig()
         self.refreshDeviceList()
 
     def changeDefaultDevice(self, *args):
-        self.soundcardBackend.setDefaultDevice(self.subdevices[self.primarySubDeviceOptionMenu.get_history()][0])
-        self.soundcardBackend.writeConfig()
+        self.soundcardBackend.setDefaultDevice(self.subdevices[self.primarySubDeviceOptionMenu.get_history()][0])        
 
     def changeHW(self, widget, data=None):
         self.soundcardBackend.setHardwareDevice(widget.get_active())
-        self.soundcardBackend.writeConfig()
-
+        
     def changeDynKeys(self, widget, data=None):
         self.soundcardBackend.setDynamicKeys(widget.get_active())
-        self.soundcardBackend.writeConfig()
-        self.soundcardBackend.reconfigureDynamicKeys()
-
-    def apply(self, *args):
+        
+    def apply(self, save_config):
         if self.doDebug:
-            return
-
-        pageNum = self.notebook.get_current_page()
-        page = self.notebook.get_nth_page(pageNum)
-
-        if page:
-            module = page.get_children()[1].get_text()
-
-            selectedItem = self.getSelectedCard()
+           return
+        if save_config:
+           self.soundcardBackend.writeConfig()
+           self.soundcardBackend.reconfigureDynamicKeys()
+
+#        pageNum = self.notebook.get_current_page()
+#        page = self.notebook.get_nth_page(pageNum)
+#        if page:
+#            module = page.get_children()[1].get_text()
+#            selectedItem = self.getSelectedCard()
 ##             if selectedItem != None:
 ##                 self.writeUnloadReload(selectedItem, module)
         
@@ -536,8 +536,11 @@
         self.mainWindow.set_border_width(10)
         self.mainWindow.set_position(gtk.WIN_POS_CENTER)
         self.mainWindow.set_icon(iconPixbuf)
-        self.okButton = self.mainWindow.add_button('gtk-close', 0)
-        self.okButton.connect("clicked", self.closeClicked)
+        
+        self.okButton = self.mainWindow.add_button('gtk-ok', 0)
+        self.okButton.connect("clicked", self.okayClicked)
+        self.cancelButton = self.mainWindow.add_button('gtk-cancel', 0)
+        self.cancelButton.connect("clicked", self.cancelClicked)
 
         self.toplevel.set_spacing(5)
         self.icon_box.pack_start(self.icon, False)
--- system-config-soundcard-1.2.17/src/soundcardBackend.py.old	2006-03-08 12:30:02.000000000 +0100
+++ system-config-soundcard-1.2.17/src/soundcardBackend.py	2006-03-08 16:55:27.000000000 +0100
@@ -36,12 +36,28 @@
 translate.textdomain ("system-config-soundcard")
 
 ##
+## Error message
+##
+def errorDialog(text):
+    dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text)
+
+    dlg.set_title(_("Error"))
+    dlg.set_default_size(100, 100)
+    dlg.set_position (gtk.WIN_POS_CENTER_ON_PARENT)
+    dlg.set_border_width(2)
+    dlg.set_modal(True)
+    rc = dlg.run()
+    dlg.destroy()
+    return
+
+##
 ## Get position
 ##
 def position(list, name):
     for line in list:
         if line[1] == name:
            return line[0]
+    errorDialog(_("Unable to find module %s in %s!") % (name, "/proc/asound/modules"))
     return 0
 
 ##
@@ -51,6 +67,7 @@
     try:
         fd = open('/proc/asound/modules', 'r') 
     except:
+        errorDialog(_("Unable to read %s!") % ("/proc/asound/modules"))
         return []
 
     list = fd.readlines()
@@ -134,7 +151,7 @@
     def destroy(self, args):
         self.stopTestSound()
         
-    def probeCards(self):        
+    def probeCards(self):
         driverList = read_driver_list()
         list = kudzu.probe(kudzu.CLASS_AUDIO, kudzu.BUS_PCI | kudzu.BUS_MACIO,
                            kudzu.PROBE_ALL)
@@ -174,8 +191,8 @@
 
         self.cardList.sort(card_sort)
 
-	if self.cardList != []:
-	    self.defaultModule = self.cardList[0].driver
+        if self.cardList != []:
+           self.defaultModule = self.cardList[0].driver
 
         return self.cardList
 
@@ -358,12 +375,15 @@
         return self.dynamic_keys
 
     def reconfigureDynamicKeys(self):
-        if self.dynamic_keys :
-            if os.path.exists("/var/run/console/console.lock"):
+        try:
+          if self.dynamic_keys :
+            if os.path.exists("/usr/bin/ainit") and os.path.exists("/var/run/console/console.lock"):
                 os.system("/usr/bin/ainit `cat /var/run/console/console.lock` start")
-        else:
-            if os.path.exists("/var/run/console/console.lock"):
+          else:
+            if os.path.exists("/usr/bin/ainit") and os.path.exists("/var/run/console/console.lock"):
                 os.system("/usr/bin/ainit `cat /var/run/console/console.lock` stop")
+        except:
+          None
 
     def writeConfig(self):
 
@@ -392,25 +412,31 @@
 	        fd.write(line)
 	    fd.close()
 
-        # re-writing ainit.conf
-        fd = open('/etc/alsa/ainit.conf', 'r')
-        lines = fd.readlines()
-        fd.close()
+        try:          
+          if os.path.exists("/etc/alsa/ainit.conf"):
 
-        lines_out = []
-        for line in lines:                
-            line_tmp = string.split(string.strip(line))
-            if line_tmp != [] and cmp(string.lower(line_tmp[0]),"enable") == 0:
-                if self.dynamic_keys:
-                   lines_out.append("enable = yes\n")
+              # re-writing ainit.conf
+              fd = open('/etc/alsa/ainit.conf', 'r')
+              lines = fd.readlines()
+              fd.close()
+
+              lines_out = []
+              for line in lines:                
+                line_tmp = string.split(string.strip(line))
+                if line_tmp != [] and cmp(string.lower(line_tmp[0]),"enable") == 0:
+                    if self.dynamic_keys:
+                       lines_out.append("enable = yes\n")
+                    else:
+                       lines_out.append("enable = no\n")
                 else:
-                   lines_out.append("enable = no\n")
-            else:
-                lines_out.append(line)
+                    lines_out.append(line)
 
-        fd = open('/etc/alsa/ainit.conf', 'w')
-        fd.writelines(lines_out)
-        fd.close()        
+              fd = open('/etc/alsa/ainit.conf', 'w')
+              fd.writelines(lines_out)
+              fd.close()
+              
+        except:
+          None
 
     def readConfig(self):
         # Check alsa configuration
@@ -431,7 +457,7 @@
 
         # Check ainit configuration
         try:
-            fd = open('/etc/alsa/ainit.conf', 'r')                       
+            fd = open('/etc/alsa/ainit.conf', 'r')
             lines = fd.readlines()
             fd.close()
 


Index: system-config-soundcard.spec
===================================================================
RCS file: /cvs/dist/rpms/system-config-soundcard/devel/system-config-soundcard.spec,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- system-config-soundcard.spec	8 Mar 2006 15:12:26 -0000	1.34
+++ system-config-soundcard.spec	8 Mar 2006 16:15:37 -0000	1.35
@@ -10,6 +10,7 @@
 BuildArch: noarch
 Source0: %{name}-%{version}.tar.bz2
 Patch0: system-config-soundcard-1.2.17-switch.patch
+Patch1: system-config-soundcard-1.2.17-ok-button.patch
 BuildRequires: desktop-file-utils
 BuildRequires: gettext
 ExcludeArch: s390 s390x
@@ -31,6 +32,7 @@
 %prep
 %setup -q
 %patch -p1
+%patch1 -p1
 
 %build
 make
@@ -87,6 +89,7 @@
 
 %changelog
 * Wed Mar 08 2006 Martin Stransky <stransky at redhat.com> 1.2.17-2
+- added "ok" button for save configuration
 - gui fix
 
 * Wed Mar 08 2006 Martin Stransky <stransky at redhat.com> 1.2.17-1




More information about the fedora-cvs-commits mailing list