Esempio n. 1
0
        private void AgentKeyListChangeHandler(object sender, Agent.KeyListChangeEventArgs e)
        {
//      if (IsDisposed) {
//        return;
//      }
            switch (e.Action)
            {
            case Agent.KeyListChangeEventAction.Add:
                Gtk.Application.Invoke(delegate(object sender1, EventArgs e1)
                {
                    mKeyCollection.AddNode(new KeyNode(e.Key));
                    UpdateVisibility();
                });
                break;

            case Agent.KeyListChangeEventAction.Remove:
                Gtk.Application.Invoke(delegate(object sender1, EventArgs e1)
                {
                    var matchFingerprint = e.Key.GetMD5Fingerprint().ToHexString();

                    var matches = mKeyCollection.Cast <KeyNode>()
                                  .Where(k => k.Fingerprint == matchFingerprint);
                    foreach (var keyNode in matches)
                    {
                        mKeyCollection.RemoveNode(keyNode);
                    }
                    UpdateVisibility();
                });
                break;
            }
        }
Esempio n. 2
0
 private void DeleteButtonClicked(object obj, EventArgs args)
 {
     if (view.NodeSelection.SelectedNode != null)
     {
         NoteTreeNode selected = (NoteTreeNode)view.NodeSelection.SelectedNode;
         store.RemoveNode(selected);
         clientActivated.DeleteRecord(selected.GetNote());
     }
 }
Esempio n. 3
0
        public FolderListGui(string Title, string Description, string[] Folders)
        {
            this.Build ();

            this.Folders = Folders;
            this.label12.Text = Description;
            this.Title = Title;

            NodeStore store = new NodeStore(typeof(StringNode));
            foreach(string folder in Folders)
                store.AddNode(new StringNode(){ Value = folder});
            nodeview1.NodeStore = store;
            nodeview1.AppendColumn("Folder", new Gtk.CellRendererText (), "text", 0);

            buttonOk.Clicked += delegate {
                // get the folders
                List<string> nodes = new List<string>();
                var enumerator = store.GetEnumerator();
                while(enumerator.MoveNext())
                {
                    string folder = ((StringNode)enumerator.Current).Value;
                    if(folder.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
                        folder = folder.Substring(0, folder.Length - 1);
                    nodes.Add(folder);
                }
                this.Folders = nodes.ToArray();
                this.DialogResult = ResponseType.Ok;
                this.Destroy();
            };
            buttonCancel.Clicked += delegate{
                this.DialogResult = ResponseType.Cancel;
                this.Destroy();
            };

            btnAdd.Clicked += delegate {
                using(Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the Folder to scan.",
                          	                    						    this,
                                                                            FileChooserAction.SelectFolder,
                                                                            "Cancel", ResponseType.Cancel,
                                                     				 	    "Open", ResponseType.Accept)){
                    fc.LocalOnly = false;
                    if (fc.Run() == (int)ResponseType.Accept)
                    {
                        store.AddNode(new StringNode(){ Value = fc.Filename});
                    }
                    //Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
                    fc.Destroy();
                }
            };

            btnRemove.Clicked += delegate {
                foreach(var node in nodeview1.NodeSelection.SelectedNodes)
                    store.RemoveNode(node);
            };
        }
Esempio n. 4
0
        public MovieEditor(iMetaLibrary.Metadata.MovieMeta Meta)
        {
            this.Build ();
            this.Meta = Meta;
            #region setup the actors datagrid
            store = new NodeStore(typeof(ActorNode));

            CellRendererText nameRender = new CellRendererText(){ Editable = true, };
            nameRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Name = args.NewText;
            };
            nvActors.AppendColumn("Name", nameRender, "text", 0);
            CellRendererText roleRender = new CellRendererText(){ Editable = true, };
            roleRender.Edited += delegate(object o, EditedArgs args) {
                // update the text
                ActorNode node = (ActorNode)store.GetNode(new Gtk.TreePath(args.Path));
                node.Role = args.NewText;
            };
            nvActors.AppendColumn("Role", roleRender, "text", 1);

            nvActors.NodeStore = store;

            btnActorsRemove.Clicked += delegate
            {
                ActorNode node = nvActors.NodeSelection.SelectedNode as ActorNode;
                if(node != null)
                    store.RemoveNode(node);
            };
            btnActorsAdd.Clicked += delegate {
                var node = new ActorNode();
                store.AddNode(node);
                nvActors.NodeSelection.SelectNode(node);
                int _n = 0;
                var enumerator = store.GetEnumerator();
                while(enumerator.MoveNext()) _n++;
                nvActors.ScrollToCell(new TreePath(new int[] {_n-1}), null, false, 0, 0);
            };
            #endregion

            if(Meta.Actors != null){
                foreach(var actor in Meta.Actors)
                    store.AddNode(new ActorNode() { Name = actor.Key, Role = actor.Value});
            }

            txtTitle.Text = Meta.Title ?? "";
            txtSortTitle.Text = Meta.SortTitle ?? "";
            txtSet.Text = Meta.Set ?? "";
            txtTagline.Text = Meta.TagLine ?? "";
            txtGenres.Text = String.Join(", ", Meta.Genres ?? new string[] {});
            txtDirectors.Text = String.Join(", ", Meta.Directors ?? new string[] {});
            txtWriters.Text = String.Join(", ", Meta.Writers ?? new string[] {});
            txtTrailer.Text = Meta.Trailer ?? "";
            txtImdbId.Text = Meta.Id ?? "";
            txtMpaa.Text = Meta.Mpaa ?? "";
            txtReleaseDate.Text = Meta.ReleaseDate > new DateTime(1850, 1,1) ? Meta.ReleaseDate.ToString("yyyy-MM-dd") : "";
            txtPlot.Buffer.Text = Meta.Plot ?? "";
            numRuntime.Value = Meta.Runtime / 60; // convert seconds to minutes
            ratingwidget.Value = (int)Meta.Rating;

            Poster = GuiHelper.ImageToPixbuf(Meta.LoadThumbnail(290, 1000));

            //ratingwidget.Visible  = false;

            buttonOk.Clicked += delegate {
                Save ();
            };

            eventPoster.ButtonPressEvent +=	delegate{
                BrowseForNewPoster();
            };
        }
Esempio n. 5
0
 void RemoveFolder(NodeView View, NodeStore Store)
 {
     foreach(var node in View.NodeSelection.SelectedNodes)
         Store.RemoveNode(node);
 }