示例#1
0
        public void AddItem(TreeIter iter, string path, bool exists, bool folder, bool expand, string fullpath)
        {
            string id = ID_FILE;

            Gdk.Pixbuf icon = ICON_FILE[Convert.ToInt32(!exists)];

            if (path.Contains("/") || folder)
            {
                icon = ICON_FOLDER [Convert.ToInt32(!exists)];
                id   = ID_FOLDER;
            }
            else if (exists)
            {
                icon = IconCache.GetIcon(window._controller.GetFullPath(fullpath));
            }

            string[] split = path.Split('/');
            TreeIter itr;

            if (!GetIter(iter, split [0], out itr))
            {
                itr = AddAndSort(iter, icon, split [0], id);
            }
            else if (treeview1.Model.GetValue(itr, 0) == ICON_FOLDER[0])
            {
                treeview1.Model.SetValue(itr, 0, ICON_FOLDER [Convert.ToInt32(!exists)]);
            }

            if (expand)
            {
                treeview1.ExpandRow(treeview1.Model.GetPath(iter), false);
            }

            if (split.Length > 1)
            {
                string newpath = split [1];
                for (int i = 2; i < split.Length; i++)
                {
                    newpath += "/" + split[i];
                }

                AddItem(itr, newpath, exists, folder, expand, fullpath);
            }
        }
示例#2
0
        public void RefreshItem(TreeIter iter, string path, bool exists, string fullpath)
        {
            string[] split = path.Split('/');
            TreeIter itr;

            if (!GetIter(iter, split [0], out itr))
            {
                return;
            }
            else if (!exists)
            {
                treeview1.Model.SetValue(itr, 0, ICON_FOLDER[1]);
            }

            if (split.Length > 1)
            {
                string newpath = split [1];
                for (int i = 2; i < split.Length; i++)
                {
                    newpath += "/" + split [i];
                }

                RefreshItem(itr, newpath, exists, fullpath);
            }
            else
            {
                Gdk.Pixbuf icon = ICON_FILE [Convert.ToInt32(!exists)];

                if (exists)
                {
                    icon = IconCache.GetIcon(window._controller.GetFullPath(fullpath));
                }

                treeview1.Model.SetValue(itr, 0, icon);

                if (exists)
                {
                    RefreshFolders(iter);
                }
            }
        }