SlideShare una empresa de Scribd logo
1 de 10
Descargar para leer sin conexión
Introducción a GSettings,
  DConf y otras historias

         Juanjo Marín
        jjmarin@gnome.org
¿Qué es GSettings?
    GNOME 1               →       GNOME 2                     →       GNOME 3
✔
    gnome_config              ✔
                                  GConf                           ✔
                                                                      Gsettings
✔
    Ficheros de texto         ✔
                                  Fragmentar la complejidad       ✔
                                                                      Separación entre la API y
    similares a los .INI de       de un fichero de texto en           el almacenamiento
    Windows                       una estructura de directorio
                                                                  ✔
                                                                      Mejora el rendimiento y
                              ✔
                                  Facilitar la gestión para           mayor flexibilidad
✔
    Solución simple
                                  mayor volúmen de
                                                                  ✔
                                                                      Opciones avanzadas:
                                  configuraciones.
                                                                  •
                                                                      sin restricciones de tipo con
                              ✔
                                  Introduce los esquemas y
                                                                      GVariant y enum
                                  las notificaciones de
                                  cambios                         •
                                                                      inicialización retardada
GSettingsBackends
●   DConf (por defecto en GNOME)
●   Windows Registry (por defecto en Windows)
●   Memory (sólo lectura, básicamente es un GHashTable. Es
    el fallback backend)
●   Keyfile (ficheros tipo .ini)
●   Delayed que se usa de forma interna para las aplicación
    retardada de configuraciones
●   Null para bloquear cualquier intento de escritura
●   Plist (ficheros plist, propierty list)
GVariant
●   La piedra angular sobre el que se basa Gsettings/Dconf es el
    tipo de datos Gvariant
●   Almacena un valor junto con información de su tipo
●   Puede ser consultado concurrentemente
●   Serialización eficiente
●   GVariant se basa en el tipo de datos de Dbus, pero introduce
    los tipos maybe/nullables(m) y los tipos indefinidos (*,?,r)
●   b=boolean, y=byte, n=int16, q=uint16, i=int32, u=uint32,
    x=int64, t=uint64, d=double, s=string
●
DConf
●   Propuesto como estándar en freedesktop
●   Optimizado para lectura (un inicio de sesión en GNOME supone
    cientos de lecturas y sólo 2 escrituras)
●   Aprovecha el planificador de E/S del kernel inundándolo con todas
    las peticiones de lectura de las aplicaciones en lugar de hacer las
    peticiones de una en una
●   Mediante el uso de un formato binario se eliminan los problemas de
    fragmentación de Gconf de ficheros xml en una estructura de
    directorios
●   Sólo 7 veces más lento GHashTable (1 µs por búsqueda)
Esquemas
●   Ficheros XML bien definidos mediante un DTD
●   Extensión .gschema.xml
●   Se sigue las reglas de nombres de Dbus
●   Tipos de datos flexibles:
    ●   Gvariant
    ●   enumerados mediante los elementos <choice>, <enum> o
        <flags>
●   Esquemas compilados con glib-compile-schemas
Esquemas II
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
 <schema id="org.guadec-es.ej-gsettings" path="/org/guadec-es/ej-gsettings/">
  <key type="b" name="fluzo">
   <default>false</default>
   <summary>Condensador de fluzo</summary>
   <description>Estado de activación del condensador de fluzo</description>
  </key>
 </schema>
</schemalist>
Distribuidores
●
    Es habitual que los distribuidores quieran modificar
    algunos de los valores por defecto
●
    En lugar de parchear los esquemas se usan
    “vendor overrides”
●
    En el mismo directorio que los esquemas
●
    Usan la extensión .gschema.override
Administradores
DCONF_PROFILE
/etc/dconf/profile/nombre_perfil:
  user_database
  system1_database ....
  system_n
user:
  ${XDG_CONFIG_HOME}/dconf/ (normalmente ~/.config/dconf/).
  formato binario GVDB
system:
  /etc/dconf/db/
  formato binario GVDB
Gsettings: API
Funciones más importantes
●
    g_settings_new()
●
    g_settings_get()
●
    g_settings_set()
●
    g_settings_bind()
GSETTINGS_BACKEND

Más contenido relacionado

Destacado

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Destacado (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

GSettings intro

  • 1. Introducción a GSettings, DConf y otras historias Juanjo Marín jjmarin@gnome.org
  • 2. ¿Qué es GSettings? GNOME 1 → GNOME 2 → GNOME 3 ✔ gnome_config ✔ GConf ✔ Gsettings ✔ Ficheros de texto ✔ Fragmentar la complejidad ✔ Separación entre la API y similares a los .INI de de un fichero de texto en el almacenamiento Windows una estructura de directorio ✔ Mejora el rendimiento y ✔ Facilitar la gestión para mayor flexibilidad ✔ Solución simple mayor volúmen de ✔ Opciones avanzadas: configuraciones. • sin restricciones de tipo con ✔ Introduce los esquemas y GVariant y enum las notificaciones de cambios • inicialización retardada
  • 3. GSettingsBackends ● DConf (por defecto en GNOME) ● Windows Registry (por defecto en Windows) ● Memory (sólo lectura, básicamente es un GHashTable. Es el fallback backend) ● Keyfile (ficheros tipo .ini) ● Delayed que se usa de forma interna para las aplicación retardada de configuraciones ● Null para bloquear cualquier intento de escritura ● Plist (ficheros plist, propierty list)
  • 4. GVariant ● La piedra angular sobre el que se basa Gsettings/Dconf es el tipo de datos Gvariant ● Almacena un valor junto con información de su tipo ● Puede ser consultado concurrentemente ● Serialización eficiente ● GVariant se basa en el tipo de datos de Dbus, pero introduce los tipos maybe/nullables(m) y los tipos indefinidos (*,?,r) ● b=boolean, y=byte, n=int16, q=uint16, i=int32, u=uint32, x=int64, t=uint64, d=double, s=string ●
  • 5. DConf ● Propuesto como estándar en freedesktop ● Optimizado para lectura (un inicio de sesión en GNOME supone cientos de lecturas y sólo 2 escrituras) ● Aprovecha el planificador de E/S del kernel inundándolo con todas las peticiones de lectura de las aplicaciones en lugar de hacer las peticiones de una en una ● Mediante el uso de un formato binario se eliminan los problemas de fragmentación de Gconf de ficheros xml en una estructura de directorios ● Sólo 7 veces más lento GHashTable (1 µs por búsqueda)
  • 6. Esquemas ● Ficheros XML bien definidos mediante un DTD ● Extensión .gschema.xml ● Se sigue las reglas de nombres de Dbus ● Tipos de datos flexibles: ● Gvariant ● enumerados mediante los elementos <choice>, <enum> o <flags> ● Esquemas compilados con glib-compile-schemas
  • 7. Esquemas II <?xml version="1.0" encoding="UTF-8"?> <schemalist> <schema id="org.guadec-es.ej-gsettings" path="/org/guadec-es/ej-gsettings/"> <key type="b" name="fluzo"> <default>false</default> <summary>Condensador de fluzo</summary> <description>Estado de activación del condensador de fluzo</description> </key> </schema> </schemalist>
  • 8. Distribuidores ● Es habitual que los distribuidores quieran modificar algunos de los valores por defecto ● En lugar de parchear los esquemas se usan “vendor overrides” ● En el mismo directorio que los esquemas ● Usan la extensión .gschema.override
  • 9. Administradores DCONF_PROFILE /etc/dconf/profile/nombre_perfil: user_database system1_database .... system_n user: ${XDG_CONFIG_HOME}/dconf/ (normalmente ~/.config/dconf/). formato binario GVDB system: /etc/dconf/db/ formato binario GVDB
  • 10. Gsettings: API Funciones más importantes ● g_settings_new() ● g_settings_get() ● g_settings_set() ● g_settings_bind() GSETTINGS_BACKEND