[devhelp/gsettings] Update to work with latest GSettings
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/gsettings] Update to work with latest GSettings
- Date: Thu, 15 Apr 2010 01:46:34 +0000 (UTC)
commit a569951e9e1666657ce752dad73697987139d763
Author: Vincent Untz <vuntz gnome org>
Date: Wed Apr 14 21:45:54 2010 -0400
Update to work with latest GSettings
data/Makefile.am | 7 +++++-
data/org.gnome.Devhelp.gschema.in | 32 +++++++++++++++++++++++++++++++
data/org.gnome.Devhelp.schemas | 32 -------------------------------
src/dh-preferences.c | 12 +++++-----
src/dh-util.c | 38 ++++++++++++++++++------------------
5 files changed, 63 insertions(+), 58 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 7087785..11c0aa2 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -14,7 +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
+gsettingsschema_in_files = org.gnome.Devhelp.gschema.in
+gsettingsschema_DATA = $(gsettingsschema_in_files:.gschema.in=.gschema)
+org.gnome.Devhelp.gschema: org.gnome.Devhelp.gschema.in
+ gsettings-schema-convert -f $< -o $@
install-data-hook:
$(gsettingsupdateschemacache) $(gsettingsschemadir)
@@ -22,11 +25,13 @@ install-data-hook:
EXTRA_DIST = \
libdevhelp-1.0.pc.in \
$(desktop_in_files) \
+ $(gsettingsschema_in_files) \
$(gsettingsschema_DATA) \
$(assistant_DATA)
CLEANFILES = \
$(DESKTOP_FILES) \
+ $(gsettingsschema_DATA) \
$(defaults_DATA)
DISTCLEANFILES = \
diff --git a/data/org.gnome.Devhelp.gschema.in b/data/org.gnome.Devhelp.gschema.in
new file mode 100644
index 0000000..a0c6ebb
--- /dev/null
+++ b/data/org.gnome.Devhelp.gschema.in
@@ -0,0 +1,32 @@
+schema org.gnome.Devhelp:
+ path /apps/devhelp/
+
+ child state:
+ child assistant:
+ child window:
+ key maximized = @b false
+ key size = @(ii) (350, 400)
+ key position = @(ii) (0, 0)
+
+ child main:
+ child window:
+ key maximized = @b false
+ key size = @(ii) (700, 500)
+ key position = @(ii) (472, 154)
+
+ child search_notebook:
+ key selected_tab = @s 'content'
+
+ child paned:
+ key position = @i 250
+
+ child ui:
+ key fixed_font = @s 'Monospace 12'
+ key variable_font = @s 'Sans 12'
+ key use_system_fonts = @b false
+
+schema org.gnome.Desktop.Interface:
+ path /desktop/gnome/interface/
+
+ key monospace_font_name = @s 'Monospace 12'
+ key font_name = @s 'Sans 12'
diff --git a/src/dh-preferences.c b/src/dh-preferences.c
index d602b0e..8820d6b 100644
--- a/src/dh-preferences.c
+++ b/src/dh-preferences.c
@@ -80,9 +80,9 @@ preferences_font_set_cb (GtkFontButton *button, gpointer user_data)
font_name = gtk_font_button_get_font_name (button);
if (GTK_WIDGET (button) == prefs->variable_font_button) {
- g_settings_set (prefs->settings, "variable_font", font_name);
+ g_settings_set (prefs->settings, "variable_font", "s", font_name);
} else {
- g_settings_set (prefs->settings, "fixed_font", font_name);
+ g_settings_set (prefs->settings, "fixed_font", "s", font_name);
}
}
@@ -109,7 +109,7 @@ preferences_system_fonts_toggled_cb (GtkToggleButton *button,
active = gtk_toggle_button_get_active (button);
- g_settings_set (prefs->settings, "use_system_fonts", active);
+ g_settings_set (prefs->settings, "use_system_fonts", "b", active);
gtk_widget_set_sensitive (prefs->fonts_table, !active);
}
@@ -253,13 +253,13 @@ dh_preferences_show_dialog (GtkWindow *parent)
"system_fonts_button", "toggled", preferences_system_fonts_toggled_cb,
NULL);
- g_settings_get (prefs->settings, "use_system_fonts", &use_system_fonts);
+ g_settings_get (prefs->settings, "use_system_fonts", "b", &use_system_fonts);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->system_fonts_button),
use_system_fonts);
gtk_widget_set_sensitive (prefs->fonts_table, !use_system_fonts);
- g_settings_get (prefs->settings, "variable_font", &var_font_name);
- g_settings_get (prefs->settings, "fixed_font", &fixed_font_name);
+ g_settings_get (prefs->settings, "variable_font", "s", &var_font_name);
+ g_settings_get (prefs->settings, "fixed_font", "s", &fixed_font_name);
if (var_font_name) {
gtk_font_button_set_font_name (GTK_FONT_BUTTON (prefs->variable_font_button),
diff --git a/src/dh-util.c b/src/dh-util.c
index cb48327..2f1f69a 100644
--- a/src/dh-util.c
+++ b/src/dh-util.c
@@ -238,9 +238,9 @@ dh_util_settings_init (void)
}
toplevel = g_settings_new ("org.gnome.Devhelp");
- ui_settings = g_settings_get_settings (toplevel, "ui");
+ ui_settings = g_settings_get_child (toplevel, "ui");
g_signal_connect (ui_settings, "changed", font_notify_cb, NULL);
- state_settings = g_settings_get_settings (toplevel, "state");
+ state_settings = g_settings_get_child (toplevel, "state");
g_object_unref (toplevel);
#ifndef GDK_WINDOWING_QUARTZ
@@ -257,8 +257,8 @@ util_get_settings_for_widget (const gchar *component,
dh_util_settings_init ();
- component_settings = g_settings_get_settings (state_settings, component);
- widget_settings = g_settings_get_settings (component_settings, widget);
+ component_settings = g_settings_get_child (state_settings, component);
+ widget_settings = g_settings_get_child (component_settings, widget);
g_object_unref (component_settings);
return widget_settings;
@@ -332,7 +332,7 @@ util_state_save_window (GtkWindow *window,
maximized = FALSE;
}
- g_settings_set (settings, "maximized", maximized);
+ g_settings_set (settings, "maximized", "b", maximized);
/* If maximized don't save the size and position. */
if (maximized) {
@@ -340,10 +340,10 @@ util_state_save_window (GtkWindow *window,
}
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
- g_settings_set (settings, "size", width, height);
+ g_settings_set (settings, "size", "(ii)", width, height);
gtk_window_get_position (GTK_WINDOW (window), &x, &y);
- g_settings_set (settings, "position", x, y);
+ g_settings_set (settings, "position", "(ii)", x, y);
}
static void
@@ -356,9 +356,9 @@ util_state_restore_window (GtkWindow *window,
GdkScreen *screen;
gint max_width, max_height;
- g_settings_get (settings, "maximized", &maximized);
- g_settings_get (settings, "size", &width, &height);
- g_settings_get (settings, "position", &x, &y);
+ g_settings_get (settings, "maximized", "b", &maximized);
+ g_settings_get (settings, "size", "(ii)", &width, &height);
+ g_settings_get (settings, "position", "(ii)", &x, &y);
if (width > 1 && height > 1) {
screen = gtk_widget_get_screen (GTK_WIDGET (window));
@@ -413,7 +413,7 @@ util_state_paned_timeout_cb (gpointer paned)
if (item) {
item->timeout_id = 0;
- g_settings_set (item->settings, "position",
+ g_settings_set (item->settings, "position", "i",
gtk_paned_get_position (paned));
}
@@ -455,7 +455,7 @@ dh_util_state_manage_paned (GtkPaned *paned,
settings = util_get_settings_for_widget (component, "paned");
util_state_setup_widget (GTK_WIDGET (paned), settings);
- g_settings_get (settings, "position", &position);
+ g_settings_get (settings, "position", "i", &position);
gtk_paned_set_position (paned, position);
g_signal_connect (paned, "notify::position",
@@ -480,7 +480,7 @@ util_state_notebook_timeout_cb (gpointer notebook)
gtk_notebook_get_current_page (notebook));
page_name = dh_util_state_get_notebook_page_name (page);
if (page_name) {
- g_settings_set (item->settings, "selected_tab", page_name);
+ g_settings_set (item->settings, "selected_tab", "s", page_name);
}
}
@@ -525,7 +525,7 @@ dh_util_state_manage_notebook (GtkNotebook *notebook,
"search_notebook");
util_state_setup_widget (GTK_WIDGET (notebook), settings);
- g_settings_get (settings, "selected_tab", &tab);
+ g_settings_get (settings, "selected_tab", "s", &tab);
for (i = 0; i < gtk_notebook_get_n_pages (notebook); i++) {
GtkWidget *page;
@@ -585,11 +585,11 @@ dh_util_font_get_variable (gchar **name,
name_and_size = g_strdup ("Lucida Grande 14");
#else
g_settings_get (desktop_settings,
- "font_name", &name_and_size);
+ "font_name", "s", &name_and_size);
#endif
} else {
g_settings_get (ui_settings,
- "variable_font", &name_and_size);
+ "variable_font", "s", &name_and_size);
}
if (!split_font_string (name_and_size, name, size)) {
@@ -612,10 +612,10 @@ dh_util_font_get_fixed (gchar **name,
name_and_size = g_strdup ("Monaco 14");
#else
g_settings_get (desktop_settings,
- "monospace_font_name", &name_and_size);
+ "monospace_font_name", "s", &name_and_size);
#endif
} else {
- g_settings_get (ui_settings, "fixed_font", &name_and_size);
+ g_settings_get (ui_settings, "fixed_font", "s", &name_and_size);
}
if (!split_font_string (name_and_size, name, size)) {
@@ -645,7 +645,7 @@ view_setup_fonts (WebKitWebView *view)
settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (view));
- g_settings_get (ui_settings, "use_system_fonts", &use_system_fonts);
+ g_settings_get (ui_settings, "use_system_fonts", "b", &use_system_fonts);
dh_util_font_get_variable (&variable_name, &variable_size,
use_system_fonts);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]