/*
* Copyright (C) 2007 Eskil Bylund
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
using System;
using System.Diagnostics;
using System.Threading;
namespace DCSharp.GUI{
public static class DCSharpEntry
{
public static void Main(string[] args)
{
Thread.CurrentThread.Name = "Main";
if (!GLib.Thread.Supported)
{
GLib.Thread.Init();
}
NDesk.DBus.BusG.Init();
Gtk.Application.Init("dcsharp", ref args);
// Check for existing instance
ICore instance = Core.FindInstance();
if (instance != null)
{
instance.Present();
Gdk.Global.NotifyStartupComplete();
System.Environment.Exit(0);
}
// Initialize D-Bus
Core core = new Core();
core.RegisterServer();
#if DEBUG
Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
Debug.AutoFlush = true;
#endif
// Init
GUI.Init();
// Run!
try
{
GUI.Run();
}
finally
{
core.UnregisterServer();
}
}
}
}
|