3
// This program is free software; you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation; either version 3 of the License, or
6
// (at your option) any later version.
8
// This program is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License
14
// along with this program; if not, see <http://www.gnu.org/licenses/> or
15
// write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
16
// Boston, MA 02111-1307 USA
21
using System.Collections;
23
using org.freedesktop.DBus;
30
[Interface("org.gnome.Tasque.RemoteControl")]
31
public interface ITasque
33
string CreateTask (string categoryName, string taskName, bool enterEditMode);
34
string[] GetCategoryNames ();
38
public class TasqueDBus
41
private const string OBJECT_PATH = "/org/gnome/Tasque/RemoteControl";
42
private const string BUS_NAME = "org.gnome.Tasque";
43
private static ITasque Tasque;
48
Tasque = FindInstance ();
50
Console.Error.WriteLine ("Could not locate Tasque on D-Bus. Make sure Tasque is running");
56
static private ITasque FindInstance ()
58
if (!Bus.Session.NameHasOwner (BUS_NAME))
59
throw new Exception (String.Format("Name {0} has no owner", BUS_NAME));
61
return Bus.Session.GetObject<ITasque> (BUS_NAME, new ObjectPath (OBJECT_PATH));
65
public ArrayList GetCategoryNames ()
67
string[] categories = null;
68
categories = Tasque.GetCategoryNames ();
69
ArrayList CategoryNames = new ArrayList ();
71
foreach (string category in categories)
72
CategoryNames.Add (category);
78
public string CreateTask (string category, string task)
80
ArrayList list = GetCategoryNames ();
82
if (list.Contains (category))
83
return Tasque.CreateTask (category, task,false);
85
return Tasque.CreateTask (list[0].ToString(), task, false);
89
public void ShowTasks ()