public void Reload() { _title.Text = _sheet.title(); _performer.Text = _sheet.performer(); _composer.Text = _sheet.composer(); _year.Text = _sheet.year(); _subtitle.Text = _sheet.subtitle(); try { _imagefile.SelectFilename(_sheet.imageFullFileName()); Gdk.Pixbuf pb = new Gdk.Pixbuf(_sheet.imageFullFileName(), 100, 100); _image.Pixbuf = pb; } catch (System.Exception e) { Hyena.Log.Information(e.ToString()); } _store.Clear(); int i, N; for (i = 0, N = _sheet.nEntries(); i < N; i++) { double b = _sheet.entry(i).offset(); int m, s, hs, t; t = (int)(b * 100.0); hs = t % 100; m = t / (100 * 60); s = (t / 100) % 60; String offset = String.Format("{0:00}", m) + ":" + String.Format("{0:00}", s) + "." + String.Format("{0:00}", hs); _store.AppendValues(i + 1, _sheet.entry(i).title(), _sheet.entry(i).performer(), _sheet.entry(i).getComposer(), _sheet.entry(i).getPiece(), offset); } }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; OnUseDefaultCompilerChanged(); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst(out iter)) { do { if (proj.UsedCompilerVendor == (DCompilerVendor)cmbCompiler.Model.GetValue(iter, 1)) { cmbCompiler.SetActiveIter(iter); break; } } while (cmbCompiler.Model.IterNext(ref iter)); } extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; libStore.Clear(); foreach (string lib in proj.ExtraLibraries) { libStore.AppendValues(lib); } includePathStore.Clear(); foreach (var p in project.LocalIncludeCache.DirectoryPaths) { includePathStore.AppendValues(p); } }
void Fill() { foreach (MimeTypePanelData mt in panel.GetMimeTypeData()) { store.AppendValues(mt, DesktopService.GetIconForType(mt.MimeType, Gtk.IconSize.Menu), mt.TypeDescription); } }
public ProjectOptions() { this.Build(); // Init compiler selection dropdown cmbCompiler.Clear(); Gtk.CellRendererText cellRenderer = new Gtk.CellRendererText(); cmbCompiler.PackStart(cellRenderer, false); cmbCompiler.AddAttribute(cellRenderer, "text", 0); cmbCompiler.Model = model_Compilers; foreach (var cmp in DCompilerService.Instance.Compilers) { model_Compilers.AppendValues(cmp.Vendor); } combo_ProjectType.Model = model_compileTarget; combo_Platform.Model = model_Platforms; // Init compile target checkbox model_compileTarget.AppendValues("Executable", DCompileTarget.Executable); model_compileTarget.AppendValues("Shared library", DCompileTarget.SharedLibrary); model_compileTarget.AppendValues("Static library", DCompileTarget.StaticLibrary); }
// FIXME: Adding torrents not on the main loop, will throw up! // Solutions: Pop every add onto main loop resulting in blocking // or add async Load(uri, location) to library, or let the GUI // program handle downloading the torrent file public void AddTorrent(TorrentRssWatcherEventArgs args) { history.Add(args.Item); historyListStore.AppendValues(args.Item); Event.Raise <TorrentRssWatcherEventArgs>(TorrentFound, this, args); }
public void Load(ValaProjectConfiguration config) { configuration = config; compilationParameters = (ValaCompilationParameters)configuration.CompilationParameters; switch (compilationParameters.WarningLevel) { case WarningLevel.None: noWarningRadio.Active = true; break; case WarningLevel.Normal: normalWarningRadio.Active = true; break; case WarningLevel.All: allWarningRadio.Active = true; break; } warningsAsErrorsCheckBox.Active = compilationParameters.WarningsAsErrors; threadingCheckbox.Sensitive = (config.CompileTarget == CompileTarget.Bin); threadingCheckbox.Active = (threadingCheckbox.Sensitive && compilationParameters.EnableMultithreading); optimizationSpinButton.Value = compilationParameters.OptimizationLevel; switch (configuration.CompileTarget) { case ValaBinding.CompileTarget.Bin: targetComboBox.Active = 0; break; case ValaBinding.CompileTarget.StaticLibrary: targetComboBox.Active = 1; break; case ValaBinding.CompileTarget.SharedLibrary: targetComboBox.Active = 2; break; } extraCompilerTextView.Buffer.Text = compilationParameters.ExtraCompilerArguments; defineSymbolsTextEntry.Text = compilationParameters.DefineSymbols; foreach (string lib in configuration.Libs) { libStore.AppendValues(lib); } foreach (string includePath in configuration.Includes) { includePathStore.AppendValues(includePath); } }
void RevisarLista() { if (telefonos != null) { // Llenar el dgv desde la lista for (int i = 0; i < telefonos.Count; i++) { //Agregas los valores al datagridview ** Ok/2 lsDataTel.AppendValues(telefonos[i].id.ToString(), telefonos[i].nombre.ToString(), telefonos[i].marca.ToString(), telefonos[i].modelo.ToString(), telefonos[i].compania.ToString()); } } }
public Image(bool allowStock, bool allowFile) : base(false, 6) { image = new Gtk.Image(Gnome.Stock.Blank, Gtk.IconSize.Button); PackStart(image, false, false, 0); if (allowStock) { store = new Gtk.ListStore(typeof(string), typeof(string)); store.AppendValues(Gnome.Stock.Blank, Catalog.GetString("(None)")); for (int i = 0; i < stockIds.Length; i++) { store.AppendValues(stockIds[i], stockLabels[i]); } combo = new Gtk.ComboBoxEntry(store, LabelColumn); Gtk.CellRendererPixbuf iconRenderer = new Gtk.CellRendererPixbuf(); iconRenderer.StockSize = (uint)Gtk.IconSize.Menu; combo.PackStart(iconRenderer, false); combo.Reorder(iconRenderer, 0); combo.AddAttribute(iconRenderer, "stock-id", IconColumn); combo.Changed += combo_Changed; // Pack the combo non-expandily into a VBox so it doesn't // get stretched to the file button's height Gtk.VBox vbox = new Gtk.VBox(false, 0); vbox.PackStart(combo, true, false, 0); PackStart(vbox, true, true, 0); entry = (Gtk.Entry)combo.Child; entry.Changed += entry_Changed; useStock = true; } if (allowFile) { if (!allowStock) { entry = new Gtk.Entry(); PackStart(entry, true, true, 0); entry.Changed += entry_Changed; } button = new Gtk.Button(); Gtk.Image icon = new Gtk.Image(Gtk.Stock.Open, Gtk.IconSize.Button); button.Add(icon); PackStart(button, false, false, 0); button.Clicked += button_Clicked; } ShowAll(); }
public CompilerOptions() { this.Build(); cmbCompiler.Clear(); Gtk.CellRendererText cellRenderer = new Gtk.CellRendererText(); cmbCompiler.PackStart(cellRenderer, false); cmbCompiler.AddAttribute(cellRenderer, "text", 0); cmbCompiler.Model = compilerStore; compilerStore.AppendValues("DMD", DCompilerVendor.DMD); compilerStore.AppendValues("GDC", DCompilerVendor.GDC); compilerStore.AppendValues("LDC", DCompilerVendor.LDC); }
private void populateComboBox() { var employees = this.dataSource.getEmployees(); var store = new Gtk.ListStore(typeof(string)); store.AppendValues("Novi djelatnik"); foreach (var employee in employees) { store.AppendValues(employee.FirstName + " " + employee.LastName); } combobox1.Model = store; this.clearWindow(); }
public void FillSourceCmb(ITranslateProvider Translator) { cmbDefaultSource.Clear(); Gtk.CellRendererText cell = new Gtk.CellRendererText(); Gtk.CellRendererPixbuf pixbuf = new Gtk.CellRendererPixbuf(); cmbDefaultSource.PackStart(pixbuf, true); cmbDefaultSource.PackStart(cell, true); cmbDefaultSource.AddAttribute(pixbuf, "pixbuf", 0); cmbDefaultSource.AddAttribute(cell, "text", 1); Gtk.ListStore SourceList = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string)); Gdk.Pixbuf LanguageFlag = null; const int scale_height = 20; string[] Icon = null; if (Translator.SupportsAutoDetect) { SourceList.AppendValues(null, AddinManager.CurrentLocalizer.GetString("Auto Detect (Recommended)"), Translator.AutoDetectCode); } foreach (LanguageItem Lang in Translator.SupportedLanguages) { Icon = Lang.Icon.Split(new char[] { '@' }); using (Gdk.Pixbuf temp = Gdk.Pixbuf.LoadFromResource(Icon[0])) { LanguageFlag = temp.ScaleSimple((scale_height * temp.Width) / temp.Height, scale_height, Gdk.InterpType.Bilinear); } SourceList.AppendValues(LanguageFlag, Lang.Name, Lang.Code); } cmbDefaultSource.Model = SourceList; //set default source to auto if it's enabled, else try what's in gconf, else, just the first in the list Gtk.TreeIter ti; if ((Translator.SupportsAutoDetect) && (SearchCombobox(out ti, cmbDefaultSource, Translator.AutoDetectCode, 2))) { cmbDefaultSource.SetActiveIter(ti); } else if (SearchCombobox(out ti, cmbDefaultSource, SelectedSourceLang, 2)) { cmbDefaultSource.SetActiveIter(ti); } else { cmbDefaultSource.Model.GetIterFirst(out ti); cmbDefaultSource.SetActiveIter(ti); } }
public FlagsSelectorDialog(Gtk.Window parent, EnumDescriptor enumDesc, uint flags, string title) { this.flags = flags; this.parent = parent; Glade.XML xml = new Glade.XML (null, "stetic.glade", "FlagsSelectorDialog", null); xml.Autoconnect (this); store = new Gtk.ListStore (typeof(bool), typeof(string), typeof(uint)); treeView.Model = store; Gtk.TreeViewColumn col = new Gtk.TreeViewColumn (); Gtk.CellRendererToggle tog = new Gtk.CellRendererToggle (); tog.Toggled += new Gtk.ToggledHandler (OnToggled); col.PackStart (tog, false); col.AddAttribute (tog, "active", 0); Gtk.CellRendererText crt = new Gtk.CellRendererText (); col.PackStart (crt, true); col.AddAttribute (crt, "text", 1); treeView.AppendColumn (col); foreach (Enum value in enumDesc.Values) { EnumValue eval = enumDesc[value]; if (eval.Label == "") continue; uint val = (uint) (int) eval.Value; store.AppendValues (((flags & val) != 0), eval.Label, val); } }
public NoteEditor() { this.Build(); var store = new Gtk.ListStore(typeof(string), typeof(string)); store.AppendValues("gtk-edit", "no, you are the fuel"); var column = new Gtk.TreeViewColumn(); var iconRenderer = new Gtk.CellRendererPixbuf(); column.PackStart(iconRenderer, false); column.AddAttribute(iconRenderer, "stock-id", 0); var textRenderer = new Gtk.CellRendererText(); column.PackStart(textRenderer, true); column.AddAttribute(textRenderer, "text", 1); NoteChildrenTreeView.Model = store; NoteChildrenTreeView.AppendColumn(column); // http://www.mono-project.com/GtkSharp_TreeView_Tutorial // http://afaikblog.files.wordpress.com/2012/05/edit-item1.png // http://james.newtonking.com/projects/json/help/ // http://mono.1490590.n4.nabble.com/NodeView-TreeView-Image-and-Text-into-the-same-column-td1546566.html // OKAY, I NEED TO DECIDE HOW I AM GOING TO BIND THINGS // I definitely want a ViewModel. }
private void FillProviders() { cmbProvider.Clear(); Gtk.CellRendererText cell = new Gtk.CellRendererText(); cmbProvider.PackStart(cell, true); cmbProvider.AddAttribute(cell, "text", 0); Gtk.ListStore ProvidersList = new Gtk.ListStore(typeof(string), typeof(string)); // Get an instance of each pastebin provider in this assembly. var providers = from type in Assembly.GetExecutingAssembly().GetTypes() where type.GetInterface("Pastebin.IPastebinProvider") != null && type.IsAbstract == false select Activator.CreateInstance(type); foreach (IPastebinProvider provider in providers) { ProvidersList.AppendValues(provider.Name, provider.GetType().ToString()); } cmbProvider.Model = ProvidersList; //set selection to what's in GConf, if we can Gtk.TreeIter ti; if (SearchCombobox(out ti, cmbProvider, SelectedProviderType, 1)) { cmbProvider.SetActiveIter(ti); } }
public LoginWidget() { this.Build(); Gtk.ListStore store = new Gtk.ListStore(typeof(string)); label5.Text = Mono.Unix.Catalog.GetString("User"); label6.Text = Mono.Unix.Catalog.GetString("Password"); label3.Text = Mono.Unix.Catalog.GetString("Enter your user and password"); store.AppendValues(Mono.Unix.Catalog.GetString("Classroom Server")); store.AppendValues(Mono.Unix.Catalog.GetString("Center Server")); serverListcombobox.Model = store; serverListcombobox.Active = 0; }
void FillList() { state.Save(); store.Clear(); string filter = entryFilter.Text; foreach (ProcessInfo pi in procs) { if (filter.Length == 0 || pi.Id.ToString().Contains(filter) || pi.Name.Contains(filter)) { store.AppendValues(pi, pi.Id.ToString(), pi.Name); } } state.Load(); if (tree.Selection.CountSelectedRows() == 0) { Gtk.TreeIter it; if (store.GetIterFirst(out it)) { tree.Selection.SelectIter(it); } } }
public void Fill() { treeState.Save(); store.Clear(); foreach (CustomExecutionMode mode in ExecutionModeCommandService.GetCustomModes(ctx)) { if (mode.Mode == null) { continue; } string scope = ""; switch (mode.Scope) { case CustomModeScope.Project: scope = GettextCatalog.GetString("Current project"); break; case CustomModeScope.Solution: scope = GettextCatalog.GetString("Current solution"); break; case CustomModeScope.Global: scope = GettextCatalog.GetString("All solutions"); break; } store.AppendValues(mode, mode.Name, mode.Mode.Name, scope, mode.Id); } treeState.Load(); UpdateButtons(); }
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; }
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) { } }
public DebuggerOptionsPanelWidget() { this.Build(); options = DebuggingService.GetUserOptions(); projectCodeOnly.Active = options.ProjectAssembliesOnly; checkAllowEval.Active = options.EvaluationOptions.AllowTargetInvoke; checkToString.Active = options.EvaluationOptions.AllowToStringCalls; checkShowBaseGroup.Active = !options.EvaluationOptions.FlattenHierarchy; checkGroupPrivate.Active = options.EvaluationOptions.GroupPrivateMembers; checkGroupStatic.Active = options.EvaluationOptions.GroupStaticMembers; checkToString.Sensitive = checkAllowEval.Active; spinTimeout.Value = options.EvaluationOptions.EvaluationTimeout; // Debugger priorities engineStore = new Gtk.ListStore(typeof(string), typeof(string)); engineList.Model = engineStore; engineList.AppendColumn("", new Gtk.CellRendererText(), "text", 1); foreach (DebuggerEngine engine in DebuggingService.GetDebuggerEngines()) { engineStore.AppendValues(engine.Id, engine.Name); } UpdatePriorityButtons(); engineList.Selection.Changed += HandleEngineListSelectionChanged; }
/// <summary> /// Initializes a new instance of the <see cref="INTV.Shared.View.RomListSettingsPage"/> class. /// </summary> public RomListSettingsPage() { this.Build(); var directoriesStore = new Gtk.ListStore(typeof(string)); foreach (var directory in Properties.Settings.Default.RomListSearchDirectories) { directoriesStore.AppendValues(directory); } var settingsForInit = new[] { Properties.Settings.ValidateAtLaunchSettingName, Properties.Settings.SearchForRomsAtLaunchSettingName, Properties.Settings.RomListSearchDirectoriesSettingName, Properties.Settings.DisplayRomFileNameForTitleSettingName, Properties.Settings.ShowRomDetailsSettingName }; foreach (var setting in settingsForInit) { HandleSettingChanged(null, new System.ComponentModel.PropertyChangedEventArgs(setting)); } Properties.Settings.Default.PropertyChanged += HandleSettingChanged; }
public FlagsSelectorDialog(Gtk.Window parent, EnumDescriptor enumDesc, uint flags, string title) { this.flags = flags; this.parent = parent; Glade.XML xml = new Glade.XML(null, "stetic.glade", "FlagsSelectorDialog", null); xml.Autoconnect(this); store = new Gtk.ListStore(typeof(bool), typeof(string), typeof(uint)); treeView.Model = store; Gtk.TreeViewColumn col = new Gtk.TreeViewColumn(); Gtk.CellRendererToggle tog = new Gtk.CellRendererToggle(); tog.Toggled += new Gtk.ToggledHandler(OnToggled); col.PackStart(tog, false); col.AddAttribute(tog, "active", 0); Gtk.CellRendererText crt = new Gtk.CellRendererText(); col.PackStart(crt, true); col.AddAttribute(crt, "text", 1); treeView.AppendColumn(col); foreach (Enum value in enumDesc.Values) { EnumValue eval = enumDesc[value]; if (eval.Label == "") { continue; } uint val = (uint)Convert.ToInt32(eval.Value); store.AppendValues(((flags & val) != 0), eval.Label, val); } }
public void SetPolicies(PolicyContainer pset) { if (pset == null) { store.Clear(); HasPolicies = false; return; } var content = new Dictionary <string, List <string> > (); foreach (var p in pset.DirectGetAll()) { string name = PolicyService.GetPolicyTypeDescription(p.PolicyType); List <string> scopes; if (!content.TryGetValue(name, out scopes)) { scopes = content [name] = new List <string> (); } scopes.Add(p.Scope ?? ""); } var sorted = content.ToList(); sorted.Sort((x, y) => x.Key.CompareTo(y.Key)); store.Clear(); var sb = new StringBuilder(); foreach (var pol in sorted) { sb.Append(pol.Key); if (pol.Value.Count != 1 || pol.Value[0].Length != 0) { sb.Append(" ("); bool first = true; if (pol.Value.Remove("")) { sb.Append(GettextCatalog.GetString("default settings")); first = false; } foreach (var s in pol.Value) { if (!first) { sb.Append(", "); } sb.Append(s); first = false; } sb.Append(")"); } store.AppendValues(sb.ToString()); sb.Length = 0; } HasPolicies = sorted.Count > 0; }
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; }
void AddSource(ProjectIconSource source) { string size = source.SizeWildcarded ? sizes[0] : source.Size.ToString(); string state = source.StateWildcarded ? states[0] : source.State.ToString(); string dir = source.DirectionWildcarded ? directions[0] : source.Direction.ToString(); sourceListStore.AppendValues(source.Image.GetThumbnail(project, 16), source.Image.Label, size, state, dir, source.Image); }
private void LoadImports() { imports.Clear(); foreach (Import import in currentImports) { imports.AppendValues(import.Include); } }
private void Populate(Gtk.TreeView treeView, bool?used = null, bool?isChange = null) { foreach (var key in App.Instance.Wallet.GetKeys()) { _Store.AppendValues(key, key.Address.ToString(), DisplayKey(key.Private), key.Used ? "Yes" : "No", key.Change ? "Yes" : "No"); } ; }
public void BuildArray () { Gtk.ListStore listStore = new Gtk.ListStore (typeof (string)); for (int i = min; i < (max + 1); i++) { listStore.AppendValues(i.ToString()); } combobox.Model = listStore; }
public Image (bool allowStock, bool allowFile) : base (false, 6) { image = new Gtk.Image (GnomeStock.Blank, Gtk.IconSize.Button); PackStart (image, false, false, 0); if (allowStock) { store = new Gtk.ListStore (typeof (string), typeof (string)); store.AppendValues (GnomeStock.Blank, Catalog.GetString ("(None)")); for (int i = 0; i < stockIds.Length; i++) store.AppendValues (stockIds[i], stockLabels[i]); combo = new Gtk.ComboBoxEntry (store, LabelColumn); Gtk.CellRendererPixbuf iconRenderer = new Gtk.CellRendererPixbuf (); iconRenderer.StockSize = (uint)Gtk.IconSize.Menu; combo.PackStart (iconRenderer, false); combo.Reorder (iconRenderer, 0); combo.AddAttribute (iconRenderer, "stock-id", IconColumn); combo.Changed += combo_Changed; // Pack the combo non-expandily into a VBox so it doesn't // get stretched to the file button's height Gtk.VBox vbox = new Gtk.VBox (false, 0); vbox.PackStart (combo, true, false, 0); PackStart (vbox, true, true, 0); entry = (Gtk.Entry)combo.Child; entry.Changed += entry_Changed; useStock = true; } if (allowFile) { if (!allowStock) { entry = new Gtk.Entry (); PackStart (entry, true, true, 0); entry.Changed += entry_Changed; } button = new Gtk.Button (); Gtk.Image icon = new Gtk.Image (Gtk.Stock.Open, Gtk.IconSize.Button); button.Add (icon); PackStart (button, false, false, 0); button.Clicked += button_Clicked; } ShowAll (); }
private void InitializeTreeView() { Gtk.ListStore model = new Gtk.ListStore(typeof(string)); treeview1.AppendColumn("", new Gtk.CellRendererText(), "text", 0); model.AppendValues("Pack Name: {0}", _configPackInformation.PackName); model.AppendValues(_configPackInformation.Description); Gtk.TreeIter iter = model.AppendValues("Credits"); foreach (var thing in _configPackInformation.CreditsParts) { iter = model.AppendValues(thing.Key); foreach (var author in thing.Value) { model.AppendValues(iter, author.Author); } } }
private void addSongs(tagInfo song) { musicListStore.AppendValues( song.Title, song.Genre, song.Artist, song.Album, song.BitRate, song.Type, song.Composer, song.Duration, song.Path); }
/// <summary> /// Loads the symbols from the config. /// </summary> /// <param name="symbolLabels"> /// The <c>SymbolLabelInfo</c> instances to be added. /// </param> public void LoadSymbols() { model.Clear(); List <SymbolLabelInfo> symbolsInfo = LibraryConfig.Instance.Symbols; foreach (SymbolLabelInfo info in symbolsInfo) { model.AppendValues(info.Label, info.Symbol); } }
public AddUser() { this.Build(); acceptButton.Sensitive = false; store = new Gtk.ListStore(typeof(string), typeof(int)); store.AppendValues(Mono.Unix.Catalog.GetString("Students"), 0); store.AppendValues(Mono.Unix.Catalog.GetString("Teachers"), 1); store.AppendValues(Mono.Unix.Catalog.GetString("Other"), 2); templateCombobox.Model = store; templateCombobox.Active = 0; image = new Gtk.Image(); image.SetFromIconName("gtk-add", Gtk.IconSize.Dnd); groups_store = new Gtk.ListStore(typeof(string), typeof(int)); groups_store.AppendValues("---", 0); label = new Gtk.Label(Mono.Unix.Catalog.GetString("Add User")); label.Show(); }
public Gtk.ListStore getMessageList() { MessagesRepository messageRepo = DaoFactory.getDao (DaoFactory.MySql).getMessagesRepository (); List<Message> messages = messageRepo.getAllMessages (); Gtk.ListStore messageList = new Gtk.ListStore ( typeof(string), typeof(string), typeof(string) ); foreach (Message message in messages) { messageList.AppendValues (message.getNumberReceiver (), message.getMessageBody (), Convert.ToString (message.getSendAt ())); } return messageList; }
public NewFormattingProfileDialog (List<CSharpFormattingPolicy> policies) { this.Build (); this.policies = policies; this.entryProfileName.Changed += delegate { NewProfileName = entryProfileName.Text; buttonOk.Sensitive = !string.IsNullOrEmpty (NewProfileName) && !this.policies.Any (p => p.Name == NewProfileName); }; Gtk.ListStore model = new Gtk.ListStore (typeof(string)); foreach (var p in policies) { model.AppendValues (p.Name); } comboboxInitFrom.Model = model; comboboxInitFrom.Active = 0; }
public void RefreshInstances() { var store = new Gtk.ListStore(typeof(Instance), typeof(string), typeof(string), typeof(string)); foreach (var instance in Context.GetInstances()) { string host = "Unknown"; try { host = new Uri(instance.Description.SyncUrl).Host; } catch (Exception) { } store.AppendValues(instance, instance.Description.Name, host, System.IO.Path.GetFileName(instance.GameFolder)); } instanceList.Model = store; }
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()); } } }
internal NewFormattingProfileDialog (List<CSharpFormattingPolicy> policies) { // ReSharper disable once DoNotCallOverridableMethodsInConstructor this.Build (); this.policies = policies; this.entryProfileName.Changed += delegate { NewProfileName = entryProfileName.Text; buttonOk.Sensitive = !string.IsNullOrEmpty (NewProfileName) && !this.policies.Any (p => p.Name == NewProfileName); }; var model = new Gtk.ListStore (typeof(string)); foreach (var p in policies) { model.AppendValues (p.Name); } comboboxInitFrom.Model = model; comboboxInitFrom.Active = 0; }
public ParamsWindow(string[] parameters) : base(Gtk.WindowType.Toplevel, "ParamsWindow") { ((Gtk.Dialog)Window).AddButton("gtk-close", Gtk.ResponseType.Cancel); treeModel = new Gtk.ListStore(typeof(int), typeof(string), typeof(string), typeof(string)); ParamsTree.Model = treeModel; var indexColumn = new Gtk.TreeViewColumn { Title = "Index" }; ParamsTree.AppendColumn(indexColumn); var nameColumn = new Gtk.TreeViewColumn { Title = "Name" }; ParamsTree.AppendColumn(nameColumn); var typeColumn = new Gtk.TreeViewColumn { Title = "Type" }; ParamsTree.AppendColumn(typeColumn); var dataColumn = new Gtk.TreeViewColumn { Title = "Data" }; ParamsTree.AppendColumn(dataColumn); var indexCell = new Gtk.CellRendererText(); indexColumn.PackStart(indexCell, true); var nameCell = new Gtk.CellRendererText(); nameColumn.PackStart(nameCell, true); var typeCell = new Gtk.CellRendererText(); typeColumn.PackStart(typeCell, true); var dataCell = new Gtk.CellRendererText(); dataColumn.PackStart(dataCell, true); indexColumn.AddAttribute(indexCell, "text", 0); nameColumn.AddAttribute(nameCell, "text", 1); typeColumn.AddAttribute(nameCell, "text", 2); dataColumn.AddAttribute(dataCell, "text", 3); var index = 0; foreach (var param in parameters) { treeModel.AppendValues(index, "#" + index, "unknown", param); index++; } Window.SetSizeRequest(500, System.Math.Min(500, 100 + index * 20)); }
public FlagsSelectorDialog (Gtk.Window parent, Type enumDesc, ulong flags, string title) { this.flags = flags; this.parent = parent; Gtk.ScrolledWindow sc = new Gtk.ScrolledWindow (); sc.HscrollbarPolicy = Gtk.PolicyType.Automatic; sc.VscrollbarPolicy = Gtk.PolicyType.Automatic; sc.ShadowType = Gtk.ShadowType.In; sc.BorderWidth = 6; treeView = new Gtk.TreeView (); sc.Add (treeView); dialog = new Gtk.Dialog (); IdeTheme.ApplyTheme (dialog); dialog.VBox.Add (sc); dialog.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); dialog.AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok); store = new Gtk.ListStore (typeof(bool), typeof(string), typeof(ulong)); treeView.Model = store; treeView.HeadersVisible = false; Gtk.TreeViewColumn col = new Gtk.TreeViewColumn (); Gtk.CellRendererToggle tog = new Gtk.CellRendererToggle (); tog.Toggled += new Gtk.ToggledHandler (OnToggled); col.PackStart (tog, false); col.AddAttribute (tog, "active", 0); Gtk.CellRendererText crt = new Gtk.CellRendererText (); col.PackStart (crt, true); col.AddAttribute (crt, "text", 1); treeView.AppendColumn (col); values = System.Enum.GetValues (enumDesc); foreach (object value in values) { ulong val = Convert.ToUInt64 (value); store.AppendValues ((flags == 0 && val == 0) || ((flags & val) != 0), value.ToString (), val); } }
public DebuggerOptionsPanelWidget () { this.Build (); options = DebuggingService.GetUserOptions (); projectCodeOnly.Active = options.ProjectAssembliesOnly; checkAllowEval.Active = options.EvaluationOptions.AllowTargetInvoke; checkToString.Active = options.EvaluationOptions.AllowToStringCalls; checkShowBaseGroup.Active = !options.EvaluationOptions.FlattenHierarchy; checkGroupPrivate.Active = options.EvaluationOptions.GroupPrivateMembers; checkGroupStatic.Active = options.EvaluationOptions.GroupStaticMembers; checkToString.Sensitive = checkAllowEval.Active; spinTimeout.Value = options.EvaluationOptions.EvaluationTimeout; // Debugger priorities engineStore = new Gtk.ListStore (typeof(string), typeof(string)); engineList.Model = engineStore; engineList.AppendColumn ("", new Gtk.CellRendererText (), "text", 1); foreach (DebuggerEngine engine in DebuggingService.GetDebuggerEngines ()) { engineStore.AppendValues (engine.Id, engine.Name); } UpdatePriorityButtons (); engineList.Selection.Changed += HandleEngineListSelectionChanged; }
private void loadPluginManager() { Gtk.ListStore store = new Gtk.ListStore ( typeof (string), typeof (string), typeof(string) ); plugins.AppendColumn ( "Title", new Gtk.CellRendererText (), "text", 0); plugins.AppendColumn ( "Author", new Gtk.CellRendererText (), "text", 1); plugins.AppendColumn ( "Description", new Gtk.CellRendererText (), "text", 2); WallpaperManager manager = new WallpaperManager(); foreach(wallpaperService.WallpaperService service in manager.getAllServices()) { store.AppendValues (service.getName(), service.getAuthor(),service.getDescription()); } plugins.Model=store; // }
/// <summary> /// Loads snippets from file. /// </summary> /// <param name="list">Snippets container.</param> /// <returns>List of snippets.</returns> public static Gtk.ListStore LoadFromFile() { Gtk.ListStore list = new Gtk.ListStore(typeof(Snippet)); StringBuilder text = new StringBuilder(); Snippet snippet; try { if (!Directory.Exists(EnvironmentVariables.ConfigPath)) Directory.CreateDirectory(EnvironmentVariables.ConfigPath); using (XmlTextReader reader = new XmlTextReader(EnvironmentVariables.ConfigPath + FileName)) { reader.Read(); while (reader.Read()) { text.Remove(0, text.Length); if (reader.Name == "label") { snippet = new Snippet(); reader.Read(); text.Append(reader.Value).Replace("<", "<").Replace(">", ">"); snippet.Label = text.ToString(); for (int i = 0; i < 4; i++) reader.Read(); text.Remove(0, text.Length).Append(reader.Value).Replace("<", "<").Replace(">", ">"); snippet.Content = text.ToString(); list.AppendValues(snippet); reader.Read(); } } } } catch (FileNotFoundException ex) { Tools.PrintInfo(ex, typeof(Snippets)); SaveToFile(new Gtk.ListStore(typeof(Snippet))); } catch (Exception ex) { Tools.PrintInfo(ex, typeof(Snippets)); } return list; }
public ProjectOptionsPanelWidget (MonoDevelop.Projects.Project project) { Gtk.ListStore store; Gtk.CellRendererText cr; this.Build(); this.project = (DotNetProject) project; parameters = (VBProjectParameters) this.project.LanguageParameters; cr = new Gtk.CellRendererText (); store = new Gtk.ListStore (typeof (string)); store.AppendValues (GettextCatalog.GetString ("Executable")); store.AppendValues (GettextCatalog.GetString ("Library")); store.AppendValues (GettextCatalog.GetString ("Executable with GUI")); store.AppendValues (GettextCatalog.GetString ("Module")); compileTargetCombo.Model = store; compileTargetCombo.PackStart (cr, true); compileTargetCombo.AddAttribute (cr, "text", 0); compileTargetCombo.Active = (int) this.project.CompileTarget; compileTargetCombo.Changed += delegate(object sender, EventArgs e) { entryMainClass.Sensitive = compileTargetCombo.Active != (int) CompileTarget.Library && compileTargetCombo.Active != (int) CompileTarget.Module; }; store = new Gtk.ListStore (typeof (string)); store.AppendValues ("WindowsForms"); store.AppendValues ("Windows"); store.AppendValues ("Console"); txtMyType.Model = store; txtMyType.TextColumn = 0; switch (parameters.MyType) { case "WindowsForms": txtMyType.Active = 0; break; case "Windows": txtMyType.Active = 1; break; case "Console": txtMyType.Active = 2; break; case null: case "": break; default: txtMyType.AppendText (parameters.MyType); txtMyType.Active = 3; break; } cr = new Gtk.CellRendererText (); store = new Gtk.ListStore (typeof (string)); store.AppendValues ("Binary"); store.AppendValues ("Text"); cmbOptionCompare.Model = store; cmbOptionCompare.PackStart (cr, true); cmbOptionCompare.AddAttribute (cr, "text", 0); cmbOptionCompare.Active = parameters.BinaryOptionCompare ? 0 : 1; cr = new Gtk.CellRendererText (); store = new Gtk.ListStore (typeof (string)); store.AppendValues ("On"); store.AppendValues ("Off"); cmbOptionExplicit.Model = store; cmbOptionExplicit.PackStart (cr, true); cmbOptionExplicit.AddAttribute (cr, "text", 0); cmbOptionExplicit.Active = parameters.OptionExplicit ? 0 : 1; cr = new Gtk.CellRendererText (); store = new Gtk.ListStore (typeof (string)); store.AppendValues ("On"); store.AppendValues ("Off"); cmbOptionInfer.Model = store; cmbOptionInfer.PackStart (cr, true); cmbOptionInfer.AddAttribute (cr, "text", 0); cmbOptionInfer.Active = parameters.OptionInfer ? 0 : 1; cr = new Gtk.CellRendererText (); store = new Gtk.ListStore (typeof (string)); store.AppendValues ("On"); store.AppendValues ("Off"); cmbOptionStrict.Model = store; cmbOptionStrict.PackStart (cr, true); cmbOptionStrict.AddAttribute (cr, "text", 0); cmbOptionStrict.Active = parameters.OptionStrict ? 0 : 1; // Codepage string foundEncoding = null; string currentCodepage = parameters.CodePage; foreach (TextEncoding e in TextEncoding.SupportedEncodings) { if (e.CodePage == -1) continue; if (e.Id == currentCodepage) foundEncoding = e.Id; cmbCodePage.AppendText (e.Id); } if (foundEncoding != null) cmbCodePage.Entry.Text = foundEncoding; else if (!string.IsNullOrEmpty (currentCodepage)) cmbCodePage.Entry.Text = currentCodepage; entryMainClass.Entry.Text = parameters.StartupObject; iconEntry.Path = parameters.ApplicationIcon; }
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; }
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; }
public PreferencesDialog(Gtk.Window parent) { Trace.Call(parent); if (parent == null) { throw new ArgumentNullException("parent"); } _Glade = new Glade.XML(null, Frontend.GladeFilename, "PreferencesDialog", null); //_Glade.BindFields(this); // changed signal is used in all settings, so use glade for now _Glade.Autoconnect(this); _Dialog = (Gtk.Dialog)_Glade["PreferencesDialog"]; _Dialog.TransientFor = parent; ((Gtk.Button)_Glade["OKButton"]).Clicked += new EventHandler(_OnOKButtonClicked); ((Gtk.Button)_Glade["ApplyButton"]).Clicked += new EventHandler(_OnApplyButtonClicked); ((Gtk.Button)_Glade["CancelButton"]).Clicked += new EventHandler(_OnCancelButtonClicked); ((Gtk.TextView)_Glade["OnConnectCommandsTextView"]).Buffer.Changed += new EventHandler(_OnChanged); ((Gtk.TextView)_Glade["OnStartupCommandsTextView"]).Buffer.Changed += new EventHandler(_OnChanged); ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Toggled += OnNotificationAreaIconCheckButtonToggled; ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Toggled += _OnChanged; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonAlways"]).Toggled += _OnChanged; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Toggled += _OnChanged; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonClosed"]).Toggled += _OnChanged; ((Gtk.CheckButton)_Glade["OverrideForegroundColorCheckButton"]).Toggled += OnOverrideForegroundColorCheckButtonToggled; ((Gtk.CheckButton)_Glade["OverrideBackgroundColorCheckButton"]).Toggled += OnOverrideBackgroundColorCheckButtonToggled; ((Gtk.CheckButton)_Glade["OverrideFontCheckButton"]).Toggled += OnOverrideFontCheckButtonToggled; Gtk.ComboBox wrapModeComboBox = (Gtk.ComboBox)_Glade["WrapModeComboBox"]; // initialize wrap modes // glade might initialize it already! wrapModeComboBox.Clear(); wrapModeComboBox.Changed += _OnChanged; Gtk.CellRendererText cell = new Gtk.CellRendererText(); wrapModeComboBox.PackStart(cell, false); wrapModeComboBox.AddAttribute(cell, "text", 1); Gtk.ListStore store = new Gtk.ListStore(typeof(Gtk.WrapMode), typeof(string)); // fill ListStore store.AppendValues(Gtk.WrapMode.Char, _("Character")); store.AppendValues(Gtk.WrapMode.WordChar, _("Word")); wrapModeComboBox.Model = store; wrapModeComboBox.Active = 0; _Notebook.ShowTabs = false; Gtk.ListStore ls = new Gtk.ListStore(typeof(Page), typeof(Gdk.Pixbuf), typeof(string)); ls.AppendValues(Page.Connection, _Dialog.RenderIcon( Gtk.Stock.Connect, Gtk.IconSize.SmallToolbar, null), _("Connection")); ls.AppendValues(Page.Interface, _Dialog.RenderIcon( Gtk.Stock.SelectFont, Gtk.IconSize.SmallToolbar, null), _("Interface")); ls.AppendValues(Page.Servers, _Dialog.RenderIcon( Gtk.Stock.Network, Gtk.IconSize.SmallToolbar, null), _("Servers")); /* ls.AppendValues(Page.Filters, _Dialog.RenderIcon( Gtk.Stock.Delete, Gtk.IconSize.SmallToolbar, null), _("Filters")); */ int i = 1; _MenuTreeView.AppendColumn(null, new Gtk.CellRendererPixbuf(), "pixbuf",i++); _MenuTreeView.AppendColumn(null, new Gtk.CellRendererText(), "text", i++); _MenuTreeView.Selection.Changed += new EventHandler(_MenuTreeViewSelectionChanged); _MenuTreeView.Selection.Mode = Gtk.SelectionMode.Browse; _MenuTreeView.Model = ls; // select the first item Gtk.TreeIter iter; ls.GetIterFirst(out iter); _MenuTreeView.Selection.SelectIter(iter); _ChannelFilterListView = new ChannelFilterListView(_Glade); _ServerListView = new ServerListView(parent, _Glade); _Load(); }
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; }
private void CreateListStore() { // Create a list store with all the check information checkPropsList = new Gtk.ListStore (typeof(BL.CheckClass), typeof(string)); // Initialize first check checkPropsList.AppendValues (new BL.CheckClass (), ""); checktableview.Model = checkPropsList; }
/// <summary> /// Init this instance. /// </summary> private void Init() { // Prepare vector of answers this.answers = new int[ this.Document.CountQuestions ]; for(int i = 0; i < this.Answers.Length; ++i) { this.Answers[ i ] = 0; } // Prepare combobox of question numbers var model = new Gtk.ListStore( new [] { typeof( string ) } ); for(int i = 0; i < this.Document.CountQuestions; ++i) { model.AppendValues( new []{ ( i +1 ).ToString() } ); } // Last fixes this.cbQuestionNumber.Model = model; this.cbQuestionNumber.Active = 0; this.questionNumber = 0; this.lblCorrect.Hide(); this.cbAnswers.Show(); this.cbAnswers.Sensitive = true; }
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 = (string) Frontend.UserConfig["Connection/ProxyPassword"]; CheckProxyShowPasswordCheckButton(); // MessageBuffer if (Frontend.EngineVersion >= new Version("0.8.1")) { // feature introduced in >= 0.8.1 Gtk.ComboBox persistencyTypeComboBox = ((Gtk.ComboBox)_Glade["PersistencyTypeComboBox"]); try { var persistencyType = (MessageBufferPersistencyType) Enum.Parse( typeof(MessageBufferPersistencyType), (string) Frontend.UserConfig["MessageBuffer/PersistencyType"] ); i = 0; foreach (object[] row in (Gtk.ListStore) persistencyTypeComboBox.Model) { if (((MessageBufferPersistencyType) row[0]) == persistencyType) { persistencyTypeComboBox.Active = i; break; } i++; } } catch (ArgumentException) { // for forward compatibility with newer engines persistencyTypeComboBox.Active = -1; } ((Gtk.SpinButton)_Glade["VolatileMaxCapacitySpinButton"]).Value = (double)(int)Frontend.UserConfig["MessageBuffer/Volatile/MaxCapacity"]; ((Gtk.SpinButton)_Glade["PersistentMaxCapacitySpinButton"]).Value = (double)(int)Frontend.UserConfig["MessageBuffer/Persistent/MaxCapacity"]; } // Interface ((Gtk.CheckButton) _Glade["ShowAdvancedSettingsCheckButton"]).Active = (bool) Frontend.UserConfig["Interface/ShowAdvancedSettings"]; CheckShowAdvancedSettingsCheckButton(); // Interface/Notebook ((Gtk.Entry)_Glade["TimestampFormatEntry"]).Text = (string)Frontend.UserConfig["Interface/Notebook/TimestampFormat"]; ((Gtk.SpinButton)_Glade["BufferLinesSpinButton"]).Value = (double)(int)Frontend.UserConfig["Interface/Notebook/BufferLines"]; ((Gtk.SpinButton)_Glade["EngineBufferLinesSpinButton"]).Value = (double)(int)Frontend.UserConfig["Interface/Notebook/EngineBufferLines"]; ((Gtk.CheckButton)_Glade["StripColorsCheckButton"]).Active = (bool)Frontend.UserConfig["Interface/Notebook/StripColors"]; ((Gtk.CheckButton)_Glade["StripFormattingsCheckButton"]).Active = (bool)Frontend.UserConfig["Interface/Notebook/StripFormattings"]; switch ((string)Frontend.UserConfig["Interface/Notebook/TabPosition"]) { case "top": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonTop"]).Active = true; break; case "bottom": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonBottom"]).Active = true; break; case "left": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonLeft"]).Active = true; break; case "right": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonRight"]).Active = true; break; case "none": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonNone"]).Active = true; break; } if (Frontend.UserConfig["Interface/Notebook/AutoSwitchPersonChats"] != null) { ((Gtk.CheckButton) _Glade["AutoSwitchPersonChatsCheckButton"]).Active = (bool) Frontend.UserConfig["Interface/Notebook/AutoSwitchPersonChats"]; } if (Frontend.UserConfig["Interface/Notebook/AutoSwitchGroupChats"] != null) { ((Gtk.CheckButton) _Glade["AutoSwitchGroupChatsCheckButton"]).Active = (bool) Frontend.UserConfig["Interface/Notebook/AutoSwitchGroupChats"]; } // Interface/Notebook/Channel switch ((string)Frontend.UserConfig["Interface/Notebook/Channel/UserListPosition"]) { case "left": ((Gtk.RadioButton)_Glade["UserListPositionRadioButtonLeft"]).Active = true; break; case "right": ((Gtk.RadioButton)_Glade["UserListPositionRadioButtonRight"]).Active = true; break; case "none": ((Gtk.RadioButton)_Glade["UserListPositionRadioButtonNone"]).Active = true; break; } switch ((string)Frontend.UserConfig["Interface/Notebook/Channel/TopicPosition"]) { case "top": ((Gtk.RadioButton)_Glade["TopicPositionRadioButtonTop"]).Active = true; break; case "bottom": ((Gtk.RadioButton)_Glade["TopicPositionRadioButtonBottom"]).Active = true; break; case "none": ((Gtk.RadioButton)_Glade["TopicPositionRadioButtonNone"]).Active = true; break; } ((Gtk.CheckButton) _Glade["NickColorsCheckButton"]).Active = (bool) Frontend.UserConfig["Interface/Notebook/Channel/NickColors"]; // Interface/Notebook/Tab Gtk.ColorButton colorButton; string colorHexCode; colorButton = (Gtk.ColorButton)_Glade["NoActivityColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Notebook/Tab/NoActivityColor"]; colorButton.Color = ColorConverter.GetGdkColor(colorHexCode); colorButton = (Gtk.ColorButton)_Glade["ActivityColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Notebook/Tab/ActivityColor"]; colorButton.Color = ColorConverter.GetGdkColor(colorHexCode); colorButton = (Gtk.ColorButton)_Glade["ModeColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Notebook/Tab/EventColor"]; colorButton.Color = ColorConverter.GetGdkColor(colorHexCode); colorButton = (Gtk.ColorButton)_Glade["HighlightColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Notebook/Tab/HighlightColor"]; colorButton.Color = ColorConverter.GetGdkColor(colorHexCode); // Interface/Chat colorButton = (Gtk.ColorButton)_Glade["ForegroundColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Chat/ForegroundColor"]; if (String.IsNullOrEmpty(colorHexCode)) { ((Gtk.CheckButton)_Glade["OverrideForegroundColorCheckButton"]).Active = false; } else { ((Gtk.CheckButton)_Glade["OverrideForegroundColorCheckButton"]).Active = true; colorButton.Color = ColorConverter.GetGdkColor(colorHexCode); } colorButton = (Gtk.ColorButton)_Glade["BackgroundColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Chat/BackgroundColor"]; if (String.IsNullOrEmpty(colorHexCode)) { ((Gtk.CheckButton)_Glade["OverrideBackgroundColorCheckButton"]).Active = false; } else { ((Gtk.CheckButton)_Glade["OverrideBackgroundColorCheckButton"]).Active = true; colorButton.Color = ColorConverter.GetGdkColor(colorHexCode); } Gtk.FontButton fontButton = (Gtk.FontButton)_Glade["FontButton"]; string fontFamily = (string)Frontend.UserConfig["Interface/Chat/FontFamily"]; string fontStyle = (string)Frontend.UserConfig["Interface/Chat/FontStyle"]; int fontSize = 0; if (Frontend.UserConfig["Interface/Chat/FontSize"] != null) { fontSize = (int) Frontend.UserConfig["Interface/Chat/FontSize"]; } if (String.IsNullOrEmpty(fontFamily) && String.IsNullOrEmpty(fontStyle) && fontSize == 0) { ((Gtk.CheckButton)_Glade["OverrideFontCheckButton"]).Active = false; } else { ((Gtk.CheckButton)_Glade["OverrideFontCheckButton"]).Active = true; Pango.FontDescription fontDescription = new Pango.FontDescription(); fontDescription.Family = fontFamily; string frontWeigth = null; if (fontStyle.Contains(" ")) { int pos = fontStyle.IndexOf(" "); frontWeigth = fontStyle.Substring(0, pos); fontStyle = fontStyle.Substring(pos + 1); } fontDescription.Style = (Pango.Style) Enum.Parse(typeof(Pango.Style), fontStyle); if (frontWeigth != null) { fontDescription.Weight = (Pango.Weight) Enum.Parse(typeof(Pango.Weight), frontWeigth); } fontDescription.Size = fontSize * 1024; fontButton.FontName = fontDescription.ToString(); } Gtk.ComboBox wrapModeComboBox = ((Gtk.ComboBox)_Glade["WrapModeComboBox"]); Gtk.WrapMode wrapMode = (Gtk.WrapMode) Enum.Parse( typeof(Gtk.WrapMode), (string) Frontend.UserConfig["Interface/Chat/WrapMode"] ); if (wrapMode == Gtk.WrapMode.Word) { wrapMode = Gtk.WrapMode.WordChar; } i = 0; foreach (object[] row in (Gtk.ListStore) wrapModeComboBox.Model) { if (((Gtk.WrapMode) row[0]) == wrapMode) { wrapModeComboBox.Active = i; break; } i++; } // Interface/Entry ((Gtk.Entry)_Glade["CompletionCharacterEntry"]).Text = (string)Frontend.UserConfig["Interface/Entry/CompletionCharacter"]; ((Gtk.Entry)_Glade["CommandCharacterEntry"]).Text = (string)Frontend.UserConfig["Interface/Entry/CommandCharacter"]; ((Gtk.CheckButton)_Glade["BashStyleCompletionCheckButton"]).Active = (bool)Frontend.UserConfig["Interface/Entry/BashStyleCompletion"]; ((Gtk.SpinButton)_Glade["CommandHistorySizeSpinButton"]).Value = (double)(int)Frontend.UserConfig["Interface/Entry/CommandHistorySize"]; var highlight_words = (string[]) Frontend.UserConfig["Interface/Chat/HighlightWords"]; // backwards compatibility with 0.7.x servers if (highlight_words == null) { highlight_words = new string[] {}; } ((Gtk.TextView)_Glade["HighlightWordsTextView"]).Buffer.Text = String.Join("\n", highlight_words); ((Gtk.CheckButton)_Glade["BeepOnHighlightCheckButton"]).Active = (bool)Frontend.UserConfig["Sound/BeepOnHighlight"]; // Interface/Notification string modeStr = (string) Frontend.UserConfig["Interface/Notification/NotificationAreaIconMode"]; NotificationAreaIconMode mode = (NotificationAreaIconMode) Enum.Parse( typeof(NotificationAreaIconMode), modeStr ); switch (mode) { case NotificationAreaIconMode.Never: ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Active = false; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonClosed"]).Active = true; // the toggle event is not raised as the checkbox is already unchecked by default // thus we have to disable the radio buttons by hand ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonAlways"]).Sensitive = false; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Sensitive = false; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonClosed"]).Sensitive = false; break; case NotificationAreaIconMode.Always: ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Active = true; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonAlways"]).Active = true; break; case NotificationAreaIconMode.Minimized: // can't support this for now, see: http://projects.qnetp.net/issues/show/158 goto case NotificationAreaIconMode.Never; /* ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Active = true; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Active = true; break; */ case NotificationAreaIconMode.Closed: ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Active = true; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonClosed"]).Active = true; break; } ((Gtk.CheckButton) _Glade["MessagingMenuCheckButton"]).Active = (bool) Frontend.UserConfig["Interface/Notification/MessagingMenuEnabled"]; ((Gtk.CheckButton) _Glade["NotificationPopupsCheckButton"]).Active = (bool) Frontend.UserConfig["Interface/Notification/PopupsEnabled"]; // Filters _FilterListWidget.InitProtocols(Frontend.Session.GetSupportedProtocols()); _FilterListWidget.Load(); // Servers _ServerListView.Load(); // Logging ((Gtk.Button) _Glade["LoggingOpenButton"]).Visible = false; if (Frontend.UserConfig["Logging/Enabled"] != null) { ((Gtk.CheckButton) _Glade["LoggingEnabledCheckButton"]).Active = (bool) Frontend.UserConfig["Logging/Enabled"]; if (Frontend.IsLocalEngine) { ((Gtk.Button) _Glade["LoggingOpenButton"]).Visible = true; } } if (Frontend.UserConfig["Logging/LogFilteredMessages"] != null) { ((Gtk.CheckButton) _Glade["LoggingLogFilteredMessagesCheckButton"]).Active = (bool) Frontend.UserConfig["Logging/LogFilteredMessages"]; } ((Gtk.Button)_Glade["ApplyButton"]).Sensitive = false; }
public PreferencesDialog(Gtk.Window parent) { Trace.Call(parent); if (parent == null) { throw new ArgumentNullException("parent"); } _Glade = new Glade.XML(null, Frontend.GladeFilename, "PreferencesDialog", null); //_Glade.BindFields(this); // changed signal is used in all settings, so use glade for now _Glade.Autoconnect(this); _Dialog = (Gtk.Dialog)_Glade["PreferencesDialog"]; _Dialog.TransientFor = parent; ((Gtk.Button)_Glade["OKButton"]).Clicked += new EventHandler(_OnOKButtonClicked); ((Gtk.Button)_Glade["ApplyButton"]).Clicked += new EventHandler(_OnApplyButtonClicked); ((Gtk.Button)_Glade["CancelButton"]).Clicked += new EventHandler(_OnCancelButtonClicked); ((Gtk.TextView)_Glade["OnConnectCommandsTextView"]).Buffer.Changed += new EventHandler(_OnChanged); ((Gtk.TextView)_Glade["OnStartupCommandsTextView"]).Buffer.Changed += new EventHandler(_OnChanged); ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Toggled += OnNotificationAreaIconCheckButtonToggled; ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Toggled += _OnChanged; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonAlways"]).Toggled += _OnChanged; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Toggled += _OnChanged; // we can't support minimize for now, see: http://projects.qnetp.net/issues/show/158 ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Visible = false; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonClosed"]).Toggled += _OnChanged; ((Gtk.CheckButton)_Glade["OverrideForegroundColorCheckButton"]).Toggled += OnOverrideForegroundColorCheckButtonToggled; ((Gtk.CheckButton)_Glade["OverrideBackgroundColorCheckButton"]).Toggled += OnOverrideBackgroundColorCheckButtonToggled; ((Gtk.CheckButton)_Glade["OverrideFontCheckButton"]).Toggled += OnOverrideFontCheckButtonToggled; ((Gtk.FontButton)_Glade["FontButton"]).FontSet += _OnChanged; ((Gtk.CheckButton)_Glade["ShowAdvancedSettingsCheckButton"]).Toggled += delegate { CheckShowAdvancedSettingsCheckButton(); }; ((Gtk.CheckButton)_Glade["ProxyShowPasswordCheckButton"]).Toggled += delegate { CheckProxyShowPasswordCheckButton(); }; ((Gtk.TextView)_Glade["HighlightWordsTextView"]).Buffer.Changed += _OnChanged; if (Frontend.EngineVersion < new Version("0.7.2")) { // feature introduced in >= 0.7.2 ((Gtk.TextView)_Glade["HighlightWordsTextView"]).Sensitive = false; } ((Gtk.Button)_Glade["LoggingOpenButton"]).Clicked += delegate { ThreadPool.QueueUserWorkItem(delegate { try { var logPath = Platform.LogPath; if (!Directory.Exists(logPath)) { Directory.CreateDirectory(logPath); } Process.Start(logPath); } catch (Exception ex) { Frontend.ShowError(parent, ex); } }); }; Gtk.ComboBox wrapModeComboBox = (Gtk.ComboBox)_Glade["WrapModeComboBox"]; // initialize wrap modes // glade might initialize it already! wrapModeComboBox.Clear(); wrapModeComboBox.Changed += _OnChanged; Gtk.CellRendererText cell = new Gtk.CellRendererText(); wrapModeComboBox.PackStart(cell, false); wrapModeComboBox.AddAttribute(cell, "text", 1); Gtk.ListStore store = new Gtk.ListStore(typeof(Gtk.WrapMode), typeof(string)); // fill ListStore store.AppendValues(Gtk.WrapMode.Char, _("Character")); store.AppendValues(Gtk.WrapMode.WordChar, _("Word")); wrapModeComboBox.Model = store; wrapModeComboBox.Active = 0; Gtk.ComboBox persistencyTypeComboBox = (Gtk.ComboBox) _Glade["PersistencyTypeComboBox"]; // glade might initialize it already! persistencyTypeComboBox.Clear(); persistencyTypeComboBox.Changed += _OnChanged; cell = new Gtk.CellRendererText(); persistencyTypeComboBox.PackStart(cell, false); persistencyTypeComboBox.AddAttribute(cell, "text", 1); store = new Gtk.ListStore( typeof(MessageBufferPersistencyType), typeof(string) ); // fill ListStore store.AppendValues(MessageBufferPersistencyType.Volatile, _("Volatile")); store.AppendValues(MessageBufferPersistencyType.Persistent, _("Persistent")); persistencyTypeComboBox.Model = store; persistencyTypeComboBox.Active = 0; if (Frontend.EngineVersion < new Version("0.8.1")) { persistencyTypeComboBox.Sensitive = false; ((Gtk.SpinButton) _Glade["VolatileMaxCapacitySpinButton"]).Sensitive = false; ((Gtk.SpinButton) _Glade["PersistentMaxCapacitySpinButton"]).Sensitive = false; } Gtk.ComboBox proxyTypeComboBox = (Gtk.ComboBox)_Glade["ProxyTypeComboBox"]; // initialize wrap modes // glade might initialize it already! proxyTypeComboBox.Clear(); proxyTypeComboBox.Changed += _OnChanged; proxyTypeComboBox.Changed += delegate { CheckProxyTypeComBoBox(); }; cell = new Gtk.CellRendererText(); proxyTypeComboBox.PackStart(cell, false); proxyTypeComboBox.AddAttribute(cell, "text", 1); store = new Gtk.ListStore(typeof(ProxyType), typeof(string)); // fill ListStore store.AppendValues(ProxyType.None, String.Format("<{0}>", _("No Proxy"))); store.AppendValues(ProxyType.System, String.Format("<{0}>", _("System Default"))); store.AppendValues(ProxyType.Http, "HTTP"); store.AppendValues(ProxyType.Socks4, "SOCK 4"); store.AppendValues(ProxyType.Socks4a, "SOCK 4a"); store.AppendValues(ProxyType.Socks5, "SOCK 5"); proxyTypeComboBox.Model = store; proxyTypeComboBox.Active = 0; _Notebook.ShowTabs = false; Gtk.ListStore ls = new Gtk.ListStore(typeof(Page), typeof(Gdk.Pixbuf), typeof(string)); ls.AppendValues(Page.Connection, _Dialog.RenderIcon( Gtk.Stock.Connect, Gtk.IconSize.SmallToolbar, null), _("Connection")); ls.AppendValues(Page.Interface, _Dialog.RenderIcon( Gtk.Stock.SelectFont, Gtk.IconSize.SmallToolbar, null), _("Interface")); ls.AppendValues(Page.Servers, _Dialog.RenderIcon( Gtk.Stock.Network, Gtk.IconSize.SmallToolbar, null), _("Servers")); if (Frontend.EngineVersion >= new Version("0.7.2")) { // features introduced in >= 0.7.2 ls.AppendValues(Page.Filters, _Dialog.RenderIcon( Gtk.Stock.Delete, Gtk.IconSize.SmallToolbar, null), _("Filters")); ls.AppendValues(Page.Logging, _Dialog.RenderIcon( Gtk.Stock.JustifyLeft, Gtk.IconSize.SmallToolbar, null), _("Logging")); } int i = 1; _MenuTreeView.AppendColumn(null, new Gtk.CellRendererPixbuf(), "pixbuf",i++); _MenuTreeView.AppendColumn(null, new Gtk.CellRendererText(), "text", i++); _MenuTreeView.Selection.Changed += new EventHandler(_MenuTreeViewSelectionChanged); _MenuTreeView.Selection.Mode = Gtk.SelectionMode.Browse; _MenuTreeView.Model = ls; // select the first item Gtk.TreeIter iter; ls.GetIterFirst(out iter); _MenuTreeView.Selection.SelectIter(iter); _ServerListView = new ServerListView(_Dialog, _Glade); _FilterListWidget = new FilterListWidget(_Dialog, Frontend.UserConfig); _FilterListWidget.Changed += _OnChanged; _FilterListEventBox.Add(_FilterListWidget); _FilterListEventBox.ShowAll(); _Load(); }
public void Init() { this.Name = "OpenGraal.GraalIM.RCPlayerList"; this.Title = global::Mono.Unix.Catalog.GetString("Players"); this.Icon = global::Gdk.Pixbuf.LoadFromResource("OpenGraal.GraalIM.Resources.rcicon.ico"); this.WidthRequest = 580; this.HeightRequest = 420; this._playerlistTabs = new global::Gtk.Notebook(); this._playerlistTabs.CanFocus = true; this._playerlistTabs.Name = "_playerlistTabs"; this._playerlistTabs.CurrentPage = 0; this._playerlistTabs.EnablePopup = true; this._playerlistTabs.Scrollable = true; this._thisServerLabel = new global::Gtk.Label(); this._thisServerLabel.CanDefault = true; this._thisServerLabel.Name = "StatusTabLabel"; this._thisServerLabel.LabelProp = global::Mono.Unix.Catalog.GetString("This server"); this._playerList = new Gtk.TreeView(); this._playerList.SetSizeRequest(230, 230); this._playerListModel = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(int)); //this.tree.Selection.Changed += new System.EventHandler(OnSelectionChanged); //this._playerList.CursorChanged += new System.EventHandler(OnSelectionChanged); /* this._playerList.ButtonPressEvent += new ButtonPressEventHandler(delegate(object o, ButtonPressEventArgs args) { System.Console.WriteLine(args.ToString()); }); */ Gtk.CellRendererPixbuf pixbufrender = new Gtk.CellRendererPixbuf(); Gtk.TreeViewColumn TypeCol = this._playerList.AppendColumn("", new Gtk.CellRendererPixbuf(), "pixbuf", 0); TypeCol.SortIndicator = true; TypeCol.SortColumnId = 0; Gtk.CellRendererPixbuf cellpb = new Gtk.CellRendererPixbuf(); Gtk.CellRendererText cell = new Gtk.CellRendererText(); TypeCol.PackStart(cellpb, false); TypeCol.PackStart(cell, false); Gtk.CellRendererText NickColText = new Gtk.CellRendererText(); Gtk.TreeViewColumn NickCol = new Gtk.TreeViewColumn (); NickCol.PackStart(NickColText,true); NickCol.Title = "Artist"; NickCol.SortIndicator = true; NickCol.SortColumnId = 1; NickCol.AddAttribute(NickColText, "text", 1); this._playerList.AppendColumn(NickCol); Gtk.TreeViewColumn AccCol = this._playerList.AppendColumn("Account", new Gtk.CellRendererText(), "text", 2); AccCol.SortIndicator = true; AccCol.SortColumnId = 2; Gtk.TreeViewColumn LvlCol = this._playerList.AppendColumn("Level", new Gtk.CellRendererText(), "text", 3); LvlCol.SortIndicator = true; LvlCol.SortColumnId = 3; Gtk.TreeViewColumn IdCol = this._playerList.AppendColumn("ID", new Gtk.CellRendererText(), "text", 4); IdCol.SortIndicator = true; IdCol.SortColumnId = 4; Gtk.TreeIter iter = _playerListModel.AppendValues("Admins"); _playerListModel.AppendValues(iter, "Fannypack", "Nu Nu (Yeah Yeah) (double j and haze radio edit)"); iter = _playerListModel.AppendValues("Players"); _playerListModel.AppendValues(iter, "Nelly", "Country Grammer"); this._playerList.FixedHeightMode = false; this._playerList.HeadersClickable = true; this._playerList.SearchColumn = 1; this._playerList.EnableSearch = true; this._playerList.EnableTreeLines = true; this._playerList.ShowExpanders = true; //this.tree.Vadjustment. //_playerListModel.AppendValues("", "Loading...", ""); Gtk.Frame frame2 = new Gtk.Frame(); this._playerList.Model = _playerListModel; this._playerListScroll = new global::Gtk.ScrolledWindow(); this._playerListScroll.Name = "GtkScrolledWindow"; this._playerListScroll.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this._playerListScroll.Add(this._playerList); this._playerlistTabs.Add(this._playerListScroll); this._playerlistTabs.SetTabLabel(this._playerListScroll, this._thisServerLabel); this._thisServerLabel.ShowAll(); this.Add(this._playerlistTabs); }
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(); // 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++; } // Interface ((Gtk.Entry)_Glade["TimestampFormatEntry"]).Text = (string)Frontend.UserConfig["Interface/Notebook/TimestampFormat"]; // Interface/Notebook ((Gtk.SpinButton)_Glade["BufferLinesSpinButton"]).Value = (double)(int)Frontend.UserConfig["Interface/Notebook/BufferLines"]; ((Gtk.SpinButton)_Glade["EngineBufferLinesSpinButton"]).Value = (double)(int)Frontend.UserConfig["Interface/Notebook/EngineBufferLines"]; ((Gtk.CheckButton)_Glade["StripColorsCheckButton"]).Active = (bool)Frontend.UserConfig["Interface/Notebook/StripColors"]; ((Gtk.CheckButton)_Glade["StripFormattingsCheckButton"]).Active = (bool)Frontend.UserConfig["Interface/Notebook/StripFormattings"]; switch ((string)Frontend.UserConfig["Interface/Notebook/TabPosition"]) { case "top": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonTop"]).Active = true; break; case "bottom": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonBottom"]).Active = true; break; case "left": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonLeft"]).Active = true; break; case "right": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonRight"]).Active = true; break; case "none": ((Gtk.RadioButton)_Glade["TabPositionRadioButtonNone"]).Active = true; break; } // Interface/Notebook/Channel switch ((string)Frontend.UserConfig["Interface/Notebook/Channel/UserListPosition"]) { case "left": ((Gtk.RadioButton)_Glade["UserListPositionRadioButtonLeft"]).Active = true; break; case "right": ((Gtk.RadioButton)_Glade["UserListPositionRadioButtonRight"]).Active = true; break; case "none": ((Gtk.RadioButton)_Glade["UserListPositionRadioButtonNone"]).Active = true; break; } switch ((string)Frontend.UserConfig["Interface/Notebook/Channel/TopicPosition"]) { case "top": ((Gtk.RadioButton)_Glade["TopicPositionRadioButtonTop"]).Active = true; break; case "bottom": ((Gtk.RadioButton)_Glade["TopicPositionRadioButtonBottom"]).Active = true; break; case "none": ((Gtk.RadioButton)_Glade["TopicPositionRadioButtonNone"]).Active = true; break; } ((Gtk.CheckButton) _Glade["NickColorsCheckButton"]).Active = (bool) Frontend.UserConfig["Interface/Notebook/Channel/NickColors"]; // Interface/Notebook/Tab Gtk.ColorButton colorButton; string colorHexCode; colorButton = (Gtk.ColorButton)_Glade["NoActivityColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Notebook/Tab/NoActivityColor"]; colorButton.Color = ColorTools.GetGdkColor(colorHexCode); colorButton = (Gtk.ColorButton)_Glade["ActivityColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Notebook/Tab/ActivityColor"]; colorButton.Color = ColorTools.GetGdkColor(colorHexCode); colorButton = (Gtk.ColorButton)_Glade["ModeColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Notebook/Tab/EventColor"]; colorButton.Color = ColorTools.GetGdkColor(colorHexCode); colorButton = (Gtk.ColorButton)_Glade["HighlightColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Notebook/Tab/HighlightColor"]; colorButton.Color = ColorTools.GetGdkColor(colorHexCode); // Interface/Chat colorButton = (Gtk.ColorButton)_Glade["ForegroundColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Chat/ForegroundColor"]; if (String.IsNullOrEmpty(colorHexCode)) { ((Gtk.CheckButton)_Glade["OverrideForegroundColorCheckButton"]).Active = false; } else { ((Gtk.CheckButton)_Glade["OverrideForegroundColorCheckButton"]).Active = true; colorButton.Color = ColorTools.GetGdkColor(colorHexCode); } colorButton = (Gtk.ColorButton)_Glade["BackgroundColorButton"]; colorHexCode = (string)Frontend.UserConfig["Interface/Chat/BackgroundColor"]; if (String.IsNullOrEmpty(colorHexCode)) { ((Gtk.CheckButton)_Glade["OverrideBackgroundColorCheckButton"]).Active = false; } else { ((Gtk.CheckButton)_Glade["OverrideBackgroundColorCheckButton"]).Active = true; colorButton.Color = ColorTools.GetGdkColor(colorHexCode); } Gtk.FontButton fontButton = (Gtk.FontButton)_Glade["FontButton"]; string fontFamily = (string)Frontend.UserConfig["Interface/Chat/FontFamily"]; string fontStyle = (string)Frontend.UserConfig["Interface/Chat/FontStyle"]; int fontSize = 0; if (Frontend.UserConfig["Interface/Chat/FontSize"] != null) { fontSize = (int) Frontend.UserConfig["Interface/Chat/FontSize"]; } if (String.IsNullOrEmpty(fontFamily) && String.IsNullOrEmpty(fontStyle) && fontSize == 0) { ((Gtk.CheckButton)_Glade["OverrideFontCheckButton"]).Active = false; } else { ((Gtk.CheckButton)_Glade["OverrideFontCheckButton"]).Active = true; Pango.FontDescription fontDescription = new Pango.FontDescription(); fontDescription.Family = fontFamily; string frontWeigth = null; if (fontStyle.Contains(" ")) { int pos = fontStyle.IndexOf(" "); frontWeigth = fontStyle.Substring(0, pos); fontStyle = fontStyle.Substring(pos + 1); } fontDescription.Style = (Pango.Style) Enum.Parse(typeof(Pango.Style), fontStyle); if (frontWeigth != null) { fontDescription.Weight = (Pango.Weight) Enum.Parse(typeof(Pango.Weight), frontWeigth); } fontDescription.Size = fontSize * 1024; fontButton.FontName = fontDescription.ToString(); } Gtk.ComboBox wrapModeComboBox = ((Gtk.ComboBox)_Glade["WrapModeComboBox"]); Gtk.WrapMode wrapMode = (Gtk.WrapMode) Enum.Parse( typeof(Gtk.WrapMode), (string) Frontend.UserConfig["Interface/Chat/WrapMode"] ); int i = 0; foreach (object[] row in (Gtk.ListStore) wrapModeComboBox.Model) { if (((Gtk.WrapMode) row[0]) == wrapMode) { wrapModeComboBox.Active = i; break; } i++; } // Interface/Entry ((Gtk.Entry)_Glade["CompletionCharacterEntry"]).Text = (string)Frontend.UserConfig["Interface/Entry/CompletionCharacter"]; ((Gtk.Entry)_Glade["CommandCharacterEntry"]).Text = (string)Frontend.UserConfig["Interface/Entry/CommandCharacter"]; ((Gtk.CheckButton)_Glade["BashStyleCompletionCheckButton"]).Active = (bool)Frontend.UserConfig["Interface/Entry/BashStyleCompletion"]; ((Gtk.SpinButton)_Glade["CommandHistorySizeSpinButton"]).Value = (double)(int)Frontend.UserConfig["Interface/Entry/CommandHistorySize"]; ((Gtk.CheckButton)_Glade["BeepOnHighlightCheckButton"]).Active = (bool)Frontend.UserConfig["Sound/BeepOnHighlight"]; // Interface/Notification string modeStr = (string) Frontend.UserConfig["Interface/Notification/NotificationAreaIconMode"]; NotificationAreaIconMode mode = (NotificationAreaIconMode) Enum.Parse( typeof(NotificationAreaIconMode), modeStr ); switch (mode) { case NotificationAreaIconMode.Never: ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Active = false; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Active = true; break; case NotificationAreaIconMode.Always: ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Active = true; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonAlways"]).Active = true; break; case NotificationAreaIconMode.Minimized: ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Active = true; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonMinimized"]).Active = true; break; case NotificationAreaIconMode.Closed: ((Gtk.CheckButton) _Glade["NotificationAreaIconCheckButton"]).Active = true; ((Gtk.RadioButton) _Glade["NotificationAreaIconRadioButtonClosed"]).Active = true; break; } // Filters _ChannelFilterListView.Load(); // Servers _ServerListView.Load(); ((Gtk.Button)_Glade["ApplyButton"]).Sensitive = false; }
void Init() { f_ProtocolListStore = new Gtk.ListStore(typeof(string)); f_ListStore = new Gtk.ListStore( typeof(FilterModel), typeof(int), // filter key typeof(string) // tool tip ); f_TreeView.Model = f_ListStore; int i = 1; Gtk.TreeViewColumn column; Gtk.CellRendererText textCellr; Gtk.CellRendererCombo comboCellr; Gtk.CellRendererToggle toggleCellr; comboCellr = new Gtk.CellRendererCombo(); comboCellr.Model = f_ProtocolListStore; comboCellr.TextColumn = 0; comboCellr.HasEntry = false; comboCellr.Editable = true; comboCellr.Edited += OnProtocolEdited; column = f_TreeView.AppendColumn(_("Protocol"), comboCellr); column.SetCellDataFunc(comboCellr, RenderProtocol); f_ChatTypeListStore = new Gtk.ListStore(typeof(string), typeof(ChatType?)); f_ChatTypeListStore.AppendValues(String.Empty, null); f_ChatTypeListStore.AppendValues(_("Person / Private"), ChatType.Person); f_ChatTypeListStore.AppendValues(_("Group / Public"), ChatType.Group); f_ChatTypeListStore.AppendValues(_("Protocol / Server"), ChatType.Protocol); comboCellr = new Gtk.CellRendererCombo(); comboCellr.Model = f_ChatTypeListStore; comboCellr.TextColumn = 0; comboCellr.HasEntry = false; comboCellr.Editable = true; comboCellr.Edited += OnChatTypeEdited; column = f_TreeView.AppendColumn(_("Chat Type"), comboCellr); column.Resizable = true; column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly; column.SetCellDataFunc(comboCellr, RenderChatType); textCellr = new Gtk.CellRendererText(); textCellr.Editable = true; textCellr.Edited += delegate(object sender, Gtk.EditedArgs e) { Gtk.TreeIter iter; if (!f_ListStore.GetIterFromString(out iter, e.Path)) { return; } FilterModel filter = (FilterModel) f_ListStore.GetValue(iter, 0); int key = (int) f_ListStore.GetValue(iter, 1); filter.ChatID = e.NewText; f_ListStore.EmitRowChanged(new Gtk.TreePath(e.Path), iter); OnChanged(EventArgs.Empty); }; column = f_TreeView.AppendColumn(_("Name"), textCellr); column.MinWidth = 80; column.Resizable = true; column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly; column.SetCellDataFunc(textCellr, delegate(Gtk.TreeViewColumn col, Gtk.CellRenderer cellr, Gtk.TreeModel model, Gtk.TreeIter iter ) { FilterModel filter = (FilterModel) model.GetValue(iter, 0); (cellr as Gtk.CellRendererText).Text = filter.ChatID; } ); f_MessageTypeListStore = new Gtk.ListStore(typeof(string), typeof(MessageType?)); f_MessageTypeListStore.AppendValues(String.Empty, null); f_MessageTypeListStore.AppendValues(_("Normal"), MessageType.Normal); f_MessageTypeListStore.AppendValues(_("Event"), MessageType.Event); comboCellr = new Gtk.CellRendererCombo(); comboCellr.Model = f_MessageTypeListStore; comboCellr.TextColumn = 0; comboCellr.HasEntry = false; comboCellr.Editable = true; comboCellr.Edited += OnMessageTypeEdited; column = f_TreeView.AppendColumn(_("Type"), comboCellr); column.Resizable = true; column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly; column.SetCellDataFunc(comboCellr, RenderMessageType); /* f_TreeView.HasTooltip = true; f_TreeView.QueryTooltip += delegate(object sender, Gtk.QueryTooltipArgs e) { e.Tooltip.Text = "Message Type"; f_TreeView.SetTooltipCell(e.Tooltip, null, column, null); e.RetVal = true; }; */ textCellr = new Gtk.CellRendererText(); textCellr.Editable = true; textCellr.Edited += delegate(object sender, Gtk.EditedArgs e) { Gtk.TreeIter iter; if (!f_ListStore.GetIterFromString(out iter, e.Path)) { return; } FilterModel filter = (FilterModel) f_ListStore.GetValue(iter, 0); int key = (int) f_ListStore.GetValue(iter, 1); filter.MessagePattern = e.NewText; f_ListStore.EmitRowChanged(new Gtk.TreePath(e.Path), iter); OnChanged(EventArgs.Empty); }; column = f_TreeView.AppendColumn(_("Pattern"), textCellr); column.Resizable = true; column.MinWidth = 80; column.Sizing = Gtk.TreeViewColumnSizing.GrowOnly; column.SetCellDataFunc(textCellr, delegate(Gtk.TreeViewColumn col, Gtk.CellRenderer cellr, Gtk.TreeModel model, Gtk.TreeIter iter) { FilterModel filter = (FilterModel) model.GetValue(iter, 0); (cellr as Gtk.CellRendererText).Text = filter.MessagePattern; } ); }
public InsertTimestampPreferences () : base (false, 12) { // Get current values String dateFormat = (string) Preferences.Get ( Preferences.INSERT_TIMESTAMP_FORMAT); DateTime now = DateTime.Now; // Label Gtk.Label label = new Gtk.Label (Catalog.GetString ( "Choose one of the predefined formats " + "or use your own.")); label.Wrap = true; label.Xalign = 0; PackStart (label); // Use Selected Format selected_radio = new Gtk.RadioButton (Catalog.GetString ( "Use _Selected Format")); PackStart (selected_radio); // 1st column (visible): formatted date // 2nd column (not visible): date format store = new Gtk.ListStore (typeof (string), typeof (string)); foreach (String format in formats) store.AppendValues (now.ToString (format), format); scroll = new Gtk.ScrolledWindow(); scroll.ShadowType = Gtk.ShadowType.In; PackStart (scroll); tv = new Gtk.TreeView (store); tv.HeadersVisible = false; tv.AppendColumn ("Format", new Gtk.CellRendererText (), "text", 0); scroll.Add (tv); // Use Custom Format Gtk.HBox customBox = new Gtk.HBox (false, 12); PackStart (customBox); custom_radio = new Gtk.RadioButton ( selected_radio, Catalog.GetString ("_Use Custom Format")); customBox.PackStart (custom_radio); custom_entry = new Gtk.Entry (); customBox.PackStart (custom_entry); IPropertyEditor entryEditor = Services.Factory.CreatePropertyEditorEntry ( Preferences.INSERT_TIMESTAMP_FORMAT, custom_entry); entryEditor.Setup (); // Activate/deactivate widgets bool useCustom = true; Gtk.TreeIter iter; store.GetIterFirst (out iter); foreach (object[] row in store) { if (dateFormat.Equals (row[1])) { // Found format in list useCustom = false; break; } store.IterNext (ref iter); } if (useCustom) { custom_radio.Active = true; scroll.Sensitive = false; } else { selected_radio.Active = true; custom_entry.Sensitive = false; tv.Selection.SelectIter (iter); Gtk.TreePath path = store.GetPath (iter); tv.ScrollToCell (path, null, false, 0, 0); } // Register Toggled event for one radio button only selected_radio.Toggled += OnSelectedRadioToggled; tv.Selection.Changed += OnSelectionChanged; ShowAll (); }
protected virtual void UpdateTypePanelSensitivity (object sender, EventArgs e) { bool enabled = typePanel.Sensitive = stronglyTypedCheck.Active; if (enabled && classDataProvider == null) { classDataProvider = new TypeDataProvider (project); dataClassStore = new Gtk.ListStore (typeof (string)); foreach (var item in classDataProvider.TypeNamesList) dataClassStore.AppendValues (item); dataClassCombo.Model = dataClassStore; if (classDataProvider.TypeNamesList.Count > 0) dataClassCombo.Active = 0; } Validate (); }