[gedit-plugins] Port drawspaces plugin to gsettings.



commit 7d005579ef4d90874fddd3a9d118a43646729ae7
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon May 10 11:55:35 2010 +0200

    Port drawspaces plugin to gsettings.

 configure.ac                                       |    6 +
 plugins/drawspaces/Makefile.am                     |   22 +-
 plugins/drawspaces/gedit-drawspaces-plugin.c       |  503 +++++++-------------
 plugins/drawspaces/gedit-drawspaces.schemas.in     |   91 ----
 .../org.gnome.gedit.drawspaces.gschema.in          |   11 +
 5 files changed, 198 insertions(+), 435 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 473147f..29ae94f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,12 @@ PKG_CHECK_MODULES(GEDIT, [
 
 AM_GCONF_SOURCE_2
 
+dnl ================================================================
+dnl GSettings stuff
+dnl ================================================================
+
+GLIB_GSETTINGS
+
 # ================================================================
 # Plugins
 # ================================================================
diff --git a/plugins/drawspaces/Makefile.am b/plugins/drawspaces/Makefile.am
index 6d846ff..e5424d3 100644
--- a/plugins/drawspaces/Makefile.am
+++ b/plugins/drawspaces/Makefile.am
@@ -27,20 +27,14 @@ plugin_in_files = drawspaces.gedit-plugin.desktop.in
 
 plugin_DATA = $(plugin_in_files:.gedit-plugin.desktop.in=.gedit-plugin)
 
-schemasdir	 = $(GCONF_SCHEMA_FILE_DIR)
-schemas_in_files = gedit-drawspaces.schemas.in
-schemas_DATA 	 = $(schemas_in_files:.schemas.in=.schemas)
- INTLTOOL_SCHEMAS_RULE@
-
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
-	        if test -z "$(DESTDIR)" ; then \
-	                for p in $(schemas_DATA) ; do \
-	                        GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/plugins/drawspaces/$$p ; \
-	                done \
-	        fi
-else
-install-data-local:
+gsettingsschema_in_files = org.gnome.gedit.drawspaces.gschema.in
+gsettingsschema_DATA = $(gsettingsschema_in_files:.gschema.in=.gschema.xml)
+org.gnome.gedit.drawspaces.gschema.xml: org.gnome.gedit.drawspaces.gschema.in
+	gsettings-schema-convert -f $< -o $@
+
+if GSETTINGS_SCHEMAS_INSTALL
+install-data-hook:
+	$(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
 endif
 
 EXTRA_DIST = $(plugin_in_files) $(ui_DATA) $(schemas_in_files)
diff --git a/plugins/drawspaces/gedit-drawspaces-plugin.c b/plugins/drawspaces/gedit-drawspaces-plugin.c
index f4038c3..dd88f78 100644
--- a/plugins/drawspaces/gedit-drawspaces-plugin.c
+++ b/plugins/drawspaces/gedit-drawspaces-plugin.c
@@ -30,17 +30,15 @@
 #include <gedit/gedit-tab.h>
 #include <gedit/gedit-utils.h>
 
-#include <gconf/gconf-client.h>
-
-#define GCONF_KEY_BASE "/apps/gedit-2/plugins/drawspaces"
-#define GCONF_KEY_ENABLE        GCONF_KEY_BASE "/enable"
-#define GCONF_KEY_DRAW_TABS     GCONF_KEY_BASE "/draw_tabs"
-#define GCONF_KEY_DRAW_SPACES   GCONF_KEY_BASE "/draw_spaces"
-#define GCONF_KEY_DRAW_NEWLINE  GCONF_KEY_BASE "/draw_newline"
-#define GCONF_KEY_DRAW_NBSP     GCONF_KEY_BASE "/draw_nbsp"
-#define GCONF_KEY_DRAW_LEADING  GCONF_KEY_BASE "/draw_leading"
-#define GCONF_KEY_DRAW_TEXT     GCONF_KEY_BASE "/draw_text"
-#define GCONF_KEY_DRAW_TRAILING GCONF_KEY_BASE "/draw_trailing"
+#define DRAWSPACES_SETTINGS_BASE   "org.gnome.gedit.plugins.drawspaces"
+#define SETTINGS_KEY_ENABLE        "enable"
+#define SETTINGS_KEY_DRAW_TABS     "draw-tabs"
+#define SETTINGS_KEY_DRAW_SPACES   "draw-spaces"
+#define SETTINGS_KEY_DRAW_NEWLINE  "draw-newline"
+#define SETTINGS_KEY_DRAW_NBSP     "draw-nbsp"
+#define SETTINGS_KEY_DRAW_LEADING  "draw-leading"
+#define SETTINGS_KEY_DRAW_TEXT     "draw-text"
+#define SETTINGS_KEY_DRAW_TRAILING "draw-trailing"
 
 #define UI_FILE "drawspaces.ui"
 
@@ -56,8 +54,7 @@ GEDIT_PLUGIN_REGISTER_TYPE (GeditDrawspacesPlugin, gedit_drawspaces_plugin)
 
 struct _GeditDrawspacesPluginPrivate
 {
-	GConfClient *gconf_client;
-	guint connection_id;
+	GSettings *settings;
 
 	GtkSourceDrawSpacesFlags flags;
 };
@@ -125,25 +122,6 @@ free_action_data (gpointer data)
 }
 
 static void
-set_draw_gconf (GeditDrawspacesPlugin *plugin,
-                const gchar           *key,
-                gboolean               value)
-{
-	GError *error = NULL;
-
-	gconf_client_set_bool (plugin->priv->gconf_client,
-			       key,
-			       value,
-			       &error);
-
-	if (error != NULL)
-	{
-		g_warning ("%s", error->message);
-		g_error_free (error);
-	}
-}
-
-static void
 on_active_toggled (GtkToggleAction *action,
 		   ActionData *action_data)
 {
@@ -157,7 +135,8 @@ on_active_toggled (GtkToggleAction *action,
 	value = gtk_toggle_action_get_active (action);
 	data->enable = value;
 
-	set_draw_gconf (action_data->plugin, GCONF_KEY_ENABLE, value);
+	g_settings_set_boolean (action_data->plugin->priv->settings,
+				SETTINGS_KEY_ENABLE, value);
 
 	draw_spaces_in_window (action_data->window, action_data->plugin);
 }
@@ -169,10 +148,108 @@ static const GtkToggleActionEntry action_entries[] =
 	 G_CALLBACK (on_active_toggled)},
 };
 
-static void on_gconf_notify (GConfClient *client,
-			     guint cnxn_id,
-			     GConfEntry *entry,
-			     gpointer user_data);
+static void
+draw_spaces (GeditDrawspacesPlugin *plugin)
+{
+	const GList *windows, *l;
+
+	windows = gedit_app_get_windows (gedit_app_get_default ());
+
+	for (l = windows; l != NULL; l = g_list_next (l))
+	{
+		draw_spaces_in_window (l->data, plugin);
+	}
+}
+
+static void
+on_settings_changed (GSettings             *settings,
+		     const gchar           *key,
+		     GeditDrawspacesPlugin *plugin)
+{
+	gboolean value;
+
+	value = g_settings_get_boolean (settings, key);
+
+	if (strcmp (key, SETTINGS_KEY_DRAW_TABS) == 0)
+	{
+		if (value)
+		{
+			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TAB;
+		}
+		else
+		{
+			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_TAB;
+		}
+	}
+	else if (strcmp (key, SETTINGS_KEY_DRAW_SPACES) == 0)
+	{
+		if (value)
+		{
+			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_SPACE;
+		}
+		else
+		{
+			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_SPACE;
+		}
+	}
+	else if (strcmp (key, SETTINGS_KEY_DRAW_NEWLINE) == 0)
+	{
+		if (value)
+		{
+			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_NEWLINE;
+		}
+		else
+		{
+			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_NEWLINE;
+		}
+	}
+	else if (strcmp (key, SETTINGS_KEY_DRAW_NBSP) == 0)
+	{
+		if (value)
+		{
+			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_NBSP;
+		}
+		else
+		{
+			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_NBSP;
+		}
+	}
+	else if (strcmp (key, SETTINGS_KEY_DRAW_LEADING) == 0)
+	{
+		if (value)
+		{
+			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_LEADING;
+		}
+		else
+		{
+			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_LEADING;
+		}
+	}
+	else if (strcmp (key, SETTINGS_KEY_DRAW_TEXT) == 0)
+	{
+		if (value)
+		{
+			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TEXT;
+		}
+		else
+		{
+			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_TEXT;
+		}
+	}
+	else if (strcmp (key, SETTINGS_KEY_DRAW_TRAILING) == 0)
+	{
+		if (value)
+		{
+			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TRAILING;
+		}
+		else
+		{
+			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_TRAILING;
+		}
+	}
+
+	draw_spaces (plugin);
+}
 
 static void
 gedit_drawspaces_plugin_init (GeditDrawspacesPlugin *plugin)
@@ -181,17 +258,12 @@ gedit_drawspaces_plugin_init (GeditDrawspacesPlugin *plugin)
 
 	plugin->priv = GEDIT_DRAWSPACES_PLUGIN_GET_PRIVATE (plugin);
 
-	plugin->priv->gconf_client = gconf_client_get_default ();
-
-	gconf_client_add_dir (plugin->priv->gconf_client,
-			      GCONF_KEY_BASE,
-			      GCONF_CLIENT_PRELOAD_ONELEVEL,
-			      NULL);
+	plugin->priv->settings = g_settings_new (DRAWSPACES_SETTINGS_BASE);
 
-	plugin->priv->connection_id = gconf_client_notify_add (plugin->priv->gconf_client,
-							       GCONF_KEY_BASE,
-							       on_gconf_notify,
-							       plugin, NULL, NULL);
+	g_signal_connect (plugin->priv->settings,
+			  "changed",
+			  G_CALLBACK (on_settings_changed),
+			  plugin);
 }
 
 static void
@@ -201,21 +273,10 @@ gedit_drawspaces_plugin_dispose (GObject *object)
 
 	gedit_debug_message (DEBUG_PLUGINS, "GeditDrawspacesPlugin disposing");
 
-	if (plugin->priv->connection_id != 0)
-	{
-		gconf_client_notify_remove (plugin->priv->gconf_client,
-					    plugin->priv->connection_id);
-
-		plugin->priv->connection_id = 0;
-	}
-
-	if (plugin->priv->gconf_client != NULL)
+	if (plugin->priv->settings != NULL)
 	{
-		gconf_client_suggest_sync (plugin->priv->gconf_client, NULL);
-
-		g_object_unref (G_OBJECT (plugin->priv->gconf_client));
-
-		plugin->priv->gconf_client = NULL;
+		g_object_unref (plugin->priv->settings);
+		plugin->priv->settings = NULL;
 	}
 
 	G_OBJECT_CLASS (gedit_drawspaces_plugin_parent_class)->dispose (object);
@@ -243,19 +304,6 @@ draw_spaces_in_window (GeditWindow *window,
 }
 
 static void
-draw_spaces (GeditDrawspacesPlugin *plugin)
-{
-	const GList *windows, *l;
-
-	windows = gedit_app_get_windows (gedit_app_get_default ());
-
-	for (l = windows; l != NULL; l = g_list_next (l))
-	{
-		draw_spaces_in_window (l->data, plugin);
-	}
-}
-
-static void
 tab_added_cb (GeditWindow *window,
 	      GeditTab *tab,
 	      GeditDrawspacesPlugin *plugin)
@@ -276,94 +324,35 @@ tab_added_cb (GeditWindow *window,
 	}
 }
 
-static gint
-get_gconf_value_with_default_int (GeditDrawspacesPlugin *plugin,
-			          const gchar           *key,
-			          gint                   def)
-{
-	GConfValue *value;
-	gint ret;
-
-	value = gconf_client_get (plugin->priv->gconf_client,
-				  key, NULL);
-
-	if (value != NULL && value->type == GCONF_VALUE_INT)
-	{
-		ret = gconf_value_get_int (value);
-	}
-	else
-	{
-		ret = def;
-	}
-
-	if (value != NULL)
-	{
-		gconf_value_free (value);
-	}
-
-	return ret;
-}
-
-static gboolean
-get_gconf_value_with_default (GeditDrawspacesPlugin *plugin,
-			      const gchar           *key,
-			      gboolean               def)
-{
-	GConfValue *value;
-	gboolean ret;
-
-	value = gconf_client_get (plugin->priv->gconf_client,
-				  key, NULL);
-
-	if (value != NULL && value->type == GCONF_VALUE_BOOL)
-	{
-		ret = gconf_value_get_bool (value);
-	}
-	else
-	{
-		ret = def;
-	}
-
-	if (value != NULL)
-	{
-		gconf_value_free (value);
-	}
-
-	return ret;
-}
-
 static void
 get_config_options (WindowData *data,
 		    GeditDrawspacesPlugin *plugin)
 {
 	gboolean tabs, spaces, newline, nbsp, leading, text, trailing;
 
-	data->enable = get_gconf_value_with_default (plugin, GCONF_KEY_ENABLE,
-						     TRUE);
+	data->enable = g_settings_get_boolean (plugin->priv->settings,
+					       SETTINGS_KEY_ENABLE);
 
-	tabs = get_gconf_value_with_default (plugin, GCONF_KEY_DRAW_TABS,
-					     TRUE);
+	tabs = g_settings_get_boolean (plugin->priv->settings,
+				       SETTINGS_KEY_DRAW_TABS);
 
-	spaces = get_gconf_value_with_default (plugin, GCONF_KEY_DRAW_SPACES,
-					       TRUE);
+	spaces = g_settings_get_boolean (plugin->priv->settings,
+					 SETTINGS_KEY_DRAW_SPACES);
 
-	newline = get_gconf_value_with_default (plugin, GCONF_KEY_DRAW_NEWLINE,
-					        FALSE);
+	newline = g_settings_get_boolean (plugin->priv->settings,
+					  SETTINGS_KEY_DRAW_NEWLINE);
 
-	nbsp = get_gconf_value_with_default (plugin, GCONF_KEY_DRAW_NBSP,
-					     FALSE);
+	nbsp = g_settings_get_boolean (plugin->priv->settings,
+				       SETTINGS_KEY_DRAW_NBSP);
 
-	leading = get_gconf_value_with_default (plugin,
-	                                        GCONF_KEY_DRAW_LEADING,
-	                                        TRUE);
+	leading = g_settings_get_boolean (plugin->priv->settings,
+					  SETTINGS_KEY_DRAW_LEADING);
 
-	text = get_gconf_value_with_default (plugin,
-	                                     GCONF_KEY_DRAW_TEXT,
-	                                     TRUE);
+	text = g_settings_get_boolean (plugin->priv->settings,
+				       SETTINGS_KEY_DRAW_TEXT);
 
-	trailing = get_gconf_value_with_default (plugin,
-	                                         GCONF_KEY_DRAW_TRAILING,
-	                                         TRUE);
+	trailing = g_settings_get_boolean (plugin->priv->settings,
+					   SETTINGS_KEY_DRAW_TRAILING);
 
 	if (tabs)
 	{
@@ -497,69 +486,6 @@ impl_deactivate	(GeditPlugin *plugin,
 }
 
 static void
-on_draw_tabs_toggled (GtkToggleButton       *button,
-                      GeditDrawspacesPlugin *plugin)
-{
-	set_draw_gconf (plugin,
-	                GCONF_KEY_DRAW_TABS,
-	                gtk_toggle_button_get_active (button));
-}
-
-static void
-on_draw_spaces_toggled (GtkToggleButton       *button,
-                        GeditDrawspacesPlugin *plugin)
-{
-	set_draw_gconf (plugin,
-	                GCONF_KEY_DRAW_SPACES,
-	                gtk_toggle_button_get_active (button));
-}
-
-static void
-on_draw_newline_toggled (GtkToggleButton       *button,
-                         GeditDrawspacesPlugin *plugin)
-{
-	set_draw_gconf (plugin,
-	                GCONF_KEY_DRAW_NEWLINE,
-	                gtk_toggle_button_get_active (button));
-}
-
-static void
-on_draw_nbsp_toggled (GtkToggleButton       *button,
-                      GeditDrawspacesPlugin *plugin)
-{
-	set_draw_gconf (plugin,
-	                GCONF_KEY_DRAW_NBSP,
-	                gtk_toggle_button_get_active (button));
-}
-
-static void
-on_draw_leading_toggled (GtkToggleButton       *button,
-                         GeditDrawspacesPlugin *plugin)
-{
-	set_draw_gconf (plugin,
-	                GCONF_KEY_DRAW_LEADING,
-	                gtk_toggle_button_get_active (button));
-}
-
-static void
-on_draw_text_toggled (GtkToggleButton       *button,
-                      GeditDrawspacesPlugin *plugin)
-{
-	set_draw_gconf (plugin,
-	                GCONF_KEY_DRAW_TEXT,
-	                gtk_toggle_button_get_active (button));
-}
-
-static void
-on_draw_trailing_toggled (GtkToggleButton       *button,
-                          GeditDrawspacesPlugin *plugin)
-{
-	set_draw_gconf (plugin,
-	                GCONF_KEY_DRAW_TRAILING,
-	                gtk_toggle_button_get_active (button));
-}
-
-static void
 dialog_destroyed (GtkObject *obj, gpointer dialog_pointer)
 {
 	gedit_debug (DEBUG_PLUGINS);
@@ -641,20 +567,41 @@ get_configuration_dialog (GeditDrawspacesPlugin *plugin)
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->draw_trailing),
 				      plugin->priv->flags & GTK_SOURCE_DRAW_SPACES_TRAILING);
 
-	g_signal_connect (dialog->draw_tabs, "toggled",
-			  G_CALLBACK (on_draw_tabs_toggled), plugin);
-	g_signal_connect (dialog->draw_spaces, "toggled",
-			  G_CALLBACK (on_draw_spaces_toggled), plugin);
-	g_signal_connect (dialog->draw_newline, "toggled",
-			  G_CALLBACK (on_draw_newline_toggled), plugin);
-	g_signal_connect (dialog->draw_nbsp, "toggled",
-			  G_CALLBACK (on_draw_nbsp_toggled), plugin);
-	g_signal_connect (dialog->draw_leading, "toggled",
-			  G_CALLBACK (on_draw_leading_toggled), plugin);
-	g_signal_connect (dialog->draw_text, "toggled",
-			  G_CALLBACK (on_draw_text_toggled), plugin);
-	g_signal_connect (dialog->draw_trailing, "toggled",
-			  G_CALLBACK (on_draw_trailing_toggled), plugin);
+	g_settings_bind (plugin->priv->settings,
+			 SETTINGS_KEY_DRAW_TABS,
+			 dialog->draw_tabs,
+			 "active",
+			 (G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET));
+	g_settings_bind (plugin->priv->settings,
+			 SETTINGS_KEY_DRAW_SPACES,
+			 dialog->draw_spaces,
+			 "active",
+			 (G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET));
+	g_settings_bind (plugin->priv->settings,
+			 SETTINGS_KEY_DRAW_NEWLINE,
+			 dialog->draw_newline,
+			 "active",
+			 (G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET));
+	g_settings_bind (plugin->priv->settings,
+			 SETTINGS_KEY_DRAW_NBSP,
+			 dialog->draw_nbsp,
+			 "active",
+			 (G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET));
+	g_settings_bind (plugin->priv->settings,
+			 SETTINGS_KEY_DRAW_LEADING,
+			 dialog->draw_leading,
+			 "active",
+			 (G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET));
+	g_settings_bind (plugin->priv->settings,
+			 SETTINGS_KEY_DRAW_TEXT,
+			 dialog->draw_text,
+			 "active",
+			 (G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET));
+	g_settings_bind (plugin->priv->settings,
+			 SETTINGS_KEY_DRAW_TRAILING,
+			 dialog->draw_trailing,
+			 "active",
+			 (G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET));
 
 	g_signal_connect (dialog->dialog, "destroy",
 			  G_CALLBACK (dialog_destroyed), dialog);
@@ -678,110 +625,6 @@ impl_create_configure_dialog (GeditPlugin *plugin)
 }
 
 static void
-on_gconf_notify (GConfClient *client,
-		 guint cnxn_id,
-		 GConfEntry *entry,
-		 gpointer user_data)
-{
-	GeditDrawspacesPlugin *plugin = GEDIT_DRAWSPACES_PLUGIN (user_data);
-	gboolean value;
-
-	if (strcmp (entry->key, GCONF_KEY_DRAW_TABS) == 0)
-	{
-		value = gconf_value_get_bool (entry->value);
-
-		if (value)
-		{
-			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TAB;
-		}
-		else
-		{
-			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_TAB;
-		}
-	}
-	else if (strcmp (entry->key, GCONF_KEY_DRAW_SPACES) == 0)
-	{
-		value = gconf_value_get_bool (entry->value);
-
-		if (value)
-		{
-			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_SPACE;
-		}
-		else
-		{
-			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_SPACE;
-		}
-	}
-	else if (strcmp (entry->key, GCONF_KEY_DRAW_NEWLINE) == 0)
-	{
-		value = gconf_value_get_bool (entry->value);
-
-		if (value)
-		{
-			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_NEWLINE;
-		}
-		else
-		{
-			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_NEWLINE;
-		}
-	}
-	else if (strcmp (entry->key, GCONF_KEY_DRAW_NBSP) == 0)
-	{
-		value = gconf_value_get_bool (entry->value);
-
-		if (value)
-		{
-			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_NBSP;
-		}
-		else
-		{
-			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_NBSP;
-		}
-	}
-	else if (strcmp (entry->key, GCONF_KEY_DRAW_LEADING) == 0)
-	{
-		value = gconf_value_get_bool (entry->value);
-
-		if (value)
-		{
-			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_LEADING;
-		}
-		else
-		{
-			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_LEADING;
-		}
-	}
-	else if (strcmp (entry->key, GCONF_KEY_DRAW_TEXT) == 0)
-	{
-		value = gconf_value_get_bool (entry->value);
-
-		if (value)
-		{
-			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TEXT;
-		}
-		else
-		{
-			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_TEXT;
-		}
-	}
-	else if (strcmp (entry->key, GCONF_KEY_DRAW_TRAILING) == 0)
-	{
-		value = gconf_value_get_bool (entry->value);
-
-		if (value)
-		{
-			plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TRAILING;
-		}
-		else
-		{
-			plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_TRAILING;
-		}
-	}
-
-	draw_spaces (plugin);
-}
-
-static void
 gedit_drawspaces_plugin_class_init (GeditDrawspacesPluginClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
diff --git a/plugins/drawspaces/org.gnome.gedit.drawspaces.gschema.in b/plugins/drawspaces/org.gnome.gedit.drawspaces.gschema.in
new file mode 100644
index 0000000..efc6f58
--- /dev/null
+++ b/plugins/drawspaces/org.gnome.gedit.drawspaces.gschema.in
@@ -0,0 +1,11 @@
+schema org.gnome.gedit.plugins.drawspaces:
+  path /apps/gedit/plugins/drawspaces/
+
+  key enable = @b true
+  key draw-tabs = @b true
+  key draw-spaces = @b true
+  key draw-newline = @b false
+  key draw-nbsp = @b false
+  key draw-leading = @b true
+  key draw-text = @b true
+  key draw-trailing = @b true



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