Author: gonzalo
Date: 2006-08-10 15:44:55 -0400 (Thu, 10 Aug 2006)
New Revision: 63622

Modified:
   trunk/gnome-keyring-sharp/ChangeLog
   trunk/gnome-keyring-sharp/src/Gnome.Keyring/KeyringInfo.cs
   trunk/gnome-keyring-sharp/src/Gnome.Keyring/Ring.cs
Log:
2006-08-10 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * src/Gnome.Keyring/KeyringInfo.cs: add a Name property.
        * src/Gnome.Keyring/Ring.cs: Unlock needed a password.



Modified: trunk/gnome-keyring-sharp/ChangeLog
===================================================================
--- trunk/gnome-keyring-sharp/ChangeLog 2006-08-10 19:42:56 UTC (rev 63621)
+++ trunk/gnome-keyring-sharp/ChangeLog 2006-08-10 19:44:55 UTC (rev 63622)
@@ -1,3 +1,8 @@
+2006-08-10 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * src/Gnome.Keyring/KeyringInfo.cs: add a Name property.
+       * src/Gnome.Keyring/Ring.cs: Unlock needed a password.
+
 2006-08-08 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * src/Gnome.Keyring/KeyringException.cs: implement ISerializable and

Modified: trunk/gnome-keyring-sharp/src/Gnome.Keyring/KeyringInfo.cs
===================================================================
--- trunk/gnome-keyring-sharp/src/Gnome.Keyring/KeyringInfo.cs  2006-08-10 
19:42:56 UTC (rev 63621)
+++ trunk/gnome-keyring-sharp/src/Gnome.Keyring/KeyringInfo.cs  2006-08-10 
19:44:55 UTC (rev 63622)
@@ -35,9 +35,11 @@
                DateTime ctime;
                bool lock_on_idle;
                bool locked;
+               string name;
 
-               internal KeyringInfo (bool lock_on_idle, int lock_timeout, 
DateTime mtime, DateTime ctime, bool locked)
+               internal KeyringInfo (string name, bool lock_on_idle, int 
lock_timeout, DateTime mtime, DateTime ctime, bool locked)
                {
+                       this.name = name;
                        this.lock_timeout = lock_timeout;
                        this.mtime = mtime;
                        this.ctime = ctime;
@@ -61,14 +63,19 @@
 
                public override string ToString ()
                {
-                       return String.Format ("LockOnIdle: {0}\n" +
-                                               "Locked: {1}\n" +
-                                               "Lock timeout: {2}\n" +
-                                               "Creation time: {3}\n" +
-                                               "Modification time: {4}\n",
-                                               lock_on_idle, locked, 
lock_timeout, ctime, mtime);
+                       return String.Format ("Keyring name: {0}\n" +
+                                               "Locked: {2}\n" +
+                                               "LockOnIdle: {1}\n" +
+                                               "Lock timeout: {3}\n" +
+                                               "Creation time: {4}\n" +
+                                               "Modification time: {5}",
+                                               name, lock_on_idle, locked, 
lock_timeout, ctime, mtime);
                }
 
+               public string Name {
+                       get { return name; }
+               }
+
                public bool LockOnIdle {
                        get { return lock_on_idle; }
                        set { lock_on_idle = value; }

Modified: trunk/gnome-keyring-sharp/src/Gnome.Keyring/Ring.cs
===================================================================
--- trunk/gnome-keyring-sharp/src/Gnome.Keyring/Ring.cs 2006-08-10 19:42:56 UTC 
(rev 63621)
+++ trunk/gnome-keyring-sharp/src/Gnome.Keyring/Ring.cs 2006-08-10 19:44:55 UTC 
(rev 63622)
@@ -178,14 +178,22 @@
                        SendRequest (req.Stream);
                }
 
-               public static void Unlock (string keyring)
+               public static void Unlock (string keyring, string password)
                {
                        if (keyring == null)
                                throw new ArgumentNullException ("keyring");
 
+                       if (password == null)
+                               throw new ArgumentNullException ("password");
+
                        RequestMessage req = new RequestMessage ();
-                       req.CreateSimpleOperation (Operation.UnlockKeyring, 
keyring);
-                       SendRequest (req.Stream);
+                       req.CreateSimpleOperation (Operation.UnlockKeyring, 
keyring, password);
+                       try {
+                               SendRequest (req.Stream);
+                       } catch (KeyringException ke) {
+                               if (ke.ResultCode != ResultCode.AlreadyUnlocked)
+                                       throw;
+                       }
                }
 
                public static void DeleteKeyring (string keyring)
@@ -417,7 +425,7 @@
                        RequestMessage req = new RequestMessage ();
                        req.CreateSimpleOperation (Operation.GetKeyringInfo, 
keyring);
                        ResponseMessage resp = SendRequest (req.Stream);
-                       return new KeyringInfo ((resp.GetInt32 () != 0),
+                       return new KeyringInfo (keyring, (resp.GetInt32 () != 
0),
                                                        resp.GetInt32 (),
                                                        resp.GetDateTime (),
                                                        resp.GetDateTime (),

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to