示例#1
0
    def __init__ (self):
        self.can_edit_mandatory = can_edit_mandatory ()
        self.client_mandatory = None

        if (self.can_edit_mandatory):
            engine = gconf.engine_get_for_address (GCONF_MANDATORY_SOURCE)
            self.client_mandatory = gconf.client_get_for_engine (engine)

        self.client = SafeGConfClient ()
示例#2
0
    def __init__(self, xml_backend_dir, description, parent_window):
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)

        self.backend_address = "xml:readonly:" + xml_backend_dir
        self.engine = gconf.engine_get_for_address("xml:readonly:" + xml_backend_dir)
        self.client = gconf.client_get_for_engine(self.engine)

        self.set_title(_("Profile settings: %s") % description)
        self.set_icon_name("sabayon")
        self.set_transient_for(parent_window)
        self.set_destroy_with_parent(True)
        self.set_default_size(480, 380)

        self.scrolled = gtk.ScrolledWindow()
        self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.scrolled.set_shadow_type(gtk.SHADOW_IN)
        self.scrolled.show()
        self.add(self.scrolled)

        self.__setup_treeview()
示例#3
0
def can_edit_mandatory ():
    try:
        engine = gconf.engine_get_for_address (GCONF_MANDATORY_SOURCE)
    except gobject.GError:
        return False

    if engine == None:
        return False

    try:
        #entry = engine.get_entry ("/apps/gconf-editor/can_edit_source",
        #                          None,
        #                          False)
        #gconf_engine_get_entry() is not wrapped. Ugly workaround:
        client = gconf.client_get_for_engine (engine)
        entry = client.get_entry ("/apps/gconf-editor/can_edit_source", "",
                                  False)
    except gobject.GError:
        return False

    if entry != None:
        return entry.get_is_writable ()

    return False
示例#4
0
# No mapping for gconf_client_recursive_unset()
def recursive_unset(client, dir):
    for entry in client.all_entries(dir):
        client.unset(entry.key)
    for subdir in client.all_dirs(dir):
        recursive_unset(client, subdir)


def get_client_and_address_for_path(path):
    try:
        os.makedirs(path)
    except OSError, err:
        if err.errno != errno.EEXIST:
            raise err
    address = "xml:readwrite:" + path
    engine = gconf.engine_get_for_address(address)
    return (gconf.client_get_for_engine(engine), address)


class GConfChange(userprofile.ProfileChange):
    """Encapsulates a change to a GConf key."""

    def __init__(self, source, key, value):
        """Construct a GConfChange from a GConfEntry."""
        userprofile.ProfileChange.__init__(self, source)
        self.key = key
        self.value = value
        self.mandatory = None

    def get_id(self):
        """Return the path to the GConf key which changed."""