aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhrxi <hrrrxi@gmail.com>2017-08-23 17:49:55 +0200
committerfiaxh <fiaxh@users.noreply.github.com>2017-09-01 00:07:24 +0200
commit2cd6e94cc567284a10c4545208f53ea8421ee8d1 (patch)
tree7fd16484191df370a5d31d9a49eabb5dbfc8305b
parentd0e86d0a8ebb6bbb254a0fb7474d09c58d8379e3 (diff)
Focus selected widgets in the accounts dialog
Previously, you had to issue two clicks in order to enter something into the text fields. This also replaces the `Entry` widgets with their label counterparts once they lose focus. Since the `ComboBox` handling of focus seems to be buggy (`focus_out_event` not firing), the OpenPGP key selection lacks the latter feature.
-rw-r--r--main/src/ui/util/label_hybrid.vala10
-rw-r--r--plugins/openpgp/src/account_settings_widget.vala5
2 files changed, 13 insertions, 2 deletions
diff --git a/main/src/ui/util/label_hybrid.vala b/main/src/ui/util/label_hybrid.vala
index a16bccf7..ab765dd1 100644
--- a/main/src/ui/util/label_hybrid.vala
+++ b/main/src/ui/util/label_hybrid.vala
@@ -20,6 +20,7 @@ public class LabelHybrid : Stack {
public void show_widget() {
visible_child_name = "widget";
+ get_child_by_name("widget").grab_focus();
}
public void show_label() {
@@ -86,6 +87,10 @@ public class EntryLabelHybrid : LabelHybrid {
}
return false;
});
+ entry.focus_out_event.connect(() => {
+ show_label();
+ return false;
+ });
}
private void update_label() {
@@ -134,6 +139,11 @@ public class ComboBoxTextLabelHybrid : LabelHybrid {
update_label();
show_label();
});
+ combobox.focus_out_event.connect(() => {
+ update_label();
+ show_label();
+ return false;
+ });
button.clicked.connect(() => {
combobox.popup();
});
diff --git a/plugins/openpgp/src/account_settings_widget.vala b/plugins/openpgp/src/account_settings_widget.vala
index a7ea2887..e5f5aaf1 100644
--- a/plugins/openpgp/src/account_settings_widget.vala
+++ b/plugins/openpgp/src/account_settings_widget.vala
@@ -31,7 +31,7 @@ private class AccountSettingsWidget : Stack, Plugins.AccountSettingsWidget {
}
public void deactivate() {
- this.set_visible_child_name("label");
+ set_visible_child_name("label");
}
public void set_account(Account account) {
@@ -45,7 +45,8 @@ private class AccountSettingsWidget : Stack, Plugins.AccountSettingsWidget {
private void on_button_clicked() {
activated();
- this.set_visible_child_name("entry");
+ set_visible_child_name("entry");
+ combobox.grab_focus();
combobox.popup();
}