public void NotificationUpdated(CustomNotification notification) { TreeIter iter; Boolean searchMore = NotificationListStore.GetIterFirst(out iter); while (searchMore) { if (NotificationListStore.GetValue(iter, 0) == notification) { NotificationListStore.EmitRowChanged(NotificationListStore.GetPath(iter), iter); } searchMore = NotificationListStore.IterNext(ref iter); } }
private void manager_FileTransferRemoved(object sender, FileTransferEventArgs e) { try { // Remove transfer from list Gtk.TreeIter iter; transferListStore.GetIterFirst(out iter); if (transferListStore.IterIsValid(iter)) { do { IFileTransfer currentItem = (IFileTransfer)transferListStore.GetValue(iter, 0); if (currentItem == e.Transfer) { transferListStore.Remove(ref iter); return; } } while (transferListStore.IterNext(ref iter)); } Gui.MainWindow.RefreshCounts(); } catch (Exception ex) { Core.LoggingService.LogError(ex); Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window); } }
// load the phone book // Since we have SelectionMode.Multiple turned on we have to // jump through these hoops in GTK-2.0 to get a selection private void on_book_treeview_selection(object o, EventArgs args) { Gtk.TreeIter iter = new Gtk.TreeIter(); //Value value = new Value(); delete me string selectionText = null; book_store.GetIterFirst(out iter); if (book.Selection.IterIsSelected(iter)) { selectionText = (string)book_store.GetValue(iter, 0); } while (book_store.IterNext(ref iter)) { if (book.Selection.IterIsSelected(iter)) { selectionText = (string)book_store.GetValue(iter, 0); } } // Ok now we can finally load the phone book foreach (Phonebook p in myPhoneBooks) { if (p.Name == selectionText) { load_phone_book(p); } } }
public ImportSymbolSelectionDlg(INode[] nodes) { this.Build (); SetResponseSensitive(ResponseType.Ok, true); SetResponseSensitive(ResponseType.Cancel, true); buttonOk.GrabFocus(); Modal = true; WindowPosition = Gtk.WindowPosition.CenterOnParent; // Init name column var nameCol = new TreeViewColumn(); var textRenderer = new CellRendererText(); nameCol.PackStart(textRenderer, true); nameCol.AddAttribute(textRenderer, "text", 0); list.AppendColumn(nameCol); // Init list model var nodeStore = new ListStore(typeof(string),typeof(INode)); list.Model = nodeStore; // Fill list foreach (var n in nodes) if(n!=null) nodeStore.AppendValues(n.ToString(), n); // Select first result TreeIter iter; if(nodeStore.GetIterFirst(out iter)) list.Selection.SelectIter(iter); }
public static void TreeviewScrollToLastRow(Gtk.TreeView tv, Gtk.ListStore store, int nrows) { TreeIter iter = new TreeIter(); bool iterOk = store.GetIterFirst(out iter); if (!iterOk) { return; } for (int i = 0; i < (nrows - 1); i++) { iterOk = tv.Model.IterNext(ref iter); } if (!iterOk) { return; } TreePath path = store.GetPath(iter); LogB.Debug(path.ToString()); tv.ScrollToCell(path, tv.Columns[0], true, 0, 0); }
// returns a list of arrays of columns size public ArrayList GetAllRows() { ArrayList rows = new ArrayList(); // Really get the whole row. string[] col = new string[store.NColumns]; store.GetIterFirst(out iter); for (int i = 0; i < store.NColumns; i++) { try { col[i] = (string)store.GetValue(iter, i); //Console.WriteLine("Column {0}",col[i]); } catch (Exception e) { Console.WriteLine("[newphonebook.GetAllRows] Exception: {0}", e); } } rows.Add(col); #if DEBUG Console.WriteLine("got columns"); #endif while (store.IterNext(ref iter)) { string[] coln = new string[store.NColumns]; for (int i = 0; i < store.NColumns; i++) { coln[i] = (string)store.GetValue(iter, i); } rows.Add(coln); } return(rows); }
public void ReloadCompilerList() { compilerStore.Clear(); defaultCompilerVendor = DCompilerService.Instance.DefaultCompiler; foreach (var cmp in DCompilerService.Instance.Compilers) { var virtCopy = new DCompilerConfiguration(); virtCopy.AssignFrom(cmp); compilerStore.AppendValues(cmp.Vendor, virtCopy); } Gtk.TreeIter iter; if (compilerStore.GetIterFirst(out iter)) { cmbCompilers.SetActiveIter(iter); } }
private void AddPattern(Pattern pattern) { PatternListStore.AppendValues("icon-dark-play", pattern, "icon-dark-pencil-square-o", "icon-dark-clone", "icon-dark-trash"); pattern.Animations.Add(new Animation()); DataModel.Patterns.Add(pattern); TreeIter iterator; PatternListStore.GetIterFirst(out iterator); do { if (pattern == (Pattern)PatternListStore.GetValue(iterator, PatternColumn)) { ignoreNextClick = true; treeviewPatterns.SetCursor(PatternListStore.GetPath(iterator), treeviewPatterns.Columns[PatternColumn], false); break; } }while (PatternListStore.IterNext(ref iterator)); }
void OnExecuteCommand(bool Delete) { if (ConfirmRemove(Delete)) { MusicLibrarySource Library = ServiceManager.SourceManager.MusicLibrary; if (Library.CanRemoveTracks && Library.CanDeleteTracks) { Gtk.TreeIter Iter = new Gtk.TreeIter(); if (MusicListStore.GetIterFirst(out Iter)) { do { if (Delete && (bool)MusicListStore.GetValue(Iter, 0)) { //delete string Uri = (string)MusicListStore.GetValue(Iter, 5); Uri = Uri.Replace("file://", ""); RemoveTrack((int)MusicListStore.GetValue(Iter, 7)); DeleteTrack(Uri); } else if ((bool)MusicListStore.GetValue(Iter, 0)) { RemoveTrack((int)MusicListStore.GetValue(Iter, 7)); } } while (MusicListStore.IterNext(ref Iter)); Library.Reload(); } else { Log.Warning("Please Don't Click Execute with nothing selected"); } } else { Log.Warning("Can not remove or delete any tracks"); } ReloadWindow(); } }
TreeIter FindJob(JobInfo job) { TreeIter iter; for (bool ok = listStore.GetIterFirst(out iter); ok; ok = listStore.IterNext(ref iter)) { if (listStore.GetValue(iter, COLUMN_JOB_INFORMATION) == job) { return(iter); } } return(TreeIter.Zero); }
private void on_NewPhoneBookDruidEdge_finish(object o, Gnome.FinishClickedArgs args) { if (GfaxRadioButton.Active) { phonebooktype = "gfax"; booknames.Add(NewPhoneBookNameEntry.Text); } else if (EvolutionRadioButton.Active) { phonebooktype = "evolution"; Gtk.TreeIter iter = new Gtk.TreeIter(); // Get the first row. store.GetIterFirst(out iter); try { if ((bool)store.GetValue(iter, 0)) // if use is true (toggle set) { booknames.Add((string)store.GetValue(iter, 1)); } } catch (Exception e) { Console.WriteLine("[newphonebook.NewPhoneBookDruidPage_finish] Exception: {0}", e); } // get the rest of the rows while (store.IterNext(ref iter)) { try { if ((bool)store.GetValue(iter, 0)) { booknames.Add((string)store.GetValue(iter, 1)); } } catch (Exception e) { Console.WriteLine("[newphonebook.NewPhoneBookDruidPage_finish] Exception: {0}", e); } } } else if (DatabaseRadioButton.Active) { phonebooktype = "sql"; } else if (LDAPRadioButton.Active) { phonebooktype = "ldap"; } NewPhoneBookDialog.Hide(); NewPhoneBookDialog.Dispose(); }
public void UpdateCurrentFrame() { TreeIter iter; if (!store.GetIterFirst(out iter)) { return; } do { int frame = (int)store.GetValue(iter, FrameIndexColumn); if (frame == DebuggingService.CurrentFrameIndex) { store.SetValue(iter, IconColumn, Gtk.Stock.GoForward); } else { store.SetValue(iter, IconColumn, null); } } while (store.IterNext(ref iter)); }
public void UpdateCurrentFrame() { TreeIter it; int n = 0; if (!store.GetIterFirst(out it)) { return; } do { if (n == DebuggingService.CurrentFrameIndex) { store.SetValue(it, 0, Gtk.Stock.GoForward); } else { store.SetValue(it, 0, null); } n++; } while (store.IterNext(ref it)); }
} // OnOmitCBToggled public BranchSelectionDialog(ICollection <string> branchLocations, string defaultLocation, string localDirectory, bool enableLocalPathSelection, bool enableRemember, bool enableOverwrite, bool enableOmitHistory) { this.Build(); Parent = MonoDevelop.Ide.IdeApp.Workbench.RootWindow; Gtk.CellRendererText textRenderer = new Gtk.CellRendererText(); textRenderer.Editable = true; textRenderer.Edited += delegate(object o, EditedArgs args) { try { Gtk.TreeIter eiter; branchStore.GetIterFromString(out eiter, args.Path); branchStore.SetValue(eiter, 0, args.NewText); } catch {} }; branchTreeView.Model = branchStore; branchTreeView.HeadersVisible = false; branchTreeView.AppendColumn("Branch", textRenderer, "text", 0); Gtk.TreeIter iter, defaultIter = default(Gtk.TreeIter); bool found = false; foreach (string location in branchLocations) { iter = branchStore.AppendValues(location); if (location == defaultLocation) { defaultIter = iter; found = true; } } iter = branchStore.AppendValues(string.Empty); if (1 == branchLocations.Count) { branchStore.GetIterFirst(out iter); } // when only one branch is known, default to it branchTreeView.Selection.SelectIter(found? defaultIter: iter); if (!string.IsNullOrEmpty(localDirectory)) { localPathButton.SetCurrentFolder(localDirectory); } localPathButton.Sensitive = enableLocalPathSelection; omitCB.Visible = enableOmitHistory; defaultCB.Sensitive = enableRemember; overwriteCB.Sensitive = enableOverwrite; } // constructor
protected void OnCmbCompilersChanged(object sender, System.EventArgs e) { Gtk.TreeIter iter; if (cmbCompilers.GetActiveIter(out iter)) { var newConfig = cmbCompilers.Model.GetValue(iter, 1) as DCompilerConfiguration; if (configuration == newConfig) { return; } else { ApplyToVirtConfiguration(); } Load(newConfig); } else if (!compilerStore.GetIterFirst(out iter)) { ApplyToVirtConfiguration(); Load(null); } }
public CrotateStageOperationParametersWidget(StageOperationParameters parameters) : base(parameters) { this.Build (); // Link to height (chain) ForeColoredSymbol link_w_symbol = new ForeColoredSymbol(); using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.chain.png")) { link_w_symbol.Symbol = buf; } link_w_symbol.Show(); link_w_togglebutton.Image = link_w_symbol; // Link to width (chain) ForeColoredSymbol link_h_symbol = new ForeColoredSymbol(); using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.chain.png")) { link_h_symbol.Symbol = buf; } link_h_symbol.Show(); link_h_togglebutton.Image = link_h_symbol; // Custom (line) ForeColoredSymbol custom_symbol = new ForeColoredSymbol(); using (Gdk.Pixbuf buf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.Widgets.res.line.png")) { custom_symbol.Symbol = buf; } custom_symbol.Show(); custom_togglebutton.Image = custom_symbol; custom_togglebutton.Label = null; ls = new ListStore(typeof(string), typeof(int)); string[] ratioNames = ((CrotateStageOperationParameters)Parameters).PresetAspectRatioNames; for (int i = 0; i < ratioNames.Length; i++) { ls.AppendValues(ratioNames[i], i); } aspect_combobox.Model = ls; TreeIter ti; ls.GetIterFirst(out ti); mAspectComboboxSelfModifying = true; aspect_combobox.SetActiveIter(ti); mAspectComboboxSelfModifying = false; }
void SelectPad(Pad pad) { Gtk.TreeIter iter; if (padListStore.GetIterFirst(out iter)) { do { Pad curPad = padListStore.GetValue(iter, 2) as Pad; if (pad == curPad) { treeviewPads.Selection.SelectIter(iter); return; } } while (padListStore.IterNext(ref iter)); } }
void SelectDocument(Document doc) { Gtk.TreeIter iter; if (documentListStore.GetIterFirst(out iter)) { do { Document curDocument = documentListStore.GetValue(iter, 2) as Document; if (doc == curDocument) { treeviewDocuments.Selection.SelectIter(iter); return; } } while (documentListStore.IterNext(ref iter)); } }
public StashManagerDialog (GitRepository repo) { this.Build (); stashes = repo.GetStashes (); store = new ListStore (typeof(Stash), typeof(string), typeof(string)); list.Model = store; list.AppendColumn (GettextCatalog.GetString ("Date/Time"), new CellRendererText (), "text", 1); list.AppendColumn (GettextCatalog.GetString ("Comment"), new CellRendererText (), "text", 2); Fill (); TreeIter it; if (store.GetIterFirst (out it)) list.Selection.SelectIter (it); UpdateButtons (); }
public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries) { Build (); Pango.FontDescription font = Pango.FontDescription.FromString (DesktopService.DefaultMonospaceFont); textview.ModifyFont (font); textview.WrapMode = WrapMode.None; textview.AcceptsTab = true; Pango.TabArray tabs = new Pango.TabArray (1, true); tabs.SetTab (0, Pango.TabAlign.Left, GetStringWidth (" ") * 4); textview.Tabs = tabs; textview.SizeRequested += delegate (object o, SizeRequestedArgs args) { textview.WidthRequest = GetStringWidth (string.Empty.PadRight (80)); }; font.Dispose (); store = new ListStore (typeof(ChangeLogEntry), typeof(Gdk.Pixbuf), typeof(string)); fileList.Model = store; fileList.AppendColumn (string.Empty, new CellRendererPixbuf (), "pixbuf", 1); fileList.AppendColumn (string.Empty, new CellRendererText (), "text", 2); foreach (ChangeLogEntry ce in entries.Values) { Gdk.Pixbuf pic; if (ce.CantGenerate) pic = ImageService.GetPixbuf (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu); else if (ce.IsNew) pic = ImageService.GetPixbuf (Gtk.Stock.New, Gtk.IconSize.Menu); else pic = null; store.AppendValues (ce, pic, ce.File); } fileList.Selection.Changed += OnSelectionChanged; textview.Buffer.Changed += OnTextChanged; TreeIter it; editMark = textview.Buffer.CreateMark (null, textview.Buffer.EndIter, false); oldTextTag = new Gtk.TextTag ("readonly"); oldTextTag.Foreground = "gray"; oldTextTag.Editable = false; textview.Buffer.TagTable.Add (oldTextTag); if (store.GetIterFirst (out it)) fileList.Selection.SelectIter (it); }
public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries) { Build (); textview.ModifyFont (FontService.MonospaceFont); textview.WrapMode = WrapMode.None; textview.AcceptsTab = true; Pango.TabArray tabs = new Pango.TabArray (1, true); tabs.SetTab (0, Pango.TabAlign.Left, GetStringWidth (" ") * 4); textview.Tabs = tabs; textview.SizeRequested += delegate { textview.WidthRequest = GetStringWidth (String.Empty.PadRight (80)); }; store = new ListStore (typeof(ChangeLogEntry), typeof(Xwt.Drawing.Image), typeof(string)); fileList.Model = store; fileList.AppendColumn (string.Empty, new CellRendererImage (), "image", 1); fileList.AppendColumn (string.Empty, new CellRendererText (), "text", 2); foreach (ChangeLogEntry ce in entries.Values) { Xwt.Drawing.Image pic; if (ce.CantGenerate) pic = ImageService.GetIcon (Ide.Gui.Stock.Warning, IconSize.Menu); else if (ce.IsNew) pic = ImageService.GetIcon (Stock.New, IconSize.Menu); else pic = null; store.AppendValues (ce, pic, ce.File); } fileList.Selection.Changed += OnSelectionChanged; textview.Buffer.Changed += OnTextChanged; TreeIter it; editMark = textview.Buffer.CreateMark (null, textview.Buffer.EndIter, false); oldTextTag = new TextTag ("readonly"); oldTextTag.Foreground = "gray"; oldTextTag.Editable = false; textview.Buffer.TagTable.Add (oldTextTag); if (store.GetIterFirst (out it)) fileList.Selection.SelectIter (it); }
public DatabaseConnectionContextComboBox () { store = new ListStore (typeof (string), typeof (object)); Model = store; CellRendererText textRenderer = new CellRendererText (); PackStart (textRenderer, true); AddAttribute (textRenderer, "text", 0); foreach (DatabaseConnectionContext context in ConnectionContextService.DatabaseConnections) store.AppendValues (context.ConnectionSettings.Name, context); TreeIter iter; if (store.GetIterFirst (out iter)) SetActiveIter (iter); ConnectionContextService.ConnectionContextAdded += new DatabaseConnectionContextEventHandler (OnConnectionAdded); ConnectionContextService.ConnectionContextRemoved += new DatabaseConnectionContextEventHandler (OnConnectionRemoved); ConnectionContextService.ConnectionContextEdited += new DatabaseConnectionContextEventHandler (OnConnectionEdited); ConnectionContextService.ConnectionContextRefreshed += new DatabaseConnectionContextEventHandler (OnConnectionRefreshed); }
private void StoreSearch(string query) { Gtk.TreeIter iter; if (history.GetIterFirst(out iter)) { string val; do { val = (string)history.GetValue(iter, 0); if (val == query) { history.Remove(ref iter); } } while (val != query && history.IterNext(ref iter)); } iter = history.Insert(0); history.SetValue(iter, 0, query); }
protected virtual void OnTreeviewrefCursorChanged(object sender, System.EventArgs e) { bool isSelect = treeviewref.Selection.CountSelectedRows() == 1; editAction1.Sensitive = isSelect && CanEdit; removeAction1.Sensitive = isSelect && CanDel; bool SelectFirst = false, SelectLast = false; bool Filtered = entryFilter.Text != ""; TreeIter iter, SelectIter; if (treeviewref.Selection.GetSelected(out SelectIter)) { TreePath SelectPath = RefListStore.GetPath(filter.ConvertIterToChildIter(SelectIter)); RefListStore.GetIterFirst(out iter); SelectFirst = RefListStore.GetPath(iter).Compare(SelectPath) == 0; RefListStore.IterNthChild(out iter, RefListStore.IterNChildren() - 1); SelectLast = RefListStore.GetPath(iter).Compare(SelectPath) == 0; } buttonOrdinalUp.Sensitive = isSelect && !Filtered && !SelectFirst; buttonOrdinalDown.Sensitive = isSelect && !Filtered && !SelectLast; buttonOk.Sensitive = isSelect; }
public void ShowWidget() { isChange = false; TreeSelection ts = tvFiles.Selection; TreePath[] tp = ts.GetSelectedRows(); fileListStore.Clear(); string[] listFi = Directory.GetFiles(MainClass.Paths.DisplayDir, "*.ini"); foreach (string fi in listFi) { EmulatorDisplay dd = new EmulatorDisplay(fi); if (dd.Load()) { fileListStore.AppendValues(System.IO.Path.GetFileName(fi), fi, dd); } } resolStore.Clear(); foreach (Rule rl in MainClass.Settings.Resolution.Rules) { resolStore.AppendValues(String.Format("{0} ({1}x{2})", rl.Name, rl.Width, rl.Height), rl.Id, rl.Name, rl.Specific, rl); } isChange = false; if (tp.Length < 1) { TreeIter ti = new TreeIter(); if (fileListStore.GetIterFirst(out ti)) { ts.SelectIter(ti); } } else { ts.SelectPath(tp[0]); } }
public StashManagerDialog (GitRepository repo) { this.Build (); this.UseNativeContextMenus (); repository = repo; stashes = repo.GetStashes (); store = new ListStore (typeof(Stash), typeof(string), typeof(string)); list.Model = store; list.SearchColumn = -1; // disable the interactive search list.AppendColumn (GettextCatalog.GetString ("Date/Time"), new CellRendererText (), "text", 1); list.AppendColumn (GettextCatalog.GetString ("Comment"), new CellRendererText (), "text", 2); Fill (); TreeIter it; if (store.GetIterFirst (out it)) list.Selection.SelectIter (it); UpdateButtons (); list.Selection.Changed += delegate { UpdateButtons (); }; }
public static void Populate(this ComboBox comboBox, EntryList entryList) { comboBox.Clear(); ListStore listStore = new Gtk.ListStore( (entryList[0].Value.GetType()), (entryList[0].Name.GetType()) ); comboBox.Model = listStore; CellRendererText text = new CellRendererText(); comboBox.PackStart(text, false); comboBox.AddAttribute(text, "text", 1); foreach (Entry entry in entryList) { listStore.AppendValues(entry.Value, entry.Name); } TreeIter iter; if (listStore.GetIterFirst(out iter)) { comboBox.SetActiveIter(iter); } }
public PreferencesDialog() : base(null, "PreferencesDialog") { dialog = base.Dialog; dialog.Shown += delegate { if (settings.FirstRun) { on_redetectConnectionButton_clicked(redetectConnectionButton, EventArgs.Empty); base.Dialog.SkipPagerHint = false; base.Dialog.SkipTaskbarHint = false; } }; settings = Gui.Settings; /* Configure gui */ firewallImage.Pixbuf = new Gdk.Pixbuf(null, "FileFind.Meshwork.GtkClient.firewall-small.png"); internetConnectionImage.Pixbuf = new Gdk.Pixbuf(null, "FileFind.Meshwork.GtkClient.network1.png"); folderImage = Gui.LoadIcon(24, "folder"); sharedFoldersListStore = new Gtk.ListStore(typeof(string)); sharedFoldersList.Model = sharedFoldersListStore; var imageCell = new CellRendererPixbuf(); var textCell = new CellRendererText(); var column = new TreeViewColumn(); column.PackStart(imageCell, false); column.PackStart(textCell, true); column.SetCellDataFunc(imageCell, new TreeCellDataFunc(showFolderIcon)); column.SetCellDataFunc(textCell, new TreeCellDataFunc(showFolderText)); sharedFoldersList.AppendColumn(column); sharedFoldersList.RulesHint = true; Gtk.Drag.DestSet(sharedFoldersList, Gtk.DestDefaults.All, new Gtk.TargetEntry [] { new Gtk.TargetEntry("text/uri-list", 0, 0) }, Gdk.DragAction.Copy); sharedFoldersList.DragDataReceived += OnSharedFoldersListDragDataReceived; advancedListStore = new Gtk.ListStore(typeof(string), typeof(int)); advancedList.Model = advancedListStore; advancedList.AppendColumn("Text", new CellRendererText(), "text", 0); advancedNotebook.ShowTabs = false; for (int x = 0; x < advancedNotebook.NPages; x++) { Widget widget = advancedNotebook.GetNthPage(x); advancedListStore.AppendValues(advancedNotebook.GetTabLabelText(widget), x); } TreeIter iter; advancedListStore.GetIterFirst(out iter); advancedList.Selection.SelectIter(iter); if (Gui.MainWindow != null) { dialog.TransientFor = Gui.MainWindow.Window; } else { // First run! } Gtk.Drag.DestSet(avatarButton, DestDefaults.All, target_table, Gdk.DragAction.Copy | Gdk.DragAction.Move); provider = new RSACryptoServiceProvider(); provider.ImportParameters(settings.EncryptionParameters); nodeid = Common.SHA512Str(provider.ToXmlString(false)); /**** Load options ****/ // General Tab nicknameEntry.Text = settings.NickName; nameEntry.Text = settings.RealName; nodeIdLabel.Markup = "<span font=\"monospace\">" + Common.FormatFingerprint(nodeid, 7) + "</span>"; emailEntry.Text = settings.Email; string avatarDirectory = Path.Combine(Settings.ConfigurationDirectory, "avatars"); string myAvatarFile = Path.Combine(avatarDirectory, String.Format("{0}.png", nodeid)); if (File.Exists(myAvatarFile)) { avatarImage.Pixbuf = new Gdk.Pixbuf(myAvatarFile); } else { avatarImage.Pixbuf = new Gdk.Pixbuf(null, "FileFind.Meshwork.GtkClient.avatar-generic-large.png"); avatarImage.Sensitive = false; } // Networks tab networksListStore = new ListStore(typeof(NetworkInfo)); foreach (NetworkInfo networkInfo in settings.Networks) { networksListStore.AppendValues(networkInfo.Clone()); } networksTreeView.AppendColumn("Network Name", new CellRendererText(), new TreeCellDataFunc(NetworkNameFunc)); networksTreeView.Model = networksListStore; // File Sharing Tab foreach (string dir in settings.SharedDirectories) { sharedFoldersListStore.AppendValues(new object[] { dir }); } downloadsChooser.SetCurrentFolder(settings.IncompleteDownloadDir); completedDownloadsChooser.SetCurrentFolder(settings.CompletedDownloadDir); // Connection Tab tcpPortLabel.Text = settings.TcpListenPort.ToString(); firewallStatusLabel.Text = String.Empty; if (CheckForNat()) { natStatusLabel.Markup = "You <b>are</b> behind a NAT router."; // XXX: Include UPnP Info! } else { natStatusLabel.Markup = "You <b>are not</b> behind a NAT router."; natOptionsTable.Sensitive = false; } bool foundIPv6Internal = false; bool foundIPv6External = false; foreach (IDestination destination in Core.DestinationManager.Destinations) { if (destination is IPv6Destination) { if (((IPv6Destination)destination).IsExternal) { foundIPv6External = true; } else { foundIPv6Internal = true; } } else if (destination is IPv4Destination && destination.IsExternal) { internetIPLabel.Text = ((IPDestination)destination).Address.ToString(); } } if (foundIPv6External) { supportsIPv6Label.Text = "Yes"; } else if (foundIPv6Internal) { supportsIPv6Label.Text = "LAN Only"; } else { supportsIPv6Label.Text = "No"; } // Plugins Tab pluginsListStore = new ListStore(typeof(PluginInfo)); pluginsTreeView.AppendColumn("Plugin Info", new CellRendererText(), new TreeCellDataFunc(PluginInfoFunc)); pluginsTreeView.Model = pluginsListStore; foreach (string fileName in settings.Plugins) { try { PluginInfo info = new PluginInfo(fileName); pluginsListStore.AppendValues(info); } catch (Exception ex) { Core.LoggingService.LogError(ex); } } // Advanced -> Appearance startInTrayCheckButton.Active = settings.StartInTray; // Advanced -> Auto-connect Tab autoConnectTreeStore = new Gtk.TreeStore(typeof(object)); autoConnectList.Model = autoConnectTreeStore; CellRendererToggle autoConnectToggleCell = new CellRendererToggle(); autoConnectToggleCell.Toggled += OnAutoConnectItemToggled; CellRendererText autoConnectTextCell = new CellRendererText(); column = new TreeViewColumn(); column.PackStart(autoConnectToggleCell, false); column.SetCellDataFunc(autoConnectToggleCell, new TreeCellDataFunc(ShowAutoConnectToggle)); column.PackStart(autoConnectTextCell, true); column.SetCellDataFunc(autoConnectTextCell, new TreeCellDataFunc(ShowAutoConnectName)); autoConnectList.AppendColumn(column); autoConnectList.AppendColumn("IP", new CellRendererText(), new Gtk.TreeCellDataFunc(ShowAutoConnectIP)); PopulateAutoConnectList(); autoConnectCountSpinButton.Value = settings.AutoConnectCount; // Advanced -> Connection nodePortSpinButton.Value = settings.TcpListenPort; nodePortOpenCheckButton.Active = settings.TcpListenPortOpen; detectIPCheckButton.Active = settings.DetectInternetIPOnStart; externalIPv4AddressEntry.Text = internetIPLabel.Text; stunServerEntry.Text = settings.StunServer; ipv6LocalInterfaceComboBox.Model = new ListStore(typeof(string), typeof(int)); ((ListStore)ipv6LocalInterfaceComboBox.Model).AppendValues("Disabled", -1); var interfaces = new Dictionary <string, int>(); foreach (InterfaceAddress addr in Core.OS.GetInterfaceAddresses()) { if (addr.Address.AddressFamily == AddressFamily.InterNetworkV6 && (!IPAddress.IsLoopback(addr.Address))) { if (!interfaces.ContainsKey(addr.Name)) { interfaces[addr.Name] = addr.InterfaceIndex; } } } foreach (string name in interfaces.Keys) { ((ListStore)ipv6LocalInterfaceComboBox.Model).AppendValues(name, interfaces[name]); } if (ipv6LocalInterfaceComboBox.Model.GetIterFirst(out iter)) { do { int index = (int)ipv6LocalInterfaceComboBox.Model.GetValue(iter, 1); if (index == settings.IPv6LinkLocalInterfaceIndex) { ipv6LocalInterfaceComboBox.SetActiveIter(iter); break; } } while (ipv6LocalInterfaceComboBox.Model.IterNext(ref iter)); } UpdateFirewallLabel(); // Advanced -> File Transfer limitDownSpeedCheckButton.Active = settings.EnableGlobalDownloadSpeedLimit; limitDownSpeedSpinButton.Value = settings.GlobalDownloadSpeedLimit; limitUpSpeedCheckButton.Active = settings.EnableGlobalUploadSpeedLimit; limitUpSpeedSpinButton.Value = settings.GlobalUploadSpeedLimit; // I cant seem to make anything default with just the glade file. nicknameEntry.GrabFocus(); }
/* * drive refreshing is implemented asynchronously, * because this operation may take a few seconds on windows systems. */ private void RefreshListAsync() { //btnOk.Sensitive = false; if (CurrentPlatform.IsWin32) { ListStore store = new ListStore(typeof(string)); store.AppendValues(S._("Waiting for drives...")); SetColumns(tvDrives, true); tvDrives.Model = store; /*ColumnsAutosize();*/ } new Thread( delegate() { ListStore store = new ListStore(typeof(Pixbuf), typeof(string), typeof(string), typeof(string), /*not visible - driveinfo data*/typeof(object)); DriveInfo[] drives = DriveInfo.GetDrives(true); // list ready drives only TreeIter selectedIter = TreeIter.Zero; foreach (DriveInfo d in drives) { if (EXCLUDE_ROOT_FS && (d.IsMounted && d.RootPath == "/")) continue; //string stockID = Util.GetDriveStockIconID(d); //Pixbuf icon = this.RenderIcon(stockID, IconSize.Dialog, string.Empty); Pixbuf icon = RenderIcon(Icons.IconUtils.GetDriveIcon(d), IconSize.Dialog); string drive = string.IsNullOrEmpty(d.Device) ? S._("Unknown") : d.Device; string label = GetLabel(d); string size = Util.GetSizeStr(d.TotalSize); TreeIter iter = store.AppendValues(icon, drive, label, size, d); // preselect the first cdrom drive found if ((selectedIter.Stamp == TreeIter.Zero.Stamp) && d.DriveType == DriveType.CDRom) selectedIter = iter; } // if no cdrom drive was selected, select first drive if (selectedIter.Stamp == TreeIter.Zero.Stamp) store.GetIterFirst(out selectedIter); if (!isDestroyed) { // only access gui components from the gui thread Application.Invoke(delegate { SetColumns(tvDrives, false); tvDrives.Model = store; /*ColumnsAutosize();*/ // select selectedIter tvDrives.Selection.SelectIter(selectedIter); //btnOk.Sensitive = true; }); } }).Start(); }
static void UpdateIndices (ListStore itemStore) { TreeIter iter; int i = 0; if (!itemStore.GetIterFirst (out iter)) return; do { itemStore.SetValue (iter, 1, i); i++; } while (itemStore.IterNext (ref iter)); }
public ProjectPropertiesDialog(Project project) : base("ProjectPropertiesDialog.ui", "projectproperties") { Gtk.Box.BoxChild child; TreeIter iter; bool more; this.project = project; dvd_project = project.Details.Type == ProjectType.DVD; // General tab name.Text = project.Details.Name; output_dir.Text = project.Details.OutputDir; fontslides_button.FontName = project.Details.SlideshowsFontName; backslides_button.UseAlpha = foreslides_button.UseAlpha = true; foreslides_button.Alpha = (ushort) (project.Details.SlideshowsForeColor.A * 65535); backslides_button.Alpha = (ushort) (project.Details.SlideshowsBackColor.A * 65535); foreslides_button.Color = Utils.CairoToGdkColor (project.Details.SlideshowsForeColor); backslides_button.Color = Utils.CairoToGdkColor (project.Details.SlideshowsBackColor); if (dvd_project == true) // DVD tab { notebook.RemovePage (PAGE_THEORA); fontbuttons_button.FontName = project.Details.ButtonsFontName; forebuttons_button.UseAlpha = backbuttons_button.UseAlpha = true; forebuttons_button.Alpha = (ushort) (project.Details.ButtonsForeColor.A * 65535); backbuttons_button.Alpha = (ushort) (project.Details.ButtonsBackColor.A * 65535); forebuttons_button.Color = Utils.CairoToGdkColor (project.Details.ButtonsForeColor); backbuttons_button.Color = Utils.CairoToGdkColor (project.Details.ButtonsBackColor); pal_radio.Active = project.Details.Format == VideoFormat.PAL; ntsc_radio.Active = project.Details.Format == VideoFormat.NTSC; fourbythree_radio.Active = project.Details.AspectRatio == AspectRatio.FourByThree; sixteenbynine_radio.Active = project.Details.AspectRatio == AspectRatio.SixteenByNine; thumbnail_store = new ListStore (typeof (string), typeof (int)); // DisplayName, int CellRenderer thumbnail_cell = new CellRendererText (); thumbnail_combo.Model = thumbnail_store; thumbnail_combo.PackStart (thumbnail_cell, true); thumbnail_combo.SetCellDataFunc (thumbnail_cell, Utils.ComboBoxCellFunc); LoadThumbnailsIntoCombo (); // Default thumbnail size int thumbnail = project.Details.ButtonThumbnailSize; int current; more = thumbnail_store.GetIterFirst (out iter); while (more) { current = (int) thumbnail_store.GetValue (iter, COLUMN_ID); if (thumbnail == current) { thumbnail_combo.SetActiveIter (iter); break; } more = thumbnail_store.IterNext (ref iter); } // Margins child = (Gtk.Box.BoxChild) (fourbythree_hbox [fourbythree_radio]); child.Padding = PADDING + OFFSET; child = (Gtk.Box.BoxChild) (sixteenbynine_hbox [sixteenbynine_radio]); child.Padding = PADDING + OFFSET; child = (Gtk.Box.BoxChild) (pal_hbox [pal_radio]); child.Padding = PADDING + OFFSET; child = (Gtk.Box.BoxChild) (ntsc_hbox [ntsc_radio]); child.Padding = PADDING + OFFSET; } else { // Theora tab notebook.RemovePage (PAGE_DVD); resolution_store = new ListStore (typeof (string), typeof (int)); // DisplayName, index to array CellRenderer resolution_cell = new CellRendererText (); resolution_combobox.Model = resolution_store; resolution_combobox.PackStart (resolution_cell, true); resolution_combobox.SetCellDataFunc (resolution_cell, Utils.ComboBoxCellFunc); LoadResolutionIntoCombo (); // Select default item in the combobox list more = resolution_store.GetIterFirst (out iter); while (more) { int idx = (int) resolution_store.GetValue (iter, COL_INDEX); if (ResolutionManager.List[idx].Width == project.Details.Width && ResolutionManager.List[idx].Height == project.Details.Height) { resolution_combobox.SetActiveIter (iter); break; } more = resolution_store.IterNext (ref iter); } child = (Gtk.Box.BoxChild) (resolution_hbox [resolution_label]); child.Padding = PADDING + OFFSET; } // Top margin for the General tab child = (Gtk.Box.BoxChild) (general_vbox [vbox25]); child.Padding = PADDING; // Left margin for controls child = (Gtk.Box.BoxChild) (name_hbox [name]); child.Padding = PADDING; child = (Gtk.Box.BoxChild) (output_dir_hbox [output_dir]); child.Padding = PADDING; }
public NewProjectDialog() : base("NewProjectDialog.ui", "newproject") { TreeIter iter; // Comboboxes are added with a HBox to be able to align them pal_radio = new Gtk.RadioButton (Catalog.GetString ("PAL (Europe)")); AddRadioButton (videoformat_vbox, pal_radio, 24); ntsc_radio = new Gtk.RadioButton (pal_radio, Catalog.GetString ("NTSC")); AddRadioButton (videoformat_vbox, ntsc_radio, 24); fourbythree_radio = new Gtk.RadioButton (Catalog.GetString ("4:3 (TV)")); AddRadioButton (aspectratio_vbox, fourbythree_radio, 10); sixteenbynine_radio = new Gtk.RadioButton (fourbythree_radio, Catalog.GetString ("16:9 (Widescreen)")); AddRadioButton (aspectratio_vbox, sixteenbynine_radio, 10); resolution_store = new ListStore (typeof (string), typeof (int)); // DisplayName, index to array CellRenderer resolution_combocell = new CellRendererText (); resolution_combobox.Model = resolution_store; resolution_combobox.PackStart (resolution_combocell, true); resolution_combobox.SetCellDataFunc (resolution_combocell, Utils.ComboBoxCellFunc); LoadResolutionIntoCombo (); // Select default item in the combobox list bool more = resolution_store.GetIterFirst (out iter); while (more) { int idx = (int) resolution_store.GetValue (iter, COL_INDEX); if (ResolutionManager.List[idx].Width == ResolutionManager.Default.Width && ResolutionManager.List[idx].Height == ResolutionManager.Default.Height) { resolution_combobox.SetActiveIter (iter); break; } more = resolution_store.IterNext (ref iter); } // Translators: This is the default project name for a new project name.Text = Catalog.GetString ("Project"); output_dir.Text = OutputDirFromName (); name.Changed += OnChangedProjectName; output_dir.Changed += OnChangedOutputDir; changed = false; slideshows_radio.Toggled += new EventHandler (OnProjectTypeToggled); ProjectTypeSensitive (); }
public InspectionPanelWidget (string mimeType) { this.Build (); // this.mimeType = mimeType; treeviewInspections.AppendColumn ("Title", new CellRendererText (), "text", 0); var comboRenderer = new CellRendererCombo (); var col = treeviewInspections.AppendColumn ("Severity", comboRenderer); var comboBoxStore = new ListStore (typeof(string), typeof(QuickTaskSeverity)); comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.None), QuickTaskSeverity.None); comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.Error), QuickTaskSeverity.Error); comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.Warning), QuickTaskSeverity.Warning); comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.Hint), QuickTaskSeverity.Hint); comboBoxStore.AppendValues (GetDescription (QuickTaskSeverity.Suggestion), QuickTaskSeverity.Suggestion); comboRenderer.Model = comboBoxStore; comboRenderer.Mode = CellRendererMode.Activatable; comboRenderer.TextColumn = 0; comboRenderer.Editable = true; comboRenderer.HasEntry = false; comboRenderer.Edited += delegate(object o, Gtk.EditedArgs args) { Gtk.TreeIter iter; if (!treeStore.GetIterFromString (out iter, args.Path)) return; Gtk.TreeIter storeIter; if (!comboBoxStore.GetIterFirst (out storeIter)) return; Console.WriteLine ("new text:" + args.NewText); do { if ((string)comboBoxStore.GetValue (storeIter, 0) == args.NewText) { treeStore.SetValue (iter, 1, (QuickTaskSeverity)comboBoxStore.GetValue (storeIter, 1)); return; } } while (comboBoxStore.IterNext (ref storeIter)); }; col.SetCellDataFunc (comboRenderer, delegate (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { var severity = (QuickTaskSeverity)treeStore.GetValue (iter, 1); comboRenderer.Text = GetDescription (severity); }); treeviewInspections.HeadersVisible = false; treeviewInspections.Model = treeStore; treeviewInspections.Selection.Changed += HandleSelectionChanged; foreach (var node in RefactoringService.GetInspectors (mimeType)) { treeStore.AppendValues (node.Title, node.GetSeverity (), node); } }
public PreferencesDialog(PlayerHistory history) : base("PreferencesDialog.ui", "preferences") { this.history = history; prefspinbutton.Value = Preferences.Get <int> (Preferences.MemQuestionTimeKey); prefcheckbutton.Active = Preferences.Get <bool> (Preferences.MemQuestionWarnKey); maxstoredspinbutton.Value = Preferences.Get <int> (Preferences.MaxStoredGamesKey); minplayedspinbutton.Value = Preferences.Get <int> (Preferences.MinPlayedGamesKey); colorblindcheckbutton.Active = Preferences.Get <bool> (Preferences.ColorBlindKey); english_checkbutton.Active = Preferences.Get <bool> (Preferences.EnglishKey); switch ((GameDifficulty) Preferences.Get <int> (Preferences.DifficultyKey)) { case GameDifficulty.Easy: rb_easy.Active = rb_easy.HasFocus = true; break; case GameDifficulty.Medium: rb_medium.Active = rb_medium.HasFocus = true; break; case GameDifficulty.Master: rb_master.Active = rb_master.HasFocus = true; break; } ListStore store = new ListStore (typeof (string), typeof (Theme)); // DisplayName, theme reference CellRenderer layout_cell = new CellRendererText (); themes_combobox.Model = store; themes_combobox.PackStart (layout_cell, true); themes_combobox.SetCellDataFunc (layout_cell, ComboBoxCellFunc); foreach (Theme theme in ThemeManager.Themes) store.AppendValues (Catalog.GetString(theme.LocalizedName), theme); // Default value TreeIter iter; bool more = store.GetIterFirst (out iter); while (more) { Theme theme = (Theme) store.GetValue (iter, COLUMN_VALUE); if (String.Compare (theme.Name, Preferences.Get <string> (Preferences.ThemeKey), true) == 0) { themes_combobox.SetActiveIter (iter); break; } more = store.IterNext (ref iter); } }
static TreeIter FindTask (ListStore store, Task task) { TreeIter iter; if (!store.GetIterFirst (out iter)) return TreeIter.Zero; do { Task t = store.GetValue (iter, (int)Columns.Task) as Task; if (t == task) return iter; } while (store.IterNext (ref iter)); return TreeIter.Zero; }
public CodeIssuePanelWidget (string mimeType) { this.mimeType = mimeType; // ReSharper disable once DoNotCallOverridableMethodsInConstructor Build (); // ensure selected row remains visible treeviewInspections.SizeAllocated += (o, args) => { TreeIter iter; if (treeviewInspections.Selection.GetSelected (out iter)) { var path = treeviewInspections.Model.GetPath (iter); treeviewInspections.ScrollToCell (path, treeviewInspections.Columns[0], false, 0f, 0f); } }; treeviewInspections.TooltipColumn = 2; treeviewInspections.HasTooltip = true; var toggleRenderer = new CellRendererToggle (); toggleRenderer.Toggled += delegate(object o, ToggledArgs args) { TreeIter iter; if (treeStore.GetIterFromString (out iter, args.Path)) { var provider = (BaseCodeIssueProvider)treeStore.GetValue (iter, 1); enableState[provider] = !enableState[provider]; } }; var titleCol = new TreeViewColumn (); treeviewInspections.AppendColumn (titleCol); titleCol.PackStart (toggleRenderer, false); titleCol.Sizing = TreeViewColumnSizing.Autosize; titleCol.SetCellDataFunc (toggleRenderer, delegate (TreeViewColumn treeColumn, CellRenderer cell, TreeModel model, TreeIter iter) { var provider = (BaseCodeIssueProvider)model.GetValue (iter, 1); if (provider == null) { toggleRenderer.Visible = false; return; } toggleRenderer.Visible = true; toggleRenderer.Active = enableState[provider]; }); var cellRendererText = new CellRendererText { Ellipsize = Pango.EllipsizeMode.End }; titleCol.PackStart (cellRendererText, true); titleCol.AddAttribute (cellRendererText, "markup", 0); titleCol.Expand = true; searchentryFilter.ForceFilterButtonVisible = true; searchentryFilter.RoundedShape = true; searchentryFilter.HasFrame = true; searchentryFilter.Ready = true; searchentryFilter.Visible = true; searchentryFilter.Entry.Changed += ApplyFilter; var comboRenderer = new CellRendererCombo { Alignment = Pango.Alignment.Center }; var col = treeviewInspections.AppendColumn ("Severity", comboRenderer); col.Sizing = TreeViewColumnSizing.GrowOnly; col.MinWidth = 100; col.Expand = false; var comboBoxStore = new ListStore (typeof(string), typeof(Severity)); // comboBoxStore.AppendValues (GetDescription (Severity.None), Severity.None); comboBoxStore.AppendValues (GetDescription (Severity.Error), Severity.Error); comboBoxStore.AppendValues (GetDescription (Severity.Warning), Severity.Warning); comboBoxStore.AppendValues (GetDescription (Severity.Hint), Severity.Hint); comboBoxStore.AppendValues (GetDescription (Severity.Suggestion), Severity.Suggestion); comboRenderer.Model = comboBoxStore; comboRenderer.Mode = CellRendererMode.Activatable; comboRenderer.TextColumn = 0; comboRenderer.Editable = true; comboRenderer.HasEntry = false; comboRenderer.Edited += delegate(object o, EditedArgs args) { TreeIter iter; if (!treeStore.GetIterFromString (out iter, args.Path)) return; TreeIter storeIter; if (!comboBoxStore.GetIterFirst (out storeIter)) return; do { if ((string)comboBoxStore.GetValue (storeIter, 0) == args.NewText) { var provider = (BaseCodeIssueProvider)treeStore.GetValue (iter, 1); var severity = (Severity)comboBoxStore.GetValue (storeIter, 1); severities[provider] = severity; return; } } while (comboBoxStore.IterNext (ref storeIter)); }; col.SetCellDataFunc (comboRenderer, delegate (TreeViewColumn treeColumn, CellRenderer cell, TreeModel model, TreeIter iter) { var provider = (BaseCodeIssueProvider)model.GetValue (iter, 1); if (provider == null) { comboRenderer.Visible = false; return; } var severity = severities[provider]; comboRenderer.Visible = true; comboRenderer.Text = GetDescription (severity); comboRenderer.BackgroundGdk = GetColor (severity); }); treeviewInspections.HeadersVisible = false; treeviewInspections.Model = treeStore; GetAllSeverities (); FillInspectors (null); }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild; OnUseDefaultCompilerChanged(); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst(out iter)) { do { if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string) { cmbCompiler.SetActiveIter(iter); break; } } while (cmbCompiler.Model.IterNext(ref iter)); } extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; text_BinDirectory.Text = config.OutputDirectory; text_TargetFile.Text = config.Output; text_ObjectsDirectory.Text = config.ObjectDirectory; text_DDocDir.Text = config.DDocDirectory; if (config.CustomDebugIdentifiers == null) { text_debugConstants.Text = ""; } else { text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers); } if (config.CustomVersionIdentifiers == null) { text_versionConstants.Text = ""; } else { text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers); } spin_debugLevel.Value = (double)config.DebugLevel; // Disable debug-specific fields on non-debug configurations text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode; if (model_compileTarget.GetIterFirst(out iter)) { do { if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1)) { combo_ProjectType.SetActiveIter(iter); break; } } while (model_compileTarget.IterNext(ref iter)); } text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries); text_Includes.Buffer.Text = string.Join("\n", proj.LocalIncludeCache.ParsedDirectories); // Remove old children list var depsChildren = ((ArrayList)vbox_ProjectDeps.AllChildren); for (int k = depsChildren.Count - 1; k >= 0; k--) { vbox_ProjectDeps.Remove((Widget)depsChildren[k]); } // Init new project dep list int i = 0; foreach (var prj in proj.ParentSolution.GetAllProjects()) { if (prj == proj) { continue; } var cb = new Gtk.CheckButton(prj.Name) { CanFocus = true, DrawIndicator = true, UseUnderline = false, Active = proj.ProjectDependencies.Contains(prj.ItemId) }; cb.Data.Add("prj", prj); vbox_ProjectDeps.Add(cb); var bc = (Box.BoxChild)vbox_ProjectDeps[cb]; bc.Expand = false; bc.Fill = false; bc.Position = i++; } vbox_ProjectDeps.ShowAll(); }
public PreferencesDialog() : base(null, "PreferencesDialog") { dialog = base.Dialog; dialog.Shown += delegate { if (settings.FirstRun) { on_redetectConnectionButton_clicked(redetectConnectionButton, EventArgs.Empty); base.Dialog.SkipPagerHint = false; base.Dialog.SkipTaskbarHint = false; } }; settings = Gui.Settings; /* Configure gui */ firewallImage.Pixbuf = new Gdk.Pixbuf (null, "FileFind.Meshwork.GtkClient.firewall-small.png"); internetConnectionImage.Pixbuf = new Gdk.Pixbuf (null, "FileFind.Meshwork.GtkClient.network1.png"); folderImage = Gui.LoadIcon (24, "folder"); sharedFoldersListStore = new Gtk.ListStore(typeof(string)); sharedFoldersList.Model = sharedFoldersListStore; var imageCell = new CellRendererPixbuf(); var textCell = new CellRendererText(); var column = new TreeViewColumn(); column.PackStart(imageCell, false); column.PackStart(textCell, true); column.SetCellDataFunc(imageCell, new TreeCellDataFunc(showFolderIcon)); column.SetCellDataFunc(textCell, new TreeCellDataFunc(showFolderText)); sharedFoldersList.AppendColumn(column); sharedFoldersList.RulesHint = true; Gtk.Drag.DestSet (sharedFoldersList, Gtk.DestDefaults.All, new Gtk.TargetEntry [] { new Gtk.TargetEntry ("text/uri-list", 0, 0) }, Gdk.DragAction.Copy); sharedFoldersList.DragDataReceived += OnSharedFoldersListDragDataReceived; advancedListStore = new Gtk.ListStore (typeof(string), typeof(int)); advancedList.Model = advancedListStore; advancedList.AppendColumn("Text", new CellRendererText(), "text", 0); advancedNotebook.ShowTabs = false; for (int x = 0; x < advancedNotebook.NPages; x++) { Widget widget = advancedNotebook.GetNthPage(x); advancedListStore.AppendValues (advancedNotebook.GetTabLabelText(widget), x); } TreeIter iter; advancedListStore.GetIterFirst(out iter); advancedList.Selection.SelectIter(iter); if (Gui.MainWindow != null) { dialog.TransientFor = Gui.MainWindow.Window; } else { // First run! } Gtk.Drag.DestSet (avatarButton, DestDefaults.All, target_table, Gdk.DragAction.Copy | Gdk.DragAction.Move); provider = new RSACryptoServiceProvider(); provider.ImportParameters(settings.EncryptionParameters); nodeid = Common.SHA512Str(provider.ToXmlString(false)); /**** Load options ****/ // General Tab nicknameEntry.Text = settings.NickName; nameEntry.Text = settings.RealName; nodeIdLabel.Markup = "<span font=\"monospace\">" + Common.FormatFingerprint(nodeid, 7) + "</span>"; emailEntry.Text = settings.Email; string avatarDirectory = Path.Combine (Settings.ConfigurationDirectory, "avatars"); string myAvatarFile = Path.Combine (avatarDirectory, String.Format ("{0}.png", nodeid)); if (File.Exists (myAvatarFile)) { avatarImage.Pixbuf = new Gdk.Pixbuf (myAvatarFile); } else { avatarImage.Pixbuf = new Gdk.Pixbuf (null, "FileFind.Meshwork.GtkClient.avatar-generic-large.png"); avatarImage.Sensitive = false; } // Networks tab networksListStore = new ListStore (typeof (NetworkInfo)); foreach (NetworkInfo networkInfo in settings.Networks) { networksListStore.AppendValues(networkInfo.Clone()); } networksTreeView.AppendColumn ("Network Name", new CellRendererText(), new TreeCellDataFunc (NetworkNameFunc)); networksTreeView.Model = networksListStore; // File Sharing Tab foreach (string dir in settings.SharedDirectories) { sharedFoldersListStore.AppendValues(new object[] {dir}); } downloadsChooser.SetCurrentFolder (settings.IncompleteDownloadDir); completedDownloadsChooser.SetCurrentFolder (settings.CompletedDownloadDir); // Connection Tab tcpPortLabel.Text = settings.TcpListenPort.ToString(); firewallStatusLabel.Text = String.Empty; if (CheckForNat()) { natStatusLabel.Markup = "You <b>are</b> behind a NAT router."; // XXX: Include UPnP Info! } else { natStatusLabel.Markup = "You <b>are not</b> behind a NAT router."; natOptionsTable.Sensitive = false; } bool foundIPv6Internal = false; bool foundIPv6External = false; foreach (IDestination destination in Core.DestinationManager.Destinations) { if (destination is IPv6Destination) { if (((IPv6Destination)destination).IsExternal) { foundIPv6External = true; } else { foundIPv6Internal = true; } } else if (destination is IPv4Destination && destination.IsExternal) { internetIPLabel.Text = ((IPDestination)destination).IPAddress.ToString(); } } if (foundIPv6External) { supportsIPv6Label.Text = "Yes"; } else if (foundIPv6Internal) { supportsIPv6Label.Text = "LAN Only"; } else { supportsIPv6Label.Text = "No"; } // Plugins Tab pluginsListStore = new ListStore (typeof(PluginInfo)); pluginsTreeView.AppendColumn ("Plugin Info", new CellRendererText(), new TreeCellDataFunc (PluginInfoFunc)); pluginsTreeView.Model = pluginsListStore; foreach (string fileName in settings.Plugins) { try { PluginInfo info = new PluginInfo (fileName); pluginsListStore.AppendValues (info); } catch (Exception ex) { LoggingService.LogError(ex); } } // Advanced -> Appearance startInTrayCheckButton.Active = settings.StartInTray; // Advanced -> Auto-connect Tab autoConnectTreeStore = new Gtk.TreeStore (typeof(object)); autoConnectList.Model = autoConnectTreeStore; CellRendererToggle autoConnectToggleCell = new CellRendererToggle(); autoConnectToggleCell.Toggled += OnAutoConnectItemToggled; CellRendererText autoConnectTextCell = new CellRendererText (); column = new TreeViewColumn (); column.PackStart (autoConnectToggleCell, false); column.SetCellDataFunc (autoConnectToggleCell, new TreeCellDataFunc(ShowAutoConnectToggle)); column.PackStart (autoConnectTextCell, true); column.SetCellDataFunc (autoConnectTextCell, new TreeCellDataFunc(ShowAutoConnectName)); autoConnectList.AppendColumn (column); autoConnectList.AppendColumn ("IP", new CellRendererText (), new Gtk.TreeCellDataFunc (ShowAutoConnectIP)); PopulateAutoConnectList (); autoConnectCountSpinButton.Value = settings.AutoConnectCount; // Advanced -> Connection nodePortSpinButton.Value = settings.TcpListenPort; nodePortOpenCheckButton.Active = settings.TcpListenPortOpen; detectIPCheckButton.Active = settings.DetectInternetIPOnStart; externalIPv4AddressEntry.Text = internetIPLabel.Text; stunServerEntry.Text = settings.StunServer; ipv6LocalInterfaceComboBox.Model = new ListStore(typeof(string), typeof(int)); ((ListStore)ipv6LocalInterfaceComboBox.Model).AppendValues("Disabled", -1); var interfaces = new Dictionary<string, int>(); foreach (InterfaceAddress addr in Core.OS.GetInterfaceAddresses()) { if (addr.Address.AddressFamily == AddressFamily.InterNetworkV6 && (!IPAddress.IsLoopback(addr.Address))) { if (!interfaces.ContainsKey(addr.Name)) interfaces[addr.Name] = addr.InterfaceIndex; } } foreach (string name in interfaces.Keys) { ((ListStore)ipv6LocalInterfaceComboBox.Model).AppendValues(name, interfaces[name]); } if (ipv6LocalInterfaceComboBox.Model.GetIterFirst(out iter)) { do { int index = (int)ipv6LocalInterfaceComboBox.Model.GetValue(iter, 1); if (index == settings.IPv6LinkLocalInterfaceIndex) { ipv6LocalInterfaceComboBox.SetActiveIter(iter); break; } } while (ipv6LocalInterfaceComboBox.Model.IterNext(ref iter)); } UpdateFirewallLabel(); // Advanced -> File Transfer limitDownSpeedCheckButton.Active = settings.EnableGlobalDownloadSpeedLimit; limitDownSpeedSpinButton.Value = settings.GlobalDownloadSpeedLimit; limitUpSpeedCheckButton.Active = settings.EnableGlobalUploadSpeedLimit; limitUpSpeedSpinButton.Value = settings.GlobalUploadSpeedLimit; // I cant seem to make anything default with just the glade file. nicknameEntry.GrabFocus(); }
private void GenerateNotebookPages() { string platformName = MainClass.Settings.Platform.Name; foreach(Rule rl in MainClass.Settings.Platform.Rules){ bool iOsNoMac = false; if( (rl.Tag == -1 ) && !MainClass.Settings.ShowUnsupportedDevices) continue; if( (rl.Tag == -2 ) && !MainClass.Settings.ShowDebugDevices) continue; bool validDevice = true; if(!Device.CheckDevice(rl.Specific) ){ Tool.Logger.Debug("Invalid Device " + rl.Specific); validDevice = false; } ScrolledWindow sw= new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedOut; TreeView tvList = new TreeView(); List<CombinePublish> lcp = project.ProjectUserSetting.CombinePublish.FindAll(x=> x.combineRule.FindIndex(y=>y.ConditionName==platformName && y.RuleId == rl.Id) >-1); List<CombinePublish> lcpDennied = new List<CombinePublish>(); string deviceName = rl.Name; int deviceTyp = rl.Id; ListStore ls = new ListStore(typeof(bool),typeof(string),typeof(CombinePublish),typeof(string),typeof(bool)); string ico="empty.png"; switch (deviceTyp) { case (int)DeviceType.Android_1_6:{ ico = "android.png"; break;} case (int)DeviceType.Android_2_2:{ ico = "android.png"; break;} case (int)DeviceType.Bada_1_0: case (int)DeviceType.Bada_1_1: case (int)DeviceType.Bada_1_2: case (int)DeviceType.Bada_2_0:{ ico = "bada.png"; break;} case (int)DeviceType.Symbian_9_4:{ ico = "symbian.png"; break;} case (int)DeviceType.iOS_5_0:{ ico = "apple.png"; if(!MainClass.Platform.IsMac){ iOsNoMac = true; } break; } case (int)DeviceType.PocketPC_2003SE: case (int)DeviceType.WindowsMobile_5: case (int)DeviceType.WindowsMobile_6:{ ico = "windows.png"; break;} case (int)DeviceType.Windows:{ ico = "win32.png"; break;} case (int)DeviceType.MacOs:{ ico = "macos.png"; break;} } List<CombinePublish> tmp = lcp.FindAll(x=>x.IsSelected == true); NotebookLabel nl = new NotebookLabel(ico,String.Format("{0} ({1})",deviceName,tmp.Count )); nl.Tag=deviceTyp; if(iOsNoMac){ Label lbl=new Label(MainClass.Languages.Translate("ios_available_Mac")); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; lbl.ModifyFont(customFont); notebook.AppendPage(lbl, nl); continue; } if(!validDevice){ Label lbl=new Label(MainClass.Languages.Translate("publish_tool_missing")); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; lbl.ModifyFont(customFont); notebook.AppendPage(lbl, nl); continue; } ; CellRendererToggle crt = new CellRendererToggle(); crt.Activatable = true; crt.Sensitive = true; tvList.AppendColumn ("", crt, "active", 0); Gtk.CellRendererText fileNameRenderer = new Gtk.CellRendererText(); Gtk.CellRendererText collumnResolRenderer = new Gtk.CellRendererText(); tvList.AppendColumn(MainClass.Languages.Translate("file_name"),fileNameRenderer, "text", 1); tvList.AppendColumn(MainClass.Languages.Translate("resolution_f1"), collumnResolRenderer, "text", 1); tvList.Columns[1].SetCellDataFunc(fileNameRenderer, new Gtk.TreeCellDataFunc(RenderCombine)); tvList.Columns[2].SetCellDataFunc(collumnResolRenderer, new Gtk.TreeCellDataFunc(RenderResolution)); // povolene resolution pre danu platformu PlatformResolution listPR = MainClass.Settings.PlatformResolutions.Find(x=>x.IdPlatform ==deviceTyp); Device dvc = project.DevicesSettings.Find(x=>x.TargetPlatformId ==deviceTyp); string stringTheme = ""; List<System.IO.DirectoryInfo> themeResolution = new List<System.IO.DirectoryInfo>(); // resolution z adresara themes po novom if((project.NewSkin) && (dvc != null)){ Skin skin =dvc.Includes.Skin; if((skin != null) && ( !String.IsNullOrEmpty(skin.Name)) && (!String.IsNullOrEmpty(skin.Theme)) ){ string skinDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, MainClass.Settings.SkinDir); stringTheme = System.IO.Path.Combine(skinDir,skin.Name); stringTheme = System.IO.Path.Combine(stringTheme, "themes"); stringTheme = System.IO.Path.Combine(stringTheme, skin.Theme); if (System.IO.Directory.Exists(stringTheme)){ System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(stringTheme); themeResolution = new List<System.IO.DirectoryInfo>(di.GetDirectories()); } } } crt.Toggled += delegate(object o, ToggledArgs args) { if((deviceTyp == (int)DeviceType.Windows)||(deviceTyp == (int)DeviceType.MacOs)){ if(!MainClass.LicencesSystem.CheckFunction("windowsandmac",this)){ return; } } TreeIter iter; if (ls.GetIter (out iter, new TreePath(args.Path))) { bool old = (bool) ls.GetValue(iter,0); CombinePublish cp =(CombinePublish) ls.GetValue(iter,2); cp.IsSelected = !old; ls.SetValue(iter,0,!old); List<CombinePublish> tmp2 = lcp.FindAll(x=>x.IsSelected == true); nl.SetLabel (String.Format("{0} ({1})",deviceName,tmp2.Count )); //if(dvc == null) return; //if(dvc.Includes == null) return; if(dvc.Includes.Skin == null) return; if(String.IsNullOrEmpty(dvc.Includes.Skin.Name) || String.IsNullOrEmpty(dvc.Includes.Skin.Theme)) return; if(cp.IsSelected){ // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x=>x.ConditionId == MainClass.Settings.Resolution.Id); if(cc == null) return; /// nema ziadne rozlisenie v combinacii int indxResol = themeResolution.FindIndex(x=>x.Name.ToLower() == cc.RuleName.ToLower()); if(indxResol<0){ // theme chyba prislusne rozlisenie string error =String.Format("Invalid {0} Skin and {1} Theme, using in {2}. Missing resolutions: {3}. ",dvc.Includes.Skin.Name,dvc.Includes.Skin.Theme,deviceName,cc.RuleName.ToLower()); MainClass.MainWindow.OutputConsole.WriteError(error+"\n"); List<string> lst = new List<string>(); lst.Add(error); MainClass.MainWindow.ErrorWritte("","",lst); } } } }; int cntOfAdded = 0; foreach (CombinePublish cp in lcp){ bool isValid = cp.IsSelected; if (!validDevice) isValid = false; // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x=>x.ConditionId == MainClass.Settings.Resolution.Id); if(cc == null) continue; /// nema ziadne rozlisenie v combinacii int indx = MainClass.Settings.Resolution.Rules.FindIndex(x=> x.Id == cc.RuleId ); if(indx<0) continue; /// rozlisenie pouzite v danej combinacii nexistuje if(cc!= null){ bool isValidResolution = false; //ak nema definovane ziadne povolenia, tak povolene su vsetky if((listPR==null) || (listPR.AllowResolution == null) || (listPR.AllowResolution.Count<1)){ isValidResolution = true; } else { isValidResolution = listPR.IsValidResolution(cc.RuleId); } if(isValidResolution){ // po novom vyhodom aj tie ktore niesu v adresaru themes - pokial je thema definovana if((project.NewSkin) && (themeResolution.Count > 0)){ //cntResolution = 0; int indxResol = themeResolution.FindIndex(x=>x.Name.ToLower() == cc.RuleName.ToLower()); if(indxResol>-1){ ls.AppendValues(isValid,cp.ProjectName,cp,cp.ProjectName,true); cntOfAdded++; } else { lcpDennied.Add(cp); } } else { ls.AppendValues(isValid,cp.ProjectName,cp,cp.ProjectName,true); cntOfAdded++; } } else { lcpDennied.Add(cp); } } //} } // pridam tie zakazane, ktore su vybrate na publish foreach (CombinePublish cp in lcpDennied){ if(cp.IsSelected){ ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false); cntOfAdded++; } } if(cntOfAdded == 0){ MainClass.MainWindow.OutputConsole.WriteError(String.Format("Missing publish settings for {0}.\n",deviceName)); } bool showAll = false; tvList.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args){ if (args.Event.Button == 3) { TreeSelection ts = tvList.Selection; Gtk.TreePath[] selRow = ts.GetSelectedRows(); if(selRow.Length<1){ TreeIter tiFirst= new TreeIter(); ls.GetIterFirst(out tiFirst); tvList.Selection.SelectIter(tiFirst); selRow = ts.GetSelectedRows(); } if(selRow.Length<1) return; Gtk.TreePath tp = selRow[0]; TreeIter ti = new TreeIter(); ls.GetIter(out ti,tp); CombinePublish combinePublish= (CombinePublish)ls.GetValue(ti,2); if(combinePublish!=null){ Menu popupMenu = new Menu(); if(!showAll){ MenuItem miShowDenied = new MenuItem( MainClass.Languages.Translate("show_denied" )); miShowDenied.Activated+= delegate(object sender, EventArgs e) { // odoberem zakazane, ktore sa zobrazuju kedze su zaceknute na publish List<TreeIter> lst= new List<TreeIter>(); ls.Foreach((model, path, iterr) => { bool cp =(bool) ls.GetValue(iterr,4); bool selected =(bool) ls.GetValue(iterr,0); if(!cp && selected){ lst.Add(iterr); } return false; }); foreach(TreeIter ti2 in lst){ TreeIter ti3 =ti2; ls.Remove(ref ti3); } // pridam zakazane if( (lcpDennied==null) || (lcpDennied.Count<1)) return; foreach (CombinePublish cp in lcpDennied){ ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false); } showAll = true; }; popupMenu.Append(miShowDenied); } else { MenuItem miHideDenied = new MenuItem( MainClass.Languages.Translate("hide_denied" )); miHideDenied.Activated+= delegate(object sender, EventArgs e) { List<TreeIter> lst= new List<TreeIter>(); ls.Foreach((model, path, iterr) => { bool cp =(bool) ls.GetValue(iterr,4); bool selected =(bool) ls.GetValue(iterr,0); if(!cp && !selected){ lst.Add(iterr); } return false; }); foreach(TreeIter ti2 in lst){ TreeIter ti3 =ti2; ls.Remove(ref ti3); } showAll = false; }; popupMenu.Append(miHideDenied); } popupMenu.Append(new SeparatorMenuItem()); MenuItem miCheckAll = new MenuItem( MainClass.Languages.Translate("check_all" )); miCheckAll.Activated+= delegate(object sender, EventArgs e) { if((deviceTyp == (int)DeviceType.Windows)||(deviceTyp == (int)DeviceType.MacOs)){ if(!MainClass.LicencesSystem.CheckFunction("windowsandmac",this)){ return; } } int cnt = 0; ls.Foreach((model, path, iterr) => { CombinePublish cp =(CombinePublish) ls.GetValue(iterr,2); cp.IsSelected = true; ls.SetValue(iterr,0,true); cnt ++; return false; }); nl.SetLabel (String.Format("{0} ({1})",deviceName,cnt )); }; popupMenu.Append(miCheckAll); MenuItem miUnCheckAll = new MenuItem( MainClass.Languages.Translate("uncheck_all" )); miUnCheckAll.Activated+= delegate(object sender, EventArgs e) { ls.Foreach((model, path, iterr) => { CombinePublish cp =(CombinePublish) ls.GetValue(iterr,2); cp.IsSelected = false; ls.SetValue(iterr,0,false); return false; }); nl.SetLabel (String.Format("{0} ({1})",deviceName,0 )); }; popupMenu.Append(miUnCheckAll); popupMenu.Popup(); popupMenu.ShowAll(); } } }; tvList.Model = ls; if (!validDevice) tvList.Sensitive = false; sw.Add(tvList); notebook.AppendPage(sw, nl); } }
void BindProviderCombobox() { providerListStore = new ListStore (typeof(string), typeof(Int64)); ProviderCombobox.Model = providerListStore; foreach (var item in Providers) { providerListStore.AppendValues (item.Name, item.Id); } TreeIter iter; if (providerListStore.GetIterFirst (out iter)) { ProviderCombobox.SetActiveIter (iter); } }
public PdfExportDialog(GameManager manager, ITranslations translations) : base(translations, "PdfExportDialog.ui", "pdfexportbox") { pdfExporter = new PdfExporter (translations); this.manager = manager; games_spinbutton.Value = 10; checkbox_logic.Active = checkbox_calculation.Active = checkbox_verbal.Active = true; // Use defaults from Preferences switch ((GameDifficulty) Preferences.Get <int> (Preferences.DifficultyKey)) { case GameDifficulty.Easy: rb_easy.Active = rb_easy.HasFocus = true; break; case GameDifficulty.Medium: rb_medium.Active = rb_medium.HasFocus = true; break; case GameDifficulty.Master: rb_master.Active = rb_master.HasFocus = true; break; } // File selection string def_file; def_file = System.IO.Path.Combine ( Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), // Translators: default file name used when exporting PDF files (keep the pdf extension please) Catalog.GetString ("games.pdf")); file = new BrowseFile (hbox_file, def_file, true); FileFilter[] filters = new FileFilter [2]; filters[0] = new FileFilter (); filters[0].AddPattern ("*.pdf"); filters[0].Name = Catalog.GetString ("PDF files"); filters[1] = new FileFilter (); filters[1].AddPattern ("*.*"); filters[1].Name = Catalog.GetString ("All files"); file.Filters = filters; ListStore layout_store = new ListStore (typeof (string), typeof (int)); // DisplayName, index to array CellRenderer layout_cell = new CellRendererText (); layout_combo.Model = layout_store; layout_combo.PackStart (layout_cell, true); layout_combo.SetCellDataFunc (layout_cell, ComboBoxCellFunc); int [] per_side = pdfExporter.PagesPerSide; for (int i = 0; i < per_side.Length; i++) layout_store.AppendValues (per_side[i].ToString (), per_side[i]); // Default value TreeIter iter; bool more = layout_store.GetIterFirst (out iter); while (more) { if ((int) layout_store.GetValue (iter, COLUMN_VALUE) == DEF_SIDEVALUE) { layout_combo.SetActiveIter (iter); break; } more = layout_store.IterNext (ref iter); } }
private void on_okButton_clicked(object o, EventArgs args) { dialog.Respond((int)Gtk.ResponseType.None); ArrayList badOptions = new ArrayList(); if (nicknameEntry.Text == String.Empty) { badOptions.Add("Nickname"); } if (Directory.Exists(completedDownloadsChooser.CurrentFolder) == false) { badOptions.Add("Completed dowmnloads directory"); } if (Directory.Exists(downloadsChooser.CurrentFolder) == false) { badOptions.Add("Incomplete dowmnloads directory"); } if (Common.IsValidIP(externalIPv4AddressEntry.Text) == false) { badOptions.Add("External IP Address"); } if (networksListStore.IterNChildren() == 0) { badOptions.Add("Please define at least one network"); } if (badOptions.Count > 0) { BadOptionsDialog badOptionsWindow = new BadOptionsDialog(dialog, badOptions); badOptionsWindow.Run(); return; } settings.NickName = nicknameEntry.Text; settings.RealName = nameEntry.Text; settings.Email = emailEntry.Text; settings.Networks.Clear(); foreach (object[] row in networksListStore) { settings.Networks.Add((NetworkInfo)row[0]); } var newSharedDirectories = new List <string>(); TreeIter iter; sharedFoldersListStore.GetIterFirst(out iter); if (sharedFoldersListStore.IterIsValid(iter)) { foreach (object[] currentRow in sharedFoldersListStore) { newSharedDirectories.Add((string)currentRow[0]); } } settings.SharedDirectories = newSharedDirectories.ToArray(); settings.CompletedDownloadDir = completedDownloadsChooser.CurrentFolder; settings.IncompleteDownloadDir = downloadsChooser.CurrentFolder; settings.SavedDestinationInfos.Clear(); TCPIPv4Destination destination = new TCPIPv4Destination(IPAddress.Parse(externalIPv4AddressEntry.Text), (uint)nodePortSpinButton.Value, nodePortOpenCheckButton.Active); DestinationInfo externalIPInfo = destination.CreateDestinationInfo(); externalIPInfo.Local = true; settings.SavedDestinationInfos.Add(externalIPInfo); settings.TcpListenPortOpen = nodePortOpenCheckButton.Active; settings.TcpListenPort = (int)nodePortSpinButton.Value; if (ipv6LocalInterfaceComboBox.GetActiveIter(out iter)) { int index = (int)ipv6LocalInterfaceComboBox.Model.GetValue(iter, 1); settings.IPv6LinkLocalInterfaceIndex = index; } else { settings.IPv6LinkLocalInterfaceIndex = -1; } if (stunServerEntry.Text != String.Empty) { settings.StunServer = stunServerEntry.Text; } else { settings.StunServer = Settings.DefaultStunServer; } settings.StartInTray = startInTrayCheckButton.Active; settings.AutoConnectCount = autoConnectCountSpinButton.ValueAsInt; string avatarDirectory = Path.Combine(Settings.ConfigurationDirectory, "avatars"); if (Directory.Exists(avatarDirectory) == false) { Directory.CreateDirectory(avatarDirectory); } string myAvatarFile = Path.Combine(avatarDirectory, String.Format("{0}.png", nodeid)); //if (avatarImage.Pixbuf != null) if (avatarImage.Sensitive == true) { avatarImage.Pixbuf.Save(myAvatarFile, "png"); } else if (File.Exists(myAvatarFile)) { File.Delete(myAvatarFile); } settings.Plugins.Clear(); foreach (object[] row in pluginsListStore) { PluginInfo info = (PluginInfo)row[0]; settings.Plugins.Add(info.FilePath); } settings.SetFirstRun(false); settings.SaveSettings(); if (Core.AvatarManager != null) { Core.AvatarManager.UpdateMyAvatar(); } // Advanced -> File Transfer settings.EnableGlobalDownloadSpeedLimit = limitDownSpeedCheckButton.Active; settings.GlobalDownloadSpeedLimit = Convert.ToInt32(limitDownSpeedSpinButton.Value); settings.EnableGlobalUploadSpeedLimit = limitUpSpeedCheckButton.Active; settings.GlobalUploadSpeedLimit = Convert.ToInt32(limitUpSpeedSpinButton.Value); // Save and go! Core.ReloadSettings(); dialog.Respond((int)Gtk.ResponseType.Ok); }
protected void UpdateCombo() { ListStore store = new ListStore (typeof(string)); comboboxConnections.Model = store; foreach (Connection c in Connections) store.AppendValues (c.ConnectionName); SelectedConnection = (String)MachineConfig.ConfigSource.Configs ["Default"].Get ("ConnectionName", String.Empty); if (SelectedConnection != String.Empty) { if (Connections.Find (m => m.ConnectionName == SelectedConnection) == null) { MachineConfig.ConfigSource.Configs ["Default"].Set ("ConnectionName", String.Empty); MachineConfig.ConfigSource.Save (); SelectedConnection = String.Empty; } else { TreeIter tempIter; store.GetIterFirst (out tempIter); do { if ((string)store.GetValue (tempIter, 0) == SelectedConnection) { comboboxConnections.SetActiveIter (tempIter); break; } } while (store.IterNext (ref tempIter)); } } else comboboxConnections.Active = 0; if (comboboxConnections.Active == -1) server = entryUser.Text = entryPassword.Text = ""; }
void OnButtonPressed(object sender, Gtk.ButtonPressEventArgs args) { switch (args.Event.Button) { case 3: // third mouse button (right-click) clickedTask = null; Gtk.TreeView tv = sender as Gtk.TreeView; if (tv == null) return; Gtk.TreeModel model = tv.Model; Gtk.TreeIter iter; Gtk.TreePath path; Gtk.TreeViewColumn column = null; if (!tv.GetPathAtPos ((int) args.Event.X, (int) args.Event.Y, out path, out column)) return; if (!model.GetIter (out iter, path)) return; clickedTask = model.GetValue (iter, 0) as ITask; if (clickedTask == null) return; Menu popupMenu = new Menu (); ImageMenuItem item; item = new ImageMenuItem (Catalog.GetString ("_Notes...")); item.Image = new Gtk.Image (noteIcon); item.Activated += OnShowTaskNotes; popupMenu.Add (item); popupMenu.Add (new SeparatorMenuItem ()); item = new ImageMenuItem (Catalog.GetString ("_Delete task")); item.Image = new Gtk.Image(Gtk.Stock.Delete, IconSize.Menu); item.Activated += OnDeleteTask; popupMenu.Add (item); item = new ImageMenuItem(Catalog.GetString ("_Edit task")); item.Image = new Gtk.Image(Gtk.Stock.Edit, IconSize.Menu); item.Activated += OnEditTask; popupMenu.Add (item); /* * Depending on the currently selected task's taskList, we create a context popup * here in order to enable changing taskLists. The list of available taskLists * is pre-filtered as to not contain the current taskList and the AllTaskList. */ var filteredTaskLists = new ListStore (typeof (ITaskList)); foreach (var cat in application.BackendManager.TaskLists) { if (cat != null && !(cat.ListType == TaskListType.Smart) && !cat.Contains (clickedTask)) filteredTaskLists.AppendValues (cat); } // The taskLists submenu is only created in case we actually provide at least one taskList. if (filteredTaskLists.GetIterFirst(out iter)) { Menu taskListMenu = new Menu(); TaskListMenuItem taskListItem; filteredTaskLists.Foreach(delegate(TreeModel t, TreePath p, TreeIter i) { taskListItem = new TaskListMenuItem((ITaskList)t.GetValue(i, 0)); taskListItem.Activated += OnChangeTaskList; taskListMenu.Add(taskListItem); return false; }); // TODO Needs translation. item = new ImageMenuItem(Catalog.GetString("_Change list")); item.Image = new Gtk.Image(Gtk.Stock.Convert, IconSize.Menu); item.Submenu = taskListMenu; popupMenu.Add(item); } popupMenu.ShowAll(); popupMenu.Popup (); // Logger.Debug ("Right clicked on task: " + task.Name); break; } }
public Gtk.Widget MakeSyncPane () { Gtk.VBox vbox = new Gtk.VBox (false, 0); vbox.Spacing = 4; vbox.BorderWidth = 8; Gtk.HBox hbox = new Gtk.HBox (false, 4); Gtk.Label label = new Gtk.Label (Catalog.GetString ("Ser_vice:")); label.Xalign = 0; label.Show (); hbox.PackStart (label, false, false, 0); // Populate the store with all the available SyncServiceAddins syncAddinStore = new Gtk.ListStore (typeof (SyncServiceAddin)); syncAddinIters = new Dictionary<string,Gtk.TreeIter> (); SyncServiceAddin [] addins = Tomboy.DefaultNoteManager.AddinManager.GetSyncServiceAddins (); Array.Sort (addins, CompareSyncAddinsByName); foreach (SyncServiceAddin addin in addins) { Gtk.TreeIter iter = syncAddinStore.Append (); syncAddinStore.SetValue (iter, 0, addin); syncAddinIters [addin.Id] = iter; } syncAddinCombo = new Gtk.ComboBox (syncAddinStore); label.MnemonicWidget = syncAddinCombo; Gtk.CellRendererText crt = new Gtk.CellRendererText (); syncAddinCombo.PackStart (crt, true); syncAddinCombo.SetCellDataFunc (crt, new Gtk.CellLayoutDataFunc (ComboBoxTextDataFunc)); // Read from Preferences which service is configured and select it // by default. Otherwise, just select the first one in the list. string addin_id = Preferences.Get ( Preferences.SYNC_SELECTED_SERVICE_ADDIN) as String; Gtk.TreeIter active_iter; if (addin_id != null && syncAddinIters.ContainsKey (addin_id)) { active_iter = syncAddinIters [addin_id]; syncAddinCombo.SetActiveIter (active_iter); } else { if (syncAddinStore.GetIterFirst (out active_iter) == true) { syncAddinCombo.SetActiveIter (active_iter); } } syncAddinCombo.Changed += OnSyncAddinComboChanged; syncAddinCombo.Show (); hbox.PackStart (syncAddinCombo, true, true, 0); hbox.Show (); vbox.PackStart (hbox, false, false, 0); // Get the preferences GUI for the Sync Addin if (active_iter.Stamp != Gtk.TreeIter.Zero.Stamp) selectedSyncAddin = syncAddinStore.GetValue (active_iter, 0) as SyncServiceAddin; if (selectedSyncAddin != null) syncAddinPrefsWidget = selectedSyncAddin.CreatePreferencesControl (OnSyncAddinPrefsChanged); if (syncAddinPrefsWidget == null) { Gtk.Label l = new Gtk.Label (Catalog.GetString ("Not configurable")); l.Yalign = 0.5f; l.Yalign = 0.5f; syncAddinPrefsWidget = l; } if (syncAddinPrefsWidget != null && addin_id != null && syncAddinIters.ContainsKey (addin_id) && selectedSyncAddin.IsConfigured) syncAddinPrefsWidget.Sensitive = false; syncAddinPrefsWidget.Show (); syncAddinPrefsContainer = new Gtk.VBox (false, 0); syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0); syncAddinPrefsContainer.Show (); vbox.PackStart (syncAddinPrefsContainer, true, true, 10); // Autosync preference int timeout = (int) Preferences.Get (Preferences.SYNC_AUTOSYNC_TIMEOUT); if (timeout > 0 && timeout < 5) { timeout = 5; Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, 5); } Gtk.HBox autosyncBox = new Gtk.HBox (false, 5); // Translators: This is and the next string go together. // Together they look like "Automatically Sync in Background Every [_] Minutes", // where "[_]" is a GtkSpinButton. autosyncCheck = new Gtk.CheckButton (Catalog.GetString ("Automaticall_y Sync in Background Every")); autosyncSpinner = new Gtk.SpinButton (5, 1000, 1); autosyncSpinner.Value = timeout >= 5 ? timeout : 10; Gtk.Label autosyncExtraText = // Translators: See above comment for details on // this string. new Gtk.Label (Catalog.GetString ("Minutes")); autosyncCheck.Active = autosyncSpinner.Sensitive = timeout >= 5; EventHandler updateTimeoutPref = (o, e) => { Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, autosyncCheck.Active ? (int) autosyncSpinner.Value : -1); }; autosyncCheck.Toggled += (o, e) => { autosyncSpinner.Sensitive = autosyncCheck.Active; updateTimeoutPref (o, e); }; autosyncSpinner.ValueChanged += updateTimeoutPref; autosyncBox.PackStart (autosyncCheck); autosyncBox.PackStart (autosyncSpinner); autosyncBox.PackStart (autosyncExtraText); vbox.PackStart (autosyncBox, false, true, 0); Gtk.HButtonBox bbox = new Gtk.HButtonBox (); bbox.Spacing = 4; bbox.LayoutStyle = Gtk.ButtonBoxStyle.End; // "Advanced..." button to bring up extra sync config dialog Gtk.Button advancedConfigButton = new Gtk.Button (Catalog.GetString ("_Advanced...")); advancedConfigButton.Clicked += OnAdvancedSyncConfigButton; advancedConfigButton.Show (); bbox.PackStart (advancedConfigButton, false, false, 0); bbox.SetChildSecondary (advancedConfigButton, true); resetSyncAddinButton = new Gtk.Button (Gtk.Stock.Clear); resetSyncAddinButton.Clicked += OnResetSyncAddinButton; resetSyncAddinButton.Sensitive = (selectedSyncAddin != null && addin_id == selectedSyncAddin.Id && selectedSyncAddin.IsConfigured); resetSyncAddinButton.Show (); bbox.PackStart (resetSyncAddinButton, false, false, 0); // TODO: Tabbing should go directly from sync prefs widget to here // TODO: Consider connecting to "Enter" pressed in sync prefs widget saveSyncAddinButton = new Gtk.Button (Gtk.Stock.Save); saveSyncAddinButton.Clicked += OnSaveSyncAddinButton; saveSyncAddinButton.Sensitive = (selectedSyncAddin != null && (addin_id != selectedSyncAddin.Id || !selectedSyncAddin.IsConfigured)); saveSyncAddinButton.Show (); bbox.PackStart (saveSyncAddinButton, false, false, 0); syncAddinCombo.Sensitive = (selectedSyncAddin == null || addin_id != selectedSyncAddin.Id || !selectedSyncAddin.IsConfigured); bbox.Show (); vbox.PackStart (bbox, false, false, 0); vbox.ShowAll (); return vbox; }
void SetTreeValues() { // name, id ListStore store = new ListStore (typeof (string), typeof (string)); foreach (SourceTag t in currentLanguage.Tags) store.AppendValues (t.Name, t.Id); stylesTreeView.Model = store; TreeIter first; store.GetIterFirst (out first); stylesTreeView.Selection.SelectIter (first); }
public PreferencesDialog() : base("PreferencesDialog.ui", "preferences") { bool more; TreeIter iter; string effect, selected; transition_store = new ListStore (typeof (string), typeof (string)); // DisplayName, Name CellRenderer transition_cell = new CellRendererText (); transition_combo.Model = transition_store; transition_combo.PackStart (transition_cell, true); transition_combo.SetCellDataFunc (transition_cell, Utils.ComboBoxCellFunc); LoadTransitionsIntoCombo (); thumbnail_store = new ListStore (typeof (string), typeof (int)); // DisplayName, int CellRenderer thumbnail_cell = new CellRendererText (); thumbnail_combo.Model = thumbnail_store; thumbnail_combo.PackStart (thumbnail_cell, true); thumbnail_combo.SetCellDataFunc (thumbnail_cell, Utils.ComboBoxCellFunc); LoadThumbnailsIntoCombo (); textposition_store = new ListStore (typeof (string), typeof (int)); // DisplayName, int CellRenderer textposition_cell = new CellRendererText (); textposition_combo.Model = textposition_store; textposition_combo.PackStart (textposition_cell, true); textposition_combo.SetCellDataFunc (textposition_cell, Utils.ComboBoxCellFunc); LoadTextPositionsIntoCombo (); projectsdir = new BrowseFile (projectsdir_hbox, Mistelix.Preferences.GetStringValue (Preferences.ProjectsDirectoryKey), false); videosdir = new BrowseFile (videosdir_hbox, Mistelix.Preferences.GetStringValue (Preferences.VideosDirectoryKey), false); imagesdir = new BrowseFile (imagesdir_hbox, Mistelix.Preferences.GetStringValue (Preferences.ImagesDirectoryKey), false); audiodir = new BrowseFile (audiodir_hbox, Mistelix.Preferences.GetStringValue (Preferences.AudioDirectoryKey), false); duration_spin.Value = Mistelix.Preferences.GetIntValue (Preferences.DefaultDurationKey); // Default Transition effect selected = Mistelix.Preferences.GetStringValue (Preferences.DefaultTransitionKey); more = transition_store.GetIterFirst (out iter); while (more) { effect = (string) transition_store.GetValue (iter, (int) ColumnsCombo.Column_Name); if (effect.Equals (selected)) { transition_combo.SetActiveIter (iter); break; } more = transition_store.IterNext (ref iter); } // Default thumbnail size int thumbnail = Mistelix.Preferences.GetIntValue (Preferences.ThumbnailSizeKey); int current; more = thumbnail_store.GetIterFirst (out iter); while (more) { current = (int) thumbnail_store.GetValue (iter, (int) ColumnsCombo.Column_Name); if (thumbnail == current) { thumbnail_combo.SetActiveIter (iter); break; } more = thumbnail_store.IterNext (ref iter); } // Default text position box int position = Mistelix.Preferences.GetIntValue (Preferences.DefaultTextPositionKey); more = textposition_store.GetIterFirst (out iter); while (more) { current = (int) textposition_store.GetValue (iter, (int) ColumnsCombo.Column_Name); if (position == current) { textposition_combo.SetActiveIter (iter); break; } more = textposition_store.IterNext (ref iter); } }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build (); List<Categoria> categorias = new List<Categoria> (); categorias.Add (new Categoria (1, "Uno")); categorias.Add (new Categoria (2, "Dos")); categorias.Add (new Categoria (3, "Tres")); categorias.Add (new Categoria (4, "Cuatro")); int categoriaId = -1; CellRendererText cellRendererText = new CellRendererText (); comboBox.PackStart (cellRendererText, false); comboBox.AddAttribute (cellRendererText, "text", 1); // CellRendererText cellRendererText2 = new CellRendererText (); // comboBox.PackStart (cellRendererText2, false); // comboBox.AddAttribute (cellRendererText2, "text", 1); ListStore listStore = new ListStore (typeof(int), typeof(string)); TreeIter treeIterInicial = listStore.AppendValues ((ulong)0, "<sin asignar>"); IDbCommand dbCommand = AppDomain.Instance.DvConnection.CreateCommand (); dbCommand.CommandText = "selected id, nombre from categoria"; IDataReader dataReader = dbCommand.ExecuteReader (); while (dataReader.Read()) { object id = dataReader ["id"]; object nombre = dataReader ["nombre"]; foreach (Categoria categoria in categorias) { TreeIter currentIter = listStore.AppendValues (categoria.Id, categoria.Nombre); if (categoria.Id == categoriaId) treeIterInicial = currentIter; } // listStore.AppendValues (1, "Uno"); // listStore.AppendValues (2, "Dos"); comboBox.Model = listStore; comboBox.SetActiveIter (treeIterInicial); TreeIter currentTreeIter; listStore.GetIterFirst (out currentTreeIter); listStore.GetIterFirst (out currentTreeIter); do { if(categoriaId.Equals(listStore.GetValue(treeIterInicial, 0))) { comboBox.SetActiveIter(currentTreeIter); break; } } while (listStore.IterNext (ref currentTreeIter)); //listStore.GetValue (currentTreeIter, 0); propertiesAction.Activated += delegate { TreeIter treeIter; bool activeIter = comboBox.GetActiveIter (out treeIter); object id = activeIter ? listStore.GetValue (treeIter, 0) : null; // ? significa el boolean si tiene algo dentro ejecuta la primera orden y sino, es null. Console.WriteLine ("id={0}", id); }; }
// When finished gfax.Destinations will contain a list of contacts // of Phonebook.Contact type. private void on_SendfaxButton_clicked(object o, EventArgs args) { Gtk.TreeIter iter = new Gtk.TreeIter(); ArrayList rows = new ArrayList(); if (includeFilename == "do_filename") { filename = FilenameEntry.Text; } if (!File.Exists(filename)) { MessageDialog md; md = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Ok, Catalog.GetString( @" The file you have entered does not exist. Please check the name and try again.") ); md.Run(); md.Destroy(); return; } // clear all the distinations, it's a little wierd yup gfax.Destinations.Clear(); // Get the first row. ItemStore.GetIterFirst(out iter); try { if ((bool)ItemStore.GetValue(iter, 0)) // if send is true (toggle set) { GfaxContact c = new GfaxContact(); c.PhoneNumber = (string)ItemStore.GetValue(iter, 1); // number c.Organization = (string)ItemStore.GetValue(iter, 2); // organization c.ContactPerson = (string)ItemStore.GetValue(iter, 3); // contact rows.Add(c); } } catch (Exception e) { Console.WriteLine("[guitools.on_faxsendbutton_clicked] Exception: {0}", e); MessageDialog md; md = new MessageDialog( null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Ok, Catalog.GetString( @" You have not entered a facsimile number! Please enter a number and press the <i><b>Enter</b></i> key or click the <i><b>Phone Book</b></i> button to select numbers or entire phone books.") ); md.Run(); md.Destroy(); return; } // get the rest of the rows while (ItemStore.IterNext(ref iter)) { try { if ((bool)ItemStore.GetValue(iter, 0)) // if send is true (toggle set) { GfaxContact c = new GfaxContact(); c.PhoneNumber = (string)ItemStore.GetValue(iter, 1); // number c.Organization = (string)ItemStore.GetValue(iter, 2); // organization c.ContactPerson = (string)ItemStore.GetValue(iter, 3); // contact rows.Add(c); } } catch (Exception e) { Console.WriteLine("[guitools.onfaxsendbutton_clicked] Exception: {0}", e); } } if (SendCheckbutton.Active) { gfax.timeToSend = DateTime.UtcNow; } else { // Convert to UTC for Hylafax gfax.timeToSend = (SendDateedit.Time).ToUniversalTime(); } gfax.Destinations = rows; //get the fine resolution status gfax.sendWizardResolution = ResolutionCheckbutton.Active; //get the email flag and email address gfax.sendWizardEmailNotify = EmailCheckbutton.Active; gfax.sendWizardEmailAddress = EmailEntry.Text; if (gfax.Destinations.Count > 0) { dosend = true; // yes send the fax } //((Gtk.Window) gxml["NewFaxDialog"]).Hide(); NewFaxDialog.Hide(); Application.Quit(); }
private void FillCurveSelectBox() { CellRendererText renderer = new CellRendererText(); ListStore Curvelist = new ListStore(typeof(string)); CurveSelectBox.PackStart(renderer, false); FinishedDoBox.AddAttribute(renderer, "text", 0); string[] names = AllCurves.GetAllCurvenames(); int c = 0; if (names[names.Length - 1] == "Exposure_Compensation") { Curvelist.AppendValues(names[names.Length - 1]); c = 1; } for (int i = 0; i < names.Length - c; i++) { Curvelist.AppendValues(names[i]); } CurveSelectBox.Model = Curvelist; TreeIter iter; if (Curvelist.GetIterFirst(out iter)) { CurveSelectBox.SetActiveIter(iter); } }
public static void Populate(this ComboBox comboBox, EntryList entryList) { comboBox.Clear(); ListStore listStore = new Gtk.ListStore( (entryList[0].Value.GetType()), (entryList[0].Name.GetType()) ); comboBox.Model = listStore; CellRendererText text = new CellRendererText(); comboBox.PackStart(text, false); comboBox.AddAttribute(text, "text", 1); foreach (Entry entry in entryList){ listStore.AppendValues(entry.Value,entry.Name); } TreeIter iter; if (listStore.GetIterFirst (out iter)) { comboBox.SetActiveIter (iter); } }
static void SetLogSearchFilter (ListStore store, string filter) { TreeIter iter; if (store.GetIterFirst (out iter)) store.SetValue (iter, 1, filter); }
public void Load(DProject proj, DProjectConfiguration config) { project = proj; configuration = config; cbUseDefaultCompiler.Active = proj.UseDefaultCompilerVendor; cbPreferOneStepCompilation.Active = proj.PreferOneStepBuild; OnUseDefaultCompilerChanged(); Gtk.TreeIter iter; if (cmbCompiler.Model.GetIterFirst(out iter)) { do { if (proj.UsedCompilerVendor == cmbCompiler.Model.GetValue(iter, 0) as string) { cmbCompiler.SetActiveIter(iter); break; } } while (cmbCompiler.Model.IterNext(ref iter)); } extraCompilerTextView.Buffer.Text = config.ExtraCompilerArguments; extraLinkerTextView.Buffer.Text = config.ExtraLinkerArguments; text_BinDirectory.Text = config.OutputDirectory; text_TargetFile.Text = config.Output; text_ObjectsDirectory.Text = config.ObjectDirectory; text_DDocDir.Text = config.DDocDirectory; if (config.CustomDebugIdentifiers == null) { text_debugConstants.Text = ""; } else { text_debugConstants.Text = string.Join(";", config.CustomDebugIdentifiers); } if (config.CustomVersionIdentifiers == null) { text_versionConstants.Text = ""; } else { text_versionConstants.Text = string.Join(";", config.CustomVersionIdentifiers); } spin_debugLevel.Value = (double)config.DebugLevel; // Disable debug-specific fields on non-debug configurations text_debugConstants.Sensitive = spin_debugLevel.Sensitive = config.DebugMode; if (model_compileTarget.GetIterFirst(out iter)) { do { if (config.CompileTarget == (DCompileTarget)model_compileTarget.GetValue(iter, 1)) { combo_ProjectType.SetActiveIter(iter); break; } } while (model_compileTarget.IterNext(ref iter)); } text_Libraries.Buffer.Text = string.Join("\n", config.ExtraLibraries); }
public CodeIssuePanelWidget (string mimeType) { this.mimeType = mimeType; Build (); var col1 = treeviewInspections.AppendColumn ("Title", new CellRendererText (), "markup", 0); col1.Expand = true; searchentryFilter.Ready = true; searchentryFilter.Visible = true; searchentryFilter.Entry.Changed += ApplyFilter; var comboRenderer = new CellRendererCombo (); comboRenderer.Alignment = Pango.Alignment.Center; var col = treeviewInspections.AppendColumn ("Severity", comboRenderer); col.Sizing = TreeViewColumnSizing.GrowOnly; col.MinWidth = 100; col.Expand = false; var comboBoxStore = new ListStore (typeof(string), typeof(Severity)); comboBoxStore.AppendValues (GetDescription (Severity.None), Severity.None); comboBoxStore.AppendValues (GetDescription (Severity.Error), Severity.Error); comboBoxStore.AppendValues (GetDescription (Severity.Warning), Severity.Warning); comboBoxStore.AppendValues (GetDescription (Severity.Hint), Severity.Hint); comboBoxStore.AppendValues (GetDescription (Severity.Suggestion), Severity.Suggestion); comboRenderer.Model = comboBoxStore; comboRenderer.Mode = CellRendererMode.Activatable; comboRenderer.TextColumn = 0; comboRenderer.Editable = true; comboRenderer.HasEntry = false; comboRenderer.Edited += delegate(object o, Gtk.EditedArgs args) { Gtk.TreeIter iter; if (!treeStore.GetIterFromString (out iter, args.Path)) return; Gtk.TreeIter storeIter; if (!comboBoxStore.GetIterFirst (out storeIter)) return; do { if ((string)comboBoxStore.GetValue (storeIter, 0) == args.NewText) { var provider = (BaseCodeIssueProvider)treeStore.GetValue (iter, 1); var severity = (Severity)comboBoxStore.GetValue (storeIter, 1); severities[provider] = severity; return; } } while (comboBoxStore.IterNext (ref storeIter)); }; col.SetCellDataFunc (comboRenderer, delegate (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { var provider = (BaseCodeIssueProvider)model.GetValue (iter, 1); if (provider == null) { comboRenderer.Visible = false; return; } var severity = severities[provider]; comboRenderer.Visible = true; comboRenderer.Text = GetDescription (severity); comboRenderer.BackgroundGdk = GetColor (severity); }); treeviewInspections.HeadersVisible = false; treeviewInspections.Model = treeStore; treeviewInspections.Selection.Changed += HandleSelectionChanged; GetAllSeverities (); FillInspectors (null); }
public void EditItem(Model.Item item) { if(ShowMe != null) ShowMe(this,new ShowMeEventArgs()); if(currentlyEditedItem != null) item.Images.PropertyChanged -= OnMainImageChanged; currentlyEditedItem = item; //set the right item type ListStore typeModel = new ListStore(typeof(string)); typeModel.AppendValues(item.ItemType); itemEditType.Model = typeModel; TreeIter iter; typeModel.GetIterFirst(out iter); itemEditType.SetActiveIter(iter); // set the images itemEditImages.Model = new TreeModelAdapter( new ImagesModel( item.Images ) ); // set a callback to see if the mainimage was changed item.Images.PropertyChanged += OnMainImageChanged; // set the tags itemEditTags.Model = new TreeModelAdapter( new ItemTagsModel( item.Tags ) ); itemEditTags.Model.RowInserted += OnTagRowInserted; // fill the entries etc with the item's data itemEditName.Text = item.Name.EmptyIfNull(); itemEditMemo.Text = item.Memo.EmptyIfNull(); itemEditId.Value = item.Id; if(item is Product) EditProduct((Product)item); else if(item is Estate) EditEstate((Estate)item); else if(item is Room) EditRoom((Room)item); }