diff options
author | Marius Ungureanu <marius.ungureanu@xamarin.com> | 2014-10-06 00:42:48 +0400 |
---|---|---|
committer | Marius Ungureanu <marius.ungureanu@xamarin.com> | 2014-10-06 00:43:10 +0400 |
commit | 8f6103398970e7e4b74e7ac2459f535e6cb992d5 (patch) | |
tree | b1c0b9e9c7bbe3a676898c43f5d41e5096e72b3d | |
parent | 2923ebe637d7c3e9e150bb63c6e0184c96e43984 (diff) |
Revert "[MessageService] Allow AlertButtons not to close the dialog."
This reverts commit e0c1a3bbe1c384ca4bbdc42c4e870f4b22f41422.
3 files changed, 3 insertions, 62 deletions
diff --git a/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs index 22ed18004e..a40909f59a 100644 --- a/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs +++ b/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs @@ -89,7 +89,7 @@ namespace MonoDevelop.MacIntegration break; } } - + foreach (var button in buttons) { var label = button.Label; if (button.IsStockButton) @@ -100,9 +100,7 @@ namespace MonoDevelop.MacIntegration if (button == AlertButton.CloseWithoutSave) label = GettextCatalog.GetString ("Don't Save"); - var nsbutton = alert.AddButton (label); - nsbutton.Target = new AlertButtonWrapper (nsbutton, button, alert); - nsbutton.Action = new MonoMac.ObjCRuntime.Selector ("buttonActivatedAction:"); + alert.AddButton (label); } @@ -180,30 +178,5 @@ namespace MonoDevelop.MacIntegration return true; } - - - } - - class AlertButtonWrapper : NSObject - { - readonly NSButton nsbutton; - readonly AlertButton alertButton; - readonly MonoMac.ObjCRuntime.Selector oldAction; - readonly NSAlert alert; - public AlertButtonWrapper (NSButton nsbutton, AlertButton alertButton, NSAlert alert) - { - this.nsbutton = nsbutton; - this.alertButton = alertButton; - this.alert = alert; - oldAction = nsbutton.Action; - } - - [Export ("buttonActivatedAction:")] - void ButtonActivatedAction () - { - alertButton.NotifyClicked (); - if (alertButton.CloseDialog) - nsbutton.SendAction (oldAction, alert); - } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs index 1f099a71f9..89f0ef9835 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs @@ -171,10 +171,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs break; } } - - resultButton.NotifyClicked (); - if (resultButton.CloseDialog) - this.Destroy (); + this.Destroy (); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs index 68e6c1f75d..578f09c53e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs @@ -37,23 +37,6 @@ using MonoDevelop.Ide.Gui; namespace MonoDevelop.Ide { - public class AlertButtonEventArgs : EventArgs - { - public bool CloseDialog { - get; - set; - } - - public AlertButtonEventArgs (bool closeDialog) - { - CloseDialog = closeDialog; - } - - public AlertButtonEventArgs () : this (true) - { - } - } - public class AlertButton { public static AlertButton Ok = new AlertButton (Gtk.Stock.Ok, true); @@ -83,23 +66,11 @@ namespace MonoDevelop.Ide public string Label { get; set; } public string Icon { get; set; } public bool IsStockButton { get; set; } - public bool CloseDialog { get; private set; } - public delegate void AlertButtonClickedHandler (AlertButtonEventArgs args); - public event EventHandler<AlertButtonEventArgs> OnClicked; - - internal void NotifyClicked () - { - var args = new AlertButtonEventArgs (CloseDialog); - if (OnClicked != null) - OnClicked (this, args); - CloseDialog = args.CloseDialog; - } public AlertButton (string label, string icon) { this.Label = label; this.Icon = icon; - this.CloseDialog = true; } public AlertButton (string label) : this (label, null) |