mac events: simplify showing/hiding of controls

This commit is contained in:
Hylke Bons 2012-09-16 17:56:31 +01:00
parent 80a5b63595
commit d53ae07edc

View file

@ -185,10 +185,9 @@ namespace SparkleShare {
using (var a = new NSAutoreleasePool ()) using (var a = new NSAutoreleasePool ())
{ {
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
this.web_view.Hidden = true;
this.progress_indicator.Hidden = true;
PerformClose (this); PerformClose (this);
if (this.web_view.Superview == ContentView)
this.web_view.RemoveFromSuperview ();
}); });
} }
}; };
@ -224,11 +223,8 @@ namespace SparkleShare {
using (var a = new NSAutoreleasePool ()) using (var a = new NSAutoreleasePool ())
{ {
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
if (this.web_view.Superview == ContentView) this.web_view.Hidden = true;
this.web_view.RemoveFromSuperview (); this.progress_indicator.Hidden = false;
if (this.progress_indicator.Superview != ContentView)
ContentView.AddSubview (this.progress_indicator);
this.progress_indicator.StartAnimation (this); this.progress_indicator.StartAnimation (this);
}); });
@ -276,9 +272,7 @@ namespace SparkleShare {
this.history_label_value.Frame.Size this.history_label_value.Frame.Size
); );
this.popup_button.RemoveFromSuperview (); // Needed to prevent redraw glitches
// Needed to prevent redraw glitches
this.popup_button.RemoveFromSuperview ();
this.popup_button.Frame = new RectangleF ( this.popup_button.Frame = new RectangleF (
new PointF (new_window_size.Width - this.popup_button.Frame.Width - 12, new_window_size.Height - TitlebarHeight - 33), new PointF (new_window_size.Width - this.popup_button.Frame.Width - 12, new_window_size.Height - TitlebarHeight - 33),
@ -374,9 +368,6 @@ namespace SparkleShare {
pixmaps_path + "/document-moved-12.png"); pixmaps_path + "/document-moved-12.png");
InvokeOnMainThread (delegate { InvokeOnMainThread (delegate {
if (this.progress_indicator.Superview == ContentView)
this.progress_indicator.RemoveFromSuperview ();
this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") { this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") {
Frame = new RectangleF (new PointF (0, 0), Frame = new RectangleF (new PointF (0, 0),
new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39)) new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39))
@ -394,6 +385,9 @@ namespace SparkleShare {
Controller.LinkClicked (href); Controller.LinkClicked (href);
}; };
this.progress_indicator.Hidden = true;
this.web_view.Hidden = false;
}); });
} }
} }