[PATCH master] Clean-up, use gtk consts instead of magic ints.

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

 



When I made this change for two new dialogs from another patch
reviewed by David, I thought it could be cleaned also at other
places in anaconda.
---
 iw/blpasswidget.py         |    4 ++--
 iw/lvm_dialog_gui.py       |    8 ++++----
 iw/osbootwidget.py         |    4 ++--
 iw/partition_dialog_gui.py |    4 ++--
 iw/raid_dialog_gui.py      |    8 ++++----
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/iw/blpasswidget.py b/iw/blpasswidget.py
index c07b4df..c6e6881 100644
--- a/iw/blpasswidget.py
+++ b/iw/blpasswidget.py
@@ -97,7 +97,7 @@ class BootloaderPasswordWidget:
     # get the bootloader password
     def passwordWindow(self, *args):
         dialog = gtk.Dialog(_("Enter Boot Loader Password"), self.parent)
-        dialog.add_button('gtk-cancel', 2)
+        dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
         dialog.add_button('gtk-ok', 1)
         dialog.set_position(gtk.WIN_POS_CENTER)
         gui.addFrame(dialog)
@@ -132,7 +132,7 @@ class BootloaderPasswordWidget:
 
         while 1:
             rc = dialog.run()
-            if rc in [2, gtk.RESPONSE_DELETE_EVENT]:
+            if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
                 break
 
             if pwEntry.get_text() != confirmEntry.get_text():
diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 73a27f7..2474627 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -505,7 +505,7 @@ class VolumeGroupEditor:
         # Here is where the gtk crap begins.
         dialog = gtk.Dialog(tstr, self.parent)
         gui.addFrame(dialog)
-        dialog.add_button('gtk-cancel', 2)
+        dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
         dialog.add_button('gtk-ok', 1)
         dialog.set_position(gtk.WIN_POS_CENTER)
 
@@ -569,7 +569,7 @@ class VolumeGroupEditor:
 
         while 1:
             rc = dialog.run()
-            if rc in [2, gtk.RESPONSE_DELETE_EVENT]:
+            if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
                 if isNew:
                     del self.lvs[lv['name']]
                 dialog.destroy()
@@ -958,7 +958,7 @@ class VolumeGroupEditor:
 	while 1:
 	    rc = self.dialog.run()
 
-	    if rc in [2, gtk.RESPONSE_DELETE_EVENT]:
+	    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
 		self.destroy()
 		return []
 
@@ -1285,7 +1285,7 @@ class VolumeGroupEditor:
 	    
         dialog = gtk.Dialog(tstr, self.parent)
         gui.addFrame(dialog)
-        dialog.add_button('gtk-cancel', 2)
+        dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
         dialog.add_button('gtk-ok', 1)
 
         dialog.set_position(gtk.WIN_POS_CENTER)
diff --git a/iw/osbootwidget.py b/iw/osbootwidget.py
index 42fc73a..8c89d43 100644
--- a/iw/osbootwidget.py
+++ b/iw/osbootwidget.py
@@ -128,7 +128,7 @@ class OSBootWidget:
     # adds/edits a new "other" os to the boot loader config
     def editOther(self, oldDevice, oldLabel, isDefault, isRoot = 0):
         dialog = gtk.Dialog(_("Image"), self.parent)
-        dialog.add_button('gtk-cancel', 2)
+        dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
         dialog.add_button('gtk-ok', 1)
         dialog.set_position(gtk.WIN_POS_CENTER)
         gui.addFrame(dialog)
@@ -197,7 +197,7 @@ class OSBootWidget:
             rc = dialog.run()
 
             # cancel
-            if rc in [2, gtk.RESPONSE_DELETE_EVENT]:
+            if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
                 break
 
             label = labelEntry.get_text()
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index fc93d66..9279636 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -105,7 +105,7 @@ class PartitionEditor:
             luksdev = None
 	    
             # user hit cancel, do nothing
-            if rc in [2, gtk.RESPONSE_DELETE_EVENT]:
+            if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
                 self.destroy()
                 return []
 
@@ -380,7 +380,7 @@ class PartitionEditor:
 	    
         self.dialog = gtk.Dialog(tstr, self.parent)
         gui.addFrame(self.dialog)
-        self.dialog.add_button('gtk-cancel', 2)
+        self.dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
         self.dialog.add_button('gtk-ok', 1)
         self.dialog.set_position(gtk.WIN_POS_CENTER)
         
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index ee0aea7..9b633d6 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -142,7 +142,7 @@ class RaidEditor:
 	    rc = self.dialog.run()
 
 	    # user hit cancel, do nothing
-	    if rc in [2, gtk.RESPONSE_DELETE_EVENT]:
+	    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
 		self.destroy()
 		return []
 
@@ -404,7 +404,7 @@ class RaidEditor:
 		
 	dialog = gtk.Dialog(tstr, self.parent)
 	gui.addFrame(dialog)
-	dialog.add_button('gtk-cancel', 2)
+	dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
 	self.ok_button = dialog.add_button('gtk-ok', 1)
 	dialog.set_position(gtk.WIN_POS_CENTER)
 
@@ -787,7 +787,7 @@ class RaidCloneDialog:
 	    rc = self.dialog.run()
 
 	    # user hit cancel, do nothing
-	    if rc in [2, gtk.RESPONSE_DELETE_EVENT]:
+	    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
 		self.destroy()
 		return None
 
@@ -861,7 +861,7 @@ class RaidCloneDialog:
 	self.dialog = gtk.Dialog(_("Clone Drive Tool"), self.parent)
         self.dialog.set_default_size(500, 200)
 	gui.addFrame(self.dialog)
-	self.dialog.add_button('gtk-cancel', 2)
+	self.dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
 	self.dialog.add_button('gtk-ok', 1)
 	self.dialog.set_position(gtk.WIN_POS_CENTER)
 
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux