public UserView() { Store = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string)); Model = Store; InsertColumn(-1, "Pix", new Gtk.CellRendererPixbuf(), "pixbuf", 0); InsertColumn(-1, "Name", new Gtk.CellRendererText(), "text", 1); HeadersVisible = false; string[] users = new string[10]; users[0] = "Bob"; users[1] = "Bill"; users[2] = "Norma Jean"; users[3] = "Susie"; users[4] = "Katie"; users[5] = "Mbutu"; users[6] = "KoolKat74383u"; foreach (string user in users) { Gtk.TreeIter iter = Store.Append(); Model.SetValue(iter, 0, null); Model.SetValue(iter, 1, user); } }
void UpdateList() { if (displayedHashCode == ComponentManager.Localization.GetCurrentHashcode()) { return; } displayedHashCode = ComponentManager.Localization.GetCurrentHashcode(); listStore.Clear(); Dictionary <string, Localization.Node> dn = ComponentManager.Localization.GetDefaultNodes(); foreach (Localization.Node node in dn.Values) { Gtk.TreeIter iter = listStore.Append(); listStore.SetValue(iter, nodeIndex, node); listStore.SetValue(iter, keyIndex, node.Key); listStore.SetValue(iter, usValueIndex, node.Value); Localization.Node ln = ComponentManager.Localization.FindCurrentNode(node.Key); if (ln != null) { listStore.SetValue(iter, localValueIndex, ln.Value); } } }
private void UpdateFromConf() { Console.WriteLine("Reading settings from Config"); // FIXME: there might be weird cases with multiple screens, // multiple monitors, resolution related problems that might // cause problem is remapping the stored values to current // screen coordinates int res_x = GD.Screen.Default.Width; int res_y = GD.Screen.Default.Height; int pos_x = (int)(Conf.Searching.BestPosX * res_x / 100); int pos_y = (int)(Conf.Searching.BestPosY * res_y / 100); int width = (int)(Conf.Searching.BestWidth * res_x / 100); int height = (int)(Conf.Searching.BestHeight * res_y / 100); if (pos_x != 0 || pos_y != 0) { posX = pos_x; posY = pos_y; Move(pos_x, pos_y); } if (width != 0) { DefaultWidth = width; } if (height != 0) { DefaultHeight = height; } Gtk.TreeIter iter; foreach (string search in Conf.Searching.SearchHistory) { iter = history.Append(); history.SetValue(iter, 0, search); } }
public void on_open1_activate(object o, EventArgs args) { FileSelection fs = new FileSelection("Select a PDF file..."); // TODO: This doesn't filter the file list... fs.Complete("*.pdf"); fs.Run(); fs.Hide(); appbar1.Push("Opening document..."); m_doc = new Pdf(fs.Filename); appbar1.Push(m_doc.PageCount + " page document"); // Populate the pages list Gtk.ListStore model = new Gtk.ListStore(typeof(string)); Gtk.TreeIter iter = new Gtk.TreeIter(); Console.WriteLine("List has " + model.NColumns + " columns"); for (int i = 0; i < m_doc.PageCount; i++) { iter = model.Append(); GLib.Value v = new GLib.Value((i + 1).ToString()); model.SetValue(iter, 0, v); } pages.Model = model; pages.Show(); }
public void AddServer(IServer server) { TreeIter iter = Store.Append(); //Store.SetValue(iter, 0, new Gdk.Pixbuf...) Store.SetValue(iter, 1, server.Name); Store.SetValue(iter, 2, server); }
public TreeIter NewRow() { /* * TreeIter rowTreeIter = new TreeIter(); * store.Append (out rowTreeIter); * return rowTreeIter; */ return(store.Append()); }
// <summary> // Same as GetTag () but will create a new tag if one doesn't already exist. // </summary> public static Tag GetOrCreateTag(string tag_name) { if (tag_name == null) { throw new ArgumentNullException("TagManager.GetOrCreateTag () called with a null tag name."); } string normalized_tag_name = tag_name.Trim().ToLower(); if (normalized_tag_name == String.Empty) { throw new ArgumentException("TagManager.GetOrCreateTag () called with an empty tag name."); } if (normalized_tag_name.StartsWith(Tag.SYSTEM_TAG_PREFIX) || normalized_tag_name.Split(':').Length > 2) { lock (locker) { if (internal_tags.ContainsKey(normalized_tag_name)) { return(internal_tags[normalized_tag_name]); } else { Tag t = new Tag(tag_name); internal_tags [t.NormalizedName] = t; return(t); } } } Gtk.TreeIter iter = Gtk.TreeIter.Zero; bool tag_added = false; Tag tag = GetTag(normalized_tag_name); if (tag == null) { lock (locker) { tag = GetTag(normalized_tag_name); if (tag == null) { tag = new Tag(tag_name.Trim()); iter = tags.Append(); tags.SetValue(iter, 0, tag); tag_map [tag.NormalizedName] = iter; tag_added = true; } } } if (tag_added && TagAdded != null) { TagAdded(tag, iter); } return(tag); }
public UserView() { Store = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string)); Model = Store; InsertColumn(-1, "Pix", new Gtk.CellRendererPixbuf(), "pixbuf", 0); InsertColumn(-1, "Name", new Gtk.CellRendererText(), "text", 1); HeadersVisible = false; string[] users = new string[10]; users[0] = "Bob"; users[1] = "Bill"; users[2] = "Norma Jean"; users[3] = "Susie"; users[4] = "Katie"; users[5] = "Mbutu"; users[6] = "KoolKat74383u"; foreach ( string user in users ) { Gtk.TreeIter iter = Store.Append(); Model.SetValue(iter, 0, null); Model.SetValue(iter, 1, user); } }
private Gtk.ComboBox FilterComboBox() { filter_data = new Gtk.ListStore(new Type[] { typeof(string), typeof(string) }); Gtk.TreeIter iter; iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("Anywhere")); filter_data.SetValue(iter, 1, null); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Files")); filter_data.SetValue(iter, 1, "File"); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Addressbook")); filter_data.SetValue(iter, 1, "Contact"); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Mail")); filter_data.SetValue(iter, 1, "MailMessage"); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Web Pages")); filter_data.SetValue(iter, 1, "WebHistory"); iter = filter_data.Append(); filter_data.SetValue(iter, 0, Catalog.GetString("in Chats")); filter_data.SetValue(iter, 1, "IMLog"); Gtk.ComboBox combo = new Gtk.ComboBox(filter_data); combo.Active = 0; Gtk.CellRendererText renderer = new Gtk.CellRendererText(); combo.PackStart(renderer, false); combo.SetAttributes(renderer, new object[] { "text", 0 }); return(combo); }
public override void LaunchDialogue () { //the Type in the collection IList collection = (IList) Value; string displayName = Property.DisplayName; //populate list with existing items ListStore itemStore = new ListStore (typeof (object), typeof (int), typeof (string)); for (int i=0; i<collection.Count; i++) itemStore.AppendValues(collection [i], i, collection [i].ToString ()); #region Building Dialogue TreeView itemTree; PropertyGrid grid; TreeIter previousIter = TreeIter.Zero; //dialogue and buttons Dialog dialog = new Dialog () { Title = displayName + " Editor", Modal = true, AllowGrow = true, AllowShrink = true, }; var toplevel = this.Container.Toplevel as Window; if (toplevel != null) dialog.TransientFor = toplevel; dialog.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel); dialog.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok); //three columns for items, sorting, PropGrid HBox hBox = new HBox (); dialog.VBox.PackStart (hBox, true, true, 5); //propGrid at end grid = new PropertyGrid (base.EditorManager) { CurrentObject = null, WidthRequest = 200, ShowHelp = false }; hBox.PackEnd (grid, true, true, 5); //followed by a ButtonBox VBox buttonBox = new VBox (); buttonBox.Spacing = 6; hBox.PackEnd (buttonBox, false, false, 5); //add/remove buttons Button addButton = new Button (new Image (Stock.Add, IconSize.Button)); buttonBox.PackStart (addButton, false, false, 0); if (types [0].IsAbstract) addButton.Sensitive = false; Button removeButton = new Button (new Gtk.Image (Stock.Remove, IconSize.Button)); buttonBox.PackStart (removeButton, false, false, 0); //sorting buttons Button upButton = new Button (new Image (Stock.GoUp, IconSize.Button)); buttonBox.PackStart (upButton, false, false, 0); Button downButton = new Button (new Image (Stock.GoDown, IconSize.Button)); buttonBox.PackStart (downButton, false, false, 0); //Third column has list (TreeView) in a ScrolledWindow ScrolledWindow listScroll = new ScrolledWindow (); listScroll.WidthRequest = 200; listScroll.HeightRequest = 320; hBox.PackStart (listScroll, false, false, 5); itemTree = new TreeView (itemStore); itemTree.Selection.Mode = SelectionMode.Single; itemTree.HeadersVisible = false; listScroll.AddWithViewport (itemTree); //renderers and attribs for TreeView CellRenderer rdr = new CellRendererText (); itemTree.AppendColumn (new TreeViewColumn ("Index", rdr, "text", 1)); rdr = new CellRendererText (); itemTree.AppendColumn (new TreeViewColumn ("Object", rdr, "text", 2)); #endregion #region Events addButton.Clicked += delegate { //create the object object instance = System.Activator.CreateInstance (types[0]); //get existing selection and insert after it TreeIter oldIter, newIter; if (itemTree.Selection.GetSelected (out oldIter)) newIter = itemStore.InsertAfter (oldIter); //or append if no previous selection else newIter = itemStore.Append (); itemStore.SetValue (newIter, 0, instance); //select, set name and update all the indices itemTree.Selection.SelectIter (newIter); UpdateName (itemStore, newIter); UpdateIndices (itemStore); }; removeButton.Clicked += delegate { //get selected iter and the replacement selection TreeIter iter, newSelection; if (!itemTree.Selection.GetSelected (out iter)) return; newSelection = iter; if (!IterPrev (itemStore, ref newSelection)) { newSelection = iter; if (!itemStore.IterNext (ref newSelection)) newSelection = TreeIter.Zero; } //new selection. Zeroing previousIter prevents trying to update name of deleted iter. previousIter = TreeIter.Zero; if (itemStore.IterIsValid (newSelection)) itemTree.Selection.SelectIter (newSelection); //and the removal and index update itemStore.Remove (ref iter); UpdateIndices (itemStore); }; upButton.Clicked += delegate { TreeIter iter, prev; if (!itemTree.Selection.GetSelected (out iter)) return; //get previous iter prev = iter; if (!IterPrev (itemStore, ref prev)) return; //swap the two itemStore.Swap (iter, prev); //swap indices too object prevVal = itemStore.GetValue (prev, 1); object iterVal = itemStore.GetValue (iter, 1); itemStore.SetValue (prev, 1, iterVal); itemStore.SetValue (iter, 1, prevVal); }; downButton.Clicked += delegate { TreeIter iter, next; if (!itemTree.Selection.GetSelected (out iter)) return; //get next iter next = iter; if (!itemStore.IterNext (ref next)) return; //swap the two itemStore.Swap (iter, next); //swap indices too object nextVal = itemStore.GetValue (next, 1); object iterVal = itemStore.GetValue (iter, 1); itemStore.SetValue (next, 1, iterVal); itemStore.SetValue (iter, 1, nextVal); }; itemTree.Selection.Changed += delegate { TreeIter iter; if (!itemTree.Selection.GetSelected (out iter)) { removeButton.Sensitive = false; return; } removeButton.Sensitive = true; //update grid object obj = itemStore.GetValue (iter, 0); grid.CurrentObject = obj; //update previously selected iter's name UpdateName (itemStore, previousIter); //update current selection so we can update //name next selection change previousIter = iter; }; grid.Changed += delegate { TreeIter iter; if (itemTree.Selection.GetSelected (out iter)) UpdateName (itemStore, iter); }; TreeIter selectionIter; removeButton.Sensitive = itemTree.Selection.GetSelected (out selectionIter); dialog.ShowAll (); grid.ShowToolbar = false; #endregion //if 'OK' put items back in collection //if (MonoDevelop.Ide.MessageService.ShowCustomDialog (dialog, toplevel) == (int)ResponseType.Ok) { DesignerTransaction tran = CreateTransaction (Instance); object old = collection; try { collection.Clear(); foreach (object[] o in itemStore) collection.Add (o[0]); EndTransaction (Instance, tran, old, collection, true); } catch { EndTransaction (Instance, tran, old, collection, false); throw; } } }
private void AddTagsTab() { Table tags_table = new Table(1, 2, false); tags_table.BorderWidth = 5; tags_table.ColumnSpacing = 10; tags_table.RowSpacing = 10; ScrolledWindow tags_swin = new ScrolledWindow(); tags_swin.ShadowType = ShadowType.In; tags_swin.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); tags_table.Attach(tags_swin, 0, 1, 0, 1); cr_toggle = new CellRendererToggle(); cr_toggle.Activatable = true; cr_toggle.Toggled += new ToggledHandler(OnCrToggleToggled); tv_tags = new TreeView(); tags_swin.Add(tv_tags); store_tags = new ListStore(typeof(bool), typeof(string)); tv_tags.Model = store_tags; // set up the columns for the view TreeViewColumn column_Read = new TreeViewColumn("Use", cr_toggle, "active", 0); tv_tags.AppendColumn(column_Read); TreeViewColumn column_Name = new TreeViewColumn("Title", new CellRendererText(), "text", 1); tv_tags.AppendColumn(column_Name); foreach ( string tag in Feeds.GetTags() ) { TreeIter iter = store_tags.Append(); if ( feed.Tags.Contains(tag) ) { store_tags.SetValue(iter, 0, true); } else { store_tags.SetValue(iter, 0, false); } store_tags.SetValue(iter, 1, tag); } ButtonBox tags_bbox = new HButtonBox(); tags_bbox.Layout = ButtonBoxStyle.End; tags_table.Attach(tags_bbox, 0, 1, 1, 2); Button add_button = new Button(Stock.Add); add_button.Clicked += new EventHandler(OnAddButtonClicked); tags_bbox.PackStart(add_button); notebook.AppendPage(tags_table, new Label("Tags")); }
/// <summary> /// Populate the grid from the DataSource. /// </summary> private void PopulateGrid() { WaitCursor = true; ClearGridColumns(); fixedcolview.Visible = false; colLookup.Clear(); // Begin by creating a new ListStore with the appropriate number of // columns. Use the string column type for everything. int nCols = DataSource != null ? this.DataSource.Columns.Count : 0; Type[] colTypes = new Type[nCols]; for (int i = 0; i < nCols; i++) colTypes[i] = typeof(string); gridmodel = new ListStore(colTypes); gridview.ModifyBase(StateType.Active, fixedcolview.Style.Base(StateType.Selected)); gridview.ModifyText(StateType.Active, fixedcolview.Style.Text(StateType.Selected)); fixedcolview.ModifyBase(StateType.Active, gridview.Style.Base(StateType.Selected)); fixedcolview.ModifyText(StateType.Active, gridview.Style.Text(StateType.Selected)); image1.Visible = false; // Now set up the grid columns for (int i = 0; i < nCols; i++) { /// Design plan: include renderers for text, toggles and combos, but hide all but one of them CellRendererText textRender = new Gtk.CellRendererText(); CellRendererToggle toggleRender = new Gtk.CellRendererToggle(); toggleRender.Visible = false; toggleRender.Toggled += ToggleRender_Toggled; CellRendererCombo comboRender = new Gtk.CellRendererCombo(); comboRender.Edited += ComboRender_Edited; comboRender.Xalign = 1.0f; comboRender.Visible = false; colLookup.Add(textRender, i); textRender.FixedHeightFromFont = 1; // 1 line high textRender.Editable = !isReadOnly; textRender.EditingStarted += OnCellBeginEdit; textRender.Edited += OnCellValueChanged; textRender.Xalign = i == 0 ? 0.0f : 1.0f; // For right alignment of text cell contents; left align the first column TreeViewColumn column = new TreeViewColumn(); column.Title = this.DataSource.Columns[i].ColumnName; column.PackStart(textRender, true); // 0 column.PackStart(toggleRender, true); // 1 column.PackStart(comboRender, true); // 2 column.Sizing = TreeViewColumnSizing.Autosize; //column.FixedWidth = 100; column.Resizable = true; column.SetCellDataFunc(textRender, OnSetCellData); column.Alignment = 0.5f; // For centered alignment of the column header gridview.AppendColumn(column); // Gtk Treeview doesn't support "frozen" columns, so we fake it by creating a second, identical, TreeView to display // the columns we want frozen // For now, these frozen columns will be treated as read-only text TreeViewColumn fixedColumn = new TreeViewColumn(this.DataSource.Columns[i].ColumnName, textRender, "text", i); fixedColumn.Sizing = TreeViewColumnSizing.Autosize; fixedColumn.Resizable = true; fixedColumn.SetCellDataFunc(textRender, OnSetCellData); fixedColumn.Alignment = 0.5f; // For centered alignment of the column header fixedColumn.Visible = false; fixedcolview.AppendColumn(fixedColumn); } // Add an empty column at the end; auto-sizing will give this any "leftover" space TreeViewColumn fillColumn = new TreeViewColumn(); gridview.AppendColumn(fillColumn); fillColumn.Sizing = TreeViewColumnSizing.Autosize; // Now let's apply center-justification to all the column headers, just for the heck of it for (int i = 0; i < nCols; i++) { Label label = GetColumnHeaderLabel(i); label.Justify = Justification.Center; label.Style.FontDescription.Weight = Pango.Weight.Bold; label = GetColumnHeaderLabel(i, fixedcolview); label.Justify = Justification.Center; label.Style.FontDescription.Weight = Pango.Weight.Bold; } int nRows = DataSource != null ? this.DataSource.Rows.Count : 0; gridview.Model = null; fixedcolview.Model = null; for (int row = 0; row < nRows; row++) { // We could store data into the grid model, but we don't. // Instead, we retrieve the data from our datastore when the OnSetCellData function is called gridmodel.Append(); } gridview.Model = gridmodel; gridview.Show(); while (Gtk.Application.EventsPending()) Gtk.Application.RunIteration(); WaitCursor = false; }
public static void Copy(TreeModel tree, TreeIter tree_iter, ListStore list, bool first) { // Copy this iter's values to the list TreeIter list_iter = list.Append(); for (int i = 0; i < list.NColumns; i++) { list.SetValue(list_iter, i, tree.GetValue(tree_iter, i)); if (i == 1) { //Console.WriteLine("Copying {0}", list.GetValue(list_iter, i)); } } // Copy the first child, which will trigger the copy if its siblings (and their children) TreeIter child_iter; if (tree.IterChildren(out child_iter, tree_iter)) { Copy(tree, child_iter, list, true); } // Add siblings and their children if we are the first child, otherwise doing so would repeat if (first) { while (tree.IterNext(ref tree_iter)) { Copy(tree, tree_iter, list, false); } } }
private void Append (ListStore store, MemberRecord mr, Type type) { TreeIter iter; store.Append (out iter); store.SetValue (iter, 0, new GLib.Value (mr.Label)); store.SetValue (iter, 1, new GLib.Value (type.FullName)); store.SetValue (iter, 2, new GLib.Value (mr.Icon)); store.SetValue (iter, 3, new GLib.Value (mr.GetType () == typeof (TypeRecord))); }
public static void ShowContributors(TreeView treeview) { #if DEBUG Console.WriteLine("TreeViewHelper.ShowContributors"); #endif string helpFile = FileHelper.FindSupportFile("bygfoot_help", true); if (string.IsNullOrEmpty(helpFile)) { GameGUI.ShowWarning(Mono.Unix.Catalog.GetString("Didn't find file 'bygfoot_help'.")); return; } OptionList helpList = null; FileHelper.LoadOptFile(helpFile, ref helpList, false); // Set treeview properties treeview.Selection.Mode = SelectionMode.None; treeview.RulesHint = false; treeview.HeadersVisible = false; TreeViewColumn column = new TreeViewColumn(); treeview.AppendColumn(column); CellRenderer cell = TreeViewHelper.TextCellRenderer(); column.PackStart(cell, true); column.AddAttribute(cell, "markup", 0); ListStore ls = new ListStore(typeof(string)); for (int i = 0; i < helpList.list.Count; i++) { TreeIter iter = ls.Append(); OptionStruct option = (OptionStruct)helpList.list[i]; if (option.name.StartsWith("string_contrib_title")) { string value = string.Format("\n<span {0}>{1}</span>", Option.ConstApp("string_help_window_title_attribute"), option.stringValue); ls.SetValue(iter, 0, value); } else { ls.SetValue(iter, 0, option.stringValue); } } treeview.Model = ls; }
private Gtk.ComboBox FilterComboBox () { filter_data = new Gtk.ListStore (new Type[] { typeof (string), typeof (string) }); Gtk.TreeIter iter; iter = filter_data.Append (); filter_data.SetValue (iter, 0, Catalog.GetString ("Anywhere")); filter_data.SetValue (iter, 1, null); iter = filter_data.Append (); filter_data.SetValue (iter, 0, Catalog.GetString ("in Files")); filter_data.SetValue (iter, 1, "File"); iter = filter_data.Append (); filter_data.SetValue (iter, 0, Catalog.GetString ("in Addressbook")); filter_data.SetValue (iter, 1, "Contact"); iter = filter_data.Append (); filter_data.SetValue (iter, 0, Catalog.GetString ("in Mail")); filter_data.SetValue (iter, 1, "MailMessage"); iter = filter_data.Append (); filter_data.SetValue (iter, 0, Catalog.GetString ("in Web Pages")); filter_data.SetValue (iter, 1, "WebHistory"); iter = filter_data.Append (); filter_data.SetValue (iter, 0, Catalog.GetString ("in Chats")); filter_data.SetValue (iter, 1, "IMLog"); Gtk.ComboBox combo = new Gtk.ComboBox (filter_data); combo.Active = 0; Gtk.CellRendererText renderer = new Gtk.CellRendererText (); combo.PackStart (renderer, false); combo.SetAttributes (renderer, new object[] { "text", 0 }); return combo; }
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; }
private Container ICSelector () { ScrolledWindow sw = new ScrolledWindow (); ICStore = new ListStore ((int) GLib.TypeFundamentals.TypeString, (int) GLib.TypeFundamentals.TypeInt); ICView = new TreeView (ICStore); TreeViewColumn col = new TreeViewColumn (); TreeIter iter; CellRenderer renderer = new CellRendererText (); col.Title = "MemberType"; col.PackStart (renderer, true); col.AddAttribute (renderer, "markup", 0); ICView.AppendColumn (col); ICView.HeadersVisible = false; ICStore.Append (out iter); ICStore.SetValue (iter, 0, new GLib.Value (ICLabel ("all", factory.staticCount + factory.instanceCount))); ICStore.SetValue (iter, 1, new GLib.Value ((int) (BindingFlags.Static | BindingFlags.Instance))); ICStore.Append (out iter); ICStore.SetValue (iter, 0, new GLib.Value (ICLabel ("instance", factory.instanceCount))); ICStore.SetValue (iter, 1, new GLib.Value ((int) BindingFlags.Instance)); ICStore.Append (out iter); ICStore.SetValue (iter, 0, new GLib.Value (ICLabel ("class", factory.staticCount))); ICStore.SetValue (iter, 1, new GLib.Value ((int) BindingFlags.Static)); ICView.Selection.SelectPath (new TreePath ("0")); ICView.Selection.Changed += new EventHandler (ICSelectionChanged); ICView.BorderWidth = 5; sw.Add (ICView); return sw; }
private Container MemberSelector () { ScrolledWindow sw = new ScrolledWindow (); memberStore = new ListStore ((int) GLib.TypeFundamentals.TypeString, (int) GLib.TypeFundamentals.TypeInt); MTView = new TreeView (memberStore); TreeViewColumn col = new TreeViewColumn (); TreeIter iter; CellRenderer renderer = new CellRendererText (); col.Title = "MemberType"; col.PackStart (renderer, true); col.AddAttribute (renderer, "markup", 0); MTView.AppendColumn (col); MTView.HeadersVisible = false; foreach (MemberRecordFactory rv in recordFactory) { memberStore.Append (out iter); memberStore.SetValue (iter, 0, new GLib.Value (rv.FullTitle)); } MTView.Selection.SelectPath (new TreePath ("0")); MTView.Selection.Changed += new EventHandler (MemberFilterSelectionChanged); MTView.BorderWidth = 5; sw.Add (MTView); return sw; }
private void AddToStore (ListStore store, GLib.Value field, GLib.Value value, GLib.Value details, GLib.Value icon) { TreeIter iter = store.Append (); store.SetValue (iter, 0, field); store.SetValue (iter, 1, value); store.SetValue (iter, 2, details); store.SetValue (iter, 3, icon); }
void UpdateAttachments() { var task = SelectedTask; var model = new ListStore (typeof (Gdk.Pixbuf), typeof (String), typeof (String)); if (task != null && task.Attachments != null) { foreach (string item in task.Attachments) { var iter = model.Append (); var info = new System.IO.FileInfo (item); model.SetValue (iter, 0, GetPixbuf (Stock.File)); model.SetValue (iter, 1, info.Name); model.SetValue (iter, 2, item); } } m_tasksIconView.Model = model; }