1## mappingsPage.py - show selinux mappings
2## Copyright (C) 2006 Red Hat, Inc.
3
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18## Author: Dan Walsh
19import string
20import gtk
21import gtk.glade
22import os
23import gobject
24import sys
25import seobject
26
27##
28## I18N
29##
30PROGNAME="policycoreutils"
31import gettext
32gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
33gettext.textdomain(PROGNAME)
34try:
35    gettext.install(PROGNAME,
36                    localedir="/usr/share/locale",
37                    unicode=False,
38                    codeset = 'utf-8')
39except IOError:
40    import __builtin__
41    __builtin__.__dict__['_'] = unicode
42
43class loginsPage:
44    def __init__(self, xml):
45        self.xml = xml
46        self.view = xml.get_widget("mappingsView")
47        self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
48        self.store.set_sort_column_id(0, gtk.SORT_ASCENDING)
49        self.view.set_model(self.store)
50        self.login = loginRecords()
51        dict = self.login.get_all(0)
52        keys = dict.keys()
53        keys.sort()
54        for k in keys:
55            print "%-25s %-25s %-25s" % (k, dict[k][0], translate(dict[k][1]))
56