[Banshee-List] Last.FM account dialog: Save+Close on Enter
- From: Peter de Kraker <banshee umito nl>
- To: banshee-list gnome org
- Subject: [Banshee-List] Last.FM account dialog: Save+Close on Enter
- Date: Sat, 31 May 2008 23:18:39 +0200
Hi,
It was bothering me for a long time that the Last.FM account dialog,
where you enter your username and password, didn't responded to pressing
Enter. Since I am starting with C# I thought of it as a nice challenge
to try to fix it myself and this is the (probably crappy but working)
result. I hope it is not a problem if I as a newbie post it here for
some feedback.
Index: src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs
===================================================================
--- src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs (revision
4052)
+++ src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs (working
copy)
@@ -64,6 +64,13 @@
password_entry = new Entry ();
password_entry.Visibility = false;
+
+ //When the user presses enter in the password field: save,
and then destroy the AcountLoginDialog
+ password_entry.Activated += delegate {
+ this.Save ();
+ this.Parent.Parent.Parent.Parent.Destroy
();
+ };
+
password_entry.Show ();
Attach (username_label, 0, 1, 0, 1, AttachOptions.Fill,
* I would guess that the Parent.[..].Parent stuff is not the best way to
close the Dialog, but I couldn't think of another way since the form is
a sub(x4)child of the AccountLoginDialog. Is there a better way?
* What is the use for the addCloseButton option in AccountLoginDialog? I
understand what it does, but not why it is optional. I couldn't find a
reference to it that used it (everything calls with bool true), but if
it is really in use or important, I guess that my code should be moved
to a method, that gets called in the "if (addCloseButton)" section.
Another thing: it took me quite some time to partly understand the code
of Lastfm.Gui, and I would really like to know why almost all the code
of the whole of Banshee is uncommented. Am I missing something or am I
supposed to understand banshee only by code? I have not really seen code
of other O/S projects but I thought it was common practice to document
code properly?
Anyway, looking forward to 1.0 and a lot of succes to the real devs !
Peter de Kraker
Index: src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs
===================================================================
--- src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs (revision 4052)
+++ src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs (working copy)
@@ -64,6 +64,13 @@
password_entry = new Entry ();
password_entry.Visibility = false;
+
+ //When the user presses enter in the password field: save, and then destroy the AcountLoginDialog
+ password_entry.Activated += delegate {
+ this.Save ();
+ this.Parent.Parent.Parent.Parent.Destroy ();
+ };
+
password_entry.Show ();
Attach (username_label, 0, 1, 0, 1, AttachOptions.Fill,
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]