[gbrainy] Support building as GTK application in non GNOME sytems (like win32)
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Support building as GTK application in non GNOME sytems (like win32)
- Date: Fri, 23 Jul 2010 14:49:09 +0000 (UTC)
commit 65cf82e2324ab3c769b0a907852ff8a375d90c81
Author: Jordi Mas <jmas softcatala org>
Date: Fri Jul 23 16:50:07 2010 +0200
Support building as GTK application in non GNOME sytems (like win32)
src/Clients/Classical/gbrainy.cs | 33 +++++++++++++++++++++++++++++----
1 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
old mode 100644
new mode 100755
index fe80173..ea8d67a
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -20,7 +20,6 @@
using System;
using Cairo;
using Gtk;
-using Gnome;
using Mono.Unix;
using System.Diagnostics;
using Gdk;
@@ -34,9 +33,16 @@ using Mono.Addins;
using Mono.Addins.Setup;
#endif
+#if GNOME
+using Gnome;
+#endif
+
namespace gbrainy.Clients.Classical
{
- public class GtkClient: Program
+ public class GtkClient
+#if GNOME
+ : Program
+#endif
{
[GtkBeans.Builder.Object("gbrainy")] Gtk.Window app_window;
[GtkBeans.Builder.Object] Gtk.CheckMenuItem toolbar_menuitem;
@@ -73,7 +79,9 @@ namespace gbrainy.Clients.Classical
GameSession.Types initial_session;
public GtkClient ()
+#if GNOME
: base ("gbrainy", Defines.VERSION, Modules.UI, new string [0])
+#endif
{
Catalog.Init ("gbrainy", Defines.GNOME_LOCALE_DIR);
Unix.FixLocaleInfo ();
@@ -93,7 +101,7 @@ namespace gbrainy.Clients.Classical
const string ASSEMBLY = "gbrainy.Games.dll";
session = new GameSession ();
-
+
session.GameManager.LoadAssemblyGames (ASSEMBLY);
session.GameManager.LoadPlugins ();
session.GameManager.LoadGamesFromXml (System.IO.Path.Combine (Defines.DATA_DIR, "games.xml"));
@@ -490,12 +498,21 @@ namespace gbrainy.Clients.Classical
void OnQuit (object sender, EventArgs args)
{
+#if GNOME
Quit ();
+#else
+ Gtk.Application.Quit ();
+#endif
+
}
void OnDeleteWindow (object sender, DeleteEventArgs args)
{
+#if GNOME
Quit ();
+#else
+ Gtk.Application.Quit ();
+#endif
}
void OnNextButtonClicked (object sender, EventArgs args)
@@ -694,7 +711,7 @@ namespace gbrainy.Clients.Classical
} catch {}
DateTime start_time = DateTime.Now;
-
+
GtkClient app = new GtkClient ();
CommandLine.Version ();
@@ -703,6 +720,9 @@ namespace gbrainy.Clients.Classical
if (line.Continue == false)
return;
+#if !GNOME
+ Gtk.Application.Init ();
+#endif
app.Initialize ();
if (line.PlayList.Length > 0) {
@@ -714,7 +734,12 @@ namespace gbrainy.Clients.Classical
TimeSpan span = DateTime.Now - start_time;
Console.WriteLine (Catalog.GetString ("Startup time {0}"), span);
+
+#if GNOME
app.Run ();
+#else
+ Gtk.Application.Run ();
+#endif
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]