[anjuta] language-support-js: Port to gsettings
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] language-support-js: Port to gsettings
- Date: Mon, 8 Nov 2010 11:02:09 +0000 (UTC)
commit b2b63bdb1f2f9f47215d381757c32bd1730580f8
Author: Jens Georg <mail jensge org>
Date: Sun Oct 31 14:30:43 2010 +0100
language-support-js: Port to gsettings
plugins/language-support-js/Makefile.am | 4 ++++
.../anjuta-language-javascript.ui | 2 +-
plugins/language-support-js/plugin.c | 16 ++++++++--------
plugins/language-support-js/plugin.h | 2 +-
plugins/language-support-js/util.c | 14 +++++++-------
5 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/plugins/language-support-js/Makefile.am b/plugins/language-support-js/Makefile.am
index f2afff5..285403f 100644
--- a/plugins/language-support-js/Makefile.am
+++ b/plugins/language-support-js/Makefile.am
@@ -64,6 +64,10 @@ libjs_support_plugin_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
libjs_support_plugin_la_LIBADD = \
$(LIBANJUTA_LIBS)
+prefs_ui_files = anjuta-language-javascript.ui
+prefs_name = org.gnome.anjuta.js
+include $(top_srcdir)/scripts/build-schemas.mk
+
EXTRA_DIST = \
$(plugin_in_files)\
$(js_support_plugin_plugin_DATA)\
diff --git a/plugins/language-support-js/anjuta-language-javascript.ui b/plugins/language-support-js/anjuta-language-javascript.ui
index 6ba69a0..d57be1b 100644
--- a/plugins/language-support-js/anjuta-language-javascript.ui
+++ b/plugins/language-support-js/anjuta-language-javascript.ui
@@ -185,7 +185,7 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="preferences_spin:int:3:1:javascript-min">
+ <object class="GtkSpinButton" id="preferences_spin:int:3:1:javascript-min-codecomplete">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
diff --git a/plugins/language-support-js/plugin.c b/plugins/language-support-js/plugin.c
index 827b83f..765850b 100644
--- a/plugins/language-support-js/plugin.c
+++ b/plugins/language-support-js/plugin.c
@@ -40,9 +40,9 @@
#define ICON_FILE "anjuta-language-cpp-java-plugin.png"
#define UI_FILE ANJUTA_UI_DIR"/anjuta-language-javascript.xml"
-#define MIN_CODECOMPLETE "javascript.min"
-#define ADD_BRACE_AFTER_FUNCCALL "javascript.add_brace_after_func"
-#define SHOW_CALLTIPS "javascript.show_calltips"
+#define MIN_CODECOMPLETE "javascript-min-codecomplete"
+#define ADD_BRACE_AFTER_FUNCCALL "javascript-add-brace-after-func"
+#define SHOW_CALLTIPS "javascript-show-calltips"
#define JSDIRS_LISTSTORE "jsdirs_liststore"
#define JSDIRS_TREEVIEW "jsdirs_treeview"
@@ -75,7 +75,7 @@ js_support_plugin_activate (AnjutaPlugin *plugin)
on_value_removed_current_editor,
plugin);
- js_support_plugin->prefs = anjuta_shell_get_preferences (plugin->shell, NULL);
+ js_support_plugin->prefs = g_settings_new ("org.gnome.anjuta.js");
return TRUE;
}
@@ -329,7 +329,7 @@ ipreferences_merge (IAnjutaPreferences* ipref, AnjutaPreferences* prefs,
gtk_builder_connect_signals (bxml, tree);
jsdirs_init_treeview (bxml);
anjuta_preferences_add_from_builder (prefs,
- bxml, "vbox1", _("JavaScript"),
+ bxml, NULL, "vbox1", _("JavaScript"),
ICON_FILE);
g_object_unref (bxml);
}
@@ -370,11 +370,11 @@ iprovider_activate (IAnjutaProvider *obj, IAnjutaIterable* iter, gpointer data,
{
IAnjutaIterable *position = ianjuta_editor_get_position (IANJUTA_EDITOR (plugin->current_editor), NULL);
- if (anjuta_preferences_get_bool (plugin->prefs, ADD_BRACE_AFTER_FUNCCALL))
+ if (g_settings_get_boolean (plugin->prefs, ADD_BRACE_AFTER_FUNCCALL))
{
ianjuta_editor_insert (IANJUTA_EDITOR (plugin->current_editor), position, " (", -1, NULL);
}
- if (anjuta_preferences_get_bool (plugin->prefs, SHOW_CALLTIPS))
+ if (g_settings_get_boolean (plugin->prefs, SHOW_CALLTIPS))
{
/* GList *t = NULL;
gchar *args = code_completion_get_func_tooltip (plugin, sym);
@@ -435,7 +435,7 @@ iprovider_populate (IAnjutaProvider *obj, IAnjutaIterable* iter, GError **err)
g_assert (plugin->prefs);
- if (strlen (str) < anjuta_preferences_get_int (plugin->prefs, MIN_CODECOMPLETE))
+ if (strlen (str) < g_settings_get_int (plugin->prefs, MIN_CODECOMPLETE))
{
ianjuta_editor_assist_proposals ( IANJUTA_EDITOR_ASSIST (plugin->current_editor), obj, NULL, TRUE, NULL);
return;
diff --git a/plugins/language-support-js/plugin.h b/plugins/language-support-js/plugin.h
index b09f350..af6195d 100644
--- a/plugins/language-support-js/plugin.h
+++ b/plugins/language-support-js/plugin.h
@@ -35,7 +35,7 @@ struct _JSLang{
gpointer last;
// GList *complition_cache;
// gint uiid;
- AnjutaPreferences *prefs;
+ GSettings *prefs;
DatabaseSymbol* symbol;
// GtkActionGroup *action_group;
};
diff --git a/plugins/language-support-js/util.c b/plugins/language-support-js/util.c
index 61336b6..4295b7d 100644
--- a/plugins/language-support-js/util.c
+++ b/plugins/language-support-js/util.c
@@ -25,9 +25,9 @@
#include "plugin.h"
#include "util.h"
-#define HIGHLIGHT_MISSEDSEMICOLON "javascript_missed"
-#define GIR_DIR_KEY "javascript_girdir"
-#define GJS_DIR_KEY "javascript_gjsdir"
+#define HIGHLIGHT_MISSEDSEMICOLON "javascript-missed"
+#define GIR_DIR_KEY "javascript-girdir"
+#define GJS_DIR_KEY "javascript-gjsdir"
static gchar*
get_gjs_path ()
@@ -35,9 +35,9 @@ get_gjs_path ()
JSLang* plugin = (JSLang*)getPlugin ();
if (!plugin->prefs)
- plugin->prefs = anjuta_shell_get_preferences (ANJUTA_PLUGIN (plugin)->shell, NULL);
+ plugin->prefs = g_settings_new ("org.gnome.anjuta.js");
- gchar *path = anjuta_preferences_get (plugin->prefs, GJS_DIR_KEY);
+ gchar *path = g_settings_get_string (plugin->prefs, GJS_DIR_KEY);
if (!path || strlen (path) < 1)
{
g_free (path);
@@ -114,7 +114,7 @@ highlight_lines (GList *lines)
if (!plugin->prefs)
plugin->prefs = anjuta_shell_get_preferences (ANJUTA_PLUGIN (plugin)->shell, NULL);
- if (!anjuta_preferences_get_bool (plugin->prefs, HIGHLIGHT_MISSEDSEMICOLON))
+ if (!g_settings_get_boolean (plugin->prefs, HIGHLIGHT_MISSEDSEMICOLON))
{
return;
}
@@ -245,7 +245,7 @@ get_gir_path ()
if (!plugin->prefs)
plugin->prefs = anjuta_shell_get_preferences (ANJUTA_PLUGIN (plugin)->shell, NULL);
- gchar *path = anjuta_preferences_get (plugin->prefs, GIR_DIR_KEY);
+ gchar *path = g_settings_get_string (plugin->prefs, GIR_DIR_KEY);
if (!path || strlen (path) < 1)
{
g_free (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]