コード例 #1
0
        private void OnLoadSubtitleAction(object o, EventArgs args)
        {
            var chooser = new Banshee.Gui.Dialogs.GtkFileChooserDialog(
                Catalog.GetString("Load Subtitle File"),
                ServiceManager.Get <Banshee.Gui.GtkElementsService> ().PrimaryWindow,
                FileChooserAction.Open
                );

            chooser.DefaultResponse = ResponseType.Ok;
            chooser.SelectMultiple  = false;

            chooser.AddButton(Stock.Cancel, ResponseType.Cancel);
            chooser.AddButton(Catalog.GetString("L_oad"), ResponseType.Ok);

            Hyena.Gui.GtkUtilities.SetChooserShortcuts(chooser,
                                                       ServiceManager.SourceManager.VideoLibrary.BaseDirectory
                                                       );

            var filter = new FileFilter();

            filter.AddMimeType("text/x-pango-markup");
            filter.AddMimeType("text/plain");
            filter.Name = Catalog.GetString("Subtitle files");
            chooser.AddFilter(filter);

            if (chooser.Run() == (int)ResponseType.Ok)
            {
                ServiceManager.PlayerEngine.SubtitleUri = new SafeUri(chooser.Uri);
            }

            chooser.Destroy();
        }
コード例 #2
0
        public IBansheeFileChooser CreateForImport(string title, bool files)
        {
            var chooser = new Banshee.Gui.Dialogs.GtkFileChooserDialog(
                title,
                ServiceManager.Get <Banshee.Gui.GtkElementsService> ().PrimaryWindow,
                files ? FileChooserAction.Open : FileChooserAction.SelectFolder
                );

            chooser.DefaultResponse = ResponseType.Ok;
            chooser.SelectMultiple  = true;

            chooser.AddButton(Stock.Cancel, ResponseType.Cancel);
            // Translators: verb
            chooser.AddButton(Mono.Unix.Catalog.GetString("I_mport"), ResponseType.Ok);

            // FIXME: this dialog should be library-specific, and so these shortcuts should be
            // library-specific too
            Hyena.Gui.GtkUtilities.SetChooserShortcuts(chooser,
                                                       ServiceManager.SourceManager.MusicLibrary.BaseDirectory,
                                                       ServiceManager.SourceManager.VideoLibrary.BaseDirectory,
                                                       GetPhotosFolder()
                                                       );

            return(chooser);
        }
コード例 #3
0
        public IBansheeFileChooser CreateForImport(string title, bool files)
        {
            var chooser = new Banshee.Gui.Dialogs.GtkFileChooserDialog (
                title,
                ServiceManager.Get<Banshee.Gui.GtkElementsService> ().PrimaryWindow,
                files ? FileChooserAction.Open : FileChooserAction.SelectFolder
            );

            chooser.DefaultResponse = ResponseType.Ok;
            chooser.SelectMultiple = true;

            chooser.AddButton (Stock.Cancel, ResponseType.Cancel);
            // Translators: verb
            chooser.AddButton (Mono.Unix.Catalog.GetString("I_mport"), ResponseType.Ok);

            // FIXME: this dialog should be library-specific, and so these shortcuts should be
            // library-specific too
            Hyena.Gui.GtkUtilities.SetChooserShortcuts (chooser,
                ServiceManager.SourceManager.MusicLibrary.BaseDirectory,
                ServiceManager.SourceManager.VideoLibrary.BaseDirectory,
                GetPhotosFolder ()
            );

            return chooser;
        }