3
* GNOME Do is the legal property of its developers. Please refer to the
4
* COPYRIGHT file distributed with this
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
using System.Collections.Generic;
31
public class NXHostItem : Item {
35
public NXHostItem (string hostname, string configpath)
41
public override string Name {
45
public override string Description {
46
get { return Catalog.GetString ("NX Host"); }
49
public override string Icon {
50
get { return "gnome-globe"; }
58
public class NXHostItemSource : ItemSource {
61
public NXHostItemSource ()
63
items = new List<Item> ();
66
public override string Name {
67
get { return Catalog.GetString ("NX Hosts"); }
70
public override string Description {
71
get { return Catalog.GetString ("Parses nx sessions"); }
74
public override string Icon {
75
get { return "network-server"; }
78
public override IEnumerable<Type> SupportedItemTypes {
79
get { yield return typeof (NXHostItem); }
82
public override IEnumerable<Item> Items {
86
public override IEnumerable<Item> ChildrenOfItem (Item parent)
91
public override void UpdateItems ()
95
string nxDir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), ".nx");
96
nxDir = Path.Combine (nxDir, "config");
97
DirectoryInfo dir = new DirectoryInfo (nxDir);
98
foreach (FileInfo file in dir.GetFiles ("*.nxs"))
100
string name = file.Name.Replace (".nxs", "");
101
items.Add (new NXHostItem (name, Path.Combine (nxDir, name)));