상속: IDisposable
예제 #1
0
파일: Program.cs 프로젝트: GNOME/tasque
        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 ();
                }
            }
        }
예제 #2
0
 RemoteControl(GtkApplicationBase application)
 {
     if (application == null)
     {
         throw new ArgumentNullException("application");
     }
     this.application = application;
 }
예제 #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]);
     };
 }
예제 #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]);
     };
 }
예제 #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;
        }
예제 #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);
        }
예제 #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;
        }
예제 #8
0
파일: GtkTray.cs 프로젝트: GNOME/tasque
        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 ();
        }
예제 #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;
        }
예제 #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();
        }
예제 #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;
		}
예제 #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;
        }
예제 #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);
        }
예제 #14
0
파일: TaskWindow.cs 프로젝트: GNOME/tasque
        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;
        }
예제 #15
0
파일: TaskWindow.cs 프로젝트: GNOME/tasque
 public static void ToggleWindowVisible(GtkApplicationBase application)
 {
     ShowWindow (true, application);
 }
예제 #16
0
파일: TaskWindow.cs 프로젝트: GNOME/tasque
        /// <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);
        }
예제 #17
0
파일: GtkTray.cs 프로젝트: GNOME/tasque
 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;
 }
예제 #18
0
 RemoteControl(GtkApplicationBase application)
 {
     if (application == null)
         throw new ArgumentNullException ("application");
     this.application = application;
 }
예제 #19
0
파일: TaskWindow.cs 프로젝트: GNOME/tasque
        public static void GrabNewTaskEntryFocus(GtkApplicationBase application)
        {
            if (taskWindow == null)
                TaskWindow.ShowWindow (application);

            taskWindow.addTaskEntry.GrabFocus ();
        }
예제 #20
0
파일: TaskWindow.cs 프로젝트: GNOME/tasque
        /// <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);
        }
예제 #21
0
파일: TaskWindow.cs 프로젝트: GNOME/tasque
 public static void SelectAndEdit(ITask task, GtkApplicationBase application)
 {
     ShowWindow (application);
     taskWindow.EnterEditMode (task, true);
     taskWindow.Present ();
 }
예제 #22
0
파일: TaskGroup.cs 프로젝트: GNOME/tasque
        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;
        }
예제 #23
0
파일: TaskWindow.cs 프로젝트: GNOME/tasque
 public static void ShowWindow(GtkApplicationBase application)
 {
     ShowWindow (false, application);
 }
예제 #24
0
파일: TaskWindow.cs 프로젝트: GNOME/tasque
        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();
            }
        }