This experience was based on Micah Carrick post, and I received help from Vincent Untz, Ryan Lortie and David King while I was trying to understand about GSettings and how lockdown works with GSettings. I learned also that this is all delegated to the backend used by GSettings: dconf.
* Before all else, in case you see ‘(your environment path)’, you must replace $(prefix) by what’s appropriate in ‘your environment’.
As the Micah tutorial says “The first step is to create a schema to define the application’s configuration settings. ” He did a great example of creating schema for apps ( applications ).
* In my case, I wanted to work with schemas for gnome-tweak-tool, so I started to analyse the tree and I did realize about the structure used in dconf. I first got shell in the tree: org – gnome – shell [Figure 01] with its schema org.gnome.shell and I also noticed that there are so much to do, I only found two of six “sub schemas for shell”. These were:
– Show date in clock with its schema org.gnome.shell.clock [Figure 02]
– Show the week date in the calendar with its schema org.gnome.shell.calendar[Figure 03]
[ Figure 01]
[ Figure 02]
[ Figure 03]
* I learned that gsettings works with schemas and keys, so I was looking for those schemas in share/glib-2.0/schemas. This is the list I found:
gschema.dtd org.gnome.desktop.enums.xml org.gnome.desktop.thumbnailers.gschema.xml
gschemas.compiled org.gnome.desktop.interface.gschema.xml org.gnome.desktop.wm.keybindings.gschema.xml
org.gnome.desktop.a11y.applications.gschema.xml org.gnome.desktop.lockdown.gschema.xml org.gnome.desktop.wm.preferences.gschema.xml
org.gnome.desktop.a11y.keyboard.gschema.xml org.gnome.desktop.media-handling.gschema.xml org.gnome.system.locale.gschema.xml
org.gnome.desktop.a11y.magnifier.gschema.xml org.gnome.desktop.screensaver.gschema.xml org.gnome.system.proxy.gschema.xml
org.gnome.desktop.a11y.mouse.gschema.xml org.gnome.desktop.session.gschema.xml org.gtk.Demo.gschema.xml
org.gnome.desktop.background.gschema.xml org.gnome.desktop.sound.gschema.xml org.gtk.Settings.ColorChooser.gschema.xml
org.gnome.desktop.default-applications.gschema.xml org.gnome.desktop.thumbnail-cache.gschema.xml org.gtk.Settings.FileChooser.gschema.xml
* After my reading, I decided to work with org.gnome.desktop.interface.schema.xml
[ Figure 04]
I create a boolean setting using the schema: org.gnome.desktop.interface.gschema.xml. My boolean setting inserted was called “julita-setting”:
<?xml version="1.0" encoding="UTF-8"?> <schemalist gettext-domain="gsettings-desktop-schemas"> <schema path="/org/gnome/desktop/interface/" id="org.gnome.desktop.interface"> <key type="b" name="julita-settings"> <default>true</default> <summary>Julita setting</summary> <description>My first example of boolean setting.</description> </key> ... </schema> </schemalist>
This is usually compiled with glib-compile-schemas that usually lives in /usr/bin. In my case, using the environment, it was available in my bin.
glib-compile-schemas /(your environment path)/share/glib-2.0/schemas/
After the compilation, we must run dconf-editor in your little environment… and: [Figure 05]
Note *************************************************************************** If your environment is correctly configured (this happens automatically if you run “jhbuild shell”), then files in /(your environment path)/share/glib-2.0/schemas will be looked at too, in addition to the files in /usr/share/glib-2.0/schemas. This is what the XDG_DATA_DIRS environment variable is responsible for (when it is set). *****************************************************************************
Finally, the Python part. I searched some py files stored in /(your environment path)/lib/python2.7/site-packages/gtweak/tweaks, and I saw GSettingsComboTweak examples that set default values…. [Figure 06] shows an example of this through “icon-theme”
[Figure 06]
I added python code in /(your environment path)/lib/python2.7/site-packages/gtweak/tweaks and this is what I got: [Figure 07]
Pingback: GNOME was presented in the Technology Week in ICA, Perú | Sólo para Mí!