[tracker/needle: 52/53] tracker-needle: Moved tracker-config to tracker-history



commit e56868a60f71339208c929e0e29fd457e0f4e93d
Author: Martyn Russell <martyn lanedo com>
Date:   Fri Nov 12 23:31:00 2010 +0000

    tracker-needle: Moved tracker-config to tracker-history
    
    Also moved history data to XDG user data dir from config dir

 src/tracker-needle/Makefile.am                     |    2 +-
 .../{tracker-config.vala => tracker-history.vala}  |   24 ++++++++++----------
 src/tracker-needle/tracker-needle.vala             |    8 +++---
 3 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/src/tracker-needle/Makefile.am b/src/tracker-needle/Makefile.am
index ef232ae..628a626 100644
--- a/src/tracker-needle/Makefile.am
+++ b/src/tracker-needle/Makefile.am
@@ -25,7 +25,7 @@ LDADD =                                                \
 
 tracker_needle_SOURCES =                               \
 	tracker-cell-renderer-text.vala                \
-	tracker-config.vala                            \
+	tracker-history.vala                           \
 	tracker-query.vala                             \
 	tracker-stats.vala                             \
 	tracker-taglist.vala                           \
diff --git a/src/tracker-needle/tracker-config.vala b/src/tracker-needle/tracker-history.vala
similarity index 74%
rename from src/tracker-needle/tracker-config.vala
rename to src/tracker-needle/tracker-history.vala
index 93ad5ae..ecfa642 100644
--- a/src/tracker-needle/tracker-config.vala
+++ b/src/tracker-needle/tracker-history.vala
@@ -17,24 +17,24 @@
 // 02110-1301, USA.
 //
 
-public class Tracker.Config {
+public class Tracker.History {
 	private KeyFile data;
 	private string filename;
 	private string[] history;
 
-	public Config () {
-		debug ("Loading config");
+	public History () {
+		debug ("Loading history");
 
 		data = new KeyFile ();
-		filename = Path.build_filename (Environment.get_home_dir (), ".config", "tracker", "tracker-needle.cfg", null);
+		filename = Path.build_filename (Environment.get_user_data_dir (), "tracker", "tracker-needle.txt", null);
 
 		try {
 			data.load_from_file (filename, KeyFileFlags.KEEP_COMMENTS | KeyFileFlags.KEEP_TRANSLATIONS);
 		} catch (KeyFileError e1) {
-			warning ("Could not load config from file:'%s': %s", filename, e1.message);
+			warning ("Could not load history from file:'%s': %s", filename, e1.message);
 			return;
 		} catch (FileError e2) {
-			warning ("Could not load config from file:'%s': %s", filename, e2.message);
+			warning ("Could not load history from file:'%s': %s", filename, e2.message);
 			return;
 		}
 
@@ -46,7 +46,7 @@ public class Tracker.Config {
 		try {
 			history = data.get_string_list ("History", "criteria");
 		} catch (KeyFileError e1) {
-			warning ("Could not load config from file:'%s': %s", filename, e1.message);
+			warning ("Could not load history from file:'%s': %s", filename, e1.message);
 			return;
 		}
 
@@ -55,8 +55,8 @@ public class Tracker.Config {
 		debug ("  Done");
 	}
 
-	~Config () {
-		debug ("Saving config");
+	~History () {
+		debug ("Saving history");
 
 		data.set_string_list ("History", "criteria", history);
 
@@ -65,13 +65,13 @@ public class Tracker.Config {
 
 			FileUtils.set_contents (filename, output, -1);
 		} catch (GLib.FileError e1) {
-			warning ("Could not save config to file:'%s': %s", filename, e1.message);
+			warning ("Could not save history to file:'%s': %s", filename, e1.message);
 		}
 
 		debug ("  Done");
 	}
 
-	public void add_history (string criteria)
+	public void add (string criteria)
 	requires (criteria != null && criteria.length > 0) {
 		// Don't add the same item more than once
 		foreach (string check in history) {
@@ -83,7 +83,7 @@ public class Tracker.Config {
 		history += criteria;
 	}
 
-	public string[] get_history () {
+	public string[] get () {
 		return history;
 	}
 
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 8184b8f..13b9acf 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -27,7 +27,7 @@ extern static const string SRCDIR;
 
 public class Tracker.Needle {
 	private const string UI_FILE = "tracker-needle.ui";
-	private Tracker.Config config;
+	private History history;
 	private Window window;
 	private ToggleToolButton view_list;
 	private ToggleToolButton view_icons;
@@ -57,7 +57,7 @@ public class Tracker.Needle {
 	static bool current_find_in = true;
 
 	public Needle () {
-		config = new Tracker.Config ();
+		history = new Tracker.History ();
 	}
 
 	public void show () {
@@ -115,7 +115,7 @@ public class Tracker.Needle {
 		search_list = builder.get_object ("comboboxentry_search") as ComboBoxEntry;
 		search = search_list.get_child () as Entry;
 		search.changed.connect (search_changed);
-		search_history_insert (config.get_history ());
+		search_history_insert (history.get ());
 
 		spinner = new Spinner ();
 		spinner_shell = builder.get_object ("toolcustom_spinner") as ToolItem;
@@ -529,7 +529,7 @@ public class Tracker.Needle {
 			store.prepend (out new_iter);
 			store.set (new_iter, 0, criteria, -1);
 
-			config.add_history (criteria);
+			history.add (criteria);
 		}
 
 		return null;



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