1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 03_fix_gks_crahers.dpatch by Christopher James Halse Rogers <raof@ubuntu.com>
4
## All lines beginning with `## DP:' are a description of the patch.
8
diff -urNad fix-lp555137~/Do.Platform.Linux/src/Do.Platform/Do.Platform.Linux/GnomeKeyringSecurePreferencesService.cs fix-lp555137/Do.Platform.Linux/src/Do.Platform/Do.Platform.Linux/GnomeKeyringSecurePreferencesService.cs
9
--- fix-lp555137~/Do.Platform.Linux/src/Do.Platform/Do.Platform.Linux/GnomeKeyringSecurePreferencesService.cs 2010-04-14 11:42:39.000000000 +1000
10
+++ fix-lp555137/Do.Platform.Linux/src/Do.Platform/Do.Platform.Linux/GnomeKeyringSecurePreferencesService.cs 2010-04-14 12:27:33.252245271 +1000
14
using System.Collections;
15
+using System.Threading;
16
using System.ComponentModel;
20
public bool Set (string key, string val)
25
if (!Ring.Available) {
26
Log.Error (KeyringUnavailableMessage);
30
keyData = new Hashtable ();
31
- keyData [AbsolutePathForKey (key)] = key;
34
- Ring.CreateItem (Ring.GetDefaultKeyring (), ItemType.GenericSecret, AbsolutePathForKey (key), keyData, val.ToString (), true);
35
- } catch (KeyringException e) {
36
- Log.Error (ErrorSavingMessage, key, e.Message);
37
- Log.Debug (e.StackTrace);
38
+ keyData[AbsolutePathForKey (key)] = key;
40
+ bool success = false;
41
+ AutoResetEvent completed = new AutoResetEvent (false);
43
+ Services.Application.RunOnMainThread (delegate {
45
+ Ring.CreateItem (Ring.GetDefaultKeyring (), ItemType.GenericSecret, AbsolutePathForKey (key), keyData, val.ToString (), true);
47
+ } catch (KeyringException e) {
48
+ Log.Error (ErrorSavingMessage, key, e.Message);
49
+ Log.Debug (e.StackTrace);
55
+ if (!completed.WaitOne (200)) {
63
public bool TryGet (string key, out string val)
72
if (!Ring.Available) {
73
Log.Error (KeyringUnavailableMessage);
78
keyData = new Hashtable ();
79
- keyData [AbsolutePathForKey (key)] = key;
80
+ keyData[AbsolutePathForKey (key)] = key;
83
- foreach (ItemData item in Ring.Find (ItemType.GenericSecret, keyData)) {
84
- if (!item.Attributes.ContainsKey (AbsolutePathForKey (key))) continue;
85
+ bool success = false;
86
+ AutoResetEvent completed = new AutoResetEvent (false);
90
+ Services.Application.RunOnMainThread (delegate {
92
+ foreach (ItemData item in Ring.Find (ItemType.GenericSecret, keyData)) {
93
+ if (!item.Attributes.ContainsKey (AbsolutePathForKey (key)))
96
+ secret = item.Secret;
100
+ } catch (KeyringException) {
101
+ Log.Debug (KeyNotFoundMessage, AbsolutePathForKey (key));
106
- } catch (KeyringException) {
107
- Log.Debug (KeyNotFoundMessage, AbsolutePathForKey (key));
109
+ if (!completed.WaitOne (200)) {