account-settings: Add buttons to copy advanced information
This commit is contained in:
parent
8292b2e37d
commit
635e7e13c3
|
@ -67,9 +67,28 @@ mod imp {
|
|||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
ButtonRow::static_type();
|
||||
|
||||
Self::bind_template(klass);
|
||||
Self::Type::bind_template_callbacks(klass);
|
||||
TemplateCallbacks::bind_template_callbacks(klass);
|
||||
|
||||
klass.install_action("account-user.copy-homeserver", None, |obj, _, _| {
|
||||
let text = obj.imp().homeserver.subtitle().unwrap_or_default();
|
||||
obj.clipboard().set_text(&text);
|
||||
toast!(obj, gettext("Homeserver address copied to clipboard"));
|
||||
});
|
||||
|
||||
klass.install_action("account-user.copy-user-id", None, |obj, _, _| {
|
||||
let text = obj.imp().user_id.subtitle().unwrap_or_default();
|
||||
obj.clipboard().set_text(&text);
|
||||
toast!(obj, gettext("Matrix user ID copied to clipboard"));
|
||||
});
|
||||
|
||||
klass.install_action("account-user.copy-session-id", None, |obj, _, _| {
|
||||
let text = obj.imp().session_id.subtitle().unwrap_or_default();
|
||||
obj.clipboard().set_text(&text);
|
||||
toast!(obj, gettext("Session ID copied to clipboard"));
|
||||
});
|
||||
}
|
||||
|
||||
fn instance_init(obj: &InitializingObject<Self>) {
|
||||
|
|
|
@ -64,6 +64,17 @@
|
|||
<style>
|
||||
<class name="property"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">copy-symbolic</property>
|
||||
<property name="action-name">account-user.copy-homeserver</property>
|
||||
<property name="tooltip-text" translatable="yes">Copy homeserver address to clipboard</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="flat"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -72,6 +83,17 @@
|
|||
<style>
|
||||
<class name="property"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">copy-symbolic</property>
|
||||
<property name="action-name">account-user.copy-user-id</property>
|
||||
<property name="tooltip-text" translatable="yes">Copy Matrix user ID to clipboard</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="flat"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -80,6 +102,17 @@
|
|||
<style>
|
||||
<class name="property"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">copy-symbolic</property>
|
||||
<property name="action-name">account-user.copy-session-id</property>
|
||||
<property name="tooltip-text" translatable="yes">Copy session ID to clipboard</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="flat"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
Loading…
Reference in New Issue