Example #1
0
        static void Main(string[] args)
        {
            try {
                lock (lockObject) {
                    if (application != null)
                        return;

                    // Fix process name not set on Unix
                    SetProcessName ("Tasque");
            #if WIN
                    application = new GtkWinApplication (args);
            #else
                    application = new GtkLinuxApplication (args);
            #endif
                }
            } catch (Exception e) {
                Logger.Debug ("Exception is: {0}", e);
                application.Exit (-1);
            } finally {
                lock (lockObject) {
                    if (application != null)
                        application.Dispose ();
                }
            }
        }
Example #2
0
 RemoteControl(GtkApplicationBase application)
 {
     if (application == null)
     {
         throw new ArgumentNullException("application");
     }
     this.application = application;
 }
Example #3
0
 public StatusIconTray(GtkApplicationBase application) : base(application)
 {
     tray            = new StatusIcon(Utilities.GetIcon(IconName, 24));
     tray.Visible    = true;
     tray.Activate  += delegate { ToggleTaskWindowAction.Activate(); };
     tray.PopupMenu += (sender, e) => {
         var popupMenu = Menu;
         popupMenu.ShowAll();                  // shows everything
         tray.PresentMenu(popupMenu, (uint)e.Args [0], (uint)e.Args [1]);
     };
 }
Example #4
0
 public StatusIconTray(GtkApplicationBase application)
     : base(application)
 {
     tray = new StatusIcon (Utilities.GetIcon (IconName, 24));
     tray.Visible = true;
     tray.Activate += delegate { ToggleTaskWindowAction.Activate (); };
     tray.PopupMenu += (sender, e) => {
         var popupMenu = Menu;
         popupMenu.ShowAll (); // shows everything
         tray.PresentMenu (popupMenu, (uint)e.Args [0], (uint)e.Args [1]);
     };
 }
Example #5
0
        public static RemoteControl Register(GtkApplicationBase application)
        {
            BusG.Init ();

            var remoteControl = new RemoteControl (application);
            Bus.Session.Register (new ObjectPath (Path), remoteControl);

            if (Bus.Session.RequestName (Namespace) != RequestNameReply.PrimaryOwner)
                return null;

            return remoteControl;
        }
Example #6
0
        public static RemoteControl Register(GtkApplicationBase application)
        {
            BusG.Init();

            var remoteControl = new RemoteControl(application);

            Bus.Session.Register(new ObjectPath(Path), remoteControl);

            if (Bus.Session.RequestName(Namespace) != RequestNameReply.PrimaryOwner)
            {
                return(null);
            }

            return(remoteControl);
        }
Example #7
0
        public PreferencesDialog(GtkApplicationBase application)
            : base()
        {
            if (application == null)
                throw new ArgumentNullException ("application");
            this.application = application;

            LoadPreferences();
            Init();
            ConnectEvents();

            Shown += OnShown;

            this.WidthRequest = 400;
            this.HeightRequest = 350;
        }
Example #8
0
        protected GtkTray(GtkApplicationBase application)
        {
            if (application == null)
                throw new ArgumentNullException ("application");
            this.application = application;

            RegisterUIManager ();

            application.BackendManager.BackendChanging += delegate {
                SwitchBackendItems (false); };
            application.BackendManager.BackendInitialized += delegate {
                SwitchBackendItems (true); };
            ((INotifyCollectionChanged)application.BackendManager.Tasks).CollectionChanged
                += delegate { RefreshTrayIconTooltip (); };
            RefreshTrayIconTooltip ();
        }
Example #9
0
        public PreferencesDialog(GtkApplicationBase application) : base()
        {
            if (application == null)
            {
                throw new ArgumentNullException("application");
            }
            this.application = application;

            LoadPreferences();
            Init();
            ConnectEvents();

            Shown += OnShown;

            this.WidthRequest  = 400;
            this.HeightRequest = 350;
        }
Example #10
0
        protected GtkTray(GtkApplicationBase application)
        {
            if (application == null)
            {
                throw new ArgumentNullException("application");
            }
            this.application = application;

            RegisterUIManager();

            application.BackendManager.BackendChanging += delegate {
                SwitchBackendItems(false);
            };
            application.BackendManager.BackendInitialized += delegate {
                SwitchBackendItems(true);
            };
            ((INotifyCollectionChanged)application.BackendManager.Tasks).CollectionChanged
                += delegate { RefreshTrayIconTooltip(); };
            RefreshTrayIconTooltip();
        }
Example #11
0
		public AppIndicatorTray (GtkApplicationBase application) : base  (application)
		{
			appIndicator = new ApplicationIndicator ("TasqueTray", IconName, Category.ApplicationStatus);
			appIndicator.Status = Status.Active;

			var menu = Menu;
			var toggleTaskWindowMenuItem = new MenuItem ();
			ToggleTaskWindowAction.ConnectProxy (toggleTaskWindowMenuItem);
			menu.Insert (toggleTaskWindowMenuItem, 0);
			menu.Insert (new SeparatorMenuItem (), 1);

			tooltipProxyMenuItem = new MenuItem (Tooltip);
			tooltipProxyMenuItem.Sensitive = false;
			menu.Insert (tooltipProxyMenuItem, 2);
			menu.Insert (new SeparatorMenuItem (), 3);

			menu.ShowAll ();
			
			appIndicator.Menu = menu;
		}
Example #12
0
        public AppIndicatorTray(GtkApplicationBase application)
            : base(application)
        {
            appIndicator = new ApplicationIndicator ("TasqueTray", IconName, Category.ApplicationStatus);
            appIndicator.Status = Status.Active;

            var menu = Menu;
            var toggleTaskWindowMenuItem = new MenuItem ();
            ToggleTaskWindowAction.ConnectProxy (toggleTaskWindowMenuItem);
            menu.Insert (toggleTaskWindowMenuItem, 0);
            menu.Insert (new SeparatorMenuItem (), 1);

            tooltipProxyMenuItem = new MenuItem (Tooltip);
            tooltipProxyMenuItem.Sensitive = false;
            menu.Insert (tooltipProxyMenuItem, 2);
            menu.Insert (new SeparatorMenuItem (), 3);

            menu.ShowAll ();

            appIndicator.Menu = menu;
        }
Example #13
0
        public static GtkTray CreateTray(GtkApplicationBase application)
        {
            var     desktopSession = Environment.GetEnvironmentVariable("DESKTOP_SESSION");
            GtkTray tray;

            switch (desktopSession)
            {
            case "ubuntu":
            case "ubuntu-2d":
            case "gnome-classic":
            case "gnome-fallback":
#if APPINDICATOR
                tray = new AppIndicatorTray(application);
                break;
#endif
            default:
                tray = new StatusIconTray(application);
                break;
            }
            return(tray);
        }
Example #14
0
        public TaskWindow(GtkApplicationBase application)
            : base(Gtk.WindowType.Toplevel)
        {
            if (application == null)
                throw new ArgumentNullException ("application");
            this.application = application;

            taskGroups = new List<TaskGroup> ();
            noteDialogs = new Dictionary<ITask, NoteDialog> ();
            InitWindow();

            Realized += OnRealized;
        }
Example #15
0
 public static void ToggleWindowVisible(GtkApplicationBase application)
 {
     ShowWindow (true, application);
 }
Example #16
0
        /// <summary>
        /// Method to allow other classes to "click" on the "Add ITask" button.
        /// </summary>
        public static void AddTask(GtkApplicationBase application)
        {
            if (taskWindow == null)
                TaskWindow.ShowWindow (application);

            taskWindow.OnAddTask (null, EventArgs.Empty);
        }
Example #17
0
 public static GtkTray CreateTray(GtkApplicationBase application)
 {
     var desktopSession = Environment.GetEnvironmentVariable ("DESKTOP_SESSION");
     GtkTray tray;
     switch (desktopSession) {
     case "ubuntu":
     case "ubuntu-2d":
     case "gnome-classic":
     case "gnome-fallback":
     #if APPINDICATOR
         tray = new AppIndicatorTray (application);
         break;
     #endif
     default:
         tray = new StatusIconTray (application);
         break;
     }
     return tray;
 }
Example #18
0
 RemoteControl(GtkApplicationBase application)
 {
     if (application == null)
         throw new ArgumentNullException ("application");
     this.application = application;
 }
Example #19
0
        public static void GrabNewTaskEntryFocus(GtkApplicationBase application)
        {
            if (taskWindow == null)
                TaskWindow.ShowWindow (application);

            taskWindow.addTaskEntry.GrabFocus ();
        }
Example #20
0
        /// <summary>
        /// This should be called after a new IBackend has been set
        /// </summary>
        public static void Reinitialize(bool show, GtkApplicationBase application)
        {
            if (TaskWindow.taskWindow != null) {
                TaskWindow.taskWindow.Hide ();
                TaskWindow.taskWindow.Destroy ();
                TaskWindow.taskWindow = null;
            }

            if (show)
                TaskWindow.ShowWindow (application);
        }
Example #21
0
 public static void SelectAndEdit(ITask task, GtkApplicationBase application)
 {
     ShowWindow (application);
     taskWindow.EnterEditMode (task, true);
     taskWindow.Present ();
 }
Example #22
0
        public TaskGroup(string groupName, DateTime rangeStart,
		                  DateTime rangeEnd, ICollection<ITask> tasks, GtkApplicationBase application)
        {
            if (application == null)
                throw new ArgumentNullException ("application");
            Application = application;

            hideWhenEmpty = true;

            // TODO: Add a date time event watcher so that when we rollover to
            // a new day, we can update the rangeStart and rangeEnd times.  The
            // ranges will be used to determine whether tasks fit into certain
            // groups in the main TaskWindow.  Reference Tomboy's NoteOfTheDay
            // add-in for code that reacts on day changes.

            treeModel = CreateModel (rangeStart, rangeEnd, tasks);

            // TODO: Add something to watch events so that the group will
            // automatically refilter and display/hide itself accordingly.

            //
            // Build the UI
            //

            //
            // Group Header
            //
            //			Gtk.EventBox eb = new Gtk.EventBox();
            //			eb.Show();
            //			eb.BorderWidth = 0;
            //			eb.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(211,215,199));
            //			eb.ModifyBase(Gtk.StateType.Normal, new Gdk.Color(211,215,199));
            Gtk.HBox headerHBox = new Gtk.HBox (false, 0);

            header = new Gtk.Label ();
            header.UseMarkup = true;
            header.UseUnderline = false;
            header.Markup = GetHeaderMarkup (groupName);
            header.Xalign = 0;

            header.Show ();

            //			eb.Add(header);
            //			PackStart (eb, false, false, 0);
            headerHBox.PackStart (header, false, false, 0);

            // spacer
            Gtk.Label spacerLabel = new Gtk.Label (string.Empty);
            spacerLabel.Show ();
            headerHBox.PackStart (spacerLabel, true, true, 0);

            extraWidgetHBox = new Gtk.HBox (false, 0);
            extraWidgetHBox.Show ();
            headerHBox.PackStart (extraWidgetHBox, false, false, 0);
            headerHBox.Show ();
            PackStart (headerHBox, false, false, 5);

            //
            // Group TreeView
            //
            taskView = new TaskView (treeModel, application.Preferences);
            taskView.TreeView.Show ();
            PackStart (taskView.TreeView, true, true, 0);

            taskView.NumberOfTasksChanged += OnNumberOfTasksChanged;
            taskView.TreeView.RowActivated += OnRowActivated;
            taskView.TreeView.ButtonPressEvent += OnButtonPressed;
        }
Example #23
0
 public static void ShowWindow(GtkApplicationBase application)
 {
     ShowWindow (false, application);
 }
Example #24
0
        private static void ShowWindow(bool supportToggle, GtkApplicationBase application)
        {
            if(taskWindow != null) {
                if(taskWindow.IsActive && supportToggle) {
                    int x;
                    int y;

                    taskWindow.GetPosition(out x, out y);

                    lastXPos = x;
                    lastYPos = y;

                    taskWindow.Hide();
                } else {
                    if(!taskWindow.Visible) {
                        int x = lastXPos;
                        int y = lastYPos;

                        if (x >= 0 && y >= 0)
                            taskWindow.Move(x, y);
                    }
                    taskWindow.Present();
                }
            } else if (application.BackendManager.CurrentBackend != null) {
                taskWindow = new TaskWindow (application);
                if(lastXPos == 0 || lastYPos == 0)
                {
                    lastXPos = application.Preferences.GetInt("MainWindowLastXPos");
                    lastYPos = application.Preferences.GetInt("MainWindowLastYPos");
                }

                int x = lastXPos;
                int y = lastYPos;

                if (x >= 0 && y >= 0)
                    taskWindow.Move(x, y);

                taskWindow.ShowAll();
            }
        }