[anjuta/gsettings-migration: 47/65] snippets-manager: Ported to GSettings



commit 0af9385dbbe2904a405d380a23ca035d7e9ef289
Author: Johannes Schmid <jhs gnome org>
Date:   Sun Oct 10 13:00:32 2010 +0200

    snippets-manager: Ported to GSettings

 plugins/snippets-manager/Makefile.am |    6 +++++-
 plugins/snippets-manager/plugin.c    |   11 +++++++++--
 plugins/snippets-manager/plugin.h    |    2 ++
 3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/plugins/snippets-manager/Makefile.am b/plugins/snippets-manager/Makefile.am
index 41dc50e..1257547 100644
--- a/plugins/snippets-manager/Makefile.am
+++ b/plugins/snippets-manager/Makefile.am
@@ -68,7 +68,11 @@ libanjuta_snippets_manager_la_SOURCES = \
 	snippets-provider.h\
 	snippets-import-export.c\
 	snippets-import-export.h
-	
+
+prefs_name = org.gnome.anjuta.snippets
+prefs_ui_files = snippets-manager-preferences.ui
+include $(top_srcdir)/scripts/build-schemas.mk
+
 EXTRA_DIST = \
 	$(plugin_in_files) \
 	$(snippets_manager_pixmaps_DATA) \
diff --git a/plugins/snippets-manager/plugin.c b/plugins/snippets-manager/plugin.c
index 3aa531e..184eb04 100644
--- a/plugins/snippets-manager/plugin.c
+++ b/plugins/snippets-manager/plugin.c
@@ -40,6 +40,8 @@
 #define GLOBAL_VAR_NEW_NAME   "new_global_var_name"
 #define GLOBAL_VAR_NEW_VALUE  "new_global_var_value"
 
+#define PREF_SCHEMA "org.gnome.anjuta.snippets"
+
 static gpointer parent_class;
 
 /* Menu callbacks and actions */
@@ -408,6 +410,8 @@ snippets_manager_dispose (GObject * obj)
 	if (ANJUTA_IS_SNIPPETS_PROVIDER (snippets_manager->snippets_provider))
 		g_object_unref (snippets_manager->snippets_provider);
 
+	g_object_unref (snippets_manager->settings);
+	
 	G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
 
@@ -424,6 +428,8 @@ snippets_manager_plugin_instance_init (GObject * obj)
 	snippets_manager->action_group = NULL;
 	snippets_manager->uiid = -1;
 
+	snippets_manager->settings = g_settings_new (PREF_SCHEMA);
+	
 	snippets_manager->snippets_db = snippets_db_new ();
 	snippets_manager->snippets_interaction = snippets_interaction_new ();
 	snippets_manager->snippets_browser = snippets_browser_new ();
@@ -926,8 +932,9 @@ ipreferences_merge (IAnjutaPreferences* ipref,
 		g_warning ("Couldn't load preferences ui file: %s", error->message);
 		g_error_free (error);
 	}
-	anjuta_preferences_add_from_builder (prefs, bxml, SNIPPETS_MANAGER_PREFERENCES_ROOT, _("Code Snippets"),
-								 ICON_FILE);
+	anjuta_preferences_add_from_builder (prefs, bxml, snippets_manager_plugin->settings,
+	                                     SNIPPETS_MANAGER_PREFERENCES_ROOT, _("Code Snippets"),
+	                                     ICON_FILE);
 
 	/* Get the Gtk objects */
 	global_vars_view  = GTK_TREE_VIEW (gtk_builder_get_object (bxml, "global_vars_view"));
diff --git a/plugins/snippets-manager/plugin.h b/plugins/snippets-manager/plugin.h
index e55180e..e434b52 100644
--- a/plugins/snippets-manager/plugin.h
+++ b/plugins/snippets-manager/plugin.h
@@ -75,6 +75,8 @@ struct _SnippetsManagerPlugin
 
 	gboolean browser_maximized;
 
+	/* Settings */
+	GSettings* settings;
 };
 
 



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