コード例 #1
0
        public FolderChooserDialog( HComboFolder father )
            : base(Gtk.WindowType.Popup)
        {
            Gtk.IconTheme theme = Gtk.IconTheme.Default;

            folder_icon = new Gdk.Pixbuf( this.GetType().Assembly, "folder.png");
            drive_icon  = new Gdk.Pixbuf( this.GetType().Assembly, "drive.png");
            if( theme.HasIcon("folder") )
                folder_icon = theme.LoadIcon( "folder", 24, Gtk.IconLookupFlags.ForceSvg );
            if( theme.HasIcon("harddrive") )
                drive_icon = theme.LoadIcon( "harddrive", 24, Gtk.IconLookupFlags.ForceSvg );

            this.father = father;
            this.Build();
            //incarca baza
            DriveInfo[] difs = DriveInfo.GetDrives();
            foreach( DriveInfo di in difs )
            {
                // adauga doar discurile fixe
                if( di.DriveType == DriveType.Fixed )
                    FolderTree.Nodes.Add( new HTreeNode( di.Name, drive_icon ) );
            }
            //add dummy childs
            foreach( HTreeNode node in FolderTree.Nodes )
            {
                node.Nodes.Add( new HTreeNode("dummy") );
            }
        }
コード例 #2
0
        public FolderChooserDialog(HComboFolder father) :
            base(Gtk.WindowType.Popup)
        {
            Gtk.IconTheme theme = Gtk.IconTheme.Default;

            folder_icon = new Gdk.Pixbuf(this.GetType().Assembly, "folder.png");
            drive_icon  = new Gdk.Pixbuf(this.GetType().Assembly, "drive.png");
            if (theme.HasIcon("folder"))
            {
                folder_icon = theme.LoadIcon("folder", 24, Gtk.IconLookupFlags.ForceSvg);
            }
            if (theme.HasIcon("harddrive"))
            {
                drive_icon = theme.LoadIcon("harddrive", 24, Gtk.IconLookupFlags.ForceSvg);
            }

            this.father = father;
            this.Build();
            //incarca baza
            DriveInfo[] difs = DriveInfo.GetDrives();
            foreach (DriveInfo di in difs)
            {
                // adauga doar discurile fixe
                if (di.DriveType == DriveType.Fixed)
                {
                    FolderTree.Nodes.Add(new HTreeNode(di.Name, drive_icon));
                }
            }
            //add dummy childs
            foreach (HTreeNode node in FolderTree.Nodes)
            {
                node.Nodes.Add(new HTreeNode("dummy"));
            }
        }