[anjuta] gtodo: Remove gconf dependency



commit 4f69377001e5020914e50f722975e4539aafa444
Author: Jens Georg <mail jensge org>
Date:   Fri Jun 18 21:05:59 2010 +0200

    gtodo: Remove gconf dependency

 plugins/gtodo/callback.c     |    4 +-
 plugins/gtodo/interface.c    |   78 ++++++++----------
 plugins/gtodo/list_tooltip.c |    2 +-
 plugins/gtodo/main.h         |    6 +-
 plugins/gtodo/notification.c |    6 +-
 plugins/gtodo/preferences.c  |  187 +++++++++++++++++++-----------------------
 6 files changed, 128 insertions(+), 155 deletions(-)
---
diff --git a/plugins/gtodo/callback.c b/plugins/gtodo/callback.c
index dbe248e..3805958 100644
--- a/plugins/gtodo/callback.c
+++ b/plugins/gtodo/callback.c
@@ -44,7 +44,7 @@ void category_changed(void)
 		if(i != 0)if( mw.mitems == NULL || mw.mitems[i-2] == NULL) return;
 		if(i == categorys+3)
 		{
-			int j =  gconf_client_get_int(client, "/apps/gtodo/view/last-category",NULL);
+			int j = anjuta_preferences_get_int (preferences, "gtodo.last-category");
 			category_manager();
 			if(j < categorys+3 && mw.mitems != NULL && mw.mitems[j-2] != NULL) gtk_combo_box_set_active(GTK_COMBO_BOX(mw.option),j);
 			gtk_list_store_clear(mw.list);
@@ -53,7 +53,7 @@ void category_changed(void)
 		}
 		gtk_list_store_clear(mw.list);
 		load_category();
-		gconf_client_set_int(client, "/apps/gtodo/view/last-category",i,NULL);
+		anjuta_preferences_set_int (preferences, "gtodo.last-category", i);
 	}
 }
 
diff --git a/plugins/gtodo/interface.c b/plugins/gtodo/interface.c
index 12f1258..b238452 100644
--- a/plugins/gtodo/interface.c
+++ b/plugins/gtodo/interface.c
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include "main.h"
 #include <libanjuta/anjuta-utils.h>
+#include <libanjuta/anjuta-preferences.h>
 #include "debug_printf.h"
 
 /* the main window struct */
@@ -11,7 +12,7 @@ mwindow mw;
 
 /* settings struct */
 sets settings;
-GConfClient* client;    
+AnjutaPreferences *preferences;
 
 /* the connection to the xml file */
 GTodoClient *cl = NULL;
@@ -37,43 +38,34 @@ static void set_read_only()
 
 void gtodo_load_settings ()
 {
-	debug_printf(DEBUG_INFO, "Creating gconf client");
-	client = gconf_client_get_default();
+	debug_printf(DEBUG_INFO, "Creating anjuta preferences client");
+	preferences = anjuta_preferences_default ();
 	
-	gconf_client_add_dir(client,
-			"/apps/gtodo/prefs",
-			GCONF_CLIENT_PRELOAD_NONE,
-			NULL);
-	gconf_client_add_dir(client,
-			"/apps/gtodo/view",
-			GCONF_CLIENT_PRELOAD_NONE,
-			NULL);
-
-	debug_printf(DEBUG_INFO, "Loading settings from gconf");
-
-	settings.place = gconf_client_get_bool(client, "/apps/gtodo/prefs/restore-position",NULL);;
-	settings.size =  gconf_client_get_bool(client, "/apps/gtodo/prefs/restore-size",NULL);;
-	settings.ask_delete_category 	=  gconf_client_get_bool(client, "/apps/gtodo/prefs/ask-delete-category",NULL);
+	debug_printf(DEBUG_INFO, "Loading settings from anjuta preferences");
+
+	settings.place = anjuta_preferences_get_bool(preferences, "gtodo.restore-position");;
+	settings.size =  anjuta_preferences_get_bool(preferences, "gtodo.restore-size");;
+	settings.ask_delete_category 	=  anjuta_preferences_get_bool(preferences, "gtodo.ask-delete-category");
 	/* this is kinda (thanks gtk :-/) buggy.. gtk need fix first */
-//	settings.list_tooltip		= gconf_client_get_bool(client, "/apps/gtodo/prefs/show-tooltip",NULL);
+//	settings.list_tooltip		= anjuta_preferences_get_bool(preferences, "gtodo.show-tooltip");
 	/* auto purge is default on.. */
-	settings.auto_purge		= gconf_client_get_bool(client, "/apps/gtodo/prefs/auto-purge",NULL);
+	settings.auto_purge		= anjuta_preferences_get_bool(preferences, "gtodo.auto-purge");
 	/* set default auto purge to a week */	
-	settings.purge_days		= gconf_client_get_int(client, "/apps/gtodo/prefs/auto-purge-days",NULL);
-	settings.due_color 		= gconf_client_get_string(client, "/apps/gtodo/prefs/due-color",NULL);
-	settings.due_today_color 	= gconf_client_get_string(client, "/apps/gtodo/prefs/due-today-color",NULL);
-	settings.due_in_days_color 	= gconf_client_get_string(client, "/apps/gtodo/prefs/due-in-days-color",NULL);
-	settings.due_days 		= gconf_client_get_int(client, "/apps/gtodo/prefs/due-days",NULL);
-	settings.sorttype 		= gconf_client_get_int(client, "/apps/gtodo/prefs/sort-type",NULL);	
-	settings.sortorder 		= gconf_client_get_int(client, "/apps/gtodo/prefs/sort-order",NULL);	
+	settings.purge_days		= anjuta_preferences_get_int(preferences, "gtodo.auto-purge-days");
+	settings.due_color 		= anjuta_preferences_get(preferences, "gtodo.due-color");
+	settings.due_today_color 	= anjuta_preferences_get(preferences, "gtodo.due-today-color");
+	settings.due_in_days_color 	= anjuta_preferences_get(preferences, "gtodo.due-in-days-color");
+	settings.due_days 		= anjuta_preferences_get_int(preferences, "gtodo.due-days");
+	settings.sorttype 		= anjuta_preferences_get_int(preferences, "gtodo.sort-type");
+	settings.sortorder 		= anjuta_preferences_get_int(preferences, "gtodo.sort-order");
 	/* treeview hide preferences.. */
-	settings.hide_done 		= gconf_client_get_bool(client, "/apps/gtodo/prefs/hide-done",NULL);
-	settings.hide_due 		= gconf_client_get_bool(client, "/apps/gtodo/prefs/hide-due",NULL);
-	settings.hide_nodate 		=  gconf_client_get_bool(client, "/apps/gtodo/prefs/hide-nodate",NULL);
-	settings.hl_indays		= gconf_client_get_bool(client,"/apps/gtodo/prefs/hl-indays",NULL);
-	settings.hl_due			= gconf_client_get_bool(client,"/apps/gtodo/prefs/hl-due",NULL);
-	settings.hl_today		= gconf_client_get_bool(client,"/apps/gtodo/prefs/hl-today",NULL);
-	pref_gconf_set_notifications(client);
+	settings.hide_done 		= anjuta_preferences_get_bool(preferences, "gtodo.hide-done");
+	settings.hide_due 		= anjuta_preferences_get_bool(preferences, "gtodo.hide-due");
+	settings.hide_nodate 		=  anjuta_preferences_get_bool(preferences, "gtodo.hide-nodate");
+	settings.hl_indays		= anjuta_preferences_get_bool(preferences,"gtodo.hl-indays");
+	settings.hl_due			= anjuta_preferences_get_bool(preferences,"gtodo.hl-due");
+	settings.hl_today		= anjuta_preferences_get_bool(preferences,"gtodo.hl-today");
+	pref_set_notifications(preferences);
 }
 
 void gtodo_update_settings()
@@ -86,13 +78,13 @@ void gtodo_update_settings()
 	
 	/* read the categorys */
 	{
-		int i =  gconf_client_get_int(client, "/apps/gtodo/view/last-category",NULL);
+		int i =  anjuta_preferences_get_int(preferences, "gtodo.last-category");
 		debug_printf(DEBUG_INFO, "Reading categories");
 		read_categorys();
 		gtk_combo_box_set_active(GTK_COMBO_BOX(mw.option),i);
 	}
 	/* nasty thing to fix the tooltip in the list */
-	if(gconf_client_get_bool(client, "/apps/gtodo/prefs/show-tooltip",NULL))
+	if(anjuta_preferences_get_bool(preferences, "gtodo.show-tooltip"))
 	{
 		gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mw.treeview), FALSE);			
 	}
@@ -215,21 +207,21 @@ GtkWidget * gui_create_todo_widget()
 	column = gtk_tree_view_column_new_with_attributes(_("Priority"), renderer, "text" , PRIOSTR,"strikethrough", DONE, "foreground-set", DUE,"foreground", COLOR, NULL);
 	gtk_tree_view_column_set_sort_column_id (column, PRIOSTR);
 	gtk_tree_view_append_column(GTK_TREE_VIEW(mw.treeview), column);    
-	if(!gconf_client_get_bool(client, "/apps/gtodo/view/show-priority-column",NULL)) gtk_tree_view_column_set_visible(column, FALSE);
+	if(!anjuta_preferences_get_bool(preferences, "gtodo.show-priority-column")) gtk_tree_view_column_set_visible(column, FALSE);
 
 	renderer =  gtk_cell_renderer_text_new();
 	g_object_set (renderer, "yalign", 0.0, NULL);
 	column = gtk_tree_view_column_new_with_attributes(_("Due date"), renderer, "text" , F_DATE,"strikethrough", DONE, "foreground-set", DUE,"foreground", COLOR,NULL);
 	gtk_tree_view_column_set_sort_column_id (column, F_DATE);
 	gtk_tree_view_append_column(GTK_TREE_VIEW(mw.treeview), column);    
-	if(!gconf_client_get_bool(client, "/apps/gtodo/prefs/show-due-column",NULL)) gtk_tree_view_column_set_visible(column, FALSE);
+	if(!anjuta_preferences_get_bool(preferences, "gtodo.show-due-column")) gtk_tree_view_column_set_visible(column, FALSE);
 
 	renderer =  gtk_cell_renderer_text_new();
 	g_object_set (renderer, "yalign", 0.0, NULL);
 	column = gtk_tree_view_column_new_with_attributes(_("Category"), renderer, "text" , CATEGORY,"strikethrough", DONE, "foreground-set", DUE,"foreground", COLOR,NULL);
 	gtk_tree_view_column_set_sort_column_id (column, CATEGORY);
 	gtk_tree_view_append_column(GTK_TREE_VIEW(mw.treeview), column);   	
-	if(!gconf_client_get_bool(client, "/apps/gtodo/view/show-category-column",NULL)) gtk_tree_view_column_set_visible(column, FALSE);
+	if(!anjuta_preferences_get_bool(preferences, "gtodo.show-category-column")) gtk_tree_view_column_set_visible(column, FALSE);
 
 	renderer =  gtk_cell_renderer_text_new();
 	g_object_set (renderer, "yalign", 0.0, "wrap-mode", PANGO_WRAP_WORD, "wrap-width", 500, NULL);
@@ -290,19 +282,19 @@ void gtodo_set_hide_done(gboolean hide_it)
 {
 	/*    settings.hide_done = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (gtk_item_factory_get_widget(mw.item_factory, N_("/View/Todo List/Hide Completed Items"))));*/
 	settings.hide_done = hide_it;
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/hide-done", settings.hide_done,NULL);
+	anjuta_preferences_set_bool(preferences, "gtodo.hide-done", settings.hide_done);
 }
 
 void gtodo_set_hide_nodate(gboolean hide_it)
 {
 	settings.hide_nodate = hide_it;
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/hide-nodate", settings.hide_nodate, NULL);
+	anjuta_preferences_set_bool(preferences, "gtodo.hide-nodate", settings.hide_nodate);
 }
 
 void gtodo_set_hide_due(gboolean hide_it)
 {
 	settings.hide_due = hide_it;
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/hide-due", settings.hide_due, NULL);
+	anjuta_preferences_set_bool(preferences, "gtodo.hide-due", settings.hide_due);
 }
 
 gboolean gtodo_get_hide_done()
@@ -323,14 +315,14 @@ gboolean gtodo_get_hide_due()
 void gtodo_set_sorting_order (gboolean ascending_sort)
 {
 	settings.sortorder = ascending_sort;
-	gconf_client_set_int(client, "/apps/gtodo/prefs/sort-order",settings.sortorder,NULL);
+	anjuta_preferences_set_int(preferences, "gtodo.sort-order",settings.sortorder);
 	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE (mw.sortmodel),0, settings.sortorder);
 }
 
 void gtodo_set_sorting_type (int sorting_type)
 {
 	settings.sorttype = sorting_type;
-	gconf_client_set_int(client, "/apps/gtodo/prefs/sort-type",sorting_type,NULL);
+	anjuta_preferences_set_int(preferences, "gtodo.sort-type",sorting_type);
 	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE (gtk_tree_view_get_model(GTK_TREE_VIEW(mw.treeview))),0, settings.sortorder);
 	category_changed();
 }
diff --git a/plugins/gtodo/list_tooltip.c b/plugins/gtodo/list_tooltip.c
index 95dd144..aceb04e 100644
--- a/plugins/gtodo/list_tooltip.c
+++ b/plugins/gtodo/list_tooltip.c
@@ -185,7 +185,7 @@ gboolean mw_tooltip_timeout(GtkWidget *tv)
 gboolean mw_motion_cb (GtkWidget *tv, GdkEventMotion *event, gpointer null)
 {
 	GtkTreePath *path;
-	if(!gconf_client_get_bool(client, "/apps/gtodo/prefs/show-tooltip",NULL)) return FALSE;
+	if(!anjuta_preferences_get_bool(preferences, "gtodo.show-tooltip")) return FALSE;
 
 	if(rect.y == 0 && rect.height == 0 && gtodo_timeout)
 	{
diff --git a/plugins/gtodo/main.h b/plugins/gtodo/main.h
index 4adde36..7c73b53 100644
--- a/plugins/gtodo/main.h
+++ b/plugins/gtodo/main.h
@@ -3,7 +3,7 @@
 #include <libxml/tree.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <gconf/gconf-client.h>
+#include <libanjuta/anjuta-preferences.h>
 
 // #include <libgtodo/libgtodo.h>
 #include <libgtodo.h>
@@ -79,7 +79,7 @@ typedef struct
 /*interface.c*/
 extern mwindow mw;
 extern sets settings;
-extern GConfClient *client;
+extern AnjutaPreferences *preferences;
 extern GTodoClient *cl;
 
 void about_window(void);
@@ -137,7 +137,7 @@ void set_sorting_menu_item();
 void windows_moved(GtkWidget *window);
 
 int check_for_notification_event(void);
-void pref_gconf_set_notifications(GConfClient *client);
+void pref_set_notifications(AnjutaPreferences *client);
 
 void export_gui(void);
 void open_playlist(void);
diff --git a/plugins/gtodo/notification.c b/plugins/gtodo/notification.c
index 46e28a6..902a65e 100644
--- a/plugins/gtodo/notification.c
+++ b/plugins/gtodo/notification.c
@@ -1,6 +1,4 @@
 #include <gtk/gtk.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
 #include "main.h"
 
 void create_notification_window(GTodoItem *item);
@@ -18,8 +16,8 @@ typedef struct
 int check_for_notification_event(void)
 {
 	GTodoList *list = NULL;
-	int min_b_not = gconf_client_get_int(client, "/apps/gtodo/prefs/notify_in_minutes",NULL);
-	if(!gconf_client_get_bool(client, "/apps/gtodo/prefs/do_notification",NULL)) return TRUE;
+	int min_b_not = anjuta_preferences_get_int(preferences, "gtodo.notify_in_minutes");
+	if(!anjuta_preferences_get_bool(preferences, "gtodo.do_notification")) return TRUE;
 	list = gtodo_client_get_todo_item_list(cl, NULL);
 	if(list == NULL) return TRUE;
 	do{
diff --git a/plugins/gtodo/preferences.c b/plugins/gtodo/preferences.c
index 325da48..8b52e38 100644
--- a/plugins/gtodo/preferences.c
+++ b/plugins/gtodo/preferences.c
@@ -31,9 +31,9 @@ void gui_preferences(void)
 
 	/* because there not directly visible I can go save the values now.. (not like do_tray) */
 	// settings.auto_purge = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb_auto_purge));
-	// gconf_client_set_bool(client,"/apps/gtodo/prefs/auto-purge",settings.auto_purge,NULL);
+	// anjuta_preferences_set_bool(preferences,"gtodo.auto-purge",settings.auto_purge,NULL);
 	// settings.purge_days = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sp_purge_days));
-	// gconf_client_set_int(client,"/apps/gtodo/prefs/auto-purge-days",settings.purge_days,NULL);
+	// anjuta_preferences_set_int(preferences,"gtodo.auto-purge-days",settings.purge_days,NULL);
 	gtk_widget_destroy(dialog);
 	/* save the settings */
 }
@@ -89,24 +89,24 @@ GtkWidget *preferences_widget()
 	gtk_box_pack_start(GTK_BOX(vbox),cb_show_date, FALSE, TRUE, 0); 
 	/* set it to current value and add signal handler */
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb_show_date), 
-		gconf_client_get_bool(client, "/apps/gtodo/prefs/show-due-column",NULL));
+		anjuta_preferences_get_bool(preferences, "gtodo.show-due-column"));
 			
 	g_signal_connect(G_OBJECT(cb_show_date), "toggled", G_CALLBACK(preferences_cb_show_date), NULL);
 
 	cb = gtk_check_button_new_with_label(_("Show category column"));
 	gtk_box_pack_start(GTK_BOX(vbox),cb, FALSE, TRUE, 0); 	
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb), gconf_client_get_bool(client, "/apps/gtodo/view/show-category-column",NULL));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb), anjuta_preferences_get_bool(preferences, "gtodo.show-category-column"));
 	g_signal_connect(G_OBJECT(cb), "toggled", G_CALLBACK(preferences_cb_toggle_show_category_column), NULL);
 
 	cb = gtk_check_button_new_with_label(_("Show priority column"));
 	gtk_box_pack_start(GTK_BOX(vbox),cb, FALSE, TRUE, 0); 	
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb), gconf_client_get_bool(client, "/apps/gtodo/view/show-priority-column",NULL));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb), anjuta_preferences_get_bool(preferences, "gtodo.show-priority-column"));
 	g_signal_connect(G_OBJECT(cb), "toggled", G_CALLBACK(preferences_cb_toggle_show_priority_column), NULL);
 
 	cb_list_tooltip = gtk_check_button_new_with_label(_("Tooltips in list"));
 	gtk_box_pack_start(GTK_BOX(vbox),cb_list_tooltip, FALSE, TRUE, 0); 
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb_list_tooltip),
-		gconf_client_get_bool(client, "/apps/gtodo/prefs/show-tooltip",NULL));      
+		anjuta_preferences_get_bool(preferences, "gtodo.show-tooltip"));
 
 	g_signal_connect(G_OBJECT(cb_list_tooltip), "toggled", G_CALLBACK(preferences_cb_do_tooltip), NULL);
 
@@ -217,12 +217,12 @@ GtkWidget *preferences_widget()
 	gtk_box_pack_start(GTK_BOX(vbox2), frame, FALSE, FALSE, 0);
 	tmp = g_strdup_printf(ngettext("Allow to-do items to notify me when they are due in %i minute",
                                  "Allow to-do items to notify me when they are due in %i minutes",
-                                 gconf_client_get_int(client, "/apps/gtodo/prefs/notify_in_minutes",NULL)),
-                                 gconf_client_get_int(client, "/apps/gtodo/prefs/notify_in_minutes",NULL));
+                                 anjuta_preferences_get_int(preferences, "gtodo.notify_in_minutes")),
+                                 anjuta_preferences_get_int(preferences, "gtodo.notify_in_minutes"));
 	cb = gtk_check_button_new_with_label(tmp);
 	g_free(tmp);
 	gtk_box_pack_start(GTK_BOX(vbox),cb, FALSE, TRUE, 0); 	
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb), gconf_client_get_bool(client, "/apps/gtodo/prefs/do_notification",NULL));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cb), anjuta_preferences_get_bool(preferences, "gtodo.do_notification"));
 	g_signal_connect(G_OBJECT(cb), "toggled", G_CALLBACK(preferences_cb_toggle_show_notification), NULL);
 
 	gtk_widget_show_all (notebook);
@@ -231,52 +231,52 @@ GtkWidget *preferences_widget()
 
 static void preferences_cb_toggle_hl_today(GtkWidget *chbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/hl-today", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);	
+	anjuta_preferences_set_bool(preferences, "gtodo.hl-today", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)));
 	settings.hl_today =  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox));
 	category_changed();
 }
 
 static void preferences_cb_toggle_hl_due(GtkWidget *chbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/hl-due", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);	
+	anjuta_preferences_set_bool(preferences, "gtodo.hl-due", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)));
 	settings.hl_due =  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox));
 	category_changed();    
 }
 
 static void preferences_cb_toggle_hl_indays(GtkWidget *chbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/hl-indays", 
-			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);
+	anjuta_preferences_set_bool(preferences, "gtodo.hl-indays",
+			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)));
 	settings.hl_indays =  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox));
 	category_changed();
 }
 
 static void preferences_cb_toggle_show_notification(GtkWidget *chbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/do_notification", 
-			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);	
+	anjuta_preferences_set_bool(preferences, "gtodo.do_notification",
+			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)));
 }
 
 static void preferences_cb_toggle_show_category_column(GtkWidget *chbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/view/show-category-column", 
-			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);	
+	anjuta_preferences_set_bool(preferences, "gtodo.show-category-column",
+			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)));
 	gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(mw.treeview), 3),
-			gconf_client_get_bool(client, "/apps/gtodo/view/show-category-column",NULL));
+			anjuta_preferences_get_bool(preferences, "gtodo.show-category-column"));
 }
 
 static void preferences_cb_toggle_show_priority_column(GtkWidget *chbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/view/show-priority-column", 
-			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);	
+	anjuta_preferences_set_bool(preferences, "gtodo.show-priority-column",
+			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)));
 	gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(mw.treeview), 1),
-			gconf_client_get_bool(client, "/apps/gtodo/view/show-priority-column",NULL));
+			anjuta_preferences_get_bool(preferences, "gtodo.show-priority-column"));
 }
 
 static void preferences_cb_show_date(GtkWidget *chbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/show-due-column", 
-			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);	
+	anjuta_preferences_set_bool(preferences, "gtodo.show-due-column",
+			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)));
 	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)))
 	{
 		gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(mw.treeview), 2),TRUE);
@@ -289,7 +289,7 @@ static void preferences_cb_show_date(GtkWidget *chbox)
 
 static void preferences_cb_do_tooltip(GtkWidget *chbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/show-tooltip", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)),NULL);	
+	anjuta_preferences_set_bool(preferences, "gtodo.show-tooltip", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)));
 	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(chbox)))
 
 	{
@@ -303,7 +303,7 @@ static void preferences_cb_do_tooltip(GtkWidget *chbox)
 
 static void preferences_cb_auto_purge(GtkWidget *cb, GtkWidget *hbox)
 {
-	gconf_client_set_bool(client, "/apps/gtodo/prefs/auto-purge", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb)),NULL);	
+	anjuta_preferences_set_bool(preferences, "gtodo.auto-purge", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb)));
 	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb)))
 		gtk_widget_set_sensitive(GTK_WIDGET(hbox), TRUE);
 	else 
@@ -311,159 +311,142 @@ static void preferences_cb_auto_purge(GtkWidget *cb, GtkWidget *hbox)
 }
 
 
-static void pref_gconf_changed_show_tooltip(GConfClient *client)
+static void pref_changed_show_tooltip(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	if(gconf_client_get_bool(client, "/apps/gtodo/prefs/show-tooltip", NULL))
-	{
-		gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mw.treeview), FALSE);			    
-	}
-	else gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mw.treeview), TRUE);			    
+	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(mw.treeview), !value);
 }
 
-static void  pref_gconf_changed_restore_size(GConfClient *client)
+static void  pref_changed_restore_size(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.size = gconf_client_get_bool(client, /* "/schemas*/"/apps/gtodo/prefs/restore-size",NULL);
+	settings.size = value;
 }    
-static void  pref_gconf_changed_restore_place(GConfClient *client)
+static void  pref_changed_restore_place(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.place = gconf_client_get_bool(client,/* "/schemas*/"/apps/gtodo/prefs/restore-position",NULL);
+	settings.place = value;
 }    
-static void  pref_gconf_changed_ask_delete_category(GConfClient *client)
+static void  pref_changed_ask_delete_category(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.ask_delete_category = gconf_client_get_bool(client,/* "/schemas*/"/apps/gtodo/prefs/ask-delete-category",NULL);
+	settings.ask_delete_category = value;
 }    
 
-static void pref_gconf_changed_show_priority_column(GtkWidget *chbox)
+static void pref_changed_show_priority_column(GtkWidget *chbox)
 {
 	gtk_tree_view_column_set_visible(
 		gtk_tree_view_get_column(GTK_TREE_VIEW(mw.treeview), 1),
-		gconf_client_get_bool(client, "/apps/gtodo/view/show-priority-column",NULL));
+		anjuta_preferences_get_bool(preferences, "gtodo.show-priority-column"));
 }
 
 
-static void pref_gconf_changed_show_category_column(GtkWidget *chbox)
+static void pref_changed_show_category_column(GtkWidget *chbox)
 {
-	gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(mw.treeview), 3),gconf_client_get_bool(client, "/apps/gtodo/view/show-category-column",NULL));
+	gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(mw.treeview), 3),anjuta_preferences_get_bool(preferences, "gtodo.show-category-column"));
 }
 
-static void pref_gconf_changed_show_due_column(GtkWidget *chbox)
+static void pref_changed_show_due_column(GtkWidget *chbox)
 {
 	gtk_tree_view_column_set_visible(
 		gtk_tree_view_get_column(GTK_TREE_VIEW(mw.treeview), 2),
-		gconf_client_get_bool(client, "/apps/gtodo/prefs/show-due-column",NULL));
+		anjuta_preferences_get_bool(preferences, "gtodo.show-due-column"));
 }
 
-static void  pref_gconf_changed_auto_purge(GConfClient *client)
+static void  pref_changed_auto_purge(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.auto_purge = gconf_client_get_bool(client,"/apps/gtodo/prefs/auto-purge",NULL);
+	settings.auto_purge = value;
 }    
 
 #if 0
-static void  pref_gconf_changed_auto_purge_days(GConfClient *client)
+static void  pref_changed_auto_purge_days(GConfClient *client)
 {
-	settings.purge_days = gconf_client_get_int(client, "/apps/gtodo/prefs/auto-purge-days",NULL);
+	settings.purge_days = anjuta_preferences_get_int(preferences, "gtodo.auto-purge-days",NULL);
 }    
 #endif 
 
-static void  pref_gconf_changed_hl_today(GConfClient *client)
+static void  pref_changed_hl_today(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.hl_today = gconf_client_get_bool(client,"/apps/gtodo/prefs/hl-today",NULL);
+	settings.hl_today = value;
 	category_changed();
 }
 
-static void  pref_gconf_changed_hl_due(GConfClient *client)
+static void  pref_changed_hl_due(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.hl_due = gconf_client_get_bool(client, "/apps/gtodo/prefs/hl-due",NULL);
+	settings.hl_due = value;
 	category_changed();
 }
 
-static void  pref_gconf_changed_hl_indays(GConfClient *client)
+static void  pref_changed_hl_indays(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.hl_indays= gconf_client_get_bool(client,"/apps/gtodo/prefs/hl-indays",NULL);
+	settings.hl_indays= value;
 	category_changed();
 }
 
-static void  pref_gconf_changed_hide_due(GConfClient *client)
+static void  pref_changed_hide_due(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.hide_due = gconf_client_get_bool(client,"/apps/gtodo/prefs/hide-due",NULL);
+	settings.hide_due = value;
 	category_changed();
 }
 
-static void  pref_gconf_changed_hide_done(GConfClient *client)
+static void  pref_changed_hide_done(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.hide_done = gconf_client_get_bool(client,"/apps/gtodo/prefs/hide-done",NULL);
+	settings.hide_done = value;
 	category_changed();
 }
 
-static void  pref_gconf_changed_hide_nodate(GConfClient *client)
+static void  pref_changed_hide_nodate(AnjutaPreferences *preferences, const char *key, gboolean value, gpointer data)
 {
-	settings.hide_nodate = gconf_client_get_bool(client,"/apps/gtodo/prefs/hide-nodate",NULL);
+	settings.hide_nodate = value;
 	category_changed();
 }
 
-void pref_gconf_set_notifications(GConfClient *client)
+void pref_set_notifications(AnjutaPreferences *preferences)
 {
-	gconf_client_notify_add(client, "/apps/gtodo/prefs/restore-size",
-			(GConfClientNotifyFunc)pref_gconf_changed_restore_size,
-			NULL,
+	anjuta_preferences_notify_add_bool (preferences, "gtodo.restore-size",
+			(AnjutaPreferencesNotifyBool)pref_changed_restore_size,
 			NULL, NULL);
 
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/restore-position",
-			(GConfClientNotifyFunc) pref_gconf_changed_restore_place,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.restore-position",
+			(AnjutaPreferencesNotifyBool) pref_changed_restore_place,
 			NULL, NULL);
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/show-tooltip",
-			(GConfClientNotifyFunc) pref_gconf_changed_show_tooltip,
-			NULL,
+
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.show-tooltip",
+			(AnjutaPreferencesNotifyBool) pref_changed_show_tooltip,
 			NULL, NULL);
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/ask-delete-category",
-			(GConfClientNotifyFunc) pref_gconf_changed_ask_delete_category,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.ask-delete-category",
+			(AnjutaPreferencesNotifyBool) pref_changed_ask_delete_category,
 			NULL, NULL);
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/show-due-column",
-			(GConfClientNotifyFunc) pref_gconf_changed_show_due_column,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.show-due-column",
+			(AnjutaPreferencesNotifyBool) pref_changed_show_due_column,
 			NULL, NULL);
-	gconf_client_notify_add(client,"/apps/gtodo/view/show-category-column",
-			(GConfClientNotifyFunc) pref_gconf_changed_show_category_column,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.show-category-column",
+			(AnjutaPreferencesNotifyBool) pref_changed_show_category_column,
 			NULL, NULL);
-	gconf_client_notify_add(client,"/apps/gtodo/view/show-priority-column",
-			(GConfClientNotifyFunc) pref_gconf_changed_show_priority_column,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.show-priority-column",
+			(AnjutaPreferencesNotifyBool) pref_changed_show_priority_column,
 			NULL, NULL);
 	
 
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/auto-purge",
-			(GConfClientNotifyFunc) pref_gconf_changed_auto_purge,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.auto-purge",
+			(AnjutaPreferencesNotifyBool) pref_changed_auto_purge,
 			NULL, NULL);
 	
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/hl-today",
-			(GConfClientNotifyFunc) pref_gconf_changed_hl_today,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.hl-today",
+			(AnjutaPreferencesNotifyBool) pref_changed_hl_today,
 			NULL, NULL);	
 
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/hl-due",
-			(GConfClientNotifyFunc) pref_gconf_changed_hl_due,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.hl-due",
+			(AnjutaPreferencesNotifyBool) pref_changed_hl_due,
 			NULL, NULL);	
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/hl-indays",
-			(GConfClientNotifyFunc) pref_gconf_changed_hl_indays,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.hl-indays",
+			(AnjutaPreferencesNotifyBool) pref_changed_hl_indays,
 			NULL, NULL);
 	
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/hide-done",
-			(GConfClientNotifyFunc) pref_gconf_changed_hide_done,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.hide-done",
+			(AnjutaPreferencesNotifyBool) pref_changed_hide_done,
 			NULL, NULL);	
 
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/hide-due",
-			(GConfClientNotifyFunc) pref_gconf_changed_hide_due,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.hide-due",
+			(AnjutaPreferencesNotifyBool) pref_changed_hide_due,
 			NULL, NULL);	
-	gconf_client_notify_add(client,"/apps/gtodo/prefs/hide-nodate",
-			(GConfClientNotifyFunc) pref_gconf_changed_hide_nodate,
-			NULL,
+	anjuta_preferences_notify_add_bool(preferences,"gtodo.hide-nodate",
+			(AnjutaPreferencesNotifyBool) pref_changed_hide_nodate,
 			NULL, NULL);
 }



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