PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/SparkleShare/SparkleUI.cs

http://github.com/hbons/SparkleShare
C# | 78 lines | 43 code | 15 blank | 20 comment | 1 complexity | 9c2175c23f3d9ccc0ed917fef521f133 MD5 | raw file
 1//   SparkleShare, a collaboration and sharing tool.
 2//   Copyright (C) 2010  Hylke Bons <hylkebons@gmail.com>
 3//
 4//   This program is free software: you can redistribute it and/or modify
 5//   it under the terms of the GNU General Public License as published by
 6//   the Free Software Foundation, either version 3 of the License, or
 7//   (at your option) any later version.
 8//
 9//   This program is distributed in the hope that it will be useful,
10//   but WITHOUT ANY WARRANTY; without even the implied warranty of
11//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//   GNU General Public License for more details.
13//
14//   You should have received a copy of the GNU General Public License
15//   along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18using System;
19using System.Collections.Generic;
20using System.Diagnostics;
21using System.IO;
22using System.Runtime.InteropServices;
23using System.Text;
24using System.Threading;
25
26using Gtk;
27using Mono.Unix;
28using Mono.Unix.Native;
29using SparkleLib;
30
31namespace SparkleShare {
32
33    public class SparkleUI {
34        
35        public static SparkleStatusIcon StatusIcon;
36        public static SparkleEventLog EventLog;
37        public static SparkleBubbles Bubbles;
38        public static SparkleSetup Setup;
39        public static SparkleAbout About;
40        public static string AssetsPath =
41            new string [] {Defines.PREFIX, "share", "sparkleshare"}.Combine ();
42
43
44        // Short alias for the translations
45        public static string _(string s)
46        {
47            return Catalog.GetString (s);
48        }
49
50
51        public SparkleUI ()
52        {
53            // Initialize the application
54            Application.Init ();
55
56            // Use translations
57            Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);
58
59            StatusIcon = new SparkleStatusIcon ();
60            Bubbles    = new SparkleBubbles ();
61            
62            if (Program.Controller.FirstRun) {
63                Setup = new SparkleSetup ();
64                Setup.Controller.ShowSetupPage ();
65            }
66            
67            Program.Controller.OnQuitWhileSyncing += delegate {
68                // TODO: Pop up a warning when quitting whilst syncing
69            };
70        }
71
72        // Runs the application
73        public void Run ()
74        {
75            Application.Run ();
76        }
77    }
78}