Ignore:
Timestamp:
Oct 30, 2008, 2:02:36 AM (14 years ago)
Author:
Sam Hocevar
Message:

ThePimp?: make file dialogs singletons so that they retain their properties
and do not take ages to build.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/ThePimp/src/OpenFile.cs

    r3099 r3145  
    2020    public partial class OpenFile : Gtk.Dialog
    2121    {
    22         public OpenFile()
     22        private static readonly OpenFile instance = new OpenFile();
     23
     24        // Do not mark type as beforefieldinit
     25        static OpenFile() {}
     26
     27        private OpenFile()
    2328        {
    2429            this.Build();
    2530        }
    2631
    27         public string GetChoice()
     32        public static string GetChoice()
    2833        {
    29             ResponseType rsp = (ResponseType)Run();
    30             Hide();
     34            instance.ShowAll();
     35            ResponseType rsp = (ResponseType)instance.Run();
     36            instance.Hide();
    3137            if(rsp != ResponseType.Ok)
    3238                return null;
    33             return filechooserwidget1.Filename;
     39            return instance.filechooserwidget1.Filename;
    3440        }
    3541
Note: See TracChangeset for help on using the changeset viewer.