本文整理汇总了C#中Gtk.Window.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Window.Destroy方法的具体用法?C# Gtk.Window.Destroy怎么用?C# Gtk.Window.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Window
的用法示例。
在下文中一共展示了Gtk.Window.Destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MusicSource
public MusicSource()
: base("Google Music", "Google Music", 30)
{
api = new Google.Music.Api();
downloadWrapper = new MusicDownloadWrapper(api);
downloadWrapper.Start();
TypeUniqueId = "google-music";
Properties.Set<Gdk.Pixbuf>("Icon.Pixbuf_16", Gdk.Pixbuf.LoadFromResource("google-music-favicon"));
var win = new Gtk.Window("Google Music Login");
var loginWidget = new LoginWidget();
loginWidget.UserLoggedIn += (cookies) => {
api.SetCookies(cookies);
AsyncUserJob.Create(() => {
Refetch();
}, "Fetching playlist");
win.Destroy();
};
win.Add(loginWidget);
win.ShowAll();
}
示例2: GlobalSetup
static void GlobalSetup ()
{
if (initedGlobal || setupFail)
return;
initedGlobal = true;
//FIXME: should we remove these when finalizing?
try {
ApplicationEvents.Quit += delegate (object sender, ApplicationQuitEventArgs e) {
if (!IdeApp.Exit ())
e.UserCancelled = true;
e.Handled = true;
};
ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
if (IdeApp.Workbench != null && IdeApp.Workbench.RootWindow != null) {
IdeApp.Workbench.RootWindow.Deiconify ();
IdeApp.Workbench.RootWindow.Show ();
// This is a workaround to a GTK+ bug. The HasTopLevelFocus flag is not properly
// set when the main window is restored. The workaround is to create and quickly
// destroy a top level window. GTK+ then detects that the top level focus has
// changed and properly sets HasTopLevelFocus.
Gtk.Window ww = new Gtk.Window ("");
ww.Decorated = false;
ww.SetDefaultSize (0, 0);
ww.Present ();
IdeApp.Workbench.RootWindow.Present ();
GLib.Timeout.Add (1, delegate {
// Without this small delay, GTK+ crashes when destroying the window
ww.Destroy ();
return false;
});
e.Handled = true;
}
};
ApplicationEvents.OpenDocuments += delegate (object sender, ApplicationDocumentEventArgs e) {
//OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout
GLib.Timeout.Add (10, delegate {
IdeApp.OpenFiles (e.Documents.Select (doc =>
new FileOpenInformation (doc.Key, doc.Value, 1, OpenDocumentOptions.Default)));
return false;
});
e.Handled = true;
};
//if not running inside an app bundle, assume usual MD build layout and load the app icon
FilePath exePath = System.Reflection.Assembly.GetExecutingAssembly ().Location;
if (!exePath.ToString ().Contains ("MonoDevelop.app")) {
var mdSrcMain = exePath.ParentDirectory.ParentDirectory.ParentDirectory;
var icons = mdSrcMain.Combine ("theme-icons", "Mac", "monodevelop.icns");
if (File.Exists (icons))
NSApplication.SharedApplication.ApplicationIconImage = new NSImage (icons);
}
} catch (Exception ex) {
MonoDevelop.Core.LoggingService.LogError ("Could not install app event handlers", ex);
setupFail = true;
}
}
示例3: GetDefaults
static void GetDefaults ()
{
if (!gotDefault) {
// Is there a better way of getting the default?
Gtk.Window d = new Gtk.Window ("");
Gtk.Toolbar t = new Gtk.Toolbar ();
d.Add (t);
defaultStyle = t.ToolbarStyle;
defaultSize = t.IconSize;
d.Destroy ();
gotDefault = true;
}
}