[gbrainy/new_menu] Initial work
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy/new_menu] Initial work
- Date: Thu, 10 Jan 2019 15:51:38 +0000 (UTC)
commit 03b549c1bff59f8840320eb019d84a5485a855b2
Author: Jordi Mas <jmas softcatala org>
Date: Thu Jan 10 16:51:24 2019 +0100
Initial work
src/Clients/Classical/gbrainy.cs | 57 +++---
src/Clients/Classical/gbrainy.ui | 380 +++++++--------------------------------
2 files changed, 99 insertions(+), 338 deletions(-)
---
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index 3951e99f..9b268da2 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -28,6 +28,7 @@ using gbrainy.Core.Services;
using gbrainy.Core.Libraries;
using gbrainy.Clients.Classical.Dialogs;
using gbrainy.Clients.Classical.Widgets;
+using GLib;
#if MONO_ADDINS
using Mono.Addins;
@@ -39,7 +40,7 @@ namespace gbrainy.Clients.Classical
public class GtkClient
{
[Builder.Object("gbrainy")] Gtk.Window app_window;
- [Builder.Object] Gtk.CheckMenuItem showtoolbar_menuitem;
+/// [Builder.Object] Gtk.CheckMenuItem showtoolbar_menuitem;
[Builder.Object] Box drawing_vbox;
[Builder.Object] Gtk.Box main_hbox;
[Builder.Object] Gtk.Box framework_vbox;
@@ -49,19 +50,25 @@ namespace gbrainy.Clients.Classical
[Builder.Object] Gtk.Button tip_button;
[Builder.Object] Gtk.Button next_button;
[Builder.Object] Gtk.Statusbar statusbar;
- [Builder.Object] Gtk.MenuBar menubar;
- [Builder.Object] Gtk.MenuItem pause_menuitem;
- [Builder.Object] Gtk.MenuItem finish_menuitem;
- [Builder.Object] Gtk.MenuItem newgame_menuitem;
- [Builder.Object] Gtk.MenuItem allgames_menuitem;
- [Builder.Object] Gtk.MenuItem logic_menuitem;
- [Builder.Object] Gtk.MenuItem calculation_menuitem;
- [Builder.Object] Gtk.MenuItem memory_menuitem;
- [Builder.Object] Gtk.MenuItem verbal_menuitem;
- [Builder.Object] Gtk.MenuItem extensions_menuitem;
- [Builder.Object] Gtk.RadioMenuItem vertical_radiomenuitem;
- [Builder.Object] Gtk.RadioMenuItem horizontal_radiomenuitem;
- [Builder.Object] Gtk.MenuItem toolbar_orientation_menuitem;
+
+/*
+ Next steps:
+ - How to build the action to the menu
+ - How to enable / disable it
+*/
+ //[Builder.Object] Gtk.MenuBar menubar;
+ //[Builder.Object] Gtk.MenuItem pause_menuitem;
+ //[Builder.Object] Gtk.MenuItem finish_menuitem;
+// [Builder.Object] SimpleAction newgame_menuitem;
+ //[Builder.Object] Gtk.MenuItem allgames_menuitem;
+ //[Builder.Object] Gtk.MenuItem logic_menuitem;
+ //[Builder.Object] Gtk.MenuItem calculation_menuitem;
+ //[Builder.Object] Gtk.MenuItem memory_menuitem;
+ //[Builder.Object] Gtk.MenuItem verbal_menuitem;
+ //[Builder.Object] Gtk.MenuItem extensions_menuitem;
+ //[Builder.Object] Gtk.RadioMenuItem vertical_radiomenuitem;
+ //[Builder.Object] Gtk.RadioMenuItem horizontal_radiomenuitem;
+ //[Builder.Object] Gtk.MenuItem toolbar_orientation_menuitem;
Widgets.Toolbar toolbar;
@@ -171,7 +178,7 @@ namespace gbrainy.Clients.Classical
app_window.ShowAll ();
- toolbar_orientation_menuitem.Sensitive = toolbar.Visible;
+ /*toolbar_orientation_menuitem.Sensitive = toolbar.Visible;
// Check default radio button
switch (toolbar.Orientation) {
@@ -205,8 +212,9 @@ namespace gbrainy.Clients.Classical
extensions_menuitem.Visible = false;
#endif
ActiveInputControls (false);
- }
-
+
+*/
+ }
public void ProcessDefaults ()
{
if (InitialSessionType != GameSession.Types.None)
@@ -310,7 +318,7 @@ namespace gbrainy.Clients.Classical
answer_label.Sensitive = answer;
next_button.Sensitive = next;
tip_button.Sensitive = tip;
- pause_menuitem.Sensitive = toolbar.PauseButton.Sensitive = can_pause;
+ //pause_menuitem.Sensitive = toolbar.PauseButton.Sensitive = can_pause;
if (answer == true)
answer_entry.GrabFocus ();
@@ -345,6 +353,9 @@ namespace gbrainy.Clients.Classical
available = session.AvailableGames;
+ SimpleAction action = new SimpleAction("newgame_menuitem", VariantType.Boolean);
+ action.Enabled = true;
+/*
if (playing == false && ((available & GameTypes.LogicPuzzle) ==
GameTypes.LogicPuzzle))
logic_menuitem.Sensitive = toolbar.LogicButton.Sensitive = true;
else
@@ -371,7 +382,7 @@ namespace gbrainy.Clients.Classical
allgames_menuitem.Sensitive = toolbar.AllButton.Sensitive = false;
finish_menuitem.Sensitive = playing;
- newgame_menuitem.Sensitive = !playing;
+ newgame_menuitem.Sensitive = !playing;*/
}
private void GetNextGame ()
@@ -656,7 +667,7 @@ namespace gbrainy.Clients.Classical
if (toolbar.Visible)
toolbar.ShowArrow = false;
- toolbar_orientation_menuitem.Sensitive = toolbar.Visible;
+ //toolbar_orientation_menuitem.Sensitive = toolbar.Visible;
if (Preferences.Get <bool> (Preferences.ToolbarShowKey) != toolbar.Visible)
{
@@ -719,7 +730,7 @@ namespace gbrainy.Clients.Classical
void OnExtending (object sender, EventArgs args)
{
- Process.Start ("https://wiki.gnome.org/Apps/gbrainy/Extending");
+ System.Diagnostics.Process.Start ("https://wiki.gnome.org/Apps/gbrainy/Extending");
}
static void InitCoreLibraries ()
@@ -746,7 +757,7 @@ namespace gbrainy.Clients.Classical
Console.WriteLine ("gbrainy.Main. Could not set process name. Error {0}", e);
}
- DateTime start_time = DateTime.Now;
+ System.DateTime start_time = System.DateTime.Now;
ITranslations translations = new TranslationsCatalog ();
InitCoreLibraries ();
@@ -772,7 +783,7 @@ namespace gbrainy.Clients.Classical
app.ProcessDefaults ();
ThemeManager.Load ();
- TimeSpan span = DateTime.Now - start_time;
+ TimeSpan span = System.DateTime.Now - start_time;
Console.WriteLine (Catalog.GetString ("Startup time {0}"), span);
Gtk.Application.Run ();
}
diff --git a/src/Clients/Classical/gbrainy.ui b/src/Clients/Classical/gbrainy.ui
index e09d950e..c2c703e6 100644
--- a/src/Clients/Classical/gbrainy.ui
+++ b/src/Clients/Classical/gbrainy.ui
@@ -2,6 +2,16 @@
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.10"/>
+ <menu id="primary-menu">
+ <section>
+ <item>
+ <attribute name="id">newgame_menuitem</attribute>
+ <attribute name="label" translatable="yes">_New Game</attribute>
+ <attribute name="accel"><Primary>n</attribute>
+ <attribute name="action">OnAllGames</attribute>
+ </item>
+ </section>
+ </menu>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">4</property>
<property name="upper">60</property>
@@ -35,338 +45,78 @@
<property name="can_focus">False</property>
<property name="draw_as_radio">True</property>
</object>
- <object class="GtkWindow" id="gbrainy">
+ <object class="GtkWindow" id="gbrainy">
<property name="can_focus">False</property>
<property name="title" translatable="yes">gbrainy</property>
<signal name="delete-event" handler="OnDeleteWindow" swapped="no"/>
+<child type="titlebar">
+ <object class="GtkHeaderBar">
+ <property name="show_close_button">True</property>
+ <property name="title" translatable="yes">Hitori</property>
+ <child>
+
+ <object class="GtkBox" id="undo_redo_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <style>
+ <class name="linked"/>
+ </style>
+
+
+ <child>
+ <object class="GtkMenuButton" id="primary_menu">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="can_focus">True</property>
+ <property name="focus_on_click">False</property>
+ <property name="menu_model">primary-menu</property>
+ <style>
+ <class name="image-button" />
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property
name="icon-name">open-menu-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+
+ </child>
+</object>
+</child>
+
<child>
+
<object class="GtkBox" id="framework_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <child>
- <object class="GtkMenuBar" id="menubar1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="game_topmenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Game</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkImageMenuItem" id="newgame_menuitem">
- <property name="label" translatable="yes">_New Game</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">False</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="allgames_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">All Games (Logic, Mental
Calculation, Memory and Verbal Analogies)</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnAllGames" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="logic_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Logic Puzzles Only</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnLogicOnly" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="calculation_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Mental Calculation Only</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnMathOnly" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="memory_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Memory Trainers Only</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnMemoryOnly" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="verbal_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Verbal Analogies Only</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnVerbalOnly" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="menuitem9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Custom Game Selection...</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnCustomGame" swapped="no"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="pause_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Pause Game</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnPauseGame" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="finish_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_End Game</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnEndGame" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="pdf_export_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Export Games to PDF for Off-line
Playing...</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnPdfExport" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="separatormenuitem3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem5">
- <property name="label">gtk-quit</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <signal name="activate" handler="OnQuit" swapped="no"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="view_topmenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_View</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="toolbar_menuitem2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Toolbar</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckMenuItem" id="showtoolbar_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Show</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <signal name="activate" handler="OnActivateToolbar" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="toolbar_orientation_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Orientation</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkRadioMenuItem" id="vertical_radiomenuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Vertical</property>
- <property name="use_underline">True</property>
- <property name="draw_as_radio">True</property>
- <property name="group">radiomenuitem1</property>
- <signal name="toggled" handler="OnVerticalToolbar" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="horizontal_radiomenuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Horizontal</property>
- <property name="use_underline">True</property>
- <property name="draw_as_radio">True</property>
- <property name="group">radiomenuitem1</property>
- <signal name="toggled" handler="OnHorizontalToolbar" swapped="no"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem6">
- <property name="label" translatable="yes">Player's Game Session History</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_stock">False</property>
- <signal name="activate" handler="OnHistory" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="fullscreen_menuitem">
- <property name="label">gtk-fullscreen</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <signal name="activate" handler="OnFullscreen" swapped="no"/>
- <accelerator key="F11" signal="activate"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="settings_topmenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Settings</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem1">
- <property name="label" translatable="yes">Preferences</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="image">image1</property>
- <property name="use_stock">False</property>
- <signal name="activate" handler="OnPreferences" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="extensions_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Extensions</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="help_topmenu">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Help</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="about_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkImageMenuItem" id="contents_menuitem">
- <property name="label" translatable="yes">_Contents</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="image">image2</property>
- <property name="use_stock">False</property>
- <signal name="activate" handler="OnMenuHelp" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="extend_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">How to Extend gbrainy's
Functionality</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="OnExtending" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem10">
- <property name="label">gtk-about</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <signal name="activate" handler="OnMenuAbout" swapped="no"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
+
<child>
<object class="GtkBox" id="main_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+
+
+
<child>
<object class="GtkBox" id="main_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
+
+
+
+
<child>
<placeholder/>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]