[seahorse/wip/nielsdg/cleanup-gkr-labels: 2/2] gkr: Try to display a username if available
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse/wip/nielsdg/cleanup-gkr-labels: 2/2] gkr: Try to display a username if available
- Date: Sun, 16 Feb 2020 23:34:51 +0000 (UTC)
commit fee50a20caa878f52c602e7bcdafa475c656c0a0
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sun Feb 16 19:45:13 2020 +0100
gkr: Try to display a username if available
gkr/gkr-item-info.vala | 9 ++++++++-
gkr/gkr-item.vala | 14 +++++++-------
2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/gkr/gkr-item-info.vala b/gkr/gkr-item-info.vala
index 1eb64308..9d9331c2 100644
--- a/gkr/gkr-item-info.vala
+++ b/gkr/gkr-item-info.vala
@@ -33,7 +33,9 @@ public class ItemInfo : GLib.Object {
public GLib.Icon? icon { get; protected set; }
- public ItemInfo(string? label, string? description = null) {
+ public ItemInfo(string? label,
+ HashTable<string, string>? attrs,
+ string? description = null) {
GLib.Object(label: label);
if (label != null)
@@ -41,6 +43,11 @@ public class ItemInfo : GLib.Object {
if (description != null)
this.description = description;
+
+ if (this.details == "") {
+ // Maybe we can display the username
+ this.details = get_attribute_string(attrs, "username") ?? "";
+ }
}
public void query_installed_apps(string item_type) {
diff --git a/gkr/gkr-item.vala b/gkr/gkr-item.vala
index 8542a954..dbed30eb 100644
--- a/gkr/gkr-item.vala
+++ b/gkr/gkr-item.vala
@@ -160,17 +160,17 @@ public class Item : Secret.Item, Deletable, Viewable {
private ItemInfo item_type_to_item_info(string item_type, string? label, HashTable<string, string>?
attrs) {
switch (item_type) {
case GENERIC_SECRET:
- return new ItemInfo(label);
+ return new ItemInfo(label, attrs);
case KEYRING_NOTE:
- return new ItemInfo(label, _("Stored note"));
+ return new ItemInfo(label, attrs, _("Stored note"));
case CHAINED_KEYRING:
- return new ItemInfo(label, _("Keyring password"));
+ return new ItemInfo(label, attrs, _("Keyring password"));
case ENCRYPTION_KEY:
- return new ItemInfo(label, _("Encryption key password"));
+ return new ItemInfo(label, attrs, _("Encryption key password"));
case PK_STORAGE:
- return new ItemInfo(label, _("Key storage password"));
+ return new ItemInfo(label, attrs, _("Key storage password"));
case NETWORK_MANAGER_SECRET:
- return new ItemInfo(label, _("Network Manager secret"));
+ return new ItemInfo(label, attrs, _("Network Manager secret"));
case NETWORK_PASSWORD:
return new GkrNetworkPassInfo(label, attrs);
case EPIPHANY_PASSWORD:
@@ -189,7 +189,7 @@ public class Item : Secret.Item, Deletable, Viewable {
break;
}
- return new ItemInfo(label);
+ return new ItemInfo(label, attrs);
}
private void load_item_secret() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]