# Accessing mandatory/defaults settings with Ruby/GConf2?

**URL:** <https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331>\
**Category:** Ruby-Gnome 2\
**Created:** [February 11, 2010, 10:48pm UTC](https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331 "2010-02-11T22:48:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nigel\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aeb1de/32.png) [@Nigel\_K](https://www.ruby-forum.com/u/Nigel_K)\
**Post date:** [February 11, 2010, 10:48pm UTC](https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331/1 "2010-02-11T22:48:08Z")

</div>

I’m looking at possibly putting together a Puppet,  
[http://reductivelabs.com/trac/puppet/](http://reductivelabs.com/trac/puppet/) , native type for manipulating  
gconf2.

I’ve got the basic idea of Ruby/GConf2 down, but I can’t see an  
obvious way to manipulate the mandatory and defaults settings. Am I  
missing something obvious?

thanks in advance,

Nigel

---

<div class="post-metadata">

**Author:** ![Nigel\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aeb1de/32.png) [@Nigel\_K](https://www.ruby-forum.com/u/Nigel_K)\
**Post date:** [February 16, 2010, 6:11pm UTC](https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331/2 "2010-02-16T18:11:39Z")

</div>

On Thu, Feb 11, 2010 at 1:20 PM, Nigel K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m looking at possibly putting together a Puppet,  
> [http://reductivelabs.com/trac/puppet/](http://reductivelabs.com/trac/puppet/) , native type for manipulating  
> gconf2.
> 
> I’ve got the basic idea of Ruby/GConf2 down, but I can’t see an  
> obvious way to manipulate the mandatory and defaults settings. Am I  
> missing something obvious?
> 
> thanks in advance,

Any ideas?

---

<div class="post-metadata">

**Author:** ![Nigel\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aeb1de/32.png) [@Nigel\_K](https://www.ruby-forum.com/u/Nigel_K)\
**Post date:** [February 17, 2010, 10:20am UTC](https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331/3 "2010-02-17T10:20:51Z")

</div>

2010/2/16 Nigel K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Any ideas?

I’m a newby to GConf, but looking at  
[http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/desktop-guide/ch-intro-gconf-overview.html](http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/desktop-guide/ch-intro-gconf-overview.html)  
it seems you open different database.

In your case /etc/gconf/gconf.xml.mandatory.

Here is a little example :

require ‘gconf2’

mandatory\_engine =  
GConf::Engine.new(“xml:readonly:/etc/gconf/gconf.xml.mandatory”)  
mandatory\_client = GConf::Client.get\_for\_engine(mandatory\_engine)  
mandatory\_client.all\_entries(“/”).each do |entry|  
puts entry.key + " : " + entry.value  
end

Create a mandatory key before you try the program, and restart gconfd.  
Note I’m opening the DB readonly, you would want xml:readwrite if you  
want to write to it.

Hope it helps

Simon

---

<div class="post-metadata">

**Author:** ![Nigel\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aeb1de/32.png) [@Nigel\_K](https://www.ruby-forum.com/u/Nigel_K)\
**Post date:** [February 17, 2010, 2:14pm UTC](https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331/4 "2010-02-17T14:14:46Z")

</div>

By the way slightly off topic, but GConf will be replaced with another  
\*Conf I think? I wonder how difficult it would be for ruby-gnome to keep  
up with that (if what I wrote is true, that is)

---

<div class="post-metadata">

**Author:** ![Nigel\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aeb1de/32.png) [@Nigel\_K](https://www.ruby-forum.com/u/Nigel_K)\
**Post date:** [February 17, 2010, 3:56pm UTC](https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331/5 "2010-02-17T15:56:20Z")

</div>

2010/2/17 Marc H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> By the way slightly off topic, but GConf will be replaced with another  
> \*Conf I think? I wonder how difficult it would be for ruby-gnome to keep  
> up with that (if what I wrote is true, that is)

I never heard of a gconf replacement.

And you second question is quite vague :).

simon

---

<div class="post-metadata">

**Author:** ![Nigel\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aeb1de/32.png) [@Nigel\_K](https://www.ruby-forum.com/u/Nigel_K)\
**Post date:** [February 19, 2010, 3:51pm UTC](https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331/6 "2010-02-19T15:51:34Z")

</div>

2010/2/17 Simon A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 2010/2/17 Marc H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > By the way slightly off topic, but GConf will be replaced with another  
> > \*Conf I think? I wonder how difficult it would be for ruby-gnome to keep  
> > up with that (if what I wrote is true, that is)
> 
> I never heard of a gconf replacement.

Just for the record, it seems Gnome is indeed switching to a new  
settings engine.  
It’s still experimental though.

> **[\-](https://www.gnomejournal.org)**

> **[some nice gsettings facts](https://blogs.gnome.org/desrt/2009/06/09/some-nice-gsettings-facts/)**
>
> i haven't written about gsettings in a while. i've been working on it a lot though. i will now write about a couple of nice things that gsettings will do for you. many backends you can have many backends for gsettings. dconf is merely one of them....

Simon

---

<div class="post-metadata">

**Author:** ![Nigel\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aeb1de/32.png) [@Nigel\_K](https://www.ruby-forum.com/u/Nigel_K)\
**Post date:** [February 17, 2010, 3:16pm UTC](https://www.ruby-forum.com/t/accessing-mandatory-defaults-settings-with-ruby-gconf2/183331/7 "2010-02-17T15:16:31Z")

</div>

On Wed, Feb 17, 2010 at 1:20 AM, Simon A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > thanks in advance,
> > 
> > Any ideas?
> 
> I’m a newby to GConf, but looking at  
> [http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/desktop-guide/ch-intro-gconf-overview.html](http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/desktop-guide/ch-intro-gconf-overview.html)  
> it seems you open different database.
> 
> In your case /etc/gconf/gconf.xml.mandatory.
> 
> Here is a little example :

ah! Thanks, I was trying completely the wrong thing.

Much appreciated.
