[devhelp/gsettings] GSettings support: install schemas, fix prefs



commit eb2df0e3439cd69e066de0d1613cbe7c53db8557
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Sep 23 10:26:06 2009 -0400

    GSettings support: install schemas, fix prefs
    
    forgot to add the schema file to the last commit
    also, forgot to test the UI dialog :)

 data/Makefile.am               |    4 ++++
 data/org.gnome.Devhelp.schemas |   32 ++++++++++++++++++++++++++++++++
 src/dh-preferences.c           |    3 +--
 src/dh-util.c                  |    7 +++++++
 src/dh-util.h                  |    2 ++
 5 files changed, 46 insertions(+), 2 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 12ef7e0..33fa7b7 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -14,6 +14,10 @@ desktopdir = $(datadir)/applications
 desktop_in_files = devhelp.desktop.in
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
+gsettingsschema_DATA = org.gnome.Devhelp.schemas
+
+install-data-hook:
+	$(gsettingsupdateschemacache) $(gsettingsschemadir)
 
 defaultsdir = $(datadir)/devhelp
 defaults_DATA = devhelp.defaults
diff --git a/data/org.gnome.Devhelp.schemas b/data/org.gnome.Devhelp.schemas
new file mode 100644
index 0000000..e45a940
--- /dev/null
+++ b/data/org.gnome.Devhelp.schemas
@@ -0,0 +1,32 @@
+schema org.gnome.Devhelp:
+  path apps/devhelp/
+
+  child state:
+    child assistant:
+      child window:
+        key maximized = false
+        key size = (350, 400)
+        key position = (0, 0)
+
+    child main:
+      child window:
+        key maximized = false
+        key size = (700, 500)
+        key position = (472, 154)
+
+      child search_notebook:
+        key selected_tab = 'content'
+
+      child paned:
+        key position = 250
+
+  child ui:
+    key fixed_font = 'Monospace 12'
+    key variable_font = 'Sans 12'
+    key use_system_fonts = false
+
+schema org.gnome.Desktop.Interface:
+  path desktop/gnome/interface/
+
+  key monospace_font_name = 'Monospace 12'
+  key font_name = 'Sans 12'
diff --git a/src/dh-preferences.c b/src/dh-preferences.c
index 86f2a8f..d602b0e 100644
--- a/src/dh-preferences.c
+++ b/src/dh-preferences.c
@@ -67,8 +67,7 @@ preferences_init (void)
 {
 	if (!prefs) {
                 prefs = g_new0 (DhPreferences, 1);
-                /* XXX unsupported use of gsettings */
-                prefs->settings = g_settings_new ("org.gnome.devhelp/ui");
+                prefs->settings = dh_util_get_ui_settings ();
         }
 }
 
diff --git a/src/dh-util.c b/src/dh-util.c
index 4bf0a49..cb48327 100644
--- a/src/dh-util.c
+++ b/src/dh-util.c
@@ -722,3 +722,10 @@ dh_util_cmp_book (DhLink *a, DhLink *b)
         return rc;
 }
 
+GSettings *
+dh_util_get_ui_settings (void)
+{
+  dh_util_settings_init ();
+
+  return g_object_ref (ui_settings);
+}
diff --git a/src/dh-util.h b/src/dh-util.h
index 5302634..09ebc53 100644
--- a/src/dh-util.h
+++ b/src/dh-util.h
@@ -53,6 +53,8 @@ void         dh_util_font_add_web_view            (WebKitWebView *view);
 gint         dh_util_cmp_book                     (DhLink *a,
                                                    DhLink *b);
 
+GSettings *  dh_util_get_ui_settings              (void);
+
 G_END_DECLS
 
 #endif /* __DH_UTIL_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]