当前位置: 首页>>代码示例>>C#>>正文


C# FileChooserDialog.AddShortcutFolder方法代码示例

本文整理汇总了C#中Gtk.FileChooserDialog.AddShortcutFolder方法的典型用法代码示例。如果您正苦于以下问题:C# FileChooserDialog.AddShortcutFolder方法的具体用法?C# FileChooserDialog.AddShortcutFolder怎么用?C# FileChooserDialog.AddShortcutFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.FileChooserDialog的用法示例。


在下文中一共展示了FileChooserDialog.AddShortcutFolder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Application

    private Application(string[] args)
    {
        selection = new Selection();

        Glade.XML.CustomHandler = GladeCustomWidgetHandler;
        Glade.XML gxml = new Glade.XML("editor.glade", "MainWindow");
        gxml.Autoconnect(this);

        if (MainWindow == null)
            throw new Exception("Couldn't resolve all widgets");

        Tileset.LoadEditorImages = true;

        //initialize statur bar for PrintStatus()
        printStatusContextID = sbMain.GetContextId("PrintStatus");
        printStatusMessageID = sbMain.Push(printStatusContextID, "Welcome to Supertux-Editor.");

        MainWindow.DeleteEvent += OnDelete;

        MainWindow.SetSizeRequest(900, 675);
        MainWindowTitlePrefix = MainWindow.Title;
        MainWindow.ShowAll();

        // Manually set icons for Tools
        ToolSelect.StockId = EditorStock.ToolSelect;
        ToolTiles.StockId = EditorStock.ToolTiles;
        ToolObjects.StockId = EditorStock.ToolObjects;
        ToolBrush.StockId = EditorStock.ToolBrush;
        ToolFill.StockId = EditorStock.ToolFill;
        ToolReplace.StockId = EditorStock.ToolReplace;

        // Tool "Select" is selected by default - call its event handler
        OnToolSelect(null, null);

        // Manually set icon for Background toggle button
        ttbShowBackground.StockId = EditorStock.Background;

        fileChooser = new FileChooserDialog("Choose a Level", MainWindow, FileChooserAction.Open, new object[] {});
        if(Settings.Instance.LastDirectoryName == null){
            if( Settings.Instance.SupertuxData != null ){
                Settings.Instance.LastDirectoryName = Settings.Instance.SupertuxData;
            } else {
                Settings.Instance.LastDirectoryName = Environment.ExpandEnvironmentVariables("%HOME%");
            }
        }
        fileChooser.SetCurrentFolder(Settings.Instance.LastDirectoryName);
        fileChooser.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
        fileChooser.AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok);
        fileChooser.DefaultResponse = Gtk.ResponseType.Ok;
        Gtk.FileFilter filter = new Gtk.FileFilter();
        filter.Name = "Supertux Levels and Worldmaps";
        filter.AddPattern("*.stl");
        filter.AddPattern("*.stwm");
        fileChooser.AddFilter( filter );
        Gtk.FileFilter levelfilter = new Gtk.FileFilter();
        levelfilter.Name = "Supertux Levels";
        levelfilter.AddPattern("*.stl");
        fileChooser.AddFilter( levelfilter );
        Gtk.FileFilter worldmapfilter = new Gtk.FileFilter();
        worldmapfilter.Name = "Supertux Worldmaps";
        worldmapfilter.AddPattern("*.stwm");
        fileChooser.AddFilter( worldmapfilter );
        Gtk.FileFilter brushfilter = new Gtk.FileFilter();
        brushfilter.Name = "Supertux-Editor Brushs";
        brushfilter.AddPattern("*.csv");
        fileChooser.AddFilter(brushfilter);
        Gtk.FileFilter all = new Gtk.FileFilter();
        all.Name = "All Files";
        all.AddPattern("*");
        fileChooser.AddFilter( all );
        if( Settings.Instance.SupertuxData != null ){
            try {
                fileChooser.AddShortcutFolder(Settings.Instance.SupertuxData);
            } catch (Exception e) {
                Console.WriteLine("Warning: Couldn't add supertux data directory to File Chooser: " + e.Message);
            }
        }

        if (args.Length > 0) {
            Load(args[0]);
        }

        PrintStatus("Welcome to Supertux-Editor.");
    }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:84,代码来源:Application.cs

示例2: Application

    private Application(string[] args)
    {
        selection = new TileSelection();

        Glade.XML.CustomHandler = GladeCustomWidgetHandler;
        Glade.XML gxml = new Glade.XML("editor.glade", "MainWindow");
        gxml.Autoconnect(this);

        if (MainWindow == null)
            throw new Exception("Couldn't resolve all widgets");

        ((GameObjectListWidget)ToolGObjectsProps).SetGtkFrame(fGObjects);

        Tileset.LoadEditorImages = true;

        // Initialize status bar for PrintStatus()
        printStatusContextID = sbMain.GetContextId("PrintStatus");
        printStatusMessageID = sbMain.Push(printStatusContextID, "Welcome to Supertux-Editor.");

        MainWindow.DeleteEvent += OnDelete;

        MainWindow.SetSizeRequest(900, 675);
        MainWindowTitlePrefix = MainWindow.Title;
        UpdateTitlebar();
        UpdateRecentDocuments();
        MainWindow.Icon = EditorStock.WindowIcon;
        //HACK: not a typo, EditorStock adds icons to the stock only when called 2x or more..
        MainWindow.Icon = EditorStock.WindowIcon;
        MainWindow.ShowAll();

        // Manually set icons for Tools, automatic stock initialization is broken on some systems
        ToolSelect.StockId = EditorStock.ToolSelect;
        ToolTiles.StockId = EditorStock.ToolTiles;
        ToolObjects.StockId = EditorStock.ToolObjects;
        ToolBrush.StockId = EditorStock.ToolBrush;
        ToolFill.StockId = EditorStock.ToolFill;
        ToolReplace.StockId = EditorStock.ToolReplace;
        ToolPath.StockId = EditorStock.ToolPath;
        ToolButtonCamera.StockId = EditorStock.Camera;

        // Hide some extra widgets (because MainWindow.ShowAll(); showed them all)
        fGObjects.Visible = false;
        if (Settings.Instance.ToolboxOnRight)
        {
            aTools.Reparent(fToolsRight);
            fToolsLeft.Hide();
        } else {
            aTools.Reparent(fToolsLeft);
            fToolsRight.Hide();
        }

        // Tool "Select" is selected by default - call its event handler
        OnToolSelect(null, null);

        //Setup drag destination for "files"
        Gtk.Drag.DestSet(MainWindow, Gtk.DestDefaults.All, target_table,
                 Gdk.DragAction.Default |
                 Gdk.DragAction.Copy |
                 Gdk.DragAction.Move |
                 Gdk.DragAction.Link |
                 Gdk.DragAction.Private |
                 Gdk.DragAction.Ask);
        MainWindow.DragDataReceived += OnDragDataReceived;

        fileChooser = new Gtk.FileChooserDialog("Choose a Level", MainWindow, Gtk.FileChooserAction.Open, new object[] {});
        if (!Directory.Exists(Settings.Instance.LastDirectoryName)) {	//noexistent (or null) LastDirectoryName, resetting to default
            if( Settings.Instance.SupertuxData != null ) {
                Settings.Instance.LastDirectoryName = System.IO.Path.Combine(Settings.Instance.SupertuxData, "levels") + System.IO.Path.DirectorySeparatorChar;
            } else {
                Settings.Instance.LastDirectoryName = Environment.ExpandEnvironmentVariables("%HOME%");
            }
        }
        fileChooser.SetCurrentFolder(Settings.Instance.LastDirectoryName);
        fileChooser.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
        fileChooser.AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok);
        fileChooser.DefaultResponse = Gtk.ResponseType.Ok;
        Gtk.FileFilter filter = new Gtk.FileFilter();
        filter.Name = "Supertux Levels and Worldmaps";
        filter.AddPattern("*.stl");
        filter.AddPattern("*.stwm");
        fileChooser.AddFilter( filter );
        Gtk.FileFilter levelfilter = new Gtk.FileFilter();
        levelfilter.Name = "Supertux Levels";
        levelfilter.AddPattern("*.stl");
        fileChooser.AddFilter( levelfilter );
        Gtk.FileFilter worldmapfilter = new Gtk.FileFilter();
        worldmapfilter.Name = "Supertux Worldmaps";
        worldmapfilter.AddPattern("*.stwm");
        fileChooser.AddFilter( worldmapfilter );
        Gtk.FileFilter brushfilter = new Gtk.FileFilter();
        brushfilter.Name = "Supertux-Editor Brushes";
        brushfilter.AddPattern("*.csv");
        fileChooser.AddFilter(brushfilter);
        Gtk.FileFilter all = new Gtk.FileFilter();
        all.Name = "All Files";
        all.AddPattern("*");
        fileChooser.AddFilter( all );
        if( Settings.Instance.SupertuxData != null ){
            try {
                fileChooser.AddShortcutFolder(System.IO.Path.Combine(Settings.Instance.SupertuxData, "levels"));
//.........这里部分代码省略.........
开发者ID:Karkus476,项目名称:supertux-editor,代码行数:101,代码来源:Application.cs


注:本文中的Gtk.FileChooserDialog.AddShortcutFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。