diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-20 11:41:42 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-20 11:41:42 +0300 |
commit | f6a55930a900bd07d4b2028e7df82bbef1a291d0 (patch) | |
tree | ee0a2f7607e61f6d8fc9cc381578c8cc4870b090 /src/gmcerts.c | |
parent | 709329cef2fe3cd88d6a4e27389b64431f5936f6 (diff) |
Improved Identity management via sidebar
Prevent redundant activations: the highest-level URL overrides the
same identity being used on lower-level URLs. Changed the icons in
the list and added the list of used URLs into the context menu as
clickable items.
Diffstat (limited to 'src/gmcerts.c')
-rw-r--r-- | src/gmcerts.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gmcerts.c b/src/gmcerts.c index 35d784f6..f86712ac 100644 --- a/src/gmcerts.c +++ b/src/gmcerts.c | |||
@@ -105,7 +105,7 @@ void deserialize_GmIdentity(iGmIdentity *d, iStream *ins) { | |||
105 | iString url; | 105 | iString url; |
106 | init_String(&url); | 106 | init_String(&url); |
107 | deserialize_String(&url, ins); | 107 | deserialize_String(&url, ins); |
108 | insert_StringSet(d->useUrls, &url); | 108 | setUse_GmIdentity(d, &url, iTrue); |
109 | deinit_String(&url); | 109 | deinit_String(&url); |
110 | } | 110 | } |
111 | } | 111 | } |
@@ -166,6 +166,15 @@ void setUse_GmIdentity(iGmIdentity *d, const iString *url, iBool use) { | |||
166 | return; /* Redudant. */ | 166 | return; /* Redudant. */ |
167 | } | 167 | } |
168 | if (use) { | 168 | if (use) { |
169 | /* Remove all use-URLs that become redundant by this newly added URL. */ | ||
170 | /* TODO: StringSet could have a non-const iterator. */ | ||
171 | iForEach(Array, i, &d->useUrls->strings.values) { | ||
172 | iString *used = i.value; | ||
173 | if (startsWithCase_String(used, cstr_String(url))) { | ||
174 | deinit_String(used); | ||
175 | remove_ArrayIterator(&i); | ||
176 | } | ||
177 | } | ||
169 | #if !defined (NDEBUG) | 178 | #if !defined (NDEBUG) |
170 | const iBool wasInserted = | 179 | const iBool wasInserted = |
171 | #endif | 180 | #endif |