[anjuta-extras] Port anjuta-extras from gconf to GSettings
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta-extras] Port anjuta-extras from gconf to GSettings
- Date: Mon, 1 Nov 2010 14:42:27 +0000 (UTC)
commit 59f252b2d259ea8d2ca40a1620171cb71ab557f3
Author: Sébastien Granjoux <seb sfo free fr>
Date: Mon Nov 1 15:41:54 2010 +0100
Port anjuta-extras from gconf to GSettings
configure.ac | 3 +
plugins/scintilla/Makefile.am | 2 +
.../anjuta-editor-scintilla.gschema-part.xml | 15 ++
plugins/scintilla/anjuta-editor-scintilla.ui | 80 ++++----
plugins/scintilla/plugin.c | 25 ++-
plugins/scintilla/print.c | 19 +-
plugins/scintilla/print.h | 12 +-
plugins/scintilla/style-editor.c | 8 +-
plugins/scintilla/style-editor.h | 3 +-
plugins/scintilla/text_editor.c | 37 ++--
plugins/scintilla/text_editor.h | 84 ++++----
plugins/scintilla/text_editor_prefs.c | 221 ++++++++------------
plugins/scratchbox/Makefile.am | 4 +
plugins/scratchbox/anjuta-scratchbox.ui | 4 +-
plugins/scratchbox/plugin.c | 46 +++--
scripts/build-schemas.mk | 32 +--
scripts/builder2schema.pl | 99 +++++----
17 files changed, 350 insertions(+), 344 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9a71e3f..1ab6372 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,9 @@ AC_SUBST(GLIB_REQUIRED)
AC_SUBST(GCONF_REQUIRED)
AC_SUBST(GNOME_REQUIRED)
+dnl GSettings
+GLIB_GSETTINGS
+
dnl ***************************************************************************
dnl Check for pkgconfig
dnl ***************************************************************************
diff --git a/plugins/scintilla/Makefile.am b/plugins/scintilla/Makefile.am
index ccf18e2..d3f1054 100644
--- a/plugins/scintilla/Makefile.am
+++ b/plugins/scintilla/Makefile.am
@@ -68,6 +68,8 @@ libanjuta_editor_la_SOURCES= \
anjuta-pcmark-16.xpm \
anjuta-linemark-16.xpm
+prefs_name = org.gnome.anjuta.scintilla
+prefs_keyfile = anjuta-editor-scintilla.gschema-part.xml
prefs_ui_files = anjuta-editor-scintilla.ui
include $(top_srcdir)/scripts/build-schemas.mk
diff --git a/plugins/scintilla/anjuta-editor-scintilla.gschema-part.xml b/plugins/scintilla/anjuta-editor-scintilla.gschema-part.xml
new file mode 100644
index 0000000..1c2aa94
--- /dev/null
+++ b/plugins/scintilla/anjuta-editor-scintilla.gschema-part.xml
@@ -0,0 +1,15 @@
+<key name="caret-fore" type="s">
+ <default>""</default>
+</key>
+<key name="calltip-back" type="s">
+ <default>""</default>
+</key>
+<key name="selection-fore" type="s">
+ <default>""</default>
+</key>
+<key name="selection-back" type="s">
+ <default>""</default>
+</key>
+<key name="view-whitespace" type="b">
+ <default>false</default>
+</key>
diff --git a/plugins/scintilla/anjuta-editor-scintilla.ui b/plugins/scintilla/anjuta-editor-scintilla.ui
index e032667..181606d 100644
--- a/plugins/scintilla/anjuta-editor-scintilla.ui
+++ b/plugins/scintilla/anjuta-editor-scintilla.ui
@@ -118,7 +118,7 @@
<property name="border_width">5</property>
<property name="spacing">5</property>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:autocomplete.choose.single">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:autocomplete-choose-single">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Choose autocomplete for single match</property>
@@ -131,7 +131,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:xml.auto.close.tags">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:xml-auto-close-tags">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Autocomplete XML/HTML closing tags</property>
@@ -149,7 +149,7 @@
<property name="visible">True</property>
<property name="spacing">5</property>
<child>
- <object class="GtkSpinButton" id="preferences_spin:int:3:0:autocompleteword.automatic">
+ <object class="GtkSpinButton" id="preferences_spin:int:3:0:autocompleteword-automatic">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment1</property>
@@ -217,7 +217,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold.comment">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold-comment">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable comments folding</property>
<property name="use_underline">True</property>
@@ -230,7 +230,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold.comment.python">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold-comment-python">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable python comments folding</property>
<property name="use_underline">True</property>
@@ -243,7 +243,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold.quotes.python">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold-quotes-python">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable python quoted strings folding</property>
<property name="use_underline">True</property>
@@ -256,7 +256,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold.html">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold-html">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable HTML tags folding</property>
<property name="use_underline">True</property>
@@ -269,7 +269,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold.compact">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold-compact">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Compact folding</property>
<property name="use_underline">True</property>
@@ -282,7 +282,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold.underline">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:fold-underline">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Draw line below folded lines</property>
@@ -296,7 +296,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:fold.on.open">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:fold-on-open">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Collapse all code folds on file open</property>
@@ -323,7 +323,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="preferences_combo:text:Plus/Minus,Arrows,Circular,Squares:0:fold.symbols">
+ <object class="GtkComboBox" id="preferences_combo:text:Plus/Minus,Arrows,Circular,Squares:0:fold-symbols">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="model">model1</property>
@@ -381,7 +381,7 @@
<property name="border_width">5</property>
<property name="spacing">5</property>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:disable.syntax.hilighting">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:disable-syntax-hilighting">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Disable syntax highlighting</property>
@@ -394,7 +394,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:braces.check">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:braces-check">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable braces check</property>
<property name="use_underline">True</property>
@@ -407,7 +407,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:strip.trailing.spaces">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:strip-trailing-spaces">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Strip trailling spaces on file save</property>
<property name="use_underline">True</property>
@@ -420,7 +420,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:editor.doseol">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:editor-doseol">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Filter extraneous characters in DOS mode</property>
<property name="use_underline">True</property>
@@ -433,7 +433,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:editor.wrapbookmarks">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:editor-wrapbookmarks">
<property name="can_focus">True</property>
<property comments="Next bookmark at the end of the file will jump to the first bookmark from the beginning" name="label" translatable="yes">Wrap bookmarks search around</property>
<property name="use_underline">True</property>
@@ -453,7 +453,7 @@
<property name="column_spacing">5</property>
<property name="row_spacing">5</property>
<child>
- <object class="GtkSpinButton" id="preferences_spin:int:80:0:edge.column">
+ <object class="GtkSpinButton" id="preferences_spin:int:80:0:edge-column">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment2</property>
@@ -467,7 +467,7 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="preferences_spin:int:350:0:caret.period">
+ <object class="GtkSpinButton" id="preferences_spin:int:350:0:caret-period">
<property name="can_focus">True</property>
<property name="adjustment">adjustment3</property>
<property name="climb_rate">10</property>
@@ -481,7 +481,7 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="preferences_spin:int:2:0:caret.width">
+ <object class="GtkSpinButton" id="preferences_spin:int:2:0:caret-width">
<property name="can_focus">True</property>
<property name="adjustment">adjustment4</property>
<property name="climb_rate">1</property>
@@ -538,7 +538,7 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="preferences_spin:int:40:0:margin.linenumber.width">
+ <object class="GtkSpinButton" id="preferences_spin:int:40:0:margin-linenumber-width">
<property name="can_focus">True</property>
<property name="adjustment">adjustment5</property>
<property name="climb_rate">1</property>
@@ -633,7 +633,7 @@
<placeholder/>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:1:indent.automatic">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:1:indent-automatic">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable automatic indentation</property>
<property name="use_underline">True</property>
@@ -647,7 +647,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:1:indent.maintain">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:1:indent-maintain">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property comments="If the user presses enter, the indentation of the current line will automatically be added to the next line" name="label" translatable="yes">Maintain past Indentation</property>
@@ -660,7 +660,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:tab.indents">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:tab-indents">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Pressing tab inserts indentation</property>
@@ -677,7 +677,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:backspace.unindents">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:backspace-unindents">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Pressing backspace un-indents</property>
@@ -706,7 +706,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:1:indent.closing">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:1:indent-closing">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Indent closing braces</property>
<property name="use_underline">True</property>
@@ -720,7 +720,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:1:indent.opening">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:1:indent-opening">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Indent opening braces</property>
<property name="use_underline">True</property>
@@ -734,7 +734,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:1:use.tabs">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:1:use-tabs">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use tabs for indentation</property>
@@ -749,7 +749,7 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="preferences_spin:int:4:1:indent.size">
+ <object class="GtkSpinButton" id="preferences_spin:int:4:1:indent-size">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment6</property>
@@ -867,7 +867,7 @@
<child>
<object class="GtkVBox" id="vbox1127">
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:view.eol">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:view-eol">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">View EOL chars</property>
@@ -880,7 +880,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:view.indentation.guides">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:view-indentation-guides">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">View Indentation Guides</property>
@@ -908,7 +908,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:view.indentation.whitespace">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:view-indentation-whitespace">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">View indentation whitespaces</property>
@@ -922,7 +922,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:view.line.wrap">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:view-line-wrap">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">View Line Wrap</property>
@@ -936,7 +936,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:margin.linenumber.visible">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:margin-linenumber-visible">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Margin Linenum visible</property>
@@ -950,7 +950,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:margin.marker.visible">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:margin-marker-visible">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Margin Marker visible</property>
@@ -964,7 +964,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:margin.fold.visible">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:margin-fold-visible">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Margin Fold visible</property>
@@ -1000,7 +1000,7 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="preferences_spin:int:1:0:print.linenumber.count">
+ <object class="GtkSpinButton" id="preferences_spin:int:1:0:print-linenumber-count">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment8</property>
@@ -1030,7 +1030,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.linewrap">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print-linewrap">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Enable line wrap</property>
@@ -1046,7 +1046,7 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.header">
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print-header">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Add page header</property>
@@ -1068,7 +1068,7 @@
<property name="label" translatable="yes">Monochrome</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <property name="group">preferences_toggle:bool:1:0:print.color</property>
+ <property name="group">preferences_toggle:bool:1:0:print-color</property>
</object>
<packing>
<property name="left_attach">2</property>
@@ -1078,7 +1078,7 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="preferences_toggle:bool:1:0:print.color">
+ <object class="GtkRadioButton" id="preferences_toggle:bool:1:0:print-color">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Colour</property>
diff --git a/plugins/scintilla/plugin.c b/plugins/scintilla/plugin.c
index a4bac13..2b5f2b1 100644
--- a/plugins/scintilla/plugin.c
+++ b/plugins/scintilla/plugin.c
@@ -51,6 +51,10 @@ struct _EditorPlugin{
IAnjutaSymbolQuery *query_system;
IAnjutaSymbolQuery *query_project;
+
+ /* Settings */
+ GSettings *settings;
+ AnjutaPreferences* prefs;
};
struct _EditorPluginClass{
@@ -139,9 +143,9 @@ on_system_symbol_scanned (IAnjutaSymbolManager *manager, guint process, IAnjutaS
}
static void
-on_style_button_clicked(GtkWidget* button, AnjutaPreferences* prefs)
+on_style_button_clicked(GtkWidget* button, EditorPlugin *plugin)
{
- StyleEditor* se = style_editor_new(prefs);
+ StyleEditor* se = style_editor_new(plugin->prefs, plugin->settings);
style_editor_show(se);
}
@@ -237,7 +241,9 @@ deactivate_plugin (AnjutaPlugin *plugin)
static void
dispose (GObject *obj)
{
- /* EditorPlugin *eplugin = ANJUTA_PLUGIN_EDITOR (obj); */
+ EditorPlugin *plugin = ANJUTA_PLUGIN_EDITOR (obj);
+
+ g_object_unref (plugin->settings);
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
@@ -252,7 +258,10 @@ finalize (GObject *obj)
static void
editor_plugin_instance_init (GObject *obj)
{
- /* EditorPlugin *plugin = ANJUTA_PLUGIN_EDITOR (obj); */
+ EditorPlugin *plugin = ANJUTA_PLUGIN_EDITOR (obj);
+
+ plugin->settings = g_settings_new (PREF_SCHEMA);
+ plugin->prefs = NULL;
}
static void
@@ -275,11 +284,10 @@ itext_editor_factory_new_editor(IAnjutaEditorFactory* factory,
GError** error)
{
AnjutaShell *shell = ANJUTA_PLUGIN (factory)->shell;
- AnjutaPreferences *prefs = anjuta_shell_get_preferences (shell, NULL);
AnjutaStatus *status = anjuta_shell_get_status (shell, NULL);
/* file can be NULL, if we open a buffer, not a file */
gchar* uri = file ? g_file_get_uri (file) : NULL;
- IAnjutaEditor* editor = IANJUTA_EDITOR(text_editor_new(status, prefs, shell,
+ IAnjutaEditor* editor = IANJUTA_EDITOR(text_editor_new(status,shell,
uri, filename));
g_free(uri);
return editor;
@@ -302,11 +310,12 @@ ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError**
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
}
+ plugin->prefs = prefs;
plugin->style_button = GTK_WIDGET (gtk_builder_get_object (bxml, "style_button"));
g_signal_connect(G_OBJECT(plugin->style_button), "clicked",
- G_CALLBACK(on_style_button_clicked), prefs);
+ G_CALLBACK(on_style_button_clicked), plugin);
anjuta_preferences_add_from_builder (prefs,
- bxml, "prefs_editor", _("Scintilla Editor"), ICON_FILE);
+ bxml, plugin->settings, "prefs_editor", _("Scintilla Editor"), ICON_FILE);
g_object_unref(bxml);
}
diff --git a/plugins/scintilla/print.c b/plugins/scintilla/print.c
index a6316f2..d9ac169 100644
--- a/plugins/scintilla/print.c
+++ b/plugins/scintilla/print.c
@@ -908,7 +908,7 @@ anjuta_print_begin (GtkPrintOperation *operation,
/* First print function called before displayed print dialog */
static GtkPrintOperation*
-anjuta_print_setup (AnjutaPreferences *p, TextEditor *te)
+anjuta_print_setup (GSettings *settings, TextEditor *te)
{
PrintJobInfo *pji;
GtkPrintOperation* operation;
@@ -920,17 +920,16 @@ anjuta_print_setup (AnjutaPreferences *p, TextEditor *te)
/* Set preferences */
pji->print_line_numbers =
- anjuta_preferences_get_bool_with_default (p, PRINT_LINENUM_COUNT, 1);
+ g_settings_get_boolean (settings, PRINT_LINENUM_COUNT);
pji->print_header =
- anjuta_preferences_get_bool_with_default (p, PRINT_HEADER, 1);
+ g_settings_get_boolean (settings, PRINT_HEADER);
pji->print_color =
- anjuta_preferences_get_bool_with_default (p, PRINT_COLOR, 1);
+ g_settings_get_boolean (settings, PRINT_COLOR);
pji->wrapping =
- anjuta_preferences_get_bool_with_default (p, PRINT_WRAP, 1);
+ g_settings_get_boolean (settings, PRINT_WRAP);
pji->tab_width =
- anjuta_preferences_get_int_with_default (p, TAB_SIZE, 8);
- pji->zoom_factor = anjuta_preferences_get_int (te->preferences,
- TEXT_ZOOM_FACTOR);
+ g_settings_get_int (settings, TAB_SIZE);
+ pji->zoom_factor = g_settings_get_int (settings, TEXT_ZOOM_FACTOR);
/* Set progress bar */
@@ -957,7 +956,7 @@ anjuta_print_setup (AnjutaPreferences *p, TextEditor *te)
}
void
-anjuta_print (gboolean preview, AnjutaPreferences *p, TextEditor *te)
+anjuta_print (gboolean preview, GSettings *settings, TextEditor *te)
{
GtkPrintOperation* operation;
@@ -968,7 +967,7 @@ anjuta_print (gboolean preview, AnjutaPreferences *p, TextEditor *te)
return;
}
- operation = anjuta_print_setup (p, te);
+ operation = anjuta_print_setup (settings, te);
gtk_print_operation_run (operation,
preview ? GTK_PRINT_OPERATION_ACTION_PREVIEW :
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
diff --git a/plugins/scintilla/print.h b/plugins/scintilla/print.h
index 6ff61dd..053d045 100644
--- a/plugins/scintilla/print.h
+++ b/plugins/scintilla/print.h
@@ -27,13 +27,13 @@
G_BEGIN_DECLS
-void anjuta_print (gboolean preview, AnjutaPreferences *p, TextEditor *te);
+void anjuta_print (gboolean preview, GSettings *settings, TextEditor *te);
-#define PRINT_HEADER "print.header"
-#define PRINT_WRAP "print.linewrap"
-#define PRINT_LINENUM_COUNT "print.linenumber.count"
-#define PRINT_LANDSCAPE "print.landscape"
-#define PRINT_COLOR "print.color"
+#define PRINT_HEADER "print-header"
+#define PRINT_WRAP "print-linewrap"
+#define PRINT_LINENUM_COUNT "print-linenumber-count"
+#define PRINT_LANDSCAPE "print-landscape"
+#define PRINT_COLOR "print-color"
G_END_DECLS
diff --git a/plugins/scintilla/style-editor.c b/plugins/scintilla/style-editor.c
index 8b516fe..a64f8fa 100644
--- a/plugins/scintilla/style-editor.c
+++ b/plugins/scintilla/style-editor.c
@@ -849,8 +849,8 @@ apply_styles (StyleEditor *se)
fclose (ofile);
g_free (filename);
}
- anjuta_preferences_set_int (se->prefs, DISABLE_SYNTAX_HILIGHTING, 1);
- anjuta_preferences_set_int (se->prefs, DISABLE_SYNTAX_HILIGHTING, 0);
+ g_settings_set_int (se->settings, DISABLE_SYNTAX_HILIGHTING, 1);
+ g_settings_set_int (se->settings, DISABLE_SYNTAX_HILIGHTING, 0);
}
static void
@@ -949,7 +949,7 @@ create_style_editor_gui (StyleEditor * se)
}
StyleEditor *
-style_editor_new (AnjutaPreferences *prefs)
+style_editor_new (AnjutaPreferences *prefs, GSettings *settings)
{
StyleEditor *se;
se = g_new0 (StyleEditor, 1);
@@ -957,6 +957,7 @@ style_editor_new (AnjutaPreferences *prefs)
se->props = text_editor_get_props ();
se->priv->dialog = NULL;
se->prefs = prefs;
+ se->settings = g_object_ref (settings);
return se;
}
@@ -966,6 +967,7 @@ void style_editor_destroy (StyleEditor *se)
if (se->priv->dialog)
gtk_widget_destroy (se->priv->dialog);
g_free (se->priv);
+ g_object_unref (se->settings);
g_free (se);
}
diff --git a/plugins/scintilla/style-editor.h b/plugins/scintilla/style-editor.h
index 279d5ec..68a8892 100644
--- a/plugins/scintilla/style-editor.h
+++ b/plugins/scintilla/style-editor.h
@@ -40,10 +40,11 @@ struct _StyleEditor
PropsID props;
StyleEditorPriv *priv;
AnjutaPreferences *prefs;
+ GSettings *settings;
};
StyleEditor *
-style_editor_new (AnjutaPreferences *prefs);
+style_editor_new (AnjutaPreferences *prefs, GSettings *settings);
void style_editor_destroy (StyleEditor *se);
diff --git a/plugins/scintilla/text_editor.c b/plugins/scintilla/text_editor.c
index 93e1047..c8dfdb5 100644
--- a/plugins/scintilla/text_editor.c
+++ b/plugins/scintilla/text_editor.c
@@ -125,7 +125,6 @@ text_editor_instance_init (TextEditor *te)
te->popup_menu = NULL;
te->monitor = NULL;
- te->preferences = NULL;
te->force_hilite = NULL;
te->force_pref = FALSE;
te->freeze_count = 0;
@@ -144,6 +143,9 @@ text_editor_instance_init (TextEditor *te)
te->completion_count = 0;
te->completion_string = g_string_sized_new (256);
te->completion_finished = FALSE;
+
+ te->settings = g_settings_new (PREF_SCHEMA);
+ te->docman_settings = g_settings_new (DOCMAN_PREF_SCHEMA);
}
static GtkWidget *
@@ -551,7 +553,7 @@ on_shell_value_changed (TextEditor *te, const char *name)
}
GtkWidget *
-text_editor_new (AnjutaStatus *status, AnjutaPreferences *eo, AnjutaShell *shell, const gchar *uri, const gchar *name)
+text_editor_new (AnjutaStatus *status, AnjutaShell *shell, const gchar *uri, const gchar *name)
{
gint zoom_factor;
static guint new_file_count;
@@ -560,7 +562,6 @@ text_editor_new (AnjutaStatus *status, AnjutaPreferences *eo, AnjutaShell *shell
te->status = status;
te->shell = shell;
- te->preferences = eo;
te->props_base = text_editor_get_props();
if (name && strlen(name) > 0)
te->filename = g_strdup(name);
@@ -599,7 +600,7 @@ text_editor_new (AnjutaStatus *status, AnjutaPreferences *eo, AnjutaShell *shell
text_editor_update_controls (te);
/* Apply font zoom separately */
- zoom_factor = anjuta_preferences_get_int (te->preferences, TEXT_ZOOM_FACTOR);
+ zoom_factor = g_settings_get_int (te->docman_settings, TEXT_ZOOM_FACTOR);
/* DEBUG_PRINT ("%s", "Initializing zoom factor to: %d", zoom_factor); */
text_editor_set_zoom_factor (te, zoom_factor);
@@ -678,6 +679,8 @@ text_editor_dispose (GObject *obj)
te->completion_string = NULL;
}
te->completion_count = 0;
+ g_object_unref (te->settings);
+ g_object_unref (te->docman_settings);
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
@@ -734,7 +737,7 @@ text_editor_hilite_one (TextEditor * te, AnEditorID editor_id)
/* syntax highlighting is disabled if te->force_pref && pref is disabled */
if (!te->force_pref ||
- !anjuta_preferences_get_bool (ANJUTA_PREFERENCES (te->preferences),
+ !g_settings_get_boolean (te->settings,
DISABLE_SYNTAX_HILIGHTING))
{
if (te->force_hilite)
@@ -1504,7 +1507,7 @@ load_from_file (TextEditor *te, gchar *uri, gchar **err)
/* DEBUG_PRINT ("File size and loaded size not matching"); */
}
dos_filter =
- anjuta_preferences_get_bool (ANJUTA_PREFERENCES (te->preferences),
+ g_settings_get_boolean (te->settings,
DOS_EOL_CHECK);
/* Set editor mode */
@@ -1626,7 +1629,7 @@ save_to_file (TextEditor *te, gchar *uri, GError **error)
}
/* Strip trailing spaces */
- strip = anjuta_preferences_get_bool (te->preferences,
+ strip = g_settings_get_boolean (te->settings,
STRIP_TRAILING_SPACES);
if (strip)
{
@@ -1638,7 +1641,7 @@ save_to_file (TextEditor *te, gchar *uri, GError **error)
data[size] = '\n';
++ size;
}
- dos_filter = anjuta_preferences_get_bool (te->preferences,
+ dos_filter = g_settings_get_boolean (te->settings,
DOS_EOL_CHECK);
editor_mode = scintilla_send_message (SCINTILLA (te->scintilla),
SCI_GETEOLMODE, 0, 0);
@@ -1705,7 +1708,7 @@ text_editor_load_file (TextEditor * te)
scintilla_send_message (SCINTILLA (te->scintilla),
SCI_EMPTYUNDOBUFFER, 0, 0);
text_editor_set_hilite_type (te, NULL);
- if (anjuta_preferences_get_bool (te->preferences, FOLD_ON_OPEN))
+ if (g_settings_get_boolean (te->settings, FOLD_ON_OPEN))
{
aneditor_command (te->editor_id, ANE_CLOSE_FOLDALL, 0, 0);
}
@@ -2158,8 +2161,8 @@ void
text_editor_set_line_number_width (TextEditor* te)
{
/* Set line numbers with according to file size */
- if (anjuta_preferences_get_bool_with_default(te->preferences,
- "margin.linenumber.visible", FALSE))
+ if (g_settings_get_boolean (te->settings,
+ VIEW_LINENUMBERS_MARGIN))
{
int lines, line_number_width;
gchar* line_number;
@@ -3446,14 +3449,14 @@ static void
iprint_print(IAnjutaPrint* print, GError** e)
{
TextEditor* te = TEXT_EDITOR(print);
- anjuta_print(FALSE, te->preferences, te);
+ anjuta_print(FALSE, te->settings, te);
}
static void
iprint_preview(IAnjutaPrint* print, GError** e)
{
TextEditor* te = TEXT_EDITOR(print);
- anjuta_print(TRUE, te->preferences, te);
+ anjuta_print(TRUE, te->settings, te);
}
static void
@@ -3499,7 +3502,7 @@ static void
izoom_in(IAnjutaEditorZoom* zoom, GError** e)
{
TextEditor* te = TEXT_EDITOR(zoom);
- gint zoom_factor = anjuta_preferences_get_int (te->preferences,
+ gint zoom_factor = g_settings_get_int (te->docman_settings,
TEXT_ZOOM_FACTOR) + 1;
if (zoom_factor > MAX_ZOOM_FACTOR)
@@ -3507,14 +3510,14 @@ izoom_in(IAnjutaEditorZoom* zoom, GError** e)
else if (zoom_factor < MIN_ZOOM_FACTOR)
zoom_factor = MIN_ZOOM_FACTOR;
- anjuta_preferences_set_int (te->preferences, TEXT_ZOOM_FACTOR, zoom_factor);
+ g_settings_set_int (te->docman_settings, TEXT_ZOOM_FACTOR, zoom_factor);
}
static void
izoom_out(IAnjutaEditorZoom* zoom, GError** e)
{
TextEditor* te = TEXT_EDITOR(zoom);
- gint zoom_factor = anjuta_preferences_get_int (te->preferences,
+ gint zoom_factor = g_settings_get_int (te->docman_settings,
TEXT_ZOOM_FACTOR) - 1;
if (zoom_factor > MAX_ZOOM_FACTOR)
@@ -3522,7 +3525,7 @@ izoom_out(IAnjutaEditorZoom* zoom, GError** e)
else if (zoom_factor < MIN_ZOOM_FACTOR)
zoom_factor = MIN_ZOOM_FACTOR;
- anjuta_preferences_set_int (te->preferences, TEXT_ZOOM_FACTOR, zoom_factor);
+ g_settings_set_int (te->docman_settings, TEXT_ZOOM_FACTOR, zoom_factor);
}
static void
diff --git a/plugins/scintilla/text_editor.h b/plugins/scintilla/text_editor.h
index 64281c8..27a06c0 100644
--- a/plugins/scintilla/text_editor.h
+++ b/plugins/scintilla/text_editor.h
@@ -24,7 +24,6 @@
#include <glib-object.h>
#include <gio/gio.h>
-#include <libanjuta/anjuta-preferences.h>
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/interfaces/ianjuta-provider.h>
@@ -83,7 +82,9 @@ struct _TextEditor
glong current_line;
- AnjutaPreferences *preferences;
+ /* Settings */
+ GSettings *settings;
+ GSettings *docman_settings;
/* Editor ID and widget for AnEditor */
AnEditorID editor_id;
@@ -142,7 +143,7 @@ struct _TextEditorClass
GType text_editor_get_type (void);
/* New instance of TextEditor */
-GtkWidget* text_editor_new (AnjutaStatus *status, AnjutaPreferences * pr, AnjutaShell* shell, const gchar *uri,
+GtkWidget* text_editor_new (AnjutaStatus *status, AnjutaShell* shell, const gchar *uri,
const gchar *tab_name);
/* Freeze and thaw editor */
@@ -283,53 +284,48 @@ void text_editor_scintilla_command (TextEditor *te, gint command,
#define linenum_text_editor_to_scintilla(x) (x-1)
#define linenum_scintilla_to_text_editor(x) (x+1)
+#define DOCMAN_PREF_SCHEMA "org.gnome.anjuta.document-manager"
+#define TEXT_ZOOM_FACTOR "text-zoom-factor"
+
+#define PREF_SCHEMA "org.gnome.anjuta.scintilla"
/* Editor preferences */
-#define DISABLE_SYNTAX_HILIGHTING "disable.syntax.hilighting"
-#define SAVE_AUTOMATIC "save.automatic"
+#define DISABLE_SYNTAX_HILIGHTING "disable-syntax-hilighting"
/*
-#define INDENT_AUTOMATIC "indent.automatic"
+#define INDENT_AUTOMATIC "indent-automatic"
*/
-#define USE_TABS "use.tabs"
-#define BRACES_CHECK "braces.check"
-#define DOS_EOL_CHECK "editor.doseol"
-#define WRAP_BOOKMARKS "editor.wrapbookmarks"
+#define USE_TABS "use-tabs"
+#define BRACES_CHECK "braces-check"
+#define DOS_EOL_CHECK "editor-doseol"
+#define WRAP_BOOKMARKS "editor-wrapbookmarks"
#define TAB_SIZE "tabsize"
-#define INDENT_SIZE "indent.size"
+#define INDENT_SIZE "indent-size"
/*
-#define INDENT_OPENING "indent.opening"
-#define INDENT_CLOSING "indent.closing"
+#define INDENT_OPENING "indent-opening"
+#define INDENT_CLOSING "indent-closing"
*/
-#define INDENT_MAINTAIN "indent.maintain"
-
-#define TAB_INDENTS "tab.indents"
-#define BACKSPACE_UNINDENTS "backspace.unindents"
-#define AUTOSAVE_TIMER "autosave.timer"
-#define SAVE_SESSION_TIMER "save.session.timer"
-
-#define AUTOFORMAT_DISABLE "autoformat.disable"
-#define AUTOFORMAT_STYLE "autoformat.style"
-#define AUTOFORMAT_LIST_STYLE "autoformat.list.style"
-#define AUTOFORMAT_OPTS "autoformat.opts"
-
-#define FOLD_SYMBOLS "fold.symbols"
-#define FOLD_UNDERLINE "fold.underline"
-
-#define STRIP_TRAILING_SPACES "strip.trailing.spaces"
-#define FOLD_ON_OPEN "fold.on.open"
-#define CARET_FORE_COLOR "caret.fore"
-#define CALLTIP_BACK_COLOR "calltip.back"
-#define SELECTION_FORE_COLOR "selection.fore"
-#define SELECTION_BACK_COLOR "selection.back"
-
-#define VIEW_LINENUMBERS_MARGIN "margin.linenumber.visible"
-#define VIEW_MARKER_MARGIN "margin.marker.visible"
-#define VIEW_FOLD_MARGIN "margin.fold.visible"
-#define VIEW_INDENTATION_GUIDES "view.indentation.guides"
-#define VIEW_WHITE_SPACES "view.whitespace"
-#define VIEW_EOL "view.eol"
-#define VIEW_LINE_WRAP "view.line.wrap"
-#define EDGE_COLUMN "edge.column"
-#define TEXT_ZOOM_FACTOR "text.zoom.factor"
+#define INDENT_MAINTAIN "indent-maintain"
+
+#define TAB_INDENTS "tab-indents"
+#define BACKSPACE_UNINDENTS "backspace-unindents"
+
+#define FOLD_SYMBOLS "fold-symbols"
+#define FOLD_UNDERLINE "fold-underline"
+
+#define STRIP_TRAILING_SPACES "strip-trailing-spaces"
+#define FOLD_ON_OPEN "fold-on-open"
+#define CARET_FORE_COLOR "caret-fore"
+#define CALLTIP_BACK_COLOR "calltip-back"
+#define SELECTION_FORE_COLOR "selection-fore"
+#define SELECTION_BACK_COLOR "selection-back"
+
+#define VIEW_LINENUMBERS_MARGIN "margin-linenumber-visible"
+#define VIEW_MARKER_MARGIN "margin-marker-visible"
+#define VIEW_FOLD_MARGIN "margin-fold-visible"
+#define VIEW_INDENTATION_GUIDES "view-indentation-guides"
+#define VIEW_WHITE_SPACES "view-whitespace"
+#define VIEW_EOL "view-eol"
+#define VIEW_LINE_WRAP "view-line-wrap"
+#define EDGE_COLUMN "edge-column"
G_END_DECLS
diff --git a/plugins/scintilla/text_editor_prefs.c b/plugins/scintilla/text_editor_prefs.c
index df779a3..2f32853 100644
--- a/plugins/scintilla/text_editor_prefs.c
+++ b/plugins/scintilla/text_editor_prefs.c
@@ -77,396 +77,357 @@ pref_notify (GConfClient *gclient, guint cnxn_id,
#endif
static gint
-set_n_get_prop_int (TextEditor *te, const gchar *key)
+set_n_get_prop_int (GSettings *settings, const gchar *key)
{
gint val;
- AnjutaPreferences *pr;
- pr = te->preferences;
- val = anjuta_preferences_get_int (pr, key);
+ val = g_settings_get_int (settings, key);
sci_prop_set_int_with_key (text_editor_get_props (), key, val);
return val;
}
static gint
-set_n_get_prop_bool (TextEditor *te, const gchar *key)
+set_n_get_prop_bool (GSettings *settings, const gchar *key)
{
gboolean val;
- AnjutaPreferences *pr;
- pr = te->preferences;
- val = anjuta_preferences_get_bool (pr, key);
+ val = g_settings_get_boolean (settings, key);
sci_prop_set_int_with_key (text_editor_get_props (), key, val);
return val;
}
static gchar *
-set_n_get_prop_string (TextEditor *te, const gchar *key)
+set_n_get_prop_string (GSettings *settings, const gchar *key)
{
gchar *val;
- AnjutaPreferences *pr;
- pr = te->preferences;
- val = anjuta_preferences_get (pr, key);
+ val = g_settings_get_string (settings, key);
sci_prop_set_with_key (text_editor_get_props (), key, val);
return val;
}
static void
-on_notify_disable_hilite (AnjutaPreferences* prefs,
+on_notify_disable_hilite (GSettings *settings,
const gchar* key,
- gboolean value,
gpointer user_data)
{
TextEditor *te;
te = TEXT_EDITOR (user_data);
- set_n_get_prop_bool (te, DISABLE_SYNTAX_HILIGHTING);
+ set_n_get_prop_bool (settings, key);
text_editor_hilite (te, TRUE);
}
static void
-on_notify_zoom_factor(AnjutaPreferences* prefs,
+on_notify_zoom_factor(GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gint zoom_factor;
te = TEXT_EDITOR (user_data);
- zoom_factor = set_n_get_prop_int (te, TEXT_ZOOM_FACTOR);
+ zoom_factor = set_n_get_prop_int (settings, key);
text_editor_set_zoom_factor (te, zoom_factor);
g_signal_emit_by_name(G_OBJECT (te), "update_ui");
}
static void
-on_notify_tab_size (AnjutaPreferences* prefs,
+on_notify_tab_size (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gint tab_size;
te = TEXT_EDITOR (user_data);
- tab_size = set_n_get_prop_int (te, TAB_SIZE);
+ tab_size = set_n_get_prop_int (settings, key);
text_editor_command (te, ANE_SETTABSIZE, tab_size, 0);
}
static void
-on_notify_use_tab_for_indentation(AnjutaPreferences* prefs,
+on_notify_use_tab_for_indentation(GSettings* settings,
const gchar* key,
- gboolean value,
gpointer user_data)
{
TextEditor *te;
gboolean use_tabs;
te = TEXT_EDITOR (user_data);
- use_tabs = set_n_get_prop_bool (te, USE_TABS);
+ use_tabs = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_SETUSETABFORINDENT, use_tabs, 0);
- // text_editor_scintilla_command (te, SCI_SETTABWIDTH, use_tabs, 0);
}
static void
-on_notify_indent_size (AnjutaPreferences* prefs,
+on_notify_indent_size (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gint indent_size;
te = TEXT_EDITOR (user_data);
- indent_size = set_n_get_prop_int (te, INDENT_SIZE);
+ indent_size = set_n_get_prop_int (settings, key);
text_editor_command (te, ANE_SETINDENTSIZE, indent_size, 0);
}
static void
-on_notify_wrap_bookmarks(AnjutaPreferences* prefs,
+on_notify_wrap_bookmarks(GSettings* settings,
const gchar* key,
- gboolean value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, WRAP_BOOKMARKS);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_SETWRAPBOOKMARKS, state, 0);
}
static void
-on_notify_braces_check (AnjutaPreferences* prefs,
+on_notify_braces_check (GSettings* settings,
const gchar* key,
- gboolean value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, BRACES_CHECK);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_SETINDENTBRACESCHECK, state, 0);
}
static void
-on_notify_indent_maintain (AnjutaPreferences* prefs,
+on_notify_indent_maintain (GSettings* settings,
const gchar* key,
- gboolean value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, INDENT_MAINTAIN);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_SETINDENTMAINTAIN, state, 0);
}
static void
-on_notify_tab_indents (AnjutaPreferences* prefs,
+on_notify_tab_indents (GSettings* settings,
const gchar* key,
- gboolean value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, TAB_INDENTS);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_SETTABINDENTS, state, 0);
}
static void
-on_notify_backspace_unindents (AnjutaPreferences* prefs,
+on_notify_backspace_unindents (GSettings* settings,
const gchar* key,
- gboolean value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, BACKSPACE_UNINDENTS);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_SETBACKSPACEUNINDENTS, state, 0);
}
static void
-on_notify_view_eols (AnjutaPreferences* prefs,
+on_notify_view_eols (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, VIEW_EOL);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_VIEWEOL, state, 0);
}
static void
-on_notify_view_whitespaces (AnjutaPreferences* prefs,
+on_notify_view_whitespaces (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, VIEW_WHITE_SPACES);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_VIEWSPACE, state, 0);
}
static void
-on_notify_view_linewrap (AnjutaPreferences* prefs,
+on_notify_view_linewrap (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, VIEW_LINE_WRAP);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_LINEWRAP, state, 0);
}
static void
-on_notify_view_indentation_guides (AnjutaPreferences* prefs,
+on_notify_view_indentation_guides (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, VIEW_INDENTATION_GUIDES);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_VIEWGUIDES, state, 0);
}
static void
-on_notify_view_folds (AnjutaPreferences* prefs,
+on_notify_view_folds (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, VIEW_FOLD_MARGIN);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_FOLDMARGIN, state, 0);
}
static void
-on_notify_view_markers (AnjutaPreferences* prefs,
+on_notify_view_markers (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, VIEW_MARKER_MARGIN);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_SELMARGIN, state, 0);
}
static void
-on_notify_view_linenums (AnjutaPreferences* prefs,
+on_notify_view_linenums (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, VIEW_LINENUMBERS_MARGIN);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_LINENUMBERMARGIN, state, 0);
/* text_editor_set_line_number_width (te); */
}
static void
-on_notify_fold_symbols (AnjutaPreferences* prefs,
+on_notify_fold_symbols (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gchar *symbols;
te = TEXT_EDITOR (user_data);
- symbols = set_n_get_prop_string (te, FOLD_SYMBOLS);
+ symbols = set_n_get_prop_string (settings, key);
text_editor_command (te, ANE_SETFOLDSYMBOLS, (long)symbols, 0);
g_free (symbols);
}
static void
-on_notify_fold_underline (AnjutaPreferences* prefs,
+on_notify_fold_underline (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gboolean state;
te = TEXT_EDITOR (user_data);
- state = set_n_get_prop_bool (te, FOLD_UNDERLINE);
+ state = set_n_get_prop_bool (settings, key);
text_editor_command (te, ANE_SETFOLDUNDERLINE, state, 0);
}
static void
-on_notify_edge_column (AnjutaPreferences* prefs,
+on_notify_edge_column (GSettings* settings,
const gchar* key,
- gint value,
gpointer user_data)
{
TextEditor *te;
gint size;
te = TEXT_EDITOR (user_data);
- size = set_n_get_prop_int (te, EDGE_COLUMN);
+ size = set_n_get_prop_int (settings, key);
text_editor_command (te, ANE_SETEDGECOLUMN, size, 0);
}
-#define REGISTER_NOTIFY(key, func, type) \
- notify_id = anjuta_preferences_notify_add_##type (te->preferences, \
- key, func, te, NULL); \
- te->notify_ids = g_list_prepend (te->notify_ids, \
- GUINT_TO_POINTER (notify_id));
+#define REGISTER_NOTIFY(settings, key, func) \
+ g_signal_connect (settings, "changed::" key, G_CALLBACK(func), te);
void
text_editor_prefs_init (TextEditor *te)
{
gint val;
- guint notify_id;
+ GSettings *settings = te->settings;
+ GSettings *docman_settings = te->docman_settings;
/* Sync prefs from gconf to props */
- set_n_get_prop_int (te, TAB_SIZE);
- set_n_get_prop_int (te, TEXT_ZOOM_FACTOR);
- set_n_get_prop_int (te, INDENT_SIZE);
- set_n_get_prop_bool (te, USE_TABS);
- set_n_get_prop_bool (te, DISABLE_SYNTAX_HILIGHTING);
- set_n_get_prop_bool (te, WRAP_BOOKMARKS);
- set_n_get_prop_bool (te, BRACES_CHECK);
+ set_n_get_prop_int (settings, TAB_SIZE);
+ set_n_get_prop_int (docman_settings, TEXT_ZOOM_FACTOR);
+ set_n_get_prop_int (settings, INDENT_SIZE);
+ set_n_get_prop_bool (settings, USE_TABS);
+ set_n_get_prop_bool (settings, DISABLE_SYNTAX_HILIGHTING);
+ set_n_get_prop_bool (settings, WRAP_BOOKMARKS);
+ set_n_get_prop_bool (settings, BRACES_CHECK);
/* This one is special */
- val = set_n_get_prop_bool (te, INDENT_MAINTAIN);
+ val = set_n_get_prop_bool (settings, INDENT_MAINTAIN);
sci_prop_set_int_with_key (te->props_base, INDENT_MAINTAIN".*", val);
- set_n_get_prop_bool (te, TAB_INDENTS);
- set_n_get_prop_bool (te, BACKSPACE_UNINDENTS);
+ set_n_get_prop_bool (settings, TAB_INDENTS);
+ set_n_get_prop_bool (settings, BACKSPACE_UNINDENTS);
- set_n_get_prop_bool (te, VIEW_EOL);
- set_n_get_prop_bool (te, VIEW_LINE_WRAP);
- set_n_get_prop_bool (te, VIEW_WHITE_SPACES);
- set_n_get_prop_bool (te, VIEW_INDENTATION_GUIDES);
- set_n_get_prop_bool (te, VIEW_FOLD_MARGIN);
- set_n_get_prop_bool (te, VIEW_MARKER_MARGIN);
- set_n_get_prop_bool (te, VIEW_LINENUMBERS_MARGIN);
- g_free (set_n_get_prop_string (te, FOLD_SYMBOLS));
- set_n_get_prop_bool (te, FOLD_UNDERLINE);
- set_n_get_prop_int (te, EDGE_COLUMN);
+ set_n_get_prop_bool (settings, VIEW_EOL);
+ set_n_get_prop_bool (settings, VIEW_LINE_WRAP);
+ set_n_get_prop_bool (settings, VIEW_WHITE_SPACES);
+ set_n_get_prop_bool (settings, VIEW_INDENTATION_GUIDES);
+ set_n_get_prop_bool (settings, VIEW_FOLD_MARGIN);
+ set_n_get_prop_bool (settings, VIEW_MARKER_MARGIN);
+ set_n_get_prop_bool (settings, VIEW_LINENUMBERS_MARGIN);
+ g_free (set_n_get_prop_string (settings, FOLD_SYMBOLS));
+ set_n_get_prop_bool (settings, FOLD_UNDERLINE);
+ set_n_get_prop_int (settings, EDGE_COLUMN);
/* Register gconf notifications */
- REGISTER_NOTIFY (TAB_SIZE, on_notify_tab_size, int);
- REGISTER_NOTIFY (TEXT_ZOOM_FACTOR, on_notify_zoom_factor, int);
- REGISTER_NOTIFY (INDENT_SIZE, on_notify_indent_size, int);
- REGISTER_NOTIFY (USE_TABS, on_notify_use_tab_for_indentation, bool);
- REGISTER_NOTIFY (DISABLE_SYNTAX_HILIGHTING, on_notify_disable_hilite, bool);
- /* REGISTER_NOTIFY (INDENT_AUTOMATIC, on_notify_automatic_indentation); */
- REGISTER_NOTIFY (WRAP_BOOKMARKS, on_notify_wrap_bookmarks, bool);
- REGISTER_NOTIFY (BRACES_CHECK, on_notify_braces_check, bool);
- REGISTER_NOTIFY (INDENT_MAINTAIN, on_notify_indent_maintain, bool);
- REGISTER_NOTIFY (TAB_INDENTS, on_notify_tab_indents, bool);
- REGISTER_NOTIFY (BACKSPACE_UNINDENTS, on_notify_backspace_unindents, bool);
- REGISTER_NOTIFY (VIEW_EOL, on_notify_view_eols, bool);
- REGISTER_NOTIFY (VIEW_LINE_WRAP, on_notify_view_linewrap, bool);
- REGISTER_NOTIFY (VIEW_WHITE_SPACES, on_notify_view_whitespaces, bool);
- REGISTER_NOTIFY (VIEW_INDENTATION_GUIDES, on_notify_view_indentation_guides, bool);
- REGISTER_NOTIFY (VIEW_FOLD_MARGIN, on_notify_view_folds, bool);
- REGISTER_NOTIFY (VIEW_MARKER_MARGIN, on_notify_view_markers, bool);
- REGISTER_NOTIFY (VIEW_LINENUMBERS_MARGIN, on_notify_view_linenums, bool);
- REGISTER_NOTIFY (FOLD_SYMBOLS, on_notify_fold_symbols, bool);
- REGISTER_NOTIFY (FOLD_UNDERLINE, on_notify_fold_underline, bool);
- REGISTER_NOTIFY (EDGE_COLUMN, on_notify_edge_column, int);
+ REGISTER_NOTIFY (settings, TAB_SIZE, on_notify_tab_size);
+ REGISTER_NOTIFY (docman_settings, TEXT_ZOOM_FACTOR, on_notify_zoom_factor);
+ REGISTER_NOTIFY (settings, INDENT_SIZE, on_notify_indent_size);
+ REGISTER_NOTIFY (settings, USE_TABS, on_notify_use_tab_for_indentation);
+ REGISTER_NOTIFY (settings, DISABLE_SYNTAX_HILIGHTING, on_notify_disable_hilite);
+ /* REGISTER_NOTIFY (settings, INDENT_AUTOMATIC, on_notify_automatic_indentation); */
+ REGISTER_NOTIFY (settings, WRAP_BOOKMARKS, on_notify_wrap_bookmarks);
+ REGISTER_NOTIFY (settings, BRACES_CHECK, on_notify_braces_check);
+ REGISTER_NOTIFY (settings, INDENT_MAINTAIN, on_notify_indent_maintain);
+ REGISTER_NOTIFY (settings, TAB_INDENTS, on_notify_tab_indents);
+ REGISTER_NOTIFY (settings, BACKSPACE_UNINDENTS, on_notify_backspace_unindents);
+ REGISTER_NOTIFY (settings, VIEW_EOL, on_notify_view_eols);
+ REGISTER_NOTIFY (settings, VIEW_LINE_WRAP, on_notify_view_linewrap);
+ REGISTER_NOTIFY (settings, VIEW_WHITE_SPACES, on_notify_view_whitespaces);
+ REGISTER_NOTIFY (settings, VIEW_INDENTATION_GUIDES, on_notify_view_indentation_guides);
+ REGISTER_NOTIFY (settings, VIEW_FOLD_MARGIN, on_notify_view_folds);
+ REGISTER_NOTIFY (settings, VIEW_MARKER_MARGIN, on_notify_view_markers);
+ REGISTER_NOTIFY (settings, VIEW_LINENUMBERS_MARGIN, on_notify_view_linenums);
+ REGISTER_NOTIFY (settings, FOLD_SYMBOLS, on_notify_fold_symbols);
+ REGISTER_NOTIFY (settings, FOLD_UNDERLINE, on_notify_fold_underline);
+ REGISTER_NOTIFY (settings, EDGE_COLUMN, on_notify_edge_column);
}
void
text_editor_prefs_finalize (TextEditor *te)
{
- GList *node;
- node = te->notify_ids;
- while (node)
- {
- anjuta_preferences_notify_remove (te->preferences,
- GPOINTER_TO_UINT (node->data));
- node = g_list_next (node);
- }
- g_list_free (te->notify_ids);
- te->notify_ids = NULL;
}
diff --git a/plugins/scratchbox/Makefile.am b/plugins/scratchbox/Makefile.am
index f7fe0b1..eaa12ce 100644
--- a/plugins/scratchbox/Makefile.am
+++ b/plugins/scratchbox/Makefile.am
@@ -36,6 +36,10 @@ libanjuta_scratchbox_la_SOURCES = \
plugin.c \
plugin.h
+prefs_ui_files = anjuta-scratchbox.ui
+prefs_name = org.gnome.anjuta.scratchbox
+include $(top_srcdir)/scripts/build-schemas.mk
+
EXTRA_DIST = \
$(plugin_in_files) \
$(anjuta_pixmaps_DATA) \
diff --git a/plugins/scratchbox/anjuta-scratchbox.ui b/plugins/scratchbox/anjuta-scratchbox.ui
index 1d5c72b..04ce0f6 100644
--- a/plugins/scratchbox/anjuta-scratchbox.ui
+++ b/plugins/scratchbox/anjuta-scratchbox.ui
@@ -96,7 +96,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="preferences_combo:text:Sbox1,Sbox2:0:scratchbox.version">
+ <object class="GtkComboBox" id="preferences_combo:text:Sbox1,Sbox2:0:scratchbox-version">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="model">model1</property>
@@ -117,7 +117,7 @@
</packing>
</child>
<child>
- <object class="GtkFileChooserButton" id="preferences_folder:text:/scratchbox:0:build.scratchbox.path">
+ <object class="GtkFileChooserButton" id="preferences_folder:text:/scratchbox:0:build-scratchbox-path">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="preview_widget_active">False</property>
diff --git a/plugins/scratchbox/plugin.c b/plugins/scratchbox/plugin.c
index 4fa2bba..75a1bda 100644
--- a/plugins/scratchbox/plugin.c
+++ b/plugins/scratchbox/plugin.c
@@ -38,12 +38,13 @@
#define ICON_FILE "anjuta-scratchbox-48.png"
#define GLADE_FILE PACKAGE_DATA_DIR"/glade/anjuta-scratchbox.ui"
-#define SB_ENTRY "preferences_folder:text:/scratchbox:0:build.scratchbox.path"
+#define SB_SCHEMA "org.gnome.anjuta.scratchbox"
+#define SB_ENTRY "preferences_folder:text:/scratchbox:0:build-scratchbox-path"
#define SB_TARGET_ENTRY "combo_target"
-#define SB_SBOX_ENTRY "preferences_combo:text:Sbox1,Sbox2:0:scratchbox.version"
+#define SB_SBOX_ENTRY "preferences_combo:text:Sbox1,Sbox2:0:scratchbox-version"
-#define PREF_SB_PATH "build.scratchbox.path"
-#define PREF_SB_VERSION "scratchbox.version"
+#define PREF_SB_PATH "build-scratchbox-path"
+#define PREF_SB_VERSION "scratchbox-version"
/* Type defintions
*---------------------------------------------------------------------------*/
@@ -66,6 +67,9 @@ struct _ScratchboxPlugin
gint id;
gint combo_element;
GString *buffer;
+
+ /* Settings */
+ GSettings *settings;
};
GtkBuilder *bxml;
@@ -177,7 +181,7 @@ on_change_target(GtkComboBox *combo, ScratchboxPlugin *plugin)
static void
on_update_target(GtkComboBox *combo, ScratchboxPlugin *plugin)
{
- AnjutaPreferences* prefs;
+ GSettings* settings;
GString* command = g_string_new (NULL);
gchar* sbox_commands;
gchar* sbox_args;
@@ -186,11 +190,10 @@ on_update_target(GtkComboBox *combo, ScratchboxPlugin *plugin)
g_return_if_fail (plugin != NULL);
- prefs = anjuta_shell_get_preferences (ANJUTA_PLUGIN (plugin)->shell,
- NULL);
- sb_ver = anjuta_preferences_get(prefs, PREF_SB_VERSION);
+ settings = plugin->settings;
+ sb_ver = g_settings_get_string (settings, PREF_SB_VERSION);
- sb_dir = anjuta_preferences_get(prefs, PREF_SB_PATH);
+ sb_dir = g_settings_get_string (settings, PREF_SB_PATH);
if (!sb_dir)
return;
@@ -309,7 +312,7 @@ static void
sbox2_environment_override (IAnjutaEnvironment* environment, gchar **dir, gchar ***argvp, gchar ***envp, GError** err)
{
ScratchboxPlugin *plugin = ANJUTA_PLUGIN_SCRATCHBOX (environment);
- AnjutaPreferences* prefs;
+ GSettings* settings;
gchar **new_argv;
gchar* sb_dir;
int i;
@@ -317,8 +320,8 @@ sbox2_environment_override (IAnjutaEnvironment* environment, gchar **dir, gchar
if (plugin->target == NULL || !strcmp(plugin->target, "host"))
return;
- prefs = anjuta_shell_get_preferences (ANJUTA_PLUGIN (plugin)->shell, NULL);
- sb_dir = anjuta_preferences_get(prefs, PREF_SB_PATH);
+ settings = plugin->settings;
+ sb_dir = g_settings_get_string (settings, PREF_SB_PATH);
if (plugin->user_dir) g_free (plugin->user_dir);
plugin->user_dir = g_strconcat (sb_dir, G_DIR_SEPARATOR_S, NULL);
@@ -345,13 +348,13 @@ static void
sbox1_environment_override (IAnjutaEnvironment* environment, gchar **dir, gchar ***argvp, gchar ***envp, GError** err)
{
ScratchboxPlugin *plugin = ANJUTA_PLUGIN_SCRATCHBOX (environment);
- AnjutaPreferences* prefs;
+ GSettings* settings;
gchar* sb_dir;
gsize len;
- prefs = anjuta_shell_get_preferences (ANJUTA_PLUGIN (plugin)->shell, NULL);
+ settings = plugin->settings;
- sb_dir = anjuta_preferences_get(prefs, PREF_SB_PATH);
+ sb_dir = g_settings_get_string (settings, PREF_SB_PATH);
if (plugin->user_dir) g_free (plugin->user_dir);
plugin->user_dir = g_strconcat (sb_dir, G_DIR_SEPARATOR_S,
@@ -389,17 +392,17 @@ static gboolean
ienvironment_override (IAnjutaEnvironment* environment, gchar **dir, gchar ***argvp, gchar ***envp, GError** err)
{
ScratchboxPlugin *plugin = ANJUTA_PLUGIN_SCRATCHBOX (environment);
- AnjutaPreferences* prefs;
+ GSettings* settings;
gchar* sb_dir;
gchar* sb_ver;
- prefs = anjuta_shell_get_preferences (ANJUTA_PLUGIN (plugin)->shell, NULL);
- sb_dir = anjuta_preferences_get(prefs, PREF_SB_PATH);
+ settings = plugin->settings;
+ sb_dir = g_settings_get_string (settings, PREF_SB_PATH);
if (!sb_dir)
return FALSE;
- sb_ver = anjuta_preferences_get(prefs, PREF_SB_VERSION);
+ sb_ver = g_settings_get_string (settings, PREF_SB_VERSION);
if (!strcmp(sb_ver, "Sbox1"))
sbox1_environment_override(environment, dir, argvp, envp, err);
else
@@ -461,7 +464,7 @@ ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError**
plugin->id = anjuta_preferences_get_int(prefs, SB_TARGET_ENTRY);
- anjuta_preferences_add_from_builder (prefs, bxml, "Scratchbox", _("Scratchbox"), ICON_FILE);
+ anjuta_preferences_add_from_builder (prefs, bxml, plugin->settings, "Scratchbox", _("Scratchbox"), ICON_FILE);
g_signal_connect(chooser_dir_entry, "current-folder-changed",
G_CALLBACK(on_change_directory),
plugin);
@@ -513,6 +516,7 @@ scratchbox_plugin_instance_init (GObject *obj)
plugin->launcher = NULL;
plugin->id = 0;
plugin->target = NULL;
+ plugin->settings = g_settings_new (SB_SCHEMA);
}
/* dispose is used to unref object created with instance_init */
@@ -529,6 +533,8 @@ scratchbox_plugin_dispose (GObject *obj)
g_free (plugin->user_dir);
plugin->user_dir = NULL;
}
+
+ g_object_unref (plugin->settings);
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
diff --git a/scripts/build-schemas.mk b/scripts/build-schemas.mk
index 6a12b14..c9ccaf0 100644
--- a/scripts/build-schemas.mk
+++ b/scripts/build-schemas.mk
@@ -1,29 +1,17 @@
# Targets for handing ui-to-GConf schema conversion for prefs keys
-prefs_ui_schemasdir = @GCONF_SCHEMA_FILE_DIR@
-prefs_ui_schemas = $(prefs_ui_files:.ui=.schemas)
-prefs_ui_schemas_DATA = $(prefs_ui_schemas)
+prefs_ui_schemas = $(prefs_ui_files:.ui=.gschema.xml)
-%.schemas: %.ui
- $(top_srcdir)/scripts/builder2schema.pl $< > $@
+# gsettings_SCHEMAS is a list of all the schemas you want to install
+gsettings_SCHEMAS = $(prefs_name).gschema.xml
-if GCONF_SCHEMAS_INSTALL
-install-data-local: $(prefs_ui_schemas)
- for p in $(prefs_ui_schemas) ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p ; \
- done
- @killall -1 gconfd-2 || true
+$(prefs_name).gschema.xml: $(prefs_ui_schemas)
+ mv -f $< $@
-uninstall-local: $(prefs_ui_schemas)
- for p in $(prefs_ui_schemas) ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-uninstall-rule $$p ; \
- done
- @killall -1 gconfd-2 || true
+%.gschema.xml: %.ui
+ $(AM_V_GEN)$(top_srcdir)/scripts/builder2schema.pl $< $(prefs_name) $(srcdir)/$(prefs_keyfile) > $@
-else
-install-data-local:
+# include the appropriate makefile rules for schema handling
+ GSETTINGS_RULES@
-uninstall-local:
-endif
-
-CLEANFILES = $(prefs_ui_schemas)
+CLEANFILES = $(prefs_ui_schemas) $(gsettings_SCHEMAS)
diff --git a/scripts/builder2schema.pl b/scripts/builder2schema.pl
index f9f9dad..0d9c4df 100755
--- a/scripts/builder2schema.pl
+++ b/scripts/builder2schema.pl
@@ -3,68 +3,85 @@
use XML::Parser;
%datatypes = (
- "bool" => "bool",
- "int" => "int",
- "string" => "string",
- "text" => "string",
- "float" => "float",
- "color" => "string",
- "font" => "string",
- "folder" => "string",
- "file" => "string"
+ "bool" => "b",
+ "int" => "i",
+ "string" => "s",
+ "text" => "s",
+ "float" => "f",
+ "color" => "s",
+ "font" => "s",
+ "folder" => "s",
+ "file" => "s"
);
%boolean = (
- 0 => "FALSE",
- 1 => "TRUE"
+ 0 => "false",
+ 1 => "true"
);
-$schema_path = "/schemas/apps/anjuta/preferences/";
-$key_path ="/apps/anjuta/preferences/";
+print "<schemalist>\n";
+print "\t<schema id=\"$ARGV[1]\" path=\"/apps/anjuta/\">\n";
-my $parser = new XML::Parser(Style => "Stream");
-print "<gconfschemafile>\n";
-print "\t<schemalist>\n";
+if ($#ARGV == 2) {
+ open FILE, "<", $ARGV[2] or die $!;
+ while (<FILE>) { print "\t\t$_"; }
+}
+my $parser = new XML::Parser(Style => "Stream");
$parser->parsefile($ARGV[0]);
-print "\t</schemalist>\n";
-print "</gconfschemafile>\n";
+print "\t</schema>\n";
+print "</schemalist>";
sub StartTag {
+ my %keys = {};
my $parser = shift;
my $key = shift;
if ($key =~ /object/) {
my $k = $_{"id"};
- if ($k =~ /(preferences_color|entry|font|spin|text|toggle|menu|folder|file):(.*):(.*):(\d):(.*)/) {
-
- my $type = $2;
- my $default = $3;
- my $flags = $4;
- my $propkey = $5;
-
-
+ if ($k =~ /(preferences_(color|entry|font|spin|text|toggle|menu|folder|file|combo)):(.*):(.*):(\d):(.*)/) {
+ my $pref = $2;
+ my $type = $3;
+ my $default = $4;
+ my $flags = $5;
+ my $propkey = $6;
+ my $realtype = $datatypes{$type};
+
+ if (exists $keys{$propkey})
+ {
+ return;
+ }
+ else
+ {
+ $keys{$propkey} = 1;
+ }
+
if ($type =~ /bool/) {
$default = $boolean{$default};
}
-
-
-
- print "\t\t<schema>\n";
- print "\t\t\t<key>$schema_path$propkey</key>\n";
- print "\t\t\t<applyto>$key_path$propkey</applyto>\n";
- print "\t\t\t<owner>anjuta</owner>\n";
- print "\t\t\t<type>$datatypes{$type}</type>\n";
- print "\t\t\t<default>$default</default>\n";
-
- # Hack to keep gconftool happy
- print "\t\t\t<locale name=\"C\" />\n";
-
- print "\t\t</schema>\n\n";
+
+
+ print "\t\t<key name=\"$propkey\" type=\"$realtype\">\n";
+ if ($pref eq "combo") {
+ @values = split(',', $default);
+ print "\t\t\t<choices>\n";
+ foreach (@values) {
+ print "\t\t\t\t<choice value=\"$_\" />\n"
+ }
+ print "\t\t\t</choices>\n";
+ print "\t\t\t<default>\"$values[$flags]\"</default>\n";
+ }
+ elsif ($realtype ne "s") {
+ print "\t\t\t<default>$default</default>\n";
+ }
+ else {
+ print "\t\t\t<default>\"$default\"</default>\n";
+ }
+ print "\t\t</key>\n";
}
}
}
sub EndTag {}
-sub Text {}
+sub Text {}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]