gbrainy r376 - trunk/src



Author: jmas
Date: Tue Jun 17 16:37:40 2008
New Revision: 376
URL: http://svn.gnome.org/viewvc/gbrainy?rev=376&view=rev

Log:
Save toolbar on/off in the preferences

Modified:
   trunk/src/ChangeLog
   trunk/src/Preferences.cs
   trunk/src/gbrainy.cs

Modified: trunk/src/Preferences.cs
==============================================================================
--- trunk/src/Preferences.cs	(original)
+++ trunk/src/Preferences.cs	Tue Jun 17 16:37:40 2008
@@ -34,6 +34,7 @@
 	static public string DifficultyKey = "Difficulty";
 	static public string MinPlayedGamesKey = "MinPlayedGames";
 	static public string MaxStoredGamesKey = "MaxStoredGamesKey";
+	static public string Toolbar = "Toolbar";
 
 	static private string element_item = "item";
 	static private string element_key = "key";
@@ -157,7 +158,8 @@
 		properties.Add (MemQuestionTimeKey, "4");
 		properties.Add (DifficultyKey, ((int)(Game.Difficulty.Medium)).ToString ());
 		properties.Add (MinPlayedGamesKey, "5");
-		properties.Add (MaxStoredGamesKey, "20");	
+		properties.Add (MaxStoredGamesKey, "20");
+		properties.Add (Toolbar, true.ToString ());
 	}
 
 	private void Load ()

Modified: trunk/src/gbrainy.cs
==============================================================================
--- trunk/src/gbrainy.cs	(original)
+++ trunk/src/gbrainy.cs	Tue Jun 17 16:37:40 2008
@@ -31,6 +31,7 @@
 public class gbrainy: Program
 {
 	[Glade.Widget("gbrainy")] Gtk.Window app_window;
+	[Glade.Widget ("toolbar_item")] Gtk.CheckMenuItem toolbar_menuitem;
 	[Glade.Widget] Box drawing_vbox;
 	[Glade.Widget] Gtk.TextView question_textview;
 	[Glade.Widget] Gtk.TextView solution_textview;
@@ -135,7 +136,10 @@
 		//app_window.SizeAllocated += new SizeAllocatedHandler (OnSizeAllocated);
 		app_window.IconName = "gbrainy";
 		app_window.ShowAll ();
-	
+
+		if (preferences.GetBoolValue (Preferences.Toolbar) == false)
+			toolbar_menuitem.Active = false;
+
 		color = label_answser.Style.Background (StateType.Normal);
 		question_textview.ModifyBase (Gtk.StateType.Normal, color);
 		solution_textview.ModifyBase (Gtk.StateType.Normal, color);
@@ -463,6 +467,8 @@
 		requisition =  toolbar.SizeRequest ();
 		app_window.GetSize (out width, out height);
 		toolbar.Visible = !toolbar.Visible;
+		preferences.SetBoolValue (Preferences.Toolbar, toolbar.Visible);
+		preferences.Save ();
 		app_window.Resize (width, height - requisition.Height);
 	}
 



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