Example #1
0
 protected virtual void OnBusesNbSwitchPage(object o, Gtk.SwitchPageArgs args)
 {
     currentPageWidget = buses_Nb.CurrentPageWidget as BusPageWidget;
     if (currentPageWidget == null) {
         buses_Nb.CurrentPage = 0;
         currentPageWidget = buses_Nb.CurrentPageWidget as BusPageWidget;
     }
     UpdateComboBox(currentPageWidget.CurrentComboBox);
 }
Example #2
0
 protected virtual void OnBusesNbSwitchPage(object o, Gtk.SwitchPageArgs args)
 {
     currentPageWidget = buses_Nb.CurrentPageWidget as BusPageWidget;
     if (currentPageWidget == null)
     {
         buses_Nb.CurrentPage = 0;
         currentPageWidget    = buses_Nb.CurrentPageWidget as BusPageWidget;
     }
     UpdateComboBox(currentPageWidget.CurrentComboBox);
 }
Example #3
0
        protected virtual void OnNewTabActionActivated(object sender, System.EventArgs e)
        {
            TabWidget     tab  = new TabWidget(Mono.Unix.Catalog.GetString("(No Title)"), buses_Nb, buses_Nb.NPages);
            BusPageWidget page = new BusPageWidget(tab);

            page.ShowAll();
            page.Explorator = DBusExplorator.SessionExplorator;
            FeedBusComboBox(page.Explorator.AvailableBusNames, page);
            buses_Nb.AppendPage(page, tab);
            // Switch to the newly append page which trigger the normal events
            buses_Nb.CurrentPage = buses_Nb.NPages - 1;
        }
Example #4
0
        void FeedBusComboBox(IEnumerable <string> buses, BusPageWidget page)
        {
            ComboBox cb = ComboBox.NewText();

            foreach (string s in buses)
            {
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                cb.AppendText(s);
            }

            UpdateComboBox(cb);
            page.CurrentComboBox = cb;
        }
Example #5
0
        public BusContentView(BusPageWidget page)
        {
            this.page  = page;
            this.Model = this.model = new TreeStore(typeof(string), typeof(Gdk.Pixbuf), typeof(object));
            CellRendererText textCell = new CellRendererText();
            TreeViewColumn   col      = this.AppendColumn("Name", textCell, "text", 0);

            this.AppendColumn(" ", new CellRendererPixbuf(), "pixbuf", 1);

            col.Clickable = true;
            col.Clicked  += OnColumnLblClicked;

            this.Selection.Mode = SelectionMode.Browse;

            this.SearchColumn    = 0;
            this.SearchEqualFunc = delegate(TreeModel mdl, int column, string key, TreeIter iter) {
                string row = mdl.GetValue(iter, 0) as string;

                return((row == null) ? false : !(row.StartsWith(key, StringComparison.OrdinalIgnoreCase)));
            };

            this.model.SetSortFunc(0, delegate(TreeModel mdl, TreeIter tia, TreeIter tib) {
                IElement a = mdl.GetValue(tia, 2) as IElement;
                IElement b = mdl.GetValue(tib, 2) as IElement;

                if (b == null || a == null)
                {
                    return(0);
                }
                else
                {
                    return(a.CompareTo(b));
                }
            });

            this.CursorChanged += OnRowSelected;
        }
Example #6
0
        void OnAvailableNamesUpdated(object sender, EventArgs e)
        {
            DBusExplorator exp = sender as DBusExplorator;

            if (exp == null)
            {
                return;
            }

            for (int i = 0; i < buses_Nb.NPages; i++)
            {
                BusPageWidget page = buses_Nb.GetNthPage(i) as BusPageWidget;
                if (page == null)
                {
                    continue;
                }
                if (page.Explorator != exp)
                {
                    continue;
                }

                FeedBusComboBox(exp.AvailableBusNames, page);
            }
        }
Example #7
0
 protected virtual void OnNewTabActionActivated(object sender, System.EventArgs e)
 {
     TabWidget tab = new TabWidget(Mono.Unix.Catalog.GetString("(No Title)"), buses_Nb, buses_Nb.NPages);
     BusPageWidget page = new BusPageWidget(tab);
     page.ShowAll();
     page.Explorator = DBusExplorator.SessionExplorator;
     FeedBusComboBox(page.Explorator.AvailableBusNames, page);
     buses_Nb.AppendPage(page, tab);
     // Switch to the newly append page which trigger the normal events
     buses_Nb.CurrentPage = buses_Nb.NPages - 1;
 }
Example #8
0
        void FeedBusComboBox(IEnumerable<string> buses, BusPageWidget page)
        {
            ComboBox cb = ComboBox.NewText();

            var sortedBuses = new List<string>(buses);
            sortedBuses.Sort(
                (a, b) => {
                    if (!a.StartsWith(":") && !b.StartsWith(":")) {
                        return a.CompareTo(b);
                    }
                    if (a.StartsWith(":") && b.StartsWith(":")) {
                        return a.Substring(1).CompareTo(b.Substring(1));
                    }
                    if (a.StartsWith(":")) return 1;
                    if (b.StartsWith(":")) return -1;
                    return 0;
                }
            );
            foreach (string s in sortedBuses) {
                if (string.IsNullOrEmpty(s))
                    continue;
                cb.AppendText(s);
            }

            UpdateComboBox(cb);
            page.CurrentComboBox = cb;
        }
Example #9
0
        void FeedBusComboBox(IEnumerable<string> buses, BusPageWidget page)
        {
            ComboBox cb = ComboBox.NewText();

            foreach (string s in buses) {
                if (string.IsNullOrEmpty(s))
                    continue;
                cb.AppendText(s);
            }

            UpdateComboBox(cb);
            page.CurrentComboBox = cb;
        }