Inheritance: System.EventArgs
Exemple #1
0
        void ProjectDb_Inserted(object sender, BdbArgs args)
        {
            /* we can't perfectly know where this row was before hand.
             * so we will just append it to the level it belongs.
             */

            var project = args.Value as Project;
            if (project == null)
                return;

            if (project.ParentId == 0) {
                m_projectStore.AppendValues (project);
            }
            else {
                m_projectStore.Foreach (delegate (TreeModel model, TreePath path, TreeIter iter) {
                    var item = model.GetValue (iter, 0) as Project;
                    if (item == null)
                        return false;

                    if (item.Id == project.ParentId) {
                        m_projectStore.AppendValues (iter, project);
                        return true;
                    }

                    return false;
                });
            }
        }
Exemple #2
0
        void ProjectDb_Removed(object sender, BdbArgs args)
        {
            var project = args.Value as Project;

            m_projectStore.Foreach (delegate (TreeModel model, TreePath path, TreeIter iter) {
                var item = model.GetValue (iter, 0) as Project;
                if (item == null)
                    return false;

                if (item.Id == project.Id) {
                    m_projectStore.Remove (ref iter);
                    return true;
                }

                return false;
            });
        }
Exemple #3
0
        void ProjectDb_Appended(object sender, BdbArgs args)
        {
            Project project = args.Value as Project;

            if (project == null)
                return;

            if (project.ParentId == 0) {
                var iter = m_projectStore.AppendValues (project);
                var path = m_projectStore.GetPath (iter);
                m_projectsTreeView.SetCursor (path, m_projectsTreeView.Columns [0], true);
            }
            else {
                m_projectStore.Foreach (delegate (TreeModel model, TreePath path, TreeIter iter) {
                    var item = (Project)model.GetValue (iter, 0);
                    if (item == null || item.Id < 0)
                        return false;;

                    if (item.Id == project.ParentId) {
                        var child = m_projectStore.AppendValues (iter, project);
                        var cpath = m_projectStore.GetPath (child);
                        Gtk.Application.Invoke (delegate {
                            m_projectsTreeView.Selection.SelectPath (cpath);
                            m_projectsTreeView.SetCursor (cpath, m_projectsTreeView.Columns [0], true);
                        });
                        return true;
                    }
                    return false;
                });
            }
        }