当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.ListStore.SetSortColumnId方法代码示例

本文整理汇总了C#中Gtk.ListStore.SetSortColumnId方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.ListStore.SetSortColumnId方法的具体用法?C# Gtk.ListStore.SetSortColumnId怎么用?C# Gtk.ListStore.SetSortColumnId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.ListStore的用法示例。


在下文中一共展示了Gtk.ListStore.SetSortColumnId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EventsSearch

        public EventsSearch()
        {
            this.Build();

            store= new Gtk.ListStore (typeof(string),typeof(string),typeof(OpenMetaverse.DirectoryManager.EventsSearchData));

            treeview1.AppendColumn("Event Name",new Gtk.CellRendererText(),"text",0);
            treeview1.AppendColumn("Time",new Gtk.CellRendererText(),"text",1);

            store.SetSortColumnId(0,Gtk.SortType.Ascending);

            treeview1.Model=store;

            MainClass.onRegister += new MainClass.register(MainClass_onRegister);
            MainClass.onDeregister += new MainClass.deregister(MainClass_onDeregister);
            if(MainClass.client != null ) { MainClass_onRegister(); }

            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Sports.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Pageants.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Nightlife.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Miscellaneous.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.LiveMusic.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Games.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Education.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Discussion.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Commercial.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Charity.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.Arts.ToString());
            this.combobox_category.InsertText(0,OpenMetaverse.DirectoryManager.EventCategories.All.ToString());

            this.combobox_category.Active=0;
            this.button_notify.Sensitive=false;
            this.button_teleport.Sensitive=false;
        }
开发者ID:robincornelius,项目名称:omvviewer-light,代码行数:34,代码来源:EventsSearch.cs

示例2: PlacesSearch

        public PlacesSearch()
        {
            this.Build();
            store= new Gtk.ListStore (typeof(string),typeof(string),typeof(string),typeof(string),typeof(Vector3),typeof(UUID));

            MyTreeViewColumn mycol;
            mycol = new MyTreeViewColumn("Name", new Gtk.CellRendererText(), "text", 0,true);
            mycol.setmodel(store);
            treeview1.AppendColumn(mycol);

            mycol = new MyTreeViewColumn("Sim", new Gtk.CellRendererText(), "text", 1,false);
            mycol.setmodel(store);
            treeview1.AppendColumn(mycol);

            mycol = new MyTreeViewColumn("Traffic", new Gtk.CellRendererText(), "text", 2,false);
            mycol.setmodel(store);
            treeview1.AppendColumn(mycol);
            store.SetSortFunc(2,numericsort);

            mycol = new MyTreeViewColumn("Location", new Gtk.CellRendererText(), "text", 3,false);
            mycol.setmodel(store);
            treeview1.AppendColumn(mycol);

            treeview1.HeadersClickable = true;
            treeview1.Model=store;
            store.SetSortColumnId(0, Gtk.SortType.Ascending);

            MainClass.onRegister += new MainClass.register(MainClass_onRegister);
            MainClass.onDeregister += new MainClass.deregister(MainClass_onDeregister);
            if(MainClass.client != null ) { MainClass_onRegister(); }
        }
开发者ID:robincornelius,项目名称:omvviewer-light,代码行数:31,代码来源:PlacesSearch.cs

示例3: Searches

        public Searches()
        {
            this.Build();

            store= new Gtk.ListStore (typeof(bool),typeof(string),typeof(UUID));

            treeview1.AppendColumn("Online",new Gtk.CellRendererToggle(),"active",0);
            treeview1.AppendColumn("Name",new Gtk.CellRendererText(),"text",1);
            store.SetSortColumnId(1,Gtk.SortType.Ascending);
            treeview1.Model=store;

            MainClass.onRegister += new MainClass.register(MainClass_onRegister);
            MainClass.onDeregister += new MainClass.deregister(MainClass_onDeregister);
            if(MainClass.client != null ) { MainClass_onRegister(); }
        }
开发者ID:robincornelius,项目名称:omvviewer-light,代码行数:15,代码来源:Searchs.cs

示例4: Init

        private void Init()
        {
            f_ListStore = new Gtk.ListStore(
                typeof(ChatType),
                typeof(string)
            );
            f_ListStore.AppendValues(ChatType.Person, _("Person / Private"));
            f_ListStore.AppendValues(ChatType.Group,  _("Group / Public"));
            f_ListStore.SetSortColumnId(1, Gtk.SortType.Ascending);

            f_ComboBox.Clear();
            Gtk.CellRenderer cell = new Gtk.CellRendererText();
            f_ComboBox.PackStart(cell, false);
            f_ComboBox.AddAttribute(cell, "text", 1);
            f_ComboBox.Model = f_ListStore;
            f_ComboBox.Active = 0;
        }
开发者ID:pacificIT,项目名称:smuxi,代码行数:17,代码来源:ChatTypeWidget.cs

示例5: InitNetworks

        public void InitNetworks(IList<string> networks)
        {
            Trace.Call(networks);

            if (networks == null) {
                throw new ArgumentNullException("networks");
            }

            f_NetworkComboBox.Clear();
            var cell = new Gtk.CellRendererText();
            f_NetworkComboBox.PackStart(cell, false);
            f_NetworkComboBox.AddAttribute(cell, "text", 0);

            Gtk.ListStore store = new Gtk.ListStore(typeof(string));
            foreach (string network in networks) {
                if (String.IsNullOrEmpty(network)) {
                    continue;
                }
                store.AppendValues(network);
            }
            store.SetSortColumnId(0, Gtk.SortType.Ascending);
            f_NetworkComboBox.Model = store;
            f_NetworkComboBox.Active = 0;
        }
开发者ID:vith,项目名称:smuxi,代码行数:24,代码来源:JoinWidget.cs

示例6: GroupChatView

        public GroupChatView(GroupChatModel groupChat)
            : base(groupChat)
        {
            Trace.Call(groupChat);

            _GroupChatModel = groupChat;

            // person list
            Participants = new List<PersonModel>();
            _OutputHPaned = new Gtk.HPaned();

            Gtk.TreeView tv = new Gtk.TreeView();
            _PersonTreeView = tv;
            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            PersonScrolledWindow = sw;
            sw.ShadowType = Gtk.ShadowType.None;
            sw.HscrollbarPolicy = Gtk.PolicyType.Never;

            //tv.CanFocus = false;
            tv.BorderWidth = 0;
            tv.Selection.Mode = Gtk.SelectionMode.Multiple;
            sw.Add(tv);

            Gtk.TreeViewColumn column;
            var cellr = new Gtk.CellRendererText() {
                Ellipsize = Pango.EllipsizeMode.End
            };
            IdentityNameCellRenderer = cellr;
            column = new Gtk.TreeViewColumn(String.Empty, cellr);
            column.SortColumnId = 0;
            column.Spacing = 0;
            column.SortIndicator = false;
            column.Expand = true;
            column.Sizing = Gtk.TreeViewColumnSizing.Autosize;
            // FIXME: this callback leaks memory
            column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(RenderPersonIdentityName));
            tv.AppendColumn(column);
            _IdentityNameColumn = column;

            Gtk.ListStore liststore = new Gtk.ListStore(typeof(PersonModel));
            liststore.SetSortColumnId(0, Gtk.SortType.Ascending);
            liststore.SetSortFunc(0, new Gtk.TreeIterCompareFunc(SortPersonListStore));
            _PersonListStore = liststore;

            tv.Model = liststore;
            tv.SearchColumn = 0;
            tv.SearchEqualFunc = (model, col, key, iter) => {
                var person = (PersonModel) model.GetValue(iter, col);
                // Ladies and gentlemen welcome to C
                // 0 means it matched but 0 as bool is false. So if it matches
                // we have to return false. Still not clear? true is false and
                // false is true, weirdo! If you think this is retarded,
                // yes it is.
                return !person.IdentityName.StartsWith(key, StringComparison.InvariantCultureIgnoreCase);
            };
            tv.EnableSearch = true;
            tv.HeadersVisible = false;
            tv.RowActivated += new Gtk.RowActivatedHandler(OnPersonsRowActivated);
            tv.FocusOutEvent += OnPersonTreeViewFocusOutEvent;

            // popup menu
            _PersonMenu = new Gtk.Menu();
            // don't loose the focus else we lose the selection too!
            // see OnPersonTreeViewFocusOutEvent()
            _PersonMenu.TakeFocus = false;
            _PersonMenu.Shown += OnPersonMenuShown;

            _PersonTreeView.ButtonPressEvent += _OnPersonTreeViewButtonPressEvent;
            _PersonTreeView.KeyPressEvent += OnPersonTreeViewKeyPressEvent;
            // frame needed for events when selecting something in the treeview
            _PersonTreeViewFrame = new Gtk.Frame() {
                ShadowType = Gtk.ShadowType.In
            };
            _PersonTreeViewFrame.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(_OnUserListButtonReleaseEvent);
            _PersonTreeViewFrame.Add(sw);

            // topic
            // don't worry, ApplyConfig() will add us to the OutputVBox!
            _OutputVBox = new Gtk.VBox() {
                Spacing = 1
            };

            _TopicTextView = new MessageTextView();
            _TopicTextView.Editable = false;
            _TopicTextView.WrapMode = Gtk.WrapMode.WordChar;
            _TopicScrolledWindow = new Gtk.ScrolledWindow();
            _TopicScrolledWindow.ShadowType = Gtk.ShadowType.In;
            _TopicScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Never;
            _TopicScrolledWindow.Add(_TopicTextView);
            // make sure the topic is invisible and remains by default and
            // visible when a topic gets set
            _TopicScrolledWindow.ShowAll();
            _TopicScrolledWindow.Visible = false;
            _TopicScrolledWindow.NoShowAll = true;
            _TopicScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) {
                // predict and set useful topic heigth
                int lineWidth, lineHeight;
                using (var layout = _TopicTextView.CreatePangoLayout("Test Topic")) {
                    layout.GetPixelSize(out lineWidth, out lineHeight);
                }
//.........这里部分代码省略.........
开发者ID:pacificIT,项目名称:smuxi,代码行数:101,代码来源:GroupChatView.cs

示例7: GroupChatView

        public GroupChatView(GroupChatModel groupChat)
            : base(groupChat)
        {
            Trace.Call(groupChat);

            _GroupChatModel = groupChat;

            // person list
            _OutputHPaned = new Gtk.HPaned();

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            _PersonScrolledWindow = sw;
            //sw.WidthRequest = 150;
            sw.HscrollbarPolicy = Gtk.PolicyType.Never;

            Gtk.TreeView tv = new Gtk.TreeView();
            _PersonTreeView = tv;
            //tv.CanFocus = false;
            tv.BorderWidth = 0;
            tv.Selection.Mode = Gtk.SelectionMode.Multiple;
            sw.Add(tv);

            Gtk.TreeViewColumn column;
            Gtk.CellRendererText cellr = new Gtk.CellRendererText();
            cellr.WidthChars = 12;
            column = new Gtk.TreeViewColumn(String.Empty, cellr);
            column.SortColumnId = 0;
            column.Spacing = 0;
            column.SortIndicator = false;
            column.Sizing = Gtk.TreeViewColumnSizing.Autosize;
            column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(RenderPersonIdentityName));
            tv.AppendColumn(column);
            _IdentityNameColumn = column;

            Gtk.ListStore liststore = new Gtk.ListStore(typeof(PersonModel));
            liststore.SetSortColumnId(0, Gtk.SortType.Ascending);
            liststore.SetSortFunc(0, new Gtk.TreeIterCompareFunc(SortPersonListStore));
            _PersonListStore = liststore;

            tv.Model = liststore;
            tv.RowActivated += new Gtk.RowActivatedHandler(OnPersonsRowActivated);
            tv.FocusOutEvent += OnPersonTreeViewFocusOutEvent;

            // popup menu
            _PersonMenu = new Gtk.Menu();
            // don't loose the focus else we lose the selection too!
            // see OnPersonTreeViewFocusOutEvent()
            _PersonMenu.TakeFocus = false;
            _PersonMenu.Shown += OnPersonMenuShown;

            _PersonTreeView.ButtonPressEvent += _OnPersonTreeViewButtonPressEvent;
            _PersonTreeView.KeyPressEvent += OnPersonTreeViewKeyPressEvent;
            // frame needed for events when selecting something in the treeview
            _PersonTreeViewFrame = new Gtk.Frame();
            _PersonTreeViewFrame.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(_OnUserListButtonReleaseEvent);
            _PersonTreeViewFrame.Add(sw);

            // topic
            // don't worry, ApplyConfig() will add us to the OutputVBox!
            _OutputVBox = new Gtk.VBox();

            _TopicTextView = new MessageTextView();
            _TopicTextView.Editable = false;
            _TopicTextView.WrapMode = Gtk.WrapMode.WordChar;
            _TopicScrolledWindow = new Gtk.ScrolledWindow();
            _TopicScrolledWindow.ShadowType = Gtk.ShadowType.In;
            // when using PolicyType.Never, it will try to grow but never shrinks!
            _TopicScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            _TopicScrolledWindow.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            _TopicScrolledWindow.Add(_TopicTextView);
            // make sure the topic is invisible and remains by default and
            // visible when a topic gets set
            _TopicScrolledWindow.ShowAll();
            _TopicScrolledWindow.Visible = false;
            _TopicScrolledWindow.NoShowAll = true;
            _TopicScrolledWindow.SizeRequested += delegate(object o, Gtk.SizeRequestedArgs args) {
                // predict and set useful topic heigth
                Pango.Layout layout = _TopicTextView.CreatePangoLayout("Test Topic");
                int lineWidth, lineHeigth;
                layout.GetPixelSize(out lineWidth, out lineHeigth);
                var lineSpacing = _TopicTextView.PixelsAboveLines +
                                  _TopicTextView.PixelsBelowLines;
                var text = Topic != null ? Topic.ToString() : String.Empty;
                // hardcoded to 2 lines for now
                var newLines = text.Length > 0 ? 2 : 0;
                var bestSize = new Gtk.Requisition() {
                    Height = ((lineHeigth + lineSpacing) * newLines) + 2
                };
                args.Requisition = bestSize;
            };

            Add(_OutputHPaned);

            //ApplyConfig(Frontend.UserConfig);

            ShowAll();
        }
开发者ID:flugsio,项目名称:smuxi,代码行数:97,代码来源:GroupChatView.cs

示例8: GroupChatView

        public GroupChatView(GroupChatModel groupChat)
            : base(groupChat)
        {
            Trace.Call(groupChat);

            _GroupChatModel = groupChat;

            // person list
            _OutputHPaned = new Gtk.HPaned();

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            _PersonScrolledWindow = sw;
            //sw.WidthRequest = 150;
            sw.HscrollbarPolicy = Gtk.PolicyType.Never;

            Gtk.TreeView tv = new Gtk.TreeView();
            _PersonTreeView = tv;
            //tv.CanFocus = false;
            tv.BorderWidth = 0;
            tv.Selection.Mode = Gtk.SelectionMode.Multiple;
            sw.Add(tv);

            Gtk.TreeViewColumn column;
            Gtk.CellRendererText cellr = new Gtk.CellRendererText();
            cellr.WidthChars = 12;
            column = new Gtk.TreeViewColumn(String.Empty, cellr);
            column.SortColumnId = 0;
            column.Spacing = 0;
            column.SortIndicator = false;
            column.Sizing = Gtk.TreeViewColumnSizing.Autosize;
            column.SetCellDataFunc(cellr, new Gtk.TreeCellDataFunc(RenderPersonIdentityName));
            tv.AppendColumn(column);
            _IdentityNameColumn = column;

            Gtk.ListStore liststore = new Gtk.ListStore(typeof(PersonModel));
            liststore.SetSortColumnId(0, Gtk.SortType.Ascending);
            liststore.SetSortFunc(0, new Gtk.TreeIterCompareFunc(SortPersonListStore));
            _PersonListStore = liststore;

            tv.Model = liststore;
            tv.RowActivated += new Gtk.RowActivatedHandler(OnPersonsRowActivated);
            tv.FocusOutEvent += OnPersonTreeViewFocusOutEvent;

            // popup menu
            _PersonMenu = new Gtk.Menu();
            // don't loose the focus else we lose the selection too!
            // see OnPersonTreeViewFocusOutEvent()
            _PersonMenu.TakeFocus = false;
            _PersonMenu.Shown += OnPersonMenuShown;

            _PersonTreeView.ButtonPressEvent += _OnPersonTreeViewButtonPressEvent;
            _PersonTreeView.KeyPressEvent += OnPersonTreeViewKeyPressEvent;
            // frame needed for events when selecting something in the treeview
            _PersonTreeViewFrame = new Gtk.Frame();
            _PersonTreeViewFrame.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(_OnUserListButtonReleaseEvent);
            _PersonTreeViewFrame.Add(sw);

            // topic
            // don't worry, ApplyConfig() will add us to the OutputVBox!
            _OutputVBox = new Gtk.VBox();

            _TopicTextView = new MessageTextView();
            _TopicTextView.Editable = false;
            _TopicTextView.WrapMode = Gtk.WrapMode.WordChar;
            _TopicScrolledWindow = new Gtk.ScrolledWindow();
            _TopicScrolledWindow.ShadowType = Gtk.ShadowType.In;
            // when using PolicyType.Never, it will try to grow but never shrinks!
            _TopicScrolledWindow.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            _TopicScrolledWindow.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            _TopicScrolledWindow.Add(_TopicTextView);
            // make sure the topic is invisible and remains by default and
            // visible when a topic gets set
            _TopicScrolledWindow.ShowAll();
            _TopicScrolledWindow.Visible = false;
            _TopicScrolledWindow.NoShowAll = true;

            Add(_OutputHPaned);

            //ApplyConfig(Frontend.UserConfig);

            ShowAll();
        }
开发者ID:carlosmn,项目名称:smuxi,代码行数:82,代码来源:GroupChatView.cs

示例9: CreateIconStore

		Gtk.ListStore CreateIconStore ()
		{
			Gtk.ListStore store = new Gtk.ListStore (
			        typeof (Gdk.Pixbuf), // icon
			        typeof (string),     // host
			        typeof (string));    // file path
			store.SetSortColumnId (1, Gtk.SortType.Ascending);

			return store;
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:10,代码来源:BugzillaPreferences.cs

示例10: LoadProtocols

        protected void LoadProtocols()
        {
            Trace.Call();

            f_ProtocolComboBox.Clear();
            f_ProtocolComboBox.Changed += OnProtocolComboBoxChanged;
            Gtk.CellRenderer cell = new Gtk.CellRendererText();
            f_ProtocolComboBox.PackStart(cell, false);
            f_ProtocolComboBox.AddAttribute(cell, "text", 0);
            IList<string> supportedProtocols = Frontend.Session.GetSupportedProtocols();
            Gtk.ListStore store = new Gtk.ListStore(typeof(string));
            foreach (string protocol in supportedProtocols) {
                store.AppendValues(protocol);
            }
            store.SetSortColumnId(0, Gtk.SortType.Ascending);
            f_ProtocolComboBox.Model = store;
            f_ProtocolComboBox.Active = 0;
        }
开发者ID:RoninBG,项目名称:smuxi,代码行数:18,代码来源:QuickConnectDialog.cs

示例11: InitProtocols

        public void InitProtocols(IList<string> protocols)
        {
            Trace.Call(protocols);

            if (protocols == null) {
                throw new ArgumentNullException("protocols");
            }

            f_ProtocolComboBox.Clear();
            var cell = new Gtk.CellRendererText();
            f_ProtocolComboBox.PackStart(cell, false);
            f_ProtocolComboBox.AddAttribute(cell, "text", 0);

            Gtk.ListStore store = new Gtk.ListStore(typeof(string));
            // fill protocols in ListStore
            foreach (string protocol in protocols) {
                store.AppendValues(protocol);
            }
            store.SetSortColumnId(0, Gtk.SortType.Ascending);
            f_ProtocolComboBox.Model = store;
            f_ProtocolComboBox.Active = 0;
        }
开发者ID:oli-obk,项目名称:smuxi,代码行数:22,代码来源:ServerWidget.cs

示例12: InitProtocols

        public void InitProtocols(IList<string> protocols)
        {
            Trace.Call(protocols);

            if (protocols == null) {
                throw new ArgumentNullException("protocols");
            }

            f_ProtocolComboBox.Clear();
            var cell = new Gtk.CellRendererText();
            f_ProtocolComboBox.PackStart(cell, false);
            f_ProtocolComboBox.AddAttribute(cell, "text", 0);

            Gtk.ListStore store = new Gtk.ListStore(typeof(string));
            // fill protocols in ListStore
            foreach (string protocol in protocols) {
                store.AppendValues(protocol);
            }
            store.SetSortColumnId(0, Gtk.SortType.Ascending);
            f_ProtocolComboBox.Model = store;

            try {
                // select IRC by default (if available)
                Protocol = "IRC";
            } catch (ArgumentOutOfRangeException) {
            }
        }
开发者ID:RAOF,项目名称:smuxi,代码行数:27,代码来源:ServerWidget.cs

示例13: CreateBlogStore

        Gtk.ListStore CreateBlogStore()
        {
            Gtk.ListStore store = new Gtk.ListStore (
                typeof (string), // label
                typeof (string),     // url
                typeof (string),     // username
                typeof (string));    // password
            store.SetSortColumnId (1, Gtk.SortType.Ascending);

            return store;
        }
开发者ID:ozamosi,项目名称:tomboy-blogposter,代码行数:11,代码来源:BlogposterPreferences.cs

示例14: _Load

        private void _Load()
        {
            Trace.Call();

            // root
            string startup_commands = String.Join("\n", (string[])Frontend.UserConfig["OnStartupCommands"]);
            ((Gtk.TextView)_Glade["OnStartupCommandsTextView"]).Buffer.Text  = startup_commands;

            // Connection
            string nicknames = String.Join(" ", (string[])Frontend.UserConfig["Connection/Nicknames"]);
            ((Gtk.Entry)_Glade["ConnectionNicknamesEntry"]).Text  = nicknames;
            ((Gtk.Entry)_Glade["ConnectionUsernameEntry"]).Text  = (string)Frontend.UserConfig["Connection/Username"];
            ((Gtk.Entry)_Glade["ConnectionRealnameEntry"]).Text  = (string)Frontend.UserConfig["Connection/Realname"];
            string connect_commands = String.Join("\n", (string[])Frontend.UserConfig["Connection/OnConnectCommands"]);
            ((Gtk.TextView)_Glade["OnConnectCommandsTextView"]).Buffer.Text = connect_commands;

            string encoding = (string)Frontend.UserConfig["Connection/Encoding"];
            encoding = encoding.ToUpper();

            Gtk.ComboBox cb = (Gtk.ComboBox)_Glade["EncodingComboBox"];
            // glade might initialize it already!
            cb.Clear();
            Gtk.CellRendererText cell = new Gtk.CellRendererText();
            cb.PackStart(cell, false);
            cb.AddAttribute(cell, "text", 0);
            Gtk.ListStore store = new Gtk.ListStore(typeof(string), typeof(string));
            store.AppendValues(String.Format("<{0}>", _("System Default")), String.Empty);
            ArrayList encodingList = new ArrayList();
            ArrayList bodyNameList = new ArrayList();
            foreach (EncodingInfo encInfo in Encoding.GetEncodings()) {
                try {
                    Encoding enc = Encoding.GetEncoding(encInfo.CodePage);
                    string encodingName = enc.EncodingName.ToUpper();

                    if (!enc.IsSingleByte && enc != Encoding.UTF8) {
                        // ignore multi byte encodings except UTF-8
                        continue;
                    }

                    // filter noise and duplicates
                    if (encodingName.IndexOf("DOS") != -1 ||
                        encodingName.IndexOf("MAC") != -1 ||
                        encodingName.IndexOf("EBCDIC") != -1 ||
                        encodingName.IndexOf("ISCII") != -1 ||
                        encodingList.Contains(encodingName) ||
                        bodyNameList.Contains(enc.BodyName)) {
                        continue;
                    }
            #if LOG4NET
                    _Logger.Debug("_Load(): adding encoding: " + enc.BodyName);
            #endif
                    encodingList.Add(encodingName);
                    bodyNameList.Add(enc.BodyName);

                    encodingName = enc.EncodingName;
                    // remove all (DOS)  / (Windows) / (Mac) crap from the encoding name
                    if (enc.EncodingName.Contains(" (")) {
                        encodingName = encodingName.Substring(0, enc.EncodingName.IndexOf(" ("));
                    }
                    store.AppendValues(enc.BodyName.ToUpper() + " - " + encodingName, enc.BodyName.ToUpper());
                } catch (NotSupportedException) {
                }
            }
            cb.Model = store;
            cb.Active = 0;
            store.SetSortColumnId(0, Gtk.SortType.Ascending);
            int j = 0;
            foreach (object[] row in store) {
                string encodingName = (string) row[1];
                if (encodingName == encoding) {
                    cb.Active = j;
                    break;
                }
                j++;
            }

            // Connection - Proxy
            Gtk.ComboBox proxyTypeComboBox = ((Gtk.ComboBox)_Glade["ProxyTypeComboBox"]);
            ProxyType proxyType = (ProxyType) Enum.Parse(
                typeof(ProxyType),
                (string) Frontend.UserConfig["Connection/ProxyType"]
            );
            int i = 0;
            foreach (object[] row in  (Gtk.ListStore) proxyTypeComboBox.Model) {
                if (((ProxyType) row[0]) == proxyType) {
                    proxyTypeComboBox.Active = i;
                    break;
                }
                i++;
            }
            ((Gtk.Entry) _Glade["ProxyHostEntry"]).Text =
                (string) Frontend.UserConfig["Connection/ProxyHostname"];
            int proxyPort = (int) Frontend.UserConfig["Connection/ProxyPort"];
            if (proxyPort == -1) {
                proxyPort = 0;
            }
            ((Gtk.SpinButton) _Glade["ProxyPortSpinButton"]).Value = proxyPort;
            ((Gtk.Entry) _Glade["ProxyUsernameEntry"]).Text =
                (string) Frontend.UserConfig["Connection/ProxyUsername"];
            ((Gtk.Entry) _Glade["ProxyPasswordEntry"]).Text =
//.........这里部分代码省略.........
开发者ID:grendello,项目名称:smuxi,代码行数:101,代码来源:PreferencesDialog.cs

示例15: CodeFormattingPanelWidget

		public CodeFormattingPanelWidget (CodeFormattingPanel panel, OptionsDialog dialog)
		{
			this.Build();
			this.panel = panel;
			this.dialog = dialog;
			
			store = new Gtk.ListStore (typeof(MimeTypePanelData), typeof(Gdk.Pixbuf), typeof(string));
			tree.Model = store;
			
			boxButtons.Visible = panel.DataObject is PolicySet;
			Gtk.CellRendererText crt = new Gtk.CellRendererText ();
			Gtk.CellRendererPixbuf crp = new Gtk.CellRendererPixbuf ();
			
			Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
			col.Title = GettextCatalog.GetString ("File Type");
			col.PackStart (crp, false);
			col.PackStart (crt, true);
			col.AddAttribute (crp, "pixbuf", 1);
			col.AddAttribute (crt, "text", 2);
			tree.AppendColumn (col);
			store.SetSortColumnId (2, Gtk.SortType.Ascending);
			
			CellRendererComboBox comboCell = new CellRendererComboBox ();
			comboCell.Changed += OnPolicySelectionChanged;
			Gtk.TreeViewColumn polCol = tree.AppendColumn (GettextCatalog.GetString ("Policy"), comboCell, new Gtk.TreeCellDataFunc (OnSetPolicyData));
			
			tree.Selection.Changed += delegate {
				Gtk.TreeIter it;
				tree.Selection.GetSelected (out it);
				Gtk.TreeViewColumn ccol;
				Gtk.TreePath path;
				tree.GetCursor (out path, out ccol);
				if (ccol == polCol)
					tree.SetCursor (path, ccol, true);
			};

			Fill ();
			UpdateButtons ();
			
			tree.Selection.Changed += delegate {
				UpdateButtons ();
			};
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:43,代码来源:CodeFormattingPanel.cs


注:本文中的Gtk.ListStore.SetSortColumnId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。