/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. using System;
  17. using System.Collections.Generic;
  18. using System.Diagnostics;
  19. using System.IO;
  20. using System.Runtime.InteropServices;
  21. using System.Text;
  22. using System.Threading;
  23. using Gtk;
  24. using Mono.Unix;
  25. using Mono.Unix.Native;
  26. using SparkleLib;
  27. namespace SparkleShare {
  28. public class SparkleUI {
  29. public static SparkleStatusIcon StatusIcon;
  30. public static SparkleEventLog EventLog;
  31. public static SparkleBubbles Bubbles;
  32. public static SparkleSetup Setup;
  33. public static SparkleAbout About;
  34. public static string AssetsPath =
  35. new string [] {Defines.PREFIX, "share", "sparkleshare"}.Combine ();
  36. // Short alias for the translations
  37. public static string _(string s)
  38. {
  39. return Catalog.GetString (s);
  40. }
  41. public SparkleUI ()
  42. {
  43. // Initialize the application
  44. Application.Init ();
  45. // Use translations
  46. Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);
  47. StatusIcon = new SparkleStatusIcon ();
  48. Bubbles = new SparkleBubbles ();
  49. if (Program.Controller.FirstRun) {
  50. Setup = new SparkleSetup ();
  51. Setup.Controller.ShowSetupPage ();
  52. }
  53. Program.Controller.OnQuitWhileSyncing += delegate {
  54. // TODO: Pop up a warning when quitting whilst syncing
  55. };
  56. }
  57. // Runs the application
  58. public void Run ()
  59. {
  60. Application.Run ();
  61. }
  62. }
  63. }