Esempio n. 1
0
        public RTPrefs()
        {
            RTPreferences prefs = new RTPreferences();

            this.Build();

            nameColumn = new Gtk.TreeViewColumn ();
            nameColumn.Title = "Name";
            urlColumn = new Gtk.TreeViewColumn ();
            urlColumn.Title = "URL";

            RTTree.AppendColumn (nameColumn);
            RTTree.AppendColumn (urlColumn);

            rtListStore = new Gtk.ListStore (typeof (string), typeof (string));
            RTTree.Model = rtListStore;

            Gtk.CellRendererText nameNameCell = new Gtk.CellRendererText ();
            nameNameCell.Editable = true;
            nameNameCell.Edited += OnNameCellEdited;
            nameColumn.PackStart (nameNameCell, true);

            Gtk.CellRendererText urlTitleCell = new Gtk.CellRendererText ();
            urlTitleCell.Editable = true;
            urlTitleCell.Edited += OnURLCellEdited;
            urlColumn.PackStart (urlTitleCell, true);

            nameColumn.AddAttribute (nameNameCell, "text", 0);
            urlColumn.AddAttribute (urlTitleCell, "text", 1);

            if (!string.IsNullOrEmpty (prefs.URLs)) {
                string[] urlbits = prefs.URLs.Split('|');
                for (int i = 0; i < urlbits.Length; i++) {
                    string name = urlbits[i];
                    string uri = urlbits[++i];
                    Uri url;
                    try {
                        url = new System.Uri(uri);
                    } catch (System.UriFormatException) {
                        continue;
                    }

                    rtListStore.AppendValues (name, url.ToString());
                }
            }
        }
Esempio n. 2
0
 static RequestTrackerItems()
 {
     Items =  new Collection<RequestTrackerItem> ();
     prefs = new RTPreferences ();
 }
Esempio n. 3
0
        public void UpdatePrefs()
        {
            Gtk.TreeIter iter;
            string URLs = "";
            string name;
            string url;
            int num_children = rtListStore.IterNChildren ();

            for (int i = 0; i < num_children; i++) {
                rtListStore.IterNthChild (out iter, i);

                name = rtListStore.GetValue (iter, 0).ToString ();
                url = rtListStore.GetValue (iter, 1).ToString ();

                if (!string.IsNullOrEmpty (name) && !string.IsNullOrEmpty (url)) {
                    if (i > 0) {
                        URLs += "|";
                    }
                    URLs += name.Replace ("|", "");
                    URLs += "|";
                    URLs += url.Replace ("|", "");
                }
            }

            RTPreferences prefs = new RTPreferences ();
            prefs.URLs = URLs;
        }