示例#1
0
        public void on_open1_activate(object o, EventArgs args)
        {
            FileSelection fs = new FileSelection("Select a PDF file...");

            // TODO: This doesn't filter the file list...
            fs.Complete("*.pdf");
            fs.Run();
            fs.Hide();

            appbar1.Push("Opening document...");
            m_doc = new Pdf(fs.Filename);
            appbar1.Push(m_doc.PageCount + " page document");

            // Populate the pages list
            Gtk.ListStore model = new Gtk.ListStore(typeof(string));
            Gtk.TreeIter  iter  = new Gtk.TreeIter();
            Console.WriteLine("List has " + model.NColumns + " columns");
            for (int i = 0; i < m_doc.PageCount; i++)
            {
                iter = model.Append();
                GLib.Value v = new GLib.Value((i + 1).ToString());
                model.SetValue(iter, 0, v);
            }
            pages.Model = model;
            pages.Show();
        }
示例#2
0
        public void OnBrowseDefaultPath(object o, EventArgs args)
        {
            FileSelection fs = new FileSelection("Select where to find media");

            fs.FileList.Parent.Hide();
            //fs.SelectionEntry.Hide();
            fs.FileopDelFile.Hide();
            fs.FileopRenFile.Hide();
            fs.HideFileopButtons();
            CConfig config = CConfig.Instance;

            if (File.Exists((string)config["Interface/currentPat        h"]))
            {
                fs.Complete((string)config["Interface/currentPath"]);
            }
            //fs.Complete("*");
            fs.Resizable = true;
            fs.Modal     = true;
            int res = fs.Run();

            fs.Hide();
            fs.Dispose();
            if (res == (int)ResponseType.Ok)
            {
                Console.WriteLine(fs.Filename);
                Console.WriteLine(fs.Selections[0]);
                pathEntry.Text = fs.Filename;
            }
        }
示例#3
0
 protected virtual void OnOpenActivated(object sender, System.EventArgs e)
 {
     //Open fileselector
     file_selection = new FileSelection("Select an NFO file");
     file_selection.Complete("*.NFO");
     file_selection.OkButton.Clicked     += new EventHandler(sel_OK_Clicked);
     file_selection.CancelButton.Clicked += new EventHandler(sel_Cancel_Clicked);
     file_selection.HideFileopButtons();
     file_selection.Run();
 }
示例#4
0
 protected virtual void OnOpenActivated(object sender, System.EventArgs e)
 {
     //Open fileselector
     file_selection = new FileSelection("Select an NFO file");
     file_selection.Complete("*.NFO");
     file_selection.OkButton.Clicked += new EventHandler(sel_OK_Clicked);
     file_selection.CancelButton.Clicked += new EventHandler(sel_Cancel_Clicked);
     file_selection.HideFileopButtons();
     file_selection.Run();
 }
示例#5
0
 string GetFilePath(string prompt, string defaultfilename)
 {
     using (FileSelection dialog = new FileSelection(prompt))
     {
         dialog.Complete(defaultfilename);
         ResponseType response = (ResponseType)dialog.Run();
         dialog.Hide();
         if (response == ResponseType.Ok)
         {
             Console.WriteLine("got filepath: " + dialog.Filename);
             return(dialog.Filename);
         }
         else
         {
             Console.WriteLine("Cancel pressed");
             return("");
         }
     }
 }
示例#6
0
 string GetFilePath(string prompt, string defaultfilename)
 {
     using (FileSelection dialog = new FileSelection(prompt))
     {
         dialog.Complete(defaultfilename);
         ResponseType response = (ResponseType)dialog.Run();
         dialog.Hide();
         if (response == ResponseType.Ok)
         {
             Console.WriteLine("got filepath: " + dialog.Filename);
             return dialog.Filename;
         }
         else
         {
             Console.WriteLine("Cancel pressed");
             return "";
         }
     }
 }
示例#7
0
        private void ConfirmLoadAssembly(string [] selection)
        {
            Gtk.Entry     e_sPlugin          = null;
            string        l_sChoosenPlayer   = "";
            MessageDialog confirmationDialog = null;

            foreach (string s in selection)
            {
                confirmationDialog = new MessageDialog(this.Window,
                                                       DialogFlags.Modal |
                                                       DialogFlags.DestroyWithParent,
                                                       MessageType.Question,
                                                       ButtonsType.YesNo,
                                                       "What extension " + Path.GetFileName(s) + " should handle ?");
                VBox vbox = confirmationDialog.VBox;
                HBox hbox = new HBox(false, 4);
                vbox.PackStart(hbox, true, true, 0);

                e_sPlugin = new Gtk.Entry(".foobar");
                hbox.PackStart(e_sPlugin, false, false, 0);

                confirmationDialog.ShowAll();
                int res = confirmationDialog.Run();
                confirmationDialog.Hide();
                confirmationDialog.Dispose();

                if (res == (int)ResponseType.Yes)
                {
                    try
                    {
                        FileSelection fs = new FileSelection("Select your favorite player");
                        fs.HideFileopButtons();
                        CConfig config = CConfig.Instance;
                        fs.Complete((string)config["Interface/currentPath"]);
                        fs.Resizable = true;
                        fs.Modal     = true;
                        int r = fs.Run();
                        fs.Hide();
                        fs.Dispose();
                        if (r == (int)ResponseType.Ok)
                        {
                            l_sChoosenPlayer = fs.Selections[0];
                            plugins.LoadAssembly((string)((Gtk.Entry)e_sPlugin).Text, s);
                            try
                            {
                                CPluginManager.SetStatic(plugins.GetOwningType((string)((Gtk.Entry)e_sPlugin).Text), "Player", l_sChoosenPlayer);
                            }
                            catch (Exception e) { Console.WriteLine("Player not found"); }
                            PopulatePluginList();
                            ((Gtk.Button)m_xXML["applyButton"]).Sensitive = true;
                        }
                        else
                        {
                            throw new Exception("Loading aborted by user.");
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Plugin error: " + e.Message);
                    }
                }
            }
        }