[gbrainy] Fixes failing to honor to toolbar default visibility setting
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Fixes failing to honor to toolbar default visibility setting
- Date: Mon, 7 Mar 2011 14:32:39 +0000 (UTC)
commit a71a2bc19db9ff8e4b1243f1235ee9968b6e1b70
Author: Jordi Mas <jmas softcatala org>
Date: Mon Mar 7 15:32:43 2011 +0100
Fixes failing to honor to toolbar default visibility setting
src/Clients/Classical/Widgets/Toolbar.cs | 3 +--
src/Clients/Classical/gbrainy.cs | 22 ++++++++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/Clients/Classical/Widgets/Toolbar.cs b/src/Clients/Classical/Widgets/Toolbar.cs
index c5ebb91..e5e1e3d 100644
--- a/src/Clients/Classical/Widgets/Toolbar.cs
+++ b/src/Clients/Classical/Widgets/Toolbar.cs
@@ -44,10 +44,9 @@ namespace gbrainy.Clients.Classical.Widgets
this.framework_vbox = framework_vbox;
ToolbarStyle = ToolbarStyle.Both;
BuildToolBar ();
- AttachToolBar (Orientation);
}
- public void AttachToolBar (Gtk.Orientation orientation_new)
+ public void Attach (Gtk.Orientation orientation_new)
{
Gtk.Box.BoxChild child = null;
Box box;
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
old mode 100755
new mode 100644
index d6c3aad..e08ad2a
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -132,6 +132,7 @@ namespace gbrainy.Clients.Classical
// Toolbar creation
toolbar = new Widgets.Toolbar (main_hbox, framework_vbox);
+ toolbar.Attach ((Gtk.Orientation) Preferences.GetIntValue (Preferences.ToolbarOrientationKey));
toolbar.AllButton.Clicked += OnAllGames;
toolbar.LogicButton.Clicked += OnLogicOnly;
toolbar.CalculationButton.Clicked += OnMathOnly;
@@ -165,7 +166,7 @@ namespace gbrainy.Clients.Classical
show_toolbar = Preferences.GetBoolValue (Preferences.ToolbarShowKey) == true && low_res == false;
// We only disable the Arrow if we are going to show the toolbar.
- // It has an impact on the total window width size even if you we do not show it
+ // It has an impact on the total window width size even if we do not show it
if (show_toolbar)
toolbar.ShowArrow = false;
@@ -173,9 +174,6 @@ namespace gbrainy.Clients.Classical
app_window.ShowAll ();
- if (show_toolbar == false)
- showtoolbar_menuitem.Active = false;
-
toolbar_orientation_menuitem.Sensitive = toolbar.Visible;
// Check default radio button
@@ -190,6 +188,11 @@ namespace gbrainy.Clients.Classical
throw new InvalidOperationException ();
}
+ // The toolbar by default is enabled. By setting this menu entry to false
+ // triggers the OnActivateToolbar event that hides the toolbar
+ if (show_toolbar == false)
+ showtoolbar_menuitem.Active = false;
+
#if MONO_ADDINS
extensions_menuitem.Activated += delegate (object sender, EventArgs ar) { Mono.Addins.Gui.AddinManagerWindow.Run (app_window);};
#else
@@ -602,8 +605,11 @@ namespace gbrainy.Clients.Classical
toolbar_orientation_menuitem.Sensitive = toolbar.Visible;
- Preferences.SetBoolValue (Preferences.ToolbarShowKey, toolbar.Visible);
- Preferences.Save ();
+ if (Preferences.GetBoolValue (Preferences.ToolbarShowKey) != toolbar.Visible)
+ {
+ Preferences.SetBoolValue (Preferences.ToolbarShowKey, toolbar.Visible);
+ Preferences.Save ();
+ }
app_window.Resize (width, height - requisition.Height);
}
@@ -615,7 +621,7 @@ namespace gbrainy.Clients.Classical
const Gtk.Orientation orientation = Gtk.Orientation.Vertical;
Preferences.SetIntValue (Preferences.ToolbarOrientationKey, (int) orientation);
Preferences.Save ();
- toolbar.AttachToolBar (orientation);
+ toolbar.Attach (orientation);
}
void OnHorizontalToolbar (object sender, System.EventArgs args)
@@ -626,7 +632,7 @@ namespace gbrainy.Clients.Classical
const Gtk.Orientation orientation = Gtk.Orientation.Horizontal;
Preferences.SetIntValue (Preferences.ToolbarOrientationKey, (int) Gtk.Orientation.Horizontal);
Preferences.Save ();
- toolbar.AttachToolBar (orientation);
+ toolbar.Attach (orientation);
}
void OnHistory (object sender, EventArgs args)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]