banshee r4196 - in trunk/banshee: . src/Libraries/Lastfm.Gui/Lastfm.Gui



Author: gburt
Date: Tue Jun 24 22:07:19 2008
New Revision: 4196
URL: http://svn.gnome.org/viewvc/banshee?rev=4196&view=rev

Log:
2008-06-24  Gabriel Burt  <gabriel burt gmail com>

	* src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginDialog.cs:
	* src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs: Patch from
	Peter de Kraker adds ability to press enter from password entry on Last.fm
	login form to save and close the dialog (BGO #536328).


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginDialog.cs
   trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs

Modified: trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginDialog.cs
==============================================================================
--- trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginDialog.cs	(original)
+++ trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginDialog.cs	Tue Jun 24 22:07:19 2008
@@ -112,6 +112,7 @@
                     login_form.Save ();
                 };
                 AddActionWidget (button, ResponseType.Ok);
+                login_form.SaveOnEnter (this);
             }
         }
         

Modified: trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs
==============================================================================
--- trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs	(original)
+++ trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs	Tue Jun 24 22:07:19 2008
@@ -42,6 +42,9 @@
         private LinkButton signup_button;
         
         private bool save_on_edit = false;
+        
+        private bool save_on_enter = false;
+        private Gtk.Dialog parentDialog;
 
         public AccountLoginForm (Account account) : base (2, 2, false)
         {
@@ -64,6 +67,15 @@
             
             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 {
+                    if (save_on_enter) {
+                        this.Save ();
+                        parentDialog.Destroy ();
+                    }
+                };
+            
             password_entry.Show ();
             
             Attach (username_label, 0, 1, 0, 1, AttachOptions.Fill, 
@@ -118,6 +130,13 @@
             set { save_on_edit = value; }
         }
         
+        //enable save on Enter and destruction of the parentDialog.
+        public void SaveOnEnter (Gtk.Dialog parentDialog) 
+        {
+           save_on_enter = true;
+           this.parentDialog = parentDialog;
+        }
+                
         public string Username {
             get { return username_entry.Text; }
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]