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); } }
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); }
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 SelectRow(int row) { Gtk.TreeIter iter; if (store.IterNthChild(out iter, row)) { Gtk.TreePath path = store.GetPath(iter); SetCursor(path, null, false); // We want the initial selection to be centered if (!IsRealized) { ScrollToCell(path, null, true, 0.5f, 0.0f); } } }
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 HandleUpdateEntry(ImageImporter.ImageEntry entry) { var tagString = entry.TagString; List <String> tags = new List <string>(tagString.Split(" ".ToCharArray())); List <String> siteTags = tags.FindAll((s) => s.StartsWith("known_on_") || s.StartsWith("not_on_")); tags.RemoveAll((s) => siteTags.Contains(s)); siteTags.RemoveAll((s) => s.StartsWith("not_on_")); for (int i = 0; i < siteTags.Count; i++) { siteTags[i] = siteTags[i].Replace("known_on_", ""); } string sites = string.Join(" ", siteTags); tagString = string.Join(" ", tags); string entryPath = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(entry.path)) + "/" + System.IO.Path.GetFileName(entry.path); //Gtk.Application.Invoke ((o,a) => { BooruApp.BooruApplication.TaskRunner.StartTaskMainThread("Import update entry", () => { lock (entries) { if (entries.ContainsKey(entry)) { var rowRef = entries[entry]; Gtk.TreeIter iter; if (rowRef.Model.GetIter(out iter, entries[entry].Path)) { entryStore.SetValues(iter, entry.Preview, entryPath, entry.MD5, entry.Status, tagString, entry.LastUpdated, sites ); scrollToPath = this.ImageEntryView.Model.GetPath(iter); } else { BooruApp.BooruApplication.Log.Log(BooruLog.Category.Application, BooruLog.Severity.Warning, "Could not update import entry " + entry.MD5 + ", row reference was invalid"); } scrollToPath = this.ImageEntryView.Model.GetPath(iter); } else { var iter = entryStore.AppendValues( entry.Preview, entryPath, entry.MD5, entry.Status, tagString, entry.LastUpdated, sites ); entries [entry] = new Gtk.TreeRowReference(entryStore, entryStore.GetPath(iter)); } } }); }
public EditModsDialog(Window parent, Instance inst) : base("Edit Mods", parent) { this.inst = inst; XML gxml = new XML(null, "MultiMC.GTKGUI.EditModsDialog.glade", "vboxEditMods", null); gxml.Autoconnect(this); this.VBox.PackStart(vboxEditMods); this.AddButton("_Cancel", ResponseType.Cancel); this.AddButton("_OK", ResponseType.Ok); WidthRequest = 600; HeightRequest = 500; // the Jar page is active by default. FIXME: determine dynamically! currentMode = Mode.Jar; modStore = new ListStore(typeof(string), typeof(Mod)); jarModList.Model = modStore; jarModList.AppendColumn("Mod Name", new CellRendererText(), "text", 0); mlModStore = new ListStore(typeof(string), typeof(Mod)); mlModList.Model = mlModStore; mlModList.AppendColumn("Mod Name", new CellRendererText(), "text", 0); //mlModList.Selection.Mode = SelectionMode.Multiple; inst.InstMods.ModFileChanged += (o, args) => LoadModList(); // Listen for key presses jarModList.KeyPressEvent += new KeyPressEventHandler(jarModList_KeyPressEvent); mlModList.KeyPressEvent += new KeyPressEventHandler(mlModList_KeyPressEvent); // set up drag & drop jarModList.EnableModelDragDest(targetEntries,Gdk.DragAction.Default); jarModList.EnableModelDragSource(Gdk.ModifierType.Button1Mask,srcEntries,Gdk.DragAction.Move); jarModList.DragDataReceived += OnDragDataReceived; jarModList.DragDataGet += (object o, DragDataGetArgs args) => { TreeIter iter; TreeModel model; if(!jarModList.Selection.GetSelected (out iter)) return; Gdk.Atom[] targets = args.Context.Targets; TreePath tp = modStore.GetPath(iter); int idx = tp.Indices[0]; args.SelectionData.Set(targets[0],0,System.Text.Encoding.UTF8.GetBytes( idx.ToString() )); }; Drag.DestSet(mlModList, DestDefaults.All, targetEntries, Gdk.DragAction.Default); mlModList.DragDataReceived += OnDragDataReceived; mlModList.EnableModelDragDest(targetEntries,Gdk.DragAction.Default); }
void PrepareTree() { themes_tree.AppendColumn (Catalog.GetString ("Name"), new CellRendererText (), "text", COL_DISPLAY_NAME); // Name, object themes_tree.Model = store = new ListStore (typeof (string), typeof (Theme)); TreePath path; TreeIter iter; foreach (Theme theme in ThemeManager.List) store.AppendValues (theme.Name, theme); store.GetIterFirst (out iter); path = store.GetPath (iter); themes_tree.CursorChanged += OnCursorChanged; themes_tree.SetCursor (path, themes_tree.Columns[0], false); }
public Fen_Menu() : base(Gtk.WindowType.Toplevel) { this.Build (); //graphical debug if ( Debug.ModeDebug && Debug.ModeDebugGraphique) { Debug.winDebug = new FEN_Debug(); Debug.winDebug.Show(); } ListStore ListMenu = new Gtk.ListStore (typeof (Gdk.Pixbuf),typeof (string)); TREE_Menu.Model=ListMenu; TREE_Menu.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 0); // Create a column for the package name Gtk.TreeViewColumn ListColumn = new Gtk.TreeViewColumn (); ListColumn.Title = "Module"; /*ListColumn.FixedWidth=70; ListColumn.MaxWidth=70; ListColumn.MinWidth=70;*/ Gtk.CellRendererText ListCell = new Gtk.CellRendererText (); // Add the cell to the column ListColumn.PackStart (ListCell, true); TREE_Menu.AppendColumn (ListColumn); ListColumn.AddAttribute (ListCell, "text", 1); // Event on treeview TREE_Menu.Selection.Changed += OnSelectionEntryUpdate; Pixbuf icoSys = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.system.png"); iter = ListMenu.AppendValues(icoSys.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_system); this.TREE_Menu.SetCursor(ListMenu.GetPath(iter),TREE_Menu.GetColumn(1),false); Pixbuf icoDate = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.datetime.png"); ListMenu.AppendValues(icoDate.ScaleSimple(20,20, Gdk.InterpType.Nearest), cch_datetime); Pixbuf icoUsers = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.users.png"); ListMenu.AppendValues(icoUsers.ScaleSimple(20,20, Gdk.InterpType.Nearest), cch_users); Pixbuf icoX = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.xorg.png"); ListMenu.AppendValues(icoX.ScaleSimple(20,20, Gdk.InterpType.Nearest), cch_xorg); Pixbuf icoupdate = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.update.png"); ListMenu.AppendValues(icoupdate.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_update); Pixbuf icoupdateConf = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.updateconf.png"); ListMenu.AppendValues(icoupdateConf.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_updateConf); Pixbuf icopkg = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.packages.png"); ListMenu.AppendValues(icopkg.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_packages); Pixbuf icohardware = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.hardware.png"); ListMenu.AppendValues(icohardware.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_hardware); Pixbuf icoservices = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.services.png"); ListMenu.AppendValues(icoservices.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_services); Pixbuf iconet = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.network.png"); ListMenu.AppendValues(iconet.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_network); Pixbuf icologin = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.loginmanager.png"); ListMenu.AppendValues(icologin.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_loginManager); string ouput = Outils.getoutput("uname -a"); if (ouput.IndexOf("i686") >=0 || ouput.IndexOf("x86_64")>=0) { Pixbuf icogrub = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.grub.png"); ListMenu.AppendValues(icogrub.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_grub); } Pixbuf icosup = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.support.png"); ListMenu.AppendValues(icosup.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_support); Pixbuf iconews = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.news.png"); ListMenu.AppendValues(iconews.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_news); Pixbuf icologs = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.logs.png"); ListMenu.AppendValues(icologs.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_logs); Pixbuf iconotes = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.notes.png"); ListMenu.AppendValues(iconotes.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_notes); Pixbuf icoconfig = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.configurations.png"); ListMenu.AppendValues(icoconfig.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_configuration); Pixbuf icoabout = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.icons.about.png"); ListMenu.AppendValues(icoabout.ScaleSimple(20,20, Gdk.InterpType.Nearest),cch_about); }