[gbrainy/gtk3] Basic gtk3# port
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy/gtk3] Basic gtk3# port
- Date: Sun, 20 May 2012 11:53:46 +0000 (UTC)
commit 5af068a346e2370651b7b37006c7a07b50ead7f6
Author: Jordi Mas <jmas softcatala org>
Date: Sun May 20 13:55:10 2012 +0200
Basic gtk3# port
GTK3-TODO | 5 +
configure.ac | 8 +-
src/Clients/Classical/Builder/Builder.cs | 621 --------------------
.../Classical/Builder/BuilderConnectFunc.cs | 10 -
.../GtkBeansSharp.BuilderConnectFuncNative.cs | 96 ---
src/Clients/Classical/Builder/ObjectManager.cs | 19 -
src/Clients/Classical/Builder/README | 3 -
src/Clients/Classical/Dialogs/BuilderDialog.cs | 5 +-
src/Clients/Classical/Dialogs/CustomGameDialog.cs | 4 +-
src/Clients/Classical/Dialogs/HigMessageDialog.cs | 6 +-
src/Clients/Classical/Dialogs/PdfExportDialog.cs | 20 +-
.../Classical/Dialogs/PlayerHistoryDialog.cs | 24 +-
src/Clients/Classical/Dialogs/PreferencesDialog.cs | 22 +-
src/Clients/Classical/Makefile.am | 5 -
src/Clients/Classical/Widgets/GameDrawingArea.cs | 14 +-
src/Clients/Classical/gbrainy.cs | 52 +-
src/Core/Makefile.am | 1 -
src/Games/Makefile.am | 2 +-
18 files changed, 83 insertions(+), 834 deletions(-)
---
diff --git a/GTK3-TODO b/GTK3-TODO
new file mode 100644
index 0000000..ca65404
--- /dev/null
+++ b/GTK3-TODO
@@ -0,0 +1,5 @@
+GTK3# porting TODO
+
+* Commented code at HigMessageDialog.cs, BuilderDialog.cs
+
+See: http://mono-project.com/GtkSharp3PortingGuide
diff --git a/configure.ac b/configure.ac
index 2651cd2..a126fca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Define gbrainy version
m4_define([gbrainy_version_major], [2])
m4_define([gbrainy_version_minor], [1])
-m4_define([gbrainy_version_revision], [3])
+m4_define([gbrainy_version_revision], [9])
m4_define([concat], $1$2$3$4)
@@ -70,7 +70,7 @@ fi
dnl -- check for various mono assemblies that we need.
-needed_assemblies="Mono.Posix Mono.Cairo Mono.CSharp"
+needed_assemblies="Mono.Posix Mono.CSharp"
for i in $needed_assemblies; do
AC_MSG_CHECKING([for $i.dll])
if test ! \( -e `$PKG_CONFIG --variable=prefix mono`/lib/mono/2.0/$i.dll -o -e `$PKG_CONFIG --variable=prefix mono`/lib64/mono/2.0/$i.dll \); then
@@ -93,7 +93,7 @@ MONO_ADDINS=0.3
PKG_CHECK_MODULES(GBRAINY_CORE, mono >= $MONO_REQUIRED)
-PKG_CHECK_MODULES(GBRAINY, gtk-sharp-2.0 >= $GTKSHARP_REQUIRED)
+PKG_CHECK_MODULES(GBRAINY, gtk-sharp-3.0 >= $GTKSHARP_REQUIRED)
AC_SUBST(GBRAINY_LIBS)
AC_ARG_ENABLE(addins, AC_HELP_STRING([--disable-addins], [Disable mono-addins support]), , enable_addins="yes")
@@ -176,7 +176,7 @@ fi
dnl -- Enable web client build
-AC_ARG_ENABLE(enable_webclient, AC_HELP_STRING([--enable-webclient], [Enable Web client build]),,enable_webclient=yes)
+AC_ARG_ENABLE(enable_webclient, AC_HELP_STRING([--enable-webclient], [Enable Web client build]),,enable_webclient=no)
AM_CONDITIONAL(ENABLE_WEBCLIENT, test "x$enable_webclient" != "xno")
diff --git a/src/Clients/Classical/Dialogs/BuilderDialog.cs b/src/Clients/Classical/Dialogs/BuilderDialog.cs
index 5be137a..b85d3e8 100644
--- a/src/Clients/Classical/Dialogs/BuilderDialog.cs
+++ b/src/Clients/Classical/Dialogs/BuilderDialog.cs
@@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
+using Gtk;
using gbrainy.Core.Services;
namespace gbrainy.Clients.Classical.Dialogs
@@ -32,11 +33,11 @@ namespace gbrainy.Clients.Classical.Dialogs
}
public BuilderDialog (System.Reflection.Assembly assembly, string resourceName, string dialogName) :
- this (new GtkBeans.Builder (assembly, resourceName, null),dialogName)
+ this (new Builder (assembly, resourceName, null),dialogName)
{
}
- public BuilderDialog (GtkBeans.Builder builder, string dialogName) : base (builder.GetRawObject (dialogName))
+ public BuilderDialog (Builder builder, string dialogName) //: base (builder.GestRawObject (dialogName))
{
builder.Autoconnect (this);
IconName = "gbrainy";
diff --git a/src/Clients/Classical/Dialogs/CustomGameDialog.cs b/src/Clients/Classical/Dialogs/CustomGameDialog.cs
index 1566b50..b206575 100644
--- a/src/Clients/Classical/Dialogs/CustomGameDialog.cs
+++ b/src/Clients/Classical/Dialogs/CustomGameDialog.cs
@@ -32,8 +32,8 @@ namespace gbrainy.Clients.Classical.Dialogs
{
// This is static to allow to preserve the selection in different instances
static ListStore games_store;
- [GtkBeans.Builder.Object] Gtk.TreeView treeview;
- [GtkBeans.Builder.Object] Box preview_vbox;
+ [Builder.Object] Gtk.TreeView treeview;
+ [Builder.Object] Box preview_vbox;
GameDrawingArea drawing_area;
GameSession session;
GameLocator [] games;
diff --git a/src/Clients/Classical/Dialogs/HigMessageDialog.cs b/src/Clients/Classical/Dialogs/HigMessageDialog.cs
index a5cf5e6..19d2f30 100644
--- a/src/Clients/Classical/Dialogs/HigMessageDialog.cs
+++ b/src/Clients/Classical/Dialogs/HigMessageDialog.cs
@@ -37,12 +37,12 @@ namespace gbrainy.Clients.Classical.Dialogs
string header,
string msg) : base ()
{
- HasSeparator = false;
+ //HasSeparator = false;
BorderWidth = 5;
Resizable = false;
Title = string.Empty;
- VBox.Spacing = 12;
+ //VBox.Spacing = 12;
ActionArea.Layout = Gtk.ButtonBoxStyle.End;
accel_group = new Gtk.AccelGroup ();
@@ -51,7 +51,7 @@ namespace gbrainy.Clients.Classical.Dialogs
Gtk.HBox hbox = new Gtk.HBox (false, 12);
hbox.BorderWidth = 5;
hbox.Show ();
- VBox.PackStart (hbox, false, false, 0);
+ //VBox.PackStart (hbox, false, false, 0);
switch (type) {
case Gtk.MessageType.Error:
diff --git a/src/Clients/Classical/Dialogs/PdfExportDialog.cs b/src/Clients/Classical/Dialogs/PdfExportDialog.cs
index 5f54d56..74981b6 100644
--- a/src/Clients/Classical/Dialogs/PdfExportDialog.cs
+++ b/src/Clients/Classical/Dialogs/PdfExportDialog.cs
@@ -29,16 +29,16 @@ namespace gbrainy.Clients.Classical.Dialogs
{
public class PdfExportDialog : BuilderDialog
{
- [GtkBeans.Builder.Object] Gtk.HBox hbox_file;
- [GtkBeans.Builder.Object] Gtk.SpinButton games_spinbutton;
- [GtkBeans.Builder.Object] Gtk.CheckButton colorblindcheckbutton;
- [GtkBeans.Builder.Object] Gtk.RadioButton rb_easy;
- [GtkBeans.Builder.Object] Gtk.RadioButton rb_medium;
- [GtkBeans.Builder.Object] Gtk.RadioButton rb_master;
- [GtkBeans.Builder.Object] Gtk.CheckButton checkbox_logic;
- [GtkBeans.Builder.Object] Gtk.CheckButton checkbox_calculation;
- [GtkBeans.Builder.Object] Gtk.CheckButton checkbox_verbal;
- [GtkBeans.Builder.Object] Gtk.ComboBox layout_combo;
+ [Builder.Object] Gtk.HBox hbox_file;
+ [Builder.Object] Gtk.SpinButton games_spinbutton;
+ [Builder.Object] Gtk.CheckButton colorblindcheckbutton;
+ [Builder.Object] Gtk.RadioButton rb_easy;
+ [Builder.Object] Gtk.RadioButton rb_medium;
+ [Builder.Object] Gtk.RadioButton rb_master;
+ [Builder.Object] Gtk.CheckButton checkbox_logic;
+ [Builder.Object] Gtk.CheckButton checkbox_calculation;
+ [Builder.Object] Gtk.CheckButton checkbox_verbal;
+ [Builder.Object] Gtk.ComboBox layout_combo;
BrowseFile file;
GameManager manager;
diff --git a/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs b/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
index 7524f72..4560c6e 100644
--- a/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
+++ b/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
@@ -29,13 +29,13 @@ namespace gbrainy.Clients.Classical.Dialogs
{
public class PlayerHistoryDialog : BuilderDialog
{
- [GtkBeans.Builder.Object] Box history_preview;
- [GtkBeans.Builder.Object] Label label_playerhistory;
- [GtkBeans.Builder.Object] Gtk.CheckButton checkbutton_total;
- [GtkBeans.Builder.Object] Gtk.CheckButton checkbutton_memory;
- [GtkBeans.Builder.Object] Gtk.CheckButton checkbutton_logic;
- [GtkBeans.Builder.Object] Gtk.CheckButton checkbutton_calculation;
- [GtkBeans.Builder.Object] Gtk.CheckButton checkbutton_verbal;
+ [Builder.Object] Box history_preview;
+ [Builder.Object] Label label_playerhistory;
+ [Builder.Object] Gtk.CheckButton checkbutton_total;
+ [Builder.Object] Gtk.CheckButton checkbutton_memory;
+ [Builder.Object] Gtk.CheckButton checkbutton_logic;
+ [Builder.Object] Gtk.CheckButton checkbutton_calculation;
+ [Builder.Object] Gtk.CheckButton checkbutton_verbal;
CairoPreview drawing_area;
@@ -116,7 +116,7 @@ namespace gbrainy.Clients.Classical.Dialogs
get { return view; }
}
- protected override bool OnExposeEvent (Gdk.EventExpose args)
+ protected override bool OnDrawn (Cairo.Context cc)
{
if(!IsRealized)
return false;
@@ -124,10 +124,11 @@ namespace gbrainy.Clients.Classical.Dialogs
int w, h, nw, nh;
double x = 0, y = 0;
- Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
CairoContextEx cr = new CairoContextEx (cc.Handle);
cr.PangoFontDescription = PangoContext.FontDescription;
- args.Window.GetSize (out w, out h);
+
+ w = Window.Width;
+ h = Window.Height;
nh = nw = Math.Min (w, h);
@@ -144,9 +145,8 @@ namespace gbrainy.Clients.Classical.Dialogs
view.Draw (cr, nw, nh, Direction == Gtk.TextDirection.Rtl);
- ((IDisposable)cc).Dispose();
((IDisposable)cr).Dispose();
- return base.OnExposeEvent(args);
+ return true;
}
}
}
diff --git a/src/Clients/Classical/Dialogs/PreferencesDialog.cs b/src/Clients/Classical/Dialogs/PreferencesDialog.cs
index 74709c5..1874358 100644
--- a/src/Clients/Classical/Dialogs/PreferencesDialog.cs
+++ b/src/Clients/Classical/Dialogs/PreferencesDialog.cs
@@ -28,17 +28,17 @@ namespace gbrainy.Clients.Classical.Dialogs
{
public class PreferencesDialog : BuilderDialog
{
- [GtkBeans.Builder.Object] Gtk.SpinButton prefspinbutton;
- [GtkBeans.Builder.Object] Gtk.SpinButton maxstoredspinbutton;
- [GtkBeans.Builder.Object] Gtk.SpinButton minplayedspinbutton;
- [GtkBeans.Builder.Object] Gtk.CheckButton prefcheckbutton;
- [GtkBeans.Builder.Object] Gtk.CheckButton colorblindcheckbutton;
- [GtkBeans.Builder.Object] Gtk.RadioButton rb_easy;
- [GtkBeans.Builder.Object] Gtk.RadioButton rb_medium;
- [GtkBeans.Builder.Object] Gtk.RadioButton rb_master;
- [GtkBeans.Builder.Object] Gtk.ComboBox themes_combobox;
- [GtkBeans.Builder.Object] Gtk.CheckButton englishcheckbutton;
- [GtkBeans.Builder.Object] Gtk.CheckButton loadextensionscheckbutton;
+ [Builder.Object] Gtk.SpinButton prefspinbutton;
+ [Builder.Object] Gtk.SpinButton maxstoredspinbutton;
+ [Builder.Object] Gtk.SpinButton minplayedspinbutton;
+ [Builder.Object] Gtk.CheckButton prefcheckbutton;
+ [Builder.Object] Gtk.CheckButton colorblindcheckbutton;
+ [Builder.Object] Gtk.RadioButton rb_easy;
+ [Builder.Object] Gtk.RadioButton rb_medium;
+ [Builder.Object] Gtk.RadioButton rb_master;
+ [Builder.Object] Gtk.ComboBox themes_combobox;
+ [Builder.Object] Gtk.CheckButton englishcheckbutton;
+ [Builder.Object] Gtk.CheckButton loadextensionscheckbutton;
const int COLUMN_VALUE = 1;
PlayerHistory history;
diff --git a/src/Clients/Classical/Makefile.am b/src/Clients/Classical/Makefile.am
index f48b2d3..5055f7f 100644
--- a/src/Clients/Classical/Makefile.am
+++ b/src/Clients/Classical/Makefile.am
@@ -7,10 +7,6 @@ GBRAINY_CSDISTFILES = \
$(srcdir)/CommandLine.cs \
$(srcdir)/gbrainy.cs \
$(srcdir)/GtkSynchronize.cs \
- $(srcdir)/Builder/Builder.cs \
- $(srcdir)/Builder/BuilderConnectFunc.cs \
- $(srcdir)/Builder/GtkBeansSharp.BuilderConnectFuncNative.cs \
- $(srcdir)/Builder/ObjectManager.cs \
$(srcdir)/Dialogs/AboutDialog.cs \
$(srcdir)/Dialogs/CustomGameDialog.cs \
$(srcdir)/Dialogs/BuilderDialog.cs \
@@ -26,7 +22,6 @@ GBRAINY_CSDISTFILES = \
ASSEMBLIES = \
$(GBRAINY_LIBS) \
$(MONO_ADDINS_LIBS) \
- -r:Mono.Cairo.dll \
-r:../../gbrainy.Core.dll \
-r:Mono.Posix
diff --git a/src/Clients/Classical/Widgets/GameDrawingArea.cs b/src/Clients/Classical/Widgets/GameDrawingArea.cs
index d7c6d79..bf22cf3 100644
--- a/src/Clients/Classical/Widgets/GameDrawingArea.cs
+++ b/src/Clients/Classical/Widgets/GameDrawingArea.cs
@@ -19,7 +19,6 @@
using System;
using Gtk;
-using Cairo;
using Mono.Unix;
using gbrainy.Core.Libraries;
@@ -80,18 +79,18 @@ namespace gbrainy.Clients.Classical.Widgets
QueueDraw ();
}
- protected override bool OnExposeEvent (Gdk.EventExpose args)
+ protected override bool OnDrawn (Cairo.Context cc)
{
if (!IsRealized)
return false;
int w, h, total_w, total_h;
- Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
CairoContextEx cr = new CairoContextEx (cc.Handle);
cr.PangoFontDescription = PangoContext.FontDescription;
- args.Window.GetSize (out total_w, out total_h);
+ total_w = Window.Width;
+ total_h = Window.Height;
h = total_h - question_high;
if (UseSolutionArea)
@@ -133,12 +132,11 @@ namespace gbrainy.Clients.Classical.Widgets
// Draw the game area
cr.Translate (OffsetX, OffsetY);
cr.SetPangoNormalFontSize ();
- cr.Color = new Color (1, 1, 1, 0.5);
+ cr.Color = new Cairo.Color (1, 1, 1, 0.5);
Drawable.Draw (cr, DrawingSquare, DrawingSquare, Direction == Gtk.TextDirection.Rtl);
cr.Stroke ();
}
- ((IDisposable)cc).Dispose();
((IDisposable)cr).Dispose();
return true;
}
@@ -201,7 +199,7 @@ namespace gbrainy.Clients.Classical.Widgets
box_height_scaled = Math.Max (height_str, (double) solution_high / (double) height);
// Draw black box
- cr.Color = new Color (0.1, 0.1, 0.1);
+ cr.Color = new Cairo.Color (0.1, 0.1, 0.1);
cr.Rectangle (text_margin,
1 - box_height_scaled - text_margin,
@@ -211,7 +209,7 @@ namespace gbrainy.Clients.Classical.Widgets
cr.Stroke ();
// Draw text and icon
- cr.Color = new Color (1, 1, 1);
+ cr.Color = new Cairo.Color (1, 1, 1);
if (Direction == Gtk.TextDirection.Rtl)
{
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index 69fcc54..9093c8e 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -40,30 +40,30 @@ namespace gbrainy.Clients.Classical
{
public class GtkClient
{
- [GtkBeans.Builder.Object("gbrainy")] Gtk.Window app_window;
- [GtkBeans.Builder.Object] Gtk.CheckMenuItem showtoolbar_menuitem;
- [GtkBeans.Builder.Object] Box drawing_vbox;
- [GtkBeans.Builder.Object] Gtk.HBox main_hbox;
- [GtkBeans.Builder.Object] Gtk.VBox framework_vbox;
- [GtkBeans.Builder.Object] Gtk.Entry answer_entry;
- [GtkBeans.Builder.Object] Gtk.Button answer_button;
- [GtkBeans.Builder.Object] Gtk.Label answer_label;
- [GtkBeans.Builder.Object] Gtk.Button tip_button;
- [GtkBeans.Builder.Object] Gtk.Button next_button;
- [GtkBeans.Builder.Object] Gtk.Statusbar statusbar;
- [GtkBeans.Builder.Object] Gtk.MenuBar menubar;
- [GtkBeans.Builder.Object] Gtk.MenuItem pause_menuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem finish_menuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem newgame_menuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem allgames_menuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem logic_menuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem calculation_menuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem memory_menuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem verbal_menuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem extensions_menuitem;
- [GtkBeans.Builder.Object] Gtk.RadioMenuItem vertical_radiomenuitem;
- [GtkBeans.Builder.Object] Gtk.RadioMenuItem horizontal_radiomenuitem;
- [GtkBeans.Builder.Object] Gtk.MenuItem toolbar_orientation_menuitem;
+ [Builder.Object("gbrainy")] Gtk.Window app_window;
+ [Builder.Object] Gtk.CheckMenuItem showtoolbar_menuitem;
+ [Builder.Object] Box drawing_vbox;
+ [Builder.Object] Gtk.HBox main_hbox;
+ [Builder.Object] Gtk.VBox framework_vbox;
+ [Builder.Object] Gtk.Entry answer_entry;
+ [Builder.Object] Gtk.Button answer_button;
+ [Builder.Object] Gtk.Label answer_label;
+ [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;
Widgets.Toolbar toolbar;
@@ -131,7 +131,7 @@ namespace gbrainy.Clients.Classical
{
bool show_toolbar;
- GtkBeans.Builder builder = new GtkBeans.Builder ("gbrainy.ui");
+ Builder builder = new Builder ("gbrainy.ui");
builder.Autoconnect (this);
show_toolbar = Preferences.Get <bool> (Preferences.ToolbarShowKey) == true && low_res == false;
@@ -206,7 +206,7 @@ namespace gbrainy.Clients.Classical
{
session.GameManager.LoadPlugins ();
}
- Mono.Addins.Gui.AddinManagerWindow.Run (app_window);
+ //Mono.Addins.Gui.AddinManagerWindow.Run (app_window);
GameManagerPreload (session.GameManager);
CustomGameDialog.Clear ();
};
diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am
index 593f36f..4806cfa 100644
--- a/src/Core/Makefile.am
+++ b/src/Core/Makefile.am
@@ -94,7 +94,6 @@ $(srcdir)/gbrainy.addin.xml
REFS = \
-r:System \
- -r:Mono.Cairo.dll \
-r:Mono.Posix \
-r:Mono.CSharp.dll \
$(GBRAINY_LIBS) \
diff --git a/src/Games/Makefile.am b/src/Games/Makefile.am
index f4c8d71..5bb4589 100644
--- a/src/Games/Makefile.am
+++ b/src/Games/Makefile.am
@@ -87,8 +87,8 @@ $(top_srcdir)/data/game-graphics/shop.svg
REFS = \
+ $(GBRAINY_LIBS) \
-r:System \
- -r:Mono.Cairo.dll \
-r:Mono.Posix \
-r:.././gbrainy.Core.dll
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]