Example #1
0
        public FavoriteEntry(NavigationBar.NavigationType navigationType) : base(false, 6)         //(string name, bool isFolder) : base (false, 6)
        {
            //this.isFolder = isFolder;
            //this.name = name;
            navBar = new NavigationBar(navigationType);
            browse = Button.NewWithMnemonic(MainClass.Languages.Translate("browse"));

            //navBar.Changed += new EventHandler (OnTextChanged);
            navBar.OnChangePath += NavigateBarChange;
            browse.Clicked      += new EventHandler(OnButtonClicked);

            PackStart(navBar, true, true, 0);
            PackEnd(browse, false, false, 0);
        }
Example #2
0
        //(string name, bool isFolder) : base (false, 6)
        public FavoriteEntry(NavigationBar.NavigationType navigationType)
            : base(false, 6)
        {
            //this.isFolder = isFolder;
            //this.name = name;
            navBar = new NavigationBar (navigationType);
            browse = Button.NewWithMnemonic (MainClass.Languages.Translate("browse"));

            //navBar.Changed += new EventHandler (OnTextChanged);
            navBar.OnChangePath += NavigateBarChange;
            browse.Clicked += new EventHandler (OnButtonClicked);

            PackStart (navBar, true, true, 0);
            PackEnd (browse, false, false, 0);
        }
Example #3
0
        public FileExplorer()
        {
            navigBar = new NavigationBar(NavigationBar.NavigationType.favorites);

            navigBar.OnChangePath+= NavigateBarChange;

            Toolbar toolbar = new Toolbar ();
            //WinMenuBar  toolbar = new WinMenuBar ();
            this.PackStart (toolbar, false, false, 0);

            refreshButton = new ToolButton ("refresh.png");//Stock.Home);
            refreshButton.IsImportant = true;
            refreshButton.Label = MainClass.Languages.Translate("menu_refresh");
            refreshButton.BorderWidth = 1;
            refreshButton.Clicked+= delegate {
                FillStore (true);
            };
            toolbar.Insert (refreshButton, -1);

            upButton = new ToolButton  ("go-up.png");//Stock.GoUp
            upButton.Sensitive = false;
            upButton.Label ="Up";
            upButton.BorderWidth = 1;
            toolbar.Insert (upButton, -1);

            Gtk.Menu menu = new Gtk.Menu ();

            MenuItem mi = new MenuItem ("Workspace");
            mi.Activated += OnWorkspaceClicked;
            menu.Insert (mi, -1);
            mi = new MenuItem ("Project");
            mi.Activated += OnProjectClicked;
            menu.Insert (mi, -1);
            menu.ShowAll ();
            mi = new MenuItem ("User home folder");
            mi.Activated += OnHomeClicked;
            menu.Insert (mi, -1);
            menu.ShowAll ();
            mi = new MenuItem ("Output folder");
            mi.Activated += OnOutputClicked;
            menu.Insert (mi, -1);
            menu.ShowAll ();
            mi = new MenuItem ("Disk root");
            mi.Activated += OnOutputClicked;
            menu.Insert (mi, -1);
            menu.ShowAll ();

            if(MainClass.Platform.IsWindows){

                SeparatorMenuItem smi = new SeparatorMenuItem();
                menu.Insert (smi, -1);

                string[] drives = Environment.GetLogicalDrives();
                 foreach(string strDrive in drives)
                 {
                    mi = new MenuItem (strDrive);
                    mi.TooltipText = strDrive;
                    mi.Activated += delegate(object sender, EventArgs e)
                    {
                        string drive = (sender as  MenuItem).TooltipText;
                        parent = new DirectoryInfo(drive);
                        FillStore (true);
                        upButton.Sensitive = false;
                    };
                    menu.Insert (mi, -1);
                    menu.ShowAll ();

                };
            }

            MenusToolButton gotoButton= new MenusToolButton(menu,"workspace.png");
            gotoButton.IsImportant = true;
            gotoButton.Label = "Go To";
            toolbar.Insert (gotoButton, -1);

            Gtk.Menu menuAdd = new Gtk.Menu ();
            mi = new MenuItem (MainClass.Languages.Translate("menu_create_file"));
            mi.Activated += OnCreateFileClicked;
            menuAdd.Insert (mi, -1);
            mi = new MenuItem (MainClass.Languages.Translate("menu_create_dir"));
            mi.Activated += OnCreateDirectoryClicked;
            menuAdd.Insert (mi, -1);
            menuAdd.ShowAll ();

            MenusToolButton mtbCreate= new MenusToolButton(menuAdd,"file-new.png");
            mtbCreate.IsImportant = true;
            mtbCreate.Label = "Create";
            toolbar.Insert (mtbCreate, -1);

            fileIcon = GetIcon ("file.png");//Stock.File);
            dirIcon = GetIcon ("folder.png");//Stock.Open);
            upIcon = GetIcon ("go-up.png");

            ScrolledWindow sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.EtchedIn;
            sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            this.PackStart (sw, true, true, 0);

            // Create the store and fill it with the contents of '/'
            store = CreateStore ();

            iconView = new IconView (store);
            iconView.ButtonReleaseEvent+= OnButtonRelease;

            iconView.SelectionMode = SelectionMode.Single;

            iconView.Columns = 1;
            iconView.Orientation = Orientation.Horizontal;

            upButton.Clicked += new EventHandler (OnUpClicked);

            iconView.TextColumn = COL_DISPLAY_NAME;
            iconView.PixbufColumn = COL_PIXBUF;
            iconView.TooltipColumn = COL_PATH;
            iconView.RowSpacing = -6;
            iconView.Spacing = -1;
            iconView.ColumnSpacing=0;
            iconView.Margin=-5;

            iconView.ItemActivated += new ItemActivatedHandler (OnItemActivated);

            sw.Add (iconView);

            iconView.SelectionChanged+= delegate(object sender, EventArgs e) {
                Gtk.TreePath[] selRow = iconView.SelectedItems;
                if(selRow.Length<1) return;

                Gtk.TreePath tp = selRow[0];
                TreeIter ti = new TreeIter();
                store.GetIter(out ti,tp);

                if(tp.Equals(TreeIter.Zero))return;

                string name = store.GetValue(ti, 1).ToString();
                if(name == ".."){
                    selectedItem = null;
                } else {
                    selectedItem = store.GetValue(ti, 0).ToString();
                    isDir = (bool)store.GetValue(ti, 3);
                }
            };
            this.PackEnd (navigBar, false, false, 0);
        }