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;
27
namespace GnomeDoVNC {
28
public class VNCHostItem : IItemSource {
33
items = new List<IItem> ();
38
get { return "Vinagre Bookmarks"; }
41
public string Description {
42
get { return "Indexes your Vinagre Bookmarks"; }
46
get { return "gnome-globe"; }
49
public Type[] SupportedItemTypes {
58
public ICollection<IItem> Items {
62
public ICollection<IItem> ChildrenOfItem (IItem parent)
67
public void UpdateItems ()
70
string bookmarks_file = Environment.GetEnvironmentVariable ("HOME") + "/.gnome2/vinagre.bookmarks";
73
StreamReader reader = File.OpenText(bookmarks_file);
74
while ((s = reader.ReadLine ()) != null) {
76
if ((s.Substring (0,1).Equals ("[")) && (s.Substring (s.Length - 1,1).Equals ("]"))) {
77
s = s.Substring (1, s.Length - 2);
78
host = reader.ReadLine ();
79
port = reader.ReadLine ();
80
host = host.Substring (5, host.Length - 5);
81
port = port.Substring (5, port.Length - 5);
82
items.Add (new HostItem(s, host, port));
87
Console.Error.WriteLine ("[ERROR] " + bookmarks_file + " cannot be read!");