void OnToggleCompletionStatus(object sender, EventArgs args) { TaskMenuItem item = sender as TaskMenuItem; if (item == null) { return; } Task task = TasksApplicationAddin.DefaultTaskManager.FindByUri( item.TaskUri); if (task == null) { return; } if (task.IsComplete) { task.ReOpen(); } else { task.Complete(); } }
void OnOpenTaskOptions(object sender, EventArgs args) { TaskMenuItem item = sender as TaskMenuItem; if (item == null) { return; } Task task = TasksApplicationAddin.DefaultTaskManager.FindByUri( item.TaskUri); if (task == null) { return; } TaskOptionsDialog dialog; if (options_dialogs.ContainsKey(task)) { dialog = options_dialogs [task]; } else { dialog = new TaskOptionsDialog( Note.Window, Gtk.DialogFlags.DestroyWithParent, task); dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent; dialog.DeleteEvent += OnOptionsDialogDeleted; options_dialogs [task] = dialog; } dialog.Show(); dialog.GrabFocus(); }
void OnPopulatePopup(object sender, Gtk.PopulatePopupArgs args) { Gtk.TextIter click_iter = Buffer.GetIterAtMark(click_mark); TaskTag task_tag = (TaskTag) Buffer.GetDynamicTag("task", click_iter); if (task_tag == null) { return; } Gtk.MenuItem item; item = new Gtk.SeparatorMenuItem(); item.Show(); args.Menu.Prepend(item); item = new Gtk.MenuItem(Catalog.GetString("Open To Do List")); item.Activated += OnOpenTaskListWindow; item.Show(); args.Menu.Prepend(item); item = new TaskMenuItem(task_tag.Uri, Catalog.GetString("To Do Options")); item.Activated += OnOpenTaskOptions; item.ShowAll(); args.Menu.Prepend(item); item = new TaskMenuItem( task_tag.Uri, task_tag.CompletionDate == DateTime.MinValue ? Catalog.GetString("Mark Complete") : Catalog.GetString("Mark Undone")); item.Activated += OnToggleCompletionStatus; item.ShowAll(); args.Menu.Prepend(item); }
void OnPopulatePopup (object sender, Gtk.PopulatePopupArgs args) { Gtk.TextIter click_iter = Buffer.GetIterAtMark (click_mark); TaskTag task_tag = (TaskTag) Buffer.GetDynamicTag ("task", click_iter); if (task_tag == null) return; Gtk.MenuItem item; item = new Gtk.SeparatorMenuItem (); item.Show (); args.Menu.Prepend (item); item = new Gtk.MenuItem (Catalog.GetString ("Open To Do List")); item.Activated += OnOpenTaskListWindow; item.Show (); args.Menu.Prepend (item); item = new TaskMenuItem (task_tag.Uri, Catalog.GetString ("To Do Options")); item.Activated += OnOpenTaskOptions; item.ShowAll (); args.Menu.Prepend (item); item = new TaskMenuItem ( task_tag.Uri, task_tag.CompletionDate == DateTime.MinValue ? Catalog.GetString ("Mark Complete") : Catalog.GetString ("Mark Undone")); item.Activated += OnToggleCompletionStatus; item.ShowAll (); args.Menu.Prepend (item); }