[blam/gtk-builder] Refactor AddChannelDialog a bit
- From: Carlos Martín Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam/gtk-builder] Refactor AddChannelDialog a bit
- Date: Mon, 7 Oct 2013 13:03:57 +0000 (UTC)
commit 4ca4ae26fbc16e07ec2b2bd73b3e13f9fb32e0b5
Author: Carlos Martín Nieto <cmn dwim me>
Date: Mon Oct 7 15:04:21 2013 +0200
Refactor AddChannelDialog a bit
src/Dialogs.cs | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/Dialogs.cs b/src/Dialogs.cs
index 5bd2b1e..d0ccf3d 100644
--- a/src/Dialogs.cs
+++ b/src/Dialogs.cs
@@ -108,18 +108,17 @@ namespace Blam
}
// seed a dummy event so we take the above set into account
- var foo = new EventPattern<EventArgs>(this, null);
- urlChange = urlChanged.StartWith(foo).Subscribe(obj => {
- button.Sensitive = !String.IsNullOrEmpty(Url);
+ var initial = new EventPattern<EventArgs>(urlEntry, null);
+ urlChange = urlChanged.StartWith(initial).Subscribe(obj => {
+ var t = ((Entry)obj.Sender).Text;
+ button.Sensitive = !String.IsNullOrEmpty(t);
});
});
activation = Observable.Merge(urlEntry.OnActivated(), usernameEntry.OnActivated(),
passwordEntry.OnActivated())
- .Subscribe(obj => {
- if (button.Sensitive)
- button.Click();
- });
+ .Where(x => button.Sensitive)
+ .Subscribe(obj => button.Click());
}
public bool Run()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]