Logo Search packages:      
Sourcecode: sabayon version File versions  Download package

def lib::sources::gconfsource::GConfSource::apply (   self,
  is_sabayon_session 
)

Apply the profile by writing the default and mandatory
sources location to ~/.gconf.path.defaults and
~/.gconf.path.mandatory.

Note that $(sysconfdir)/gconf/2/path needs to contain
something like the following in order for this to work:

include $(HOME)/.gconf.path.mandatory
xml:readwrite:$(HOME)/.gconf
include $(HOME)/.gconf.path.defaults

Reimplemented from lib::userprofile::ProfileSource.

Definition at line 268 of file gconfsource.py.

00268                                         :
        """Apply the profile by writing the default and mandatory
        sources location to ~/.gconf.path.defaults and
        ~/.gconf.path.mandatory.

        Note that $(sysconfdir)/gconf/2/path needs to contain
        something like the following in order for this to work:

        include $(HOME)/.gconf.path.mandatory
        xml:readwrite:$(HOME)/.gconf
        include $(HOME)/.gconf.path.defaults
        """
        def write_path_file (filename, source):
            """Write a GConf path file. First try writing to a
            temporary file and move it over the original. Failing
            that, write directly to the original.
            """
            dprint ("Writing GConf path file with '%s' to '%s'", source, filename)
            temp = filename + ".new"
            try:
                f = file (temp, "w")
            except:
                temp = None
                f = file (filename, "w")

            try:
                f.write (source + "\n")
                f.close ()
            except:
                if temp != None:
                    os.remove (temp)
                raise

            if temp != None:
                os.rename (temp, filename)

        storage_contents = self.storage.list (self.name)

        if ("GConf", ".gconf.xml.defaults") in storage_contents:
            self.storage.extract (".gconf.xml.defaults", self.home_dir, True)
        default_path = "xml:readonly:" + os.path.join (self.home_dir, ".gconf.xml.defaults");
        if is_sabayon_session:
            default_path = "xml:readonly:" + os.path.join (self.home_dir, ".gconf.xml.mandatory-alt") + "\n" + default_path
                                                  
        write_path_file (os.path.join (self.home_dir, ".gconf.path.defaults"), default_path)
        
        if ("GConf", ".gconf.xml.mandatory") in storage_contents:
            self.storage.extract (".gconf.xml.mandatory", self.home_dir, True)
        write_path_file (os.path.join (self.home_dir, ".gconf.path.mandatory"),
                         "xml:readonly:" + os.path.join (self.home_dir, ".gconf.xml.mandatory"))

        # FIXME: perhaps just kill -HUP it? It would really just be better
        #        if we could guarantee that there wasn't a gconfd already
        #        running.
        dprint ("Shutting down gconfd so it kill pick up new paths")
        os.system ("gconftool-2 --shutdown")

    def add_gconf_notify (self, key, handler, data):


Generated by  Doxygen 1.6.0   Back to index