From 73b8ccd58d5e23bcdf04c8985f74b54ec4a85e1e Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Thu, 8 Oct 2015 11:15:17 +0200 Subject: [PATCH] policycoreutils-2.4-14 - Revert the attempt to port -gui to GTK 3 (#1269328, #1266059) --- policycoreutils-rhat.patch | 839 ++++--------------------------------- policycoreutils.spec | 7 +- 2 files changed, 87 insertions(+), 759 deletions(-) diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index e6fb6db..1bd5c9e 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -416,7 +416,7 @@ index 9d9f820..0c2b390 100644 polgen.glade \ portsPage.py \ diff --git a/policycoreutils-2.4/gui/booleansPage.py b/policycoreutils-2.4/gui/booleansPage.py -index eee954d..8e7e8e6 100644 +index eee954d..0c4b14b 100644 --- a/policycoreutils-2.4/gui/booleansPage.py +++ b/policycoreutils-2.4/gui/booleansPage.py @@ -18,20 +18,17 @@ @@ -424,13 +424,10 @@ index eee954d..8e7e8e6 100644 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -import string --import gtk --import gtk.glade + import gtk + import gtk.glade -import os --import gobject -+from gi.repository import Gtk -+import Gtk.glade -+from gi.repository import GObject + import gobject import sys -import tempfile import seobject @@ -457,73 +454,24 @@ index eee954d..8e7e8e6 100644 class Modifier: def __init__(self,name, on, save): -@@ -86,8 +81,8 @@ class booleansPage: - self.selinuxsupport = True - self.typechanged = False - self.doDebug = doDebug -- self.busy_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) -- self.ready_cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) -+ self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) -+ self.ready_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) - - # Bring in widgets from glade file. - self.typeHBox = xml.get_widget("typeHBox") -@@ -103,33 +98,31 @@ class booleansPage: +@@ -103,8 +98,6 @@ class booleansPage: self.revertButton = xml.get_widget("booleanRevertButton") self.revertButton.set_sensitive(self.local) self.revertButton.connect("clicked", self.on_revert_clicked) - listStore = gtk.ListStore(gobject.TYPE_STRING) - cell = gtk.CellRendererText() -- self.store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) -- self.store.set_sort_column_id(1, gtk.SORT_ASCENDING) -+ self.store = Gtk.ListStore(GObject.TYPE_BOOLEAN, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) -+ self.store.set_sort_column_id(1, Gtk.SortType.ASCENDING) - self.booleansView.set_model(self.store) - -- checkbox = gtk.CellRendererToggle() -+ checkbox = Gtk.CellRendererToggle() - checkbox.connect("toggled", self.boolean_toggled) -- col = gtk.TreeViewColumn('Active', checkbox, active = ACTIVE) -+ col = Gtk.TreeViewColumn('Active', checkbox, active = ACTIVE) - col.set_clickable(True) - col.set_sort_column_id(ACTIVE) + self.store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) + self.store.set_sort_column_id(1, gtk.SORT_ASCENDING) +@@ -123,7 +116,7 @@ class booleansPage: self.booleansView.append_column(col) -- col = gtk.TreeViewColumn("Module", gtk.CellRendererText(), text=MODULE) -+ col = Gtk.TreeViewColumn("Module", Gtk.CellRendererText(), text=MODULE) - col.set_sort_column_id(MODULE) - col.set_resizable(True) - self.booleansView.append_column(col) - -- col = gtk.TreeViewColumn("Description", gtk.CellRendererText(), text=DESC) + col = gtk.TreeViewColumn("Description", gtk.CellRendererText(), text=DESC) - col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) -+ col = Gtk.TreeViewColumn("Description", Gtk.CellRendererText(), text=DESC) -+ col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) ++ col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) col.set_fixed_width(400) col.set_sort_column_id(DESC) col.set_resizable(True) - self.booleansView.append_column(col) - -- col = gtk.TreeViewColumn("Name", gtk.CellRendererText(), text=BOOLEAN) -+ col = Gtk.TreeViewColumn("Name", Gtk.CellRendererText(), text=BOOLEAN) - col.set_sort_column_id(BOOLEAN) - col.set_resizable(True) - self.booleansView.set_search_equal_func(self.__search) -@@ -138,10 +131,10 @@ class booleansPage: - self.load(self.filter) - - def error(self, message): -- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, -- gtk.BUTTONS_CLOSE, -+ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, -+ Gtk.ButtonsType.CLOSE, - message) -- dlg.set_position(gtk.WIN_POS_MOUSE) -+ dlg.set_position(Gtk.WindowPosition.MOUSE) - dlg.show_all() - dlg.run() - dlg.destroy() @@ -170,16 +163,15 @@ class booleansPage: # change cursor if boolean == None: @@ -581,25 +529,18 @@ index eee954d..8e7e8e6 100644 def on_local_clicked(self, button): diff --git a/policycoreutils-2.4/gui/domainsPage.py b/policycoreutils-2.4/gui/domainsPage.py -index 6af1e9a..ea937b4 100644 +index 6af1e9a..39a4574 100644 --- a/policycoreutils-2.4/gui/domainsPage.py +++ b/policycoreutils-2.4/gui/domainsPage.py -@@ -17,11 +17,11 @@ - - ## Author: Dan Walsh - import string --import gtk --import gtk.glade -+from gi.repository import Gtk -+import Gtk.glade +@@ -20,7 +20,7 @@ import string + import gtk + import gtk.glade import os -import commands --import gobject +import subprocess -+from gi.repository import GObject + import gobject import sys import seobject - import selinux @@ -41,8 +41,8 @@ try: unicode=False, codeset = 'utf-8') @@ -611,27 +552,6 @@ index 6af1e9a..ea937b4 100644 class domainsPage(semanagePage): def __init__(self, xml): -@@ -51,15 +51,15 @@ class domainsPage(semanagePage): - self.domain_filter.connect("focus_out_event", self.filter_changed) - self.domain_filter.connect("activate", self.filter_changed) - -- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) -+ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING) - self.view.set_model(self.store) -- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Domain Name"), gtk.CellRendererText(), text = 0) -+ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Domain Name"), Gtk.CellRendererText(), text = 0) - col.set_sort_column_id(0) - col.set_resizable(True) - self.view.append_column(col) -- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Mode"), gtk.CellRendererText(), text = 1) -+ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Mode"), Gtk.CellRendererText(), text = 1) - col.set_sort_column_id(1) - col.set_resizable(True) - self.view.append_column(col) @@ -115,18 +115,17 @@ class domainsPage(semanagePage): selection = self.view.get_selection() store, iter = selection.get_selected() @@ -688,20 +608,15 @@ index 6af1e9a..ea937b4 100644 + self.error(e.output) + self.ready() diff --git a/policycoreutils-2.4/gui/fcontextPage.py b/policycoreutils-2.4/gui/fcontextPage.py -index 131f1c2..27de5fb 100644 +index 131f1c2..9a34143 100644 --- a/policycoreutils-2.4/gui/fcontextPage.py +++ b/policycoreutils-2.4/gui/fcontextPage.py -@@ -16,12 +16,11 @@ - ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - +@@ -18,10 +18,9 @@ ## Author: Dan Walsh --import gtk --import gtk.glade + import gtk + import gtk.glade -import os --import gobject -+from gi.repository import Gtk -+import Gtk.glade -+from gi.repository import GObject + import gobject import seobject -import commands +import subprocess @@ -719,47 +634,28 @@ index 131f1c2..27de5fb 100644 class fcontextPage(semanagePage): -@@ -66,47 +65,47 @@ class fcontextPage(semanagePage): - self.fcontextFilter.connect("focus_out_event", self.filter_changed) - self.fcontextFilter.connect("activate", self.filter_changed) - -- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) -+ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) - self.view = xml.get_widget("fcontextView") - self.view.set_model(self.store) +@@ -72,16 +71,16 @@ class fcontextPage(semanagePage): self.view.set_search_equal_func(self.search) -- col = gtk.TreeViewColumn(_("File\nSpecification"), gtk.CellRendererText(), text=SPEC_COL) + col = gtk.TreeViewColumn(_("File\nSpecification"), gtk.CellRendererText(), text=SPEC_COL) - col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) - col.set_fixed_width(250) -+ col = Gtk.TreeViewColumn(_("File\nSpecification"), Gtk.CellRendererText(), text=SPEC_COL) -+ col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) ++ col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) + col.set_fixed_width(250) col.set_sort_column_id(SPEC_COL) col.set_resizable(True) self.view.append_column(col) -- col = gtk.TreeViewColumn(_("Selinux\nFile Type"), gtk.CellRendererText(), text=TYPE_COL) -+ col = Gtk.TreeViewColumn(_("Selinux\nFile Type"), Gtk.CellRendererText(), text=TYPE_COL) + col = gtk.TreeViewColumn(_("Selinux\nFile Type"), gtk.CellRendererText(), text=TYPE_COL) - col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) - col.set_fixed_width(250) -+ col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) ++ col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) + col.set_fixed_width(250) col.set_sort_column_id(TYPE_COL) col.set_resizable(True) self.view.append_column(col) -- col = gtk.TreeViewColumn(_("File\nType"), gtk.CellRendererText(), text=2) -+ col = Gtk.TreeViewColumn(_("File\nType"), Gtk.CellRendererText(), text=2) - col.set_sort_column_id(FTYPE_COL) - col.set_resizable(True) - self.view.append_column(col) - -- self.store.set_sort_column_id(SPEC_COL, gtk.SORT_ASCENDING) -+ self.store.set_sort_column_id(SPEC_COL, Gtk.SortType.ASCENDING) - self.load() - self.fcontextEntry = xml.get_widget("fcontextEntry") - self.fcontextFileTypeCombo = xml.get_widget("fcontextFileTypeCombo") +@@ -97,16 +96,16 @@ class fcontextPage(semanagePage): liststore=self.fcontextFileTypeCombo.get_model() for k in seobject.file_types: if len(k) > 0 and k[0] != '-': @@ -986,7 +882,7 @@ index 68eed76..32de37a 100644 if type(result) in [TupleType, ListType]: for item in result: diff --git a/policycoreutils-2.4/gui/loginsPage.py b/policycoreutils-2.4/gui/loginsPage.py -index ec29fd9..54b6b34 100644 +index ec29fd9..8a1c0b7 100644 --- a/policycoreutils-2.4/gui/loginsPage.py +++ b/policycoreutils-2.4/gui/loginsPage.py @@ -16,13 +16,10 @@ @@ -994,20 +890,17 @@ index ec29fd9..54b6b34 100644 ## Author: Dan Walsh -import string --import gtk --import gtk.glade + import gtk + import gtk.glade -import os --import gobject + import gobject -import sys -import commands -+from gi.repository import Gtk -+import Gtk.glade -+from gi.repository import GObject +import subprocess import seobject from semanagePage import *; -@@ -39,24 +36,24 @@ try: +@@ -39,8 +36,8 @@ try: unicode=False, codeset = 'utf-8') except IOError: @@ -1018,28 +911,7 @@ index ec29fd9..54b6b34 100644 class loginsPage(semanagePage): def __init__(self, xml): - self.firstTime = False - semanagePage.__init__(self, xml, "logins", _("User Mapping")) -- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) -+ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) - self.view.set_model(self.store) -- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Login\nName"), gtk.CellRendererText(), text = 0) -+ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Login\nName"), Gtk.CellRendererText(), text = 0) - col.set_sort_column_id(0) - col.set_resizable(True) - self.view.append_column(col) -- col = gtk.TreeViewColumn(_("SELinux\nUser"), gtk.CellRendererText(), text = 1) -+ col = Gtk.TreeViewColumn(_("SELinux\nUser"), Gtk.CellRendererText(), text = 1) - col.set_resizable(True) - self.view.append_column(col) -- col = gtk.TreeViewColumn(_("MLS/\nMCS Range"), gtk.CellRendererText(), text = 2) -+ col = Gtk.TreeViewColumn(_("MLS/\nMCS Range"), Gtk.CellRendererText(), text = 2) - col.set_resizable(True) - self.view.append_column(col) - self.load() -@@ -68,55 +65,55 @@ class loginsPage(semanagePage): +@@ -68,21 +65,21 @@ class loginsPage(semanagePage): self.filter=filter self.login = seobject.loginRecords() dict = self.login.get_all(0) @@ -1066,12 +938,8 @@ index ec29fd9..54b6b34 100644 + if self.firstTime: return self.firstTime = True -- liststore = gtk.ListStore(gobject.TYPE_STRING) -+ liststore = Gtk.ListStore(GObject.TYPE_STRING) - self.loginsSelinuxUserCombo.set_model(liststore) -- cell = gtk.CellRendererText() -+ cell = Gtk.CellRendererText() - self.loginsSelinuxUserCombo.pack_start(cell, True) + liststore = gtk.ListStore(gobject.TYPE_STRING) +@@ -92,31 +89,31 @@ class loginsPage(semanagePage): self.loginsSelinuxUserCombo.add_attribute(cell, 'text', 0) selusers = seobject.seluserRecords().get_all(0) @@ -1218,25 +1086,18 @@ index ec29fd9..54b6b34 100644 - self.store.set_value(iter, 1, seuser) - self.store.set_value(iter, 2, seobject.translate(serange)) diff --git a/policycoreutils-2.4/gui/modulesPage.py b/policycoreutils-2.4/gui/modulesPage.py -index 9ff0766..f3277f5 100644 +index 9ff0766..a52863e 100644 --- a/policycoreutils-2.4/gui/modulesPage.py +++ b/policycoreutils-2.4/gui/modulesPage.py -@@ -17,11 +17,11 @@ - - ## Author: Dan Walsh - import string --import gtk --import gtk.glade -+from gi.repository import Gtk -+import Gtk.glade +@@ -20,7 +20,7 @@ import string + import gtk + import gtk.glade import os -import commands --import gobject +import subprocess -+from gi.repository import GObject + import gobject import sys import seobject - import selinux @@ -41,8 +41,8 @@ try: unicode=False, codeset = 'utf-8') @@ -1248,27 +1109,6 @@ index 9ff0766..f3277f5 100644 class modulesPage(semanagePage): def __init__(self, xml): -@@ -52,15 +52,15 @@ class modulesPage(semanagePage): - self.module_filter.connect("activate", self.filter_changed) - self.audit_enabled = False - -- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) -+ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING) - self.view.set_model(self.store) -- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Module Name"), gtk.CellRendererText(), text = 0) -+ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Module Name"), Gtk.CellRendererText(), text = 0) - col.set_sort_column_id(0) - col.set_resizable(True) - self.view.append_column(col) -- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Version"), gtk.CellRendererText(), text = 1) -+ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Version"), Gtk.CellRendererText(), text = 1) - self.enable_audit_button = xml.get_widget("enableAuditButton") - self.enable_audit_button.connect("clicked", self.enable_audit) - self.new_button = xml.get_widget("newModuleButton") @@ -85,8 +85,8 @@ class modulesPage(semanagePage): except: return 0 @@ -1296,7 +1136,7 @@ index 9ff0766..f3277f5 100644 except: pass self.view.get_selection().select_path ((0,)) -@@ -107,85 +107,82 @@ class modulesPage(semanagePage): +@@ -107,53 +107,51 @@ class modulesPage(semanagePage): def new_module(self, args): try: Popen(["/usr/share/system-config-selinux/polgengui.py"]) @@ -1384,34 +1224,22 @@ index 9ff0766..f3277f5 100644 def propertiesDialog(self): # Do nothing - return - - def addDialog(self): -- dialog = gtk.FileChooserDialog(_("Load Policy Module"), -+ dialog = Gtk.FileChooserDialog(_("Load Policy Module"), - None, -- gtk.FILE_CHOOSER_ACTION_OPEN, -- (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, -- gtk.STOCK_OPEN, gtk.RESPONSE_OK)) -- dialog.set_default_response(gtk.RESPONSE_OK) -+ Gtk.FileChooserAction.OPEN, -+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, -+ Gtk.STOCK_OPEN, Gtk.ResponseType.OK)) -+ dialog.set_default_response(Gtk.ResponseType.OK) +@@ -167,10 +165,10 @@ class modulesPage(semanagePage): + gtk.STOCK_OPEN, gtk.RESPONSE_OK)) + dialog.set_default_response(gtk.RESPONSE_OK) - filter = gtk.FileFilter() - filter.set_name("Policy Files") - filter.add_pattern("*.pp") - dialog.add_filter(filter) -+ filt = Gtk.FileFilter() ++ filt = gtk.FileFilter() + filt.set_name("Policy Files") + filt.add_pattern("*.pp") + dialog.add_filter(filt) response = dialog.run() -- if response == gtk.RESPONSE_OK: -+ if response == Gtk.ResponseType.OK: - self.add(dialog.get_filename()) + if response == gtk.RESPONSE_OK: +@@ -178,14 +176,13 @@ class modulesPage(semanagePage): dialog.destroy() def add(self, file): @@ -1530,21 +1358,10 @@ index 37c1472..9854fb2 100644 False diff --git a/policycoreutils-2.4/gui/polgengui.py b/policycoreutils-2.4/gui/polgengui.py -index 0f0e564..e3c5594 100644 +index 0f0e564..1b88c47 100644 --- a/policycoreutils-2.4/gui/polgengui.py +++ b/policycoreutils-2.4/gui/polgengui.py -@@ -22,37 +22,23 @@ - # - import signal - import string --import gtk --import gtk.glade -+from gi.repository import Gtk -+import Gtk.glade - import os --import gobject -+from gi.repository import GObject - import gnome +@@ -30,29 +30,15 @@ import gnome import sys try: from sepolicy import generate @@ -1588,18 +1405,6 @@ index 0f0e564..e3c5594 100644 gnome.program_init("SELinux Policy Generation Tool", "5") -@@ -85,9 +71,9 @@ def foreach(model, path, iter, selected): - ## Pull in the Glade file - ## - if os.access("polgen.glade", os.F_OK): -- xml = gtk.glade.XML ("polgen.glade", domain=PROGNAME) -+ xml = Gtk.glade.XML ("polgen.glade", domain=PROGNAME) - else: -- xml = gtk.glade.XML ("/usr/share/system-config-selinux/polgen.glade", domain=PROGNAME) -+ xml = Gtk.glade.XML ("/usr/share/system-config-selinux/polgen.glade", domain=PROGNAME) - - FILE = 1 - DIR = 2 @@ -191,10 +177,10 @@ class childWindow: try: @@ -1613,7 +1418,7 @@ index 0f0e564..e3c5594 100644 self.all_types = [] self.all_modules = [] self.all_roles = [] -@@ -262,31 +248,31 @@ class childWindow: +@@ -262,7 +248,7 @@ class childWindow: self.out_udp_entry = self.xml.get_widget("out_udp_entry") self.network_buttons[self.out_udp_all_checkbutton] = [ self.out_udp_entry ] @@ -1622,85 +1427,6 @@ index 0f0e564..e3c5594 100644 b.connect("clicked",self.network_all_clicked) self.boolean_treeview = self.xml.get_widget("boolean_treeview") -- self.boolean_store = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING) -+ self.boolean_store = Gtk.ListStore(GObject.TYPE_STRING,GObject.TYPE_STRING) - self.boolean_treeview.set_model(self.boolean_store) -- self.boolean_store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Name"), gtk.CellRendererText(), text = 0) -+ self.boolean_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Name"), Gtk.CellRendererText(), text = 0) - self.boolean_treeview.append_column(col) -- col = gtk.TreeViewColumn(_("Description"), gtk.CellRendererText(), text = 1) -+ col = Gtk.TreeViewColumn(_("Description"), Gtk.CellRendererText(), text = 1) - self.boolean_treeview.append_column(col) - - self.role_treeview = self.xml.get_widget("role_treeview") -- self.role_store = gtk.ListStore(gobject.TYPE_STRING) -+ self.role_store = Gtk.ListStore(GObject.TYPE_STRING) - self.role_treeview.set_model(self.role_store) -- self.role_treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) -- self.role_store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Role"), gtk.CellRendererText(), text = 0) -+ self.role_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) -+ self.role_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Role"), Gtk.CellRendererText(), text = 0) - self.role_treeview.append_column(col) - - self.existing_user_treeview = self.xml.get_widget("existing_user_treeview") -- self.existing_user_store = gtk.ListStore(gobject.TYPE_STRING) -+ self.existing_user_store = Gtk.ListStore(GObject.TYPE_STRING) - self.existing_user_treeview.set_model(self.existing_user_store) -- self.existing_user_store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Existing_User"), gtk.CellRendererText(), text = 0) -+ self.existing_user_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Existing_User"), Gtk.CellRendererText(), text = 0) - self.existing_user_treeview.append_column(col) - - for i in self.all_roles: -@@ -296,19 +282,19 @@ class childWindow: - self.in_tcp_reserved_checkbutton = xml.get_widget ("in_tcp_reserved_checkbutton") - - self.transition_treeview = self.xml.get_widget("transition_treeview") -- self.transition_store = gtk.ListStore(gobject.TYPE_STRING) -+ self.transition_store = Gtk.ListStore(GObject.TYPE_STRING) - self.transition_treeview.set_model(self.transition_store) -- self.transition_treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) -- self.transition_store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Application"), gtk.CellRendererText(), text = 0) -+ self.transition_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) -+ self.transition_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text = 0) - self.transition_treeview.append_column(col) - - self.user_transition_treeview = self.xml.get_widget("user_transition_treeview") -- self.user_transition_store = gtk.ListStore(gobject.TYPE_STRING) -+ self.user_transition_store = Gtk.ListStore(GObject.TYPE_STRING) - self.user_transition_treeview.set_model(self.user_transition_store) -- self.user_transition_treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) -- self.user_transition_store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Application"), gtk.CellRendererText(), text = 0) -+ self.user_transition_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) -+ self.user_transition_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text = 0) - self.user_transition_treeview.append_column(col) - - for i in self.all_users: -@@ -318,11 +304,11 @@ class childWindow: - self.existing_user_store.set_value(iter, 0, i[:-2]) - - self.admin_treeview = self.xml.get_widget("admin_treeview") -- self.admin_store = gtk.ListStore(gobject.TYPE_STRING) -+ self.admin_store = Gtk.ListStore(GObject.TYPE_STRING) - self.admin_treeview.set_model(self.admin_store) -- self.admin_treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) -- self.admin_store.set_sort_column_id(0, gtk.SORT_ASCENDING) -- col = gtk.TreeViewColumn(_("Application"), gtk.CellRendererText(), text = 0) -+ self.admin_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) -+ self.admin_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) -+ col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text = 0) - self.admin_treeview.append_column(col) - - try: @@ -333,7 +319,7 @@ class childWindow: for a in sepolicy.interface.get_admin(): iter = self.admin_store.append() @@ -1710,67 +1436,6 @@ index 0f0e564..e3c5594 100644 self.error(e.message) def confine_application(self): -@@ -372,17 +358,17 @@ class childWindow: - - if self.pages[type][self.current_page] == self.FINISH_PAGE: - self.generate_policy() -- self.xml.get_widget ("cancel_button").set_label(gtk.STOCK_CLOSE) -+ self.xml.get_widget ("cancel_button").set_label(Gtk.STOCK_CLOSE) - else: - self.current_page = self.current_page + 1 - self.notebook.set_current_page(self.pages[type][self.current_page]) - if self.pages[type][self.current_page] == self.FINISH_PAGE: -- self.forward_button.set_label(gtk.STOCK_APPLY) -+ self.forward_button.set_label(Gtk.STOCK_APPLY) - - def back(self,arg): - type = self.get_type() - if self.pages[type][self.current_page] == self.FINISH_PAGE: -- self.forward_button.set_label(gtk.STOCK_GO_FORWARD) -+ self.forward_button.set_label(Gtk.STOCK_GO_FORWARD) - - self.current_page = self.current_page - 1 - self.notebook.set_current_page(self.pages[type][self.current_page]) -@@ -395,30 +381,30 @@ class childWindow: - b.set_sensitive(not active) - - def verify(self, message, title="" ): -- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, -- gtk.BUTTONS_YES_NO, -+ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, -+ Gtk.ButtonsType.YES_NO, - message) - dlg.set_title(title) -- dlg.set_position(gtk.WIN_POS_MOUSE) -+ dlg.set_position(Gtk.WindowPosition.MOUSE) - dlg.show_all() - rc = dlg.run() - dlg.destroy() - return rc - - def info(self, message): -- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, -- gtk.BUTTONS_OK, -+ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, -+ Gtk.ButtonsType.OK, - message) -- dlg.set_position(gtk.WIN_POS_MOUSE) -+ dlg.set_position(Gtk.WindowPosition.MOUSE) - dlg.show_all() - dlg.run() - dlg.destroy() - - def error(self, message): -- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, -- gtk.BUTTONS_CLOSE, -+ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, -+ Gtk.ButtonsType.CLOSE, - message) -- dlg.set_position(gtk.WIN_POS_MOUSE) -+ dlg.set_position(Gtk.WindowPosition.MOUSE) - dlg.show_all() - dlg.run() - dlg.destroy() @@ -519,7 +505,7 @@ class childWindow: self.info(my_policy.generate(outputdir)) @@ -1780,116 +1445,6 @@ index 0f0e564..e3c5594 100644 self.error(e.message) def delete(self, args): -@@ -539,7 +525,7 @@ class childWindow: - self.boolean_description_entry.set_text("") - rc = self.boolean_dialog.run() - self.boolean_dialog.hide() -- if rc == gtk.RESPONSE_CANCEL: -+ if rc == Gtk.ResponseType.CANCEL: - return - iter = self.boolean_store.append() - self.boolean_store.set_value(iter, 0, self.boolean_name_entry.get_text()) -@@ -548,7 +534,7 @@ class childWindow: - def __add(self,type): - rc = self.file_dialog.run() - self.file_dialog.hide() -- if rc == gtk.RESPONSE_CANCEL: -+ if rc == Gtk.ResponseType.CANCEL: - return - for i in self.file_dialog.get_filenames(): - iter = self.store.append() -@@ -558,29 +544,29 @@ class childWindow: - def exec_select(self, args): - self.file_dialog.set_select_multiple(0) - self.file_dialog.set_title(_("Select executable file to be confined.")) -- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) -+ self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) - self.file_dialog.set_current_folder("/usr/sbin") - rc = self.file_dialog.run() - self.file_dialog.hide() -- if rc == gtk.RESPONSE_CANCEL: -+ if rc == Gtk.ResponseType.CANCEL: - return - self.exec_entry.set_text(self.file_dialog.get_filename()) - - def init_script_select(self, args): - self.file_dialog.set_select_multiple(0) - self.file_dialog.set_title(_("Select init script file to be confined.")) -- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) -+ self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) - self.file_dialog.set_current_folder("/etc/rc.d/init.d") - rc = self.file_dialog.run() - self.file_dialog.hide() -- if rc == gtk.RESPONSE_CANCEL: -+ if rc == Gtk.ResponseType.CANCEL: - return - self.init_script_entry.set_text(self.file_dialog.get_filename()) - - def add(self, args): - self.file_dialog.set_title(_("Select file(s) that confined application creates or writes")) - self.file_dialog.set_current_folder("/") -- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) -+ self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) - self.file_dialog.set_select_multiple(1) - self.__add(FILE) - -@@ -588,7 +574,7 @@ class childWindow: - self.file_dialog.set_title(_("Select directory(s) that the confined application owns and writes into")) - self.file_dialog.set_current_folder("/") - self.file_dialog.set_select_multiple(1) -- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) -+ self.file_dialog.set_action(Gtk.FileChooserAction.SELECT_FOLDER) - self.__add(DIR) - - def on_about_clicked(self, args): -@@ -597,7 +583,7 @@ class childWindow: - dlg.hide () - - def quit(self, args): -- gtk.main_quit() -+ Gtk.main_quit() - - def setupScreen(self): - # Bring in widgets from glade file. -@@ -639,20 +625,20 @@ class childWindow: - self.view = self.xml.get_widget("write_treeview") - self.file_dialog = self.xml.get_widget("filechooserdialog") - -- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) -+ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_INT) - self.view.set_model(self.store) -- col = gtk.TreeViewColumn("", gtk.CellRendererText(), text = 0) -+ col = Gtk.TreeViewColumn("", Gtk.CellRendererText(), text = 0) - col.set_resizable(True) - self.view.append_column(col) - self.view.get_selection().select_path ((0,)) - - def output_button_clicked(self, *args): - self.file_dialog.set_title(_("Select directory to generate policy files in")) -- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) -+ self.file_dialog.set_action(Gtk.FileChooserAction.SELECT_FOLDER) - self.file_dialog.set_select_multiple(0) - rc = self.file_dialog.run() - self.file_dialog.hide() -- if rc == gtk.RESPONSE_CANCEL: -+ if rc == Gtk.ResponseType.CANCEL: - return - self.output_entry.set_text(self.file_dialog.get_filename()) - -@@ -664,11 +650,11 @@ class childWindow: - name = entry.get_text() - if self.name != name: - if name in self.all_types: -- if self.verify(_("Type %s_t already defined in current policy.\nDo you want to continue?") % name, _("Verify Name")) == gtk.RESPONSE_NO: -+ if self.verify(_("Type %s_t already defined in current policy.\nDo you want to continue?") % name, _("Verify Name")) == Gtk.ResponseType.NO: - entry.set_text("") - return False - if name in self.all_modules: -- if self.verify(_("Module %s.pp already loaded in current policy.\nDo you want to continue?") % name, _("Verify Name")) == gtk.RESPONSE_NO: -+ if self.verify(_("Module %s.pp already loaded in current policy.\nDo you want to continue?") % name, _("Verify Name")) == Gtk.ResponseType.NO: - entry.set_text("") - return False - @@ -687,7 +673,7 @@ class childWindow: try: generate.verify_ports(self.in_tcp_entry.get_text()) @@ -1923,17 +1478,8 @@ index 0f0e564..e3c5594 100644 iter = self.store.append() self.store.set_value(iter, 0, f) self.store.set_value(iter, 1, DIR) -@@ -759,7 +745,7 @@ class childWindow: - self.mainWindow.connect("destroy", self.quit) - - self.mainWindow.show_all() -- gtk.main() -+ Gtk.main() - - if __name__ == "__main__": - signal.signal (signal.SIGINT, signal.SIG_DFL) diff --git a/policycoreutils-2.4/gui/portsPage.py b/policycoreutils-2.4/gui/portsPage.py -index bfb4e36..c2a6e38 100644 +index bfb4e36..e6c87c5 100644 --- a/policycoreutils-2.4/gui/portsPage.py +++ b/policycoreutils-2.4/gui/portsPage.py @@ -16,14 +16,11 @@ @@ -1941,14 +1487,11 @@ index bfb4e36..c2a6e38 100644 ## Author: Dan Walsh -import string --import gtk --import gtk.glade + import gtk + import gtk.glade -import os --import gobject + import gobject -import sys -+from gi.repository import Gtk -+import Gtk.glade -+from gi.repository import GObject import seobject -import commands +import subprocess @@ -1966,7 +1509,7 @@ index bfb4e36..c2a6e38 100644 class portsPage(semanagePage): def __init__(self, xml): -@@ -62,43 +59,43 @@ class portsPage(semanagePage): +@@ -62,19 +59,19 @@ class portsPage(semanagePage): self.ports_properties_button = xml.get_widget("portsPropertiesButton") self.ports_delete_button = xml.get_widget("portsDeleteButton") liststore = self.ports_protocol_combo.get_model() @@ -1991,38 +1534,7 @@ index bfb4e36..c2a6e38 100644 + self.group_load(filt) def init_store(self): -- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING , gobject.TYPE_STRING) -+ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING , GObject.TYPE_STRING) - self.view.set_model(self.store) -- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) -+ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) - - self.view.set_search_equal_func(self.search) -- col = gtk.TreeViewColumn(_("SELinux Port\nType"), gtk.CellRendererText(), text = TYPE_COL) -+ col = Gtk.TreeViewColumn(_("SELinux Port\nType"), Gtk.CellRendererText(), text = TYPE_COL) - col.set_sort_column_id(TYPE_COL) - col.set_resizable(True) - self.view.append_column(col) -- self.store.set_sort_column_id(TYPE_COL, gtk.SORT_ASCENDING) -+ self.store.set_sort_column_id(TYPE_COL, Gtk.SortType.ASCENDING) - -- col = gtk.TreeViewColumn(_("Protocol"), gtk.CellRendererText(), text = PROTOCOL_COL) -+ col = Gtk.TreeViewColumn(_("Protocol"), Gtk.CellRendererText(), text = PROTOCOL_COL) - col.set_sort_column_id(PROTOCOL_COL) - col.set_resizable(True) - self.view.append_column(col) - -- self.mls_col = gtk.TreeViewColumn(_("MLS/MCS\nLevel"), gtk.CellRendererText(), text = MLS_COL) -+ self.mls_col = Gtk.TreeViewColumn(_("MLS/MCS\nLevel"), Gtk.CellRendererText(), text = MLS_COL) - self.mls_col.set_resizable(True) - self.mls_col.set_sort_column_id(MLS_COL) - self.view.append_column(self.mls_col) - -- col = gtk.TreeViewColumn(_("Port"), gtk.CellRendererText(), text = PORT_COL) -+ col = Gtk.TreeViewColumn(_("Port"), Gtk.CellRendererText(), text = PORT_COL) - col.set_sort_column_id(PORT_COL) - col.set_resizable(True) - self.view.append_column(col) + self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING , gobject.TYPE_STRING) @@ -116,43 +113,43 @@ class portsPage(semanagePage): except: return 0 @@ -2223,24 +1735,10 @@ index bfb4e36..c2a6e38 100644 def on_group_clicked(self, button): self.ports_add_button.set_sensitive(self.group) diff --git a/policycoreutils-2.4/gui/semanagePage.py b/policycoreutils-2.4/gui/semanagePage.py -index 3a0e478..9a5a4d2 100644 +index 3a0e478..040a4f8 100644 --- a/policycoreutils-2.4/gui/semanagePage.py +++ b/policycoreutils-2.4/gui/semanagePage.py -@@ -17,10 +17,10 @@ - - ## Author: Dan Walsh - import string --import gtk --import gtk.glade -+from gi.repository import Gtk -+import Gtk.glade - import os --import gobject -+from gi.repository import GObject - import sys - import seobject - -@@ -37,19 +37,19 @@ try: +@@ -37,8 +37,8 @@ try: unicode=False, codeset = 'utf-8') except IOError: @@ -2250,22 +1748,7 @@ index 3a0e478..9a5a4d2 100644 + builtins.__dict__['_'] = str def idle_func(): -- while gtk.events_pending(): -- gtk.main_iteration() -+ while Gtk.events_pending(): -+ Gtk.main_iteration() - - class semanagePage: - def __init__(self, xml, name, description): - self.xml = xml - self.window = self.xml.get_widget("mainWindow").get_root_window() -- self.busy_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) -- self.ready_cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) -+ self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) -+ self.ready_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) - - self.local = False - self.view = xml.get_widget("%sView" % name) + while gtk.events_pending(): @@ -77,9 +77,9 @@ class semanagePage: return @@ -2279,40 +1762,14 @@ index 3a0e478..9a5a4d2 100644 def search(self, model, col, key, i): sort_col = self.store.get_sort_column_id()[0] -@@ -102,57 +102,81 @@ class semanagePage: - self.propertiesDialog() - - def verify(self, message, title="" ): -- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, -- gtk.BUTTONS_YES_NO, -+ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, -+ Gtk.ButtonsType.YES_NO, - message) - dlg.set_title(title) -- dlg.set_position(gtk.WIN_POS_MOUSE) -+ dlg.set_position(Gtk.WindowPosition.MOUSE) - dlg.show_all() - rc = dlg.run() - dlg.destroy() - return rc - - def error(self, message): -- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, -- gtk.BUTTONS_CLOSE, -+ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, -+ Gtk.ButtonsType.CLOSE, - message) -- dlg.set_position(gtk.WIN_POS_MOUSE) -+ dlg.set_position(Gtk.WindowPosition.MOUSE) - dlg.show_all() - dlg.run() +@@ -122,13 +122,37 @@ class semanagePage: dlg.destroy() def deleteDialog(self): - store, iter = self.view.get_selection().get_selected() - if self.verify(_("Are you sure you want to delete %s '%s'?" % (self.description, store.get_value(iter, 0))), _("Delete %s" % self.description)) == gtk.RESPONSE_YES: + store, it = self.view.get_selection().get_selected() -+ if self.verify(_("Are you sure you want to delete %s '%s'?" % (self.description, store.get_value(it, 0))), _("Delete %s" % self.description)) == Gtk.ResponseType.YES: ++ if self.verify(_("Are you sure you want to delete %s '%s'?" % (self.description, store.get_value(it, 0))), _("Delete %s" % self.description)) == gtk.RESPONSE_YES: self.delete() def use_menus(self): @@ -2345,11 +1802,9 @@ index 3a0e478..9a5a4d2 100644 def addDialog(self): self.dialogClear() self.dialog.set_title(_("Add %s" % self.description)) -- self.dialog.set_position(gtk.WIN_POS_MOUSE) -+ self.dialog.set_position(Gtk.WindowPosition.MOUSE) +@@ -136,10 +160,10 @@ class semanagePage: -- while self.dialog.run() == gtk.RESPONSE_OK: -+ while self.dialog.run() == Gtk.ResponseType.OK: + while self.dialog.run() == gtk.RESPONSE_OK: try: - if self.add() == False: + if not self.add(): @@ -2360,13 +1815,9 @@ index 3a0e478..9a5a4d2 100644 self.error(e.args[0]) self.dialog.hide() - def propertiesDialog(self): - self.dialogInit() - self.dialog.set_title(_("Modify %s" % self.description)) -- self.dialog.set_position(gtk.WIN_POS_MOUSE) -- while self.dialog.run() == gtk.RESPONSE_OK: -+ self.dialog.set_position(Gtk.WindowPosition.MOUSE) -+ while self.dialog.run() == Gtk.ResponseType.OK: +@@ -149,10 +173,10 @@ class semanagePage: + self.dialog.set_position(gtk.WIN_POS_MOUSE) + while self.dialog.run() == gtk.RESPONSE_OK: try: - if self.modify() == False: + if not self.modify(): @@ -2378,7 +1829,7 @@ index 3a0e478..9a5a4d2 100644 self.dialog.hide() diff --git a/policycoreutils-2.4/gui/statusPage.py b/policycoreutils-2.4/gui/statusPage.py -index 02685f2..0bdc5bf 100644 +index 02685f2..6510d2a 100644 --- a/policycoreutils-2.4/gui/statusPage.py +++ b/policycoreutils-2.4/gui/statusPage.py @@ -16,18 +16,14 @@ @@ -2386,10 +1837,8 @@ index 02685f2..0bdc5bf 100644 ## Author: Dan Walsh -import string --import gtk --import gtk.glade -+from gi.repository import Gtk -+import Gtk.glade + import gtk + import gtk.glade import os -import gobject import sys @@ -2413,20 +1862,7 @@ index 02685f2..0bdc5bf 100644 class statusPage: def __init__(self, xml): -@@ -117,48 +113,48 @@ class statusPage: - os.unlink(RELABELFILE) - - def verify(self, message): -- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, -- gtk.BUTTONS_YES_NO, -+ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, -+ Gtk.ButtonsType.YES_NO, - message) -- dlg.set_position(gtk.WIN_POS_MOUSE) -+ dlg.set_position(Gtk.WindowPosition.MOUSE) - dlg.show_all() - rc = dlg.run() - dlg.destroy() +@@ -127,21 +123,21 @@ class statusPage: return rc def typemenu_changed(self, menu): @@ -2434,9 +1870,8 @@ index 02685f2..0bdc5bf 100644 + setype = self.get_type() enabled = self.enabledOptionMenu.get_active() - if self.initialtype != type: -- if self.verify(_("Changing the policy type will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == gtk.RESPONSE_NO: + if self.initialtype != setype: -+ if self.verify(_("Changing the policy type will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == Gtk.ResponseType.NO: + if self.verify(_("Changing the policy type will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == gtk.RESPONSE_NO: menu.set_active(self.typeHistory) return None @@ -2452,15 +1887,8 @@ index 02685f2..0bdc5bf 100644 + setype = self.get_type() if self.initEnabled != DISABLED and enabled == DISABLED: -- if self.verify(_("Changing to SELinux disabled requires a reboot. It is not recommended. If you later decide to turn SELinux back on, the system will be required to relabel. If you just want to see if SELinux is causing a problem on your system, you can go to permissive mode which will only log errors and not enforce SELinux policy. Permissive mode does not require a reboot Do you wish to continue?")) == gtk.RESPONSE_NO: -+ if self.verify(_("Changing to SELinux disabled requires a reboot. It is not recommended. If you later decide to turn SELinux back on, the system will be required to relabel. If you just want to see if SELinux is causing a problem on your system, you can go to permissive mode which will only log errors and not enforce SELinux policy. Permissive mode does not require a reboot Do you wish to continue?")) == Gtk.ResponseType.NO: - combo.set_active(self.enabled) - return None - - if self.initEnabled == DISABLED and enabled < 2: -- if self.verify(_("Changing to SELinux enabled will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == gtk.RESPONSE_NO: -+ if self.verify(_("Changing to SELinux enabled will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == Gtk.ResponseType.NO: - combo.set_active(self.enabled) + if self.verify(_("Changing to SELinux disabled requires a reboot. It is not recommended. If you later decide to turn SELinux back on, the system will be required to relabel. If you just want to see if SELinux is causing a problem on your system, you can go to permissive mode which will only log errors and not enforce SELinux policy. Permissive mode does not require a reboot Do you wish to continue?")) == gtk.RESPONSE_NO: +@@ -154,11 +150,11 @@ class statusPage: return None self.relabel_checkbutton.set_active(True) @@ -2485,31 +1913,22 @@ index 02685f2..0bdc5bf 100644 fd.write(l) fd.close() diff --git a/policycoreutils-2.4/gui/system-config-selinux.py b/policycoreutils-2.4/gui/system-config-selinux.py -index bc3027e..b4bfe5c 100644 +index bc3027e..9482fa5 100644 --- a/policycoreutils-2.4/gui/system-config-selinux.py +++ b/policycoreutils-2.4/gui/system-config-selinux.py -@@ -24,15 +24,15 @@ import signal - import string +@@ -25,9 +25,9 @@ import string import sys try: -- import gtk + import gtk -except RuntimeError, e: - print "system-config-selinux:", e - print "This is a graphical application and requires DISPLAY to be set." -+ from gi.repository import Gtk +except RuntimeError as e: + print("system-config-selinux:", e) + print("This is a graphical application and requires DISPLAY to be set.") sys.exit (1) --import gtk.glade -+import Gtk.glade - import os --import gobject -+from gi.repository import GObject - import gnome - import statusPage - import booleansPage + import gtk.glade @@ -57,8 +57,8 @@ try: unicode=False, codeset = 'utf-8') @@ -2521,18 +1940,6 @@ index bc3027e..b4bfe5c 100644 gnome.program_init("SELinux Management Tool", "5") -@@ -72,9 +72,9 @@ sys.path.append('/usr/share/system-config-selinux') - ## Pull in the Glade file - ## - if os.access("system-config-selinux.glade", os.F_OK): -- xml = gtk.glade.XML ("system-config-selinux.glade", domain=PROGNAME) -+ xml = Gtk.glade.XML ("system-config-selinux.glade", domain=PROGNAME) - else: -- xml = gtk.glade.XML ("/usr/share/system-config-selinux/system-config-selinux.glade", domain=PROGNAME) -+ xml = Gtk.glade.XML ("/usr/share/system-config-selinux/system-config-selinux.glade", domain=PROGNAME) - - class childWindow: - def __init__(self): @@ -95,7 +95,7 @@ class childWindow: self.add_page(portsPage.portsPage(xml)) self.add_page(modulesPage.modulesPage(xml)) # modules @@ -2542,52 +1949,8 @@ index bc3027e..b4bfe5c 100644 self.error(e.message) xml.signal_connect("on_quit_activate", self.destroy) -@@ -108,10 +108,10 @@ class childWindow: - self.delete_menu = xml.get_widget("delete_menu_item") - - def error(self, message): -- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, -- gtk.BUTTONS_CLOSE, -+ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, -+ Gtk.ButtonsType.CLOSE, - message) -- dlg.set_position(gtk.WIN_POS_MOUSE) -+ dlg.set_position(Gtk.WindowPosition.MOUSE) - dlg.show_all() - dlg.run() - dlg.destroy() -@@ -142,7 +142,7 @@ class childWindow: - dlg.hide () - - def destroy(self, args): -- gtk.main_quit() -+ Gtk.main_quit() - - def use_menus(self, use_menus): - self.add_menu.set_sensitive(use_menus) -@@ -165,9 +165,9 @@ class childWindow: - self.notebook = self.xml.get_widget("notebook") - self.view = self.xml.get_widget("selectView") - self.view.get_selection().connect("changed", self.itemSelected) -- self.store = gtk.ListStore(gobject.TYPE_STRING) -+ self.store = Gtk.ListStore(GObject.TYPE_STRING) - self.view.set_model(self.store) -- col = gtk.TreeViewColumn("", gtk.CellRendererText(), text = 0) -+ col = Gtk.TreeViewColumn("", Gtk.CellRendererText(), text = 0) - col.set_resizable(True) - self.view.append_column(col) - -@@ -184,7 +184,7 @@ class childWindow: - self.mainWindow.connect("destroy", self.destroy) - - self.mainWindow.show_all() -- gtk.main() -+ Gtk.main() - - if __name__ == "__main__": - signal.signal (signal.SIGINT, signal.SIG_DFL) diff --git a/policycoreutils-2.4/gui/usersPage.py b/policycoreutils-2.4/gui/usersPage.py -index 93804ac..697d5b1 100644 +index 93804ac..1451903 100644 --- a/policycoreutils-2.4/gui/usersPage.py +++ b/policycoreutils-2.4/gui/usersPage.py @@ -16,13 +16,10 @@ @@ -2595,20 +1958,17 @@ index 93804ac..697d5b1 100644 ## Author: Dan Walsh -import string --import gtk --import gtk.glade + import gtk + import gtk.glade -import os --import gobject + import gobject -import sys -import commands -+from gi.repository import Gtk -+import Gtk.glade -+from gi.repository import GObject +import subprocess import seobject from semanagePage import *; -@@ -36,27 +33,27 @@ gettext.textdomain(PROGNAME) +@@ -36,8 +33,8 @@ gettext.textdomain(PROGNAME) try: gettext.install(PROGNAME, localedir="/usr/share/locale", unicode=1) except IOError: @@ -2619,30 +1979,6 @@ index 93804ac..697d5b1 100644 class usersPage(semanagePage): def __init__(self, xml): - semanagePage.__init__(self, xml, "users", _("SELinux User")) - -- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) -+ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) - self.view.set_model(self.store) -- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) -+ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) - -- col = gtk.TreeViewColumn(_("SELinux\nUser"), gtk.CellRendererText(), text = 0) -+ col = Gtk.TreeViewColumn(_("SELinux\nUser"), Gtk.CellRendererText(), text = 0) - col.set_sort_column_id(0) - col.set_resizable(True) - self.view.append_column(col) - -- col = gtk.TreeViewColumn(_("MLS/\nMCS Range"), gtk.CellRendererText(), text = 1) -+ col = Gtk.TreeViewColumn(_("MLS/\nMCS Range"), Gtk.CellRendererText(), text = 1) - col.set_resizable(True) - self.view.append_column(col) - -- col = gtk.TreeViewColumn(_("SELinux Roles"), gtk.CellRendererText(), text = 2) -+ col = Gtk.TreeViewColumn(_("SELinux Roles"), Gtk.CellRendererText(), text = 2) - col.set_resizable(True) - self.view.append_column(col) - @@ -65,34 +62,30 @@ class usersPage(semanagePage): self.mlsRangeEntry = xml.get_widget("mlsRangeEntry") self.selinuxRolesEntry = xml.get_widget("selinuxRolesEntry") @@ -661591,7 +660927,7 @@ index 6b53035..a06c6c4 100644 out += "%s # %s\n" % (self.write_te(out_dir), _("Type Enforcement file")) out += "%s # %s\n" % (self.write_if(out_dir), _("Interface file")) diff --git a/policycoreutils-2.4/sepolicy/sepolicy/gui.py b/policycoreutils-2.4/sepolicy/sepolicy/gui.py -index 5ca87b9..da826e0 100644 +index 5ca87b9..4437d9e 100644 --- a/policycoreutils-2.4/sepolicy/sepolicy/gui.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/gui.py @@ -1,4 +1,4 @@ @@ -661651,17 +660987,6 @@ index 5ca87b9..da826e0 100644 self.quit() self.init_cur() -@@ -130,8 +126,8 @@ class SELinuxGui(): - self.popup = 0 - self.applications_selection_button = builder.get_object("applications_selection_button") - self.revert_button = builder.get_object("Revert_button") -- self.busy_cursor = Gdk.Cursor(Gdk.CursorType.WATCH) -- self.ready_cursor = Gdk.Cursor(Gdk.CursorType.LEFT_PTR) -+ self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) -+ self.ready_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) - self.initialtype = selinux.selinux_getpolicytype()[1] - self.current_popup = None - self.import_export = None @@ -139,7 +135,7 @@ class SELinuxGui(): self.files_add = False self.network_add = False diff --git a/policycoreutils.spec b/policycoreutils.spec index 2cc1269..40b46c2 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -7,7 +7,7 @@ Summary: SELinux policy core utilities Name: policycoreutils Version: 2.4 -Release: 13%{?dist} +Release: 14%{?dist} License: GPLv2 Group: System Environment/Base # https://github.com/SELinuxProject/selinux/wiki/Releases @@ -18,7 +18,7 @@ Source2: policycoreutils_man_ru2.tar.bz2 Source3: system-config-selinux.png Source4: sepolicy-icons.tgz # use make-rhat-patches.sh to create following patches from https://github.com/fedora-selinux/selinux/ -# HEAD https://github.com/fedora-selinux/selinux/commit/2722bc1a30abda48574d87c06413d1219f74d2de +# HEAD https://github.com/fedora-selinux/selinux/commit/e4cbbd53b5639def20ae09f3db44afa4691c7460 Patch: policycoreutils-rhat.patch Patch1: sepolgen-rhat.patch Patch100: policycoreutils-fix-semanage-python3.patch @@ -404,6 +404,9 @@ The policycoreutils-restorecond package contains the restorecond service. %systemd_postun_with_restart restorecond.service %changelog +* Thu Oct 08 2015 Petr Lautrbach 2.4-14 +- Revert the attempt to port -gui to GTK 3 (#1269328, #1266059) + * Fri Oct 02 2015 Petr Lautrbach 2.4-13 - newrole: Set keepcaps around setresuid calls - newrole: Open stdin as read/write