[fractal/multi-account] Generate action names to switch to any user
- From: Alejandro Domínguez <aledomu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/multi-account] Generate action names to switch to any user
- Date: Tue, 13 Jul 2021 15:31:42 +0000 (UTC)
commit 5916433e3dbd26ba643632d9e71a1cbe7cef4e50
Author: Alejandro Domínguez <adomu net-c com>
Date: Tue Jul 13 15:39:21 2021 +0200
Generate action names to switch to any user
src/session/user.rs | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/src/session/user.rs b/src/session/user.rs
index 1875ca92..52eef7bb 100644
--- a/src/session/user.rs
+++ b/src/session/user.rs
@@ -63,6 +63,13 @@ mod imp {
Session::static_type(),
glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
),
+ glib::ParamSpec::new_string(
+ "switch-action-name",
+ "Switch action name",
+ "GTK action name to switch user",
+ None,
+ glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY,
+ ),
]
});
@@ -92,6 +99,7 @@ mod imp {
"user-id" => self.user_id.get().to_value(),
"session" => obj.session().to_value(),
"avatar" => obj.avatar().to_value(),
+ "switch-action-name" => obj.switch_action_name().to_value(),
_ => unimplemented!(),
}
}
@@ -252,4 +260,8 @@ impl User {
self.notify("display-name");
}
}
+
+ pub fn switch_action_name(&self) -> String {
+ String::from("app.switch-to.") + self.user_id().as_str()
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]