From 9b8cf706d6b0ff83472af53c31b96c4c2f55f6b7 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 10 Mar 2017 16:16:48 +0100 Subject: Outfactor PGP into pgpme-vala --- .../conversation_summary/merged_message_item.vala | 2 +- client/src/ui/manage_accounts/dialog.vala | 90 ++++++++-------------- 2 files changed, 32 insertions(+), 60 deletions(-) (limited to 'client/src/ui') diff --git a/client/src/ui/conversation_summary/merged_message_item.vala b/client/src/ui/conversation_summary/merged_message_item.vala index b73e8b4f..3647d082 100644 --- a/client/src/ui/conversation_summary/merged_message_item.vala +++ b/client/src/ui/conversation_summary/merged_message_item.vala @@ -68,11 +68,11 @@ public class MergedMessageItem : Grid { } private void update_received() { - received_image.visible = true; bool all_received = true; bool all_read = true; foreach (Message message in messages) { if (message.marked == Message.Marked.WONTSEND) { + received_image.visible = true; Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default(); Gtk.IconInfo? icon_info = icon_theme.lookup_icon("dialog-warning-symbolic", IconSize.SMALL_TOOLBAR, 0); received_image.set_from_pixbuf(icon_info.load_symbolic({1,0,0,1})); diff --git a/client/src/ui/manage_accounts/dialog.vala b/client/src/ui/manage_accounts/dialog.vala index 4f3ade45..5d18cb30 100644 --- a/client/src/ui/manage_accounts/dialog.vala +++ b/client/src/ui/manage_accounts/dialog.vala @@ -11,55 +11,28 @@ public class Dialog : Gtk.Window { public signal void account_enabled(Account account); public signal void account_disabled(Account account); - [GtkChild] - public Stack main_stack; + [GtkChild] public Stack main_stack; + [GtkChild] public ListBox account_list; + [GtkChild] public Button no_accounts_add; + [GtkChild] public ToolButton add_button; + [GtkChild] public ToolButton remove_button; + [GtkChild] public Image image; + [GtkChild] public Button image_button; + [GtkChild] public Label jid_label; + [GtkChild] public Switch active_switch; + [GtkChild] public Stack password_stack; + [GtkChild] public Label password_label; + [GtkChild] public Button password_button; + [GtkChild] public Entry password_entry; + [GtkChild] public Stack alias_stack; + [GtkChild] public Label alias_label; + [GtkChild] public Button alias_button; + [GtkChild] public Entry alias_entry; + [GtkChild] public Stack pgp_stack; + [GtkChild] public Label pgp_label; + [GtkChild] public Button pgp_button; + [GtkChild] public ComboBoxText pgp_combobox; - [GtkChild] - public ListBox account_list; - - [GtkChild] - public Button no_accounts_add; - - [GtkChild] - public ToolButton add_button; - - [GtkChild] - public ToolButton remove_button; - - [GtkChild] - public Image image; - - [GtkChild] Button image_button; - - [GtkChild] - public Label jid_label; - - [GtkChild] - public Switch active_switch; - - [GtkChild] - public Stack password_stack; - - [GtkChild] - public Label password_label; - - [GtkChild] - public Button password_button; - - [GtkChild] - public Entry password_entry; - - [GtkChild] - public Stack alias_stack; - - [GtkChild] - public Label alias_label; - - [GtkChild] - public Button alias_button; - - [GtkChild] - public Entry alias_entry; private Database db; private StreamInteractor stream_interactor; @@ -142,22 +115,14 @@ public class Dialog : Gtk.Window { for (int i = 0; i < account.password.length; i++) filler += password_entry.get_invisible_char().to_string(); password_label.label = filler; password_stack.set_visible_child_name("label"); - password_button.clicked.connect(() => { - password_stack.set_visible_child_name("entry"); - alias_stack.set_visible_child_name("label"); - set_focus(password_entry); - }); password_entry.text = account.password; - alias_label.label = account.alias; alias_stack.set_visible_child_name("label"); - alias_button.clicked.connect(() => { - alias_stack.set_visible_child_name("entry"); - password_stack.set_visible_child_name("label"); - set_focus(alias_entry); - }); + alias_label.label = account.alias; alias_entry.text = account.alias; + password_button.clicked.connect(() => { set_active_stack(password_stack); }); + alias_button.clicked.connect(() => { set_active_stack(alias_stack); }); active_switch.state_set.connect(on_active_switch_state_changed); } @@ -216,6 +181,13 @@ public class Dialog : Gtk.Window { Util.image_set_from_scaled_pixbuf(image, (new AvatarGenerator(50, 50, image.scale_factor)).draw_account(stream_interactor, account)); } } + + private void set_active_stack(Stack stack) { + stack.set_visible_child_name("entry"); + if (stack != password_stack) password_stack.set_visible_child_name("label"); + if (stack != alias_stack) alias_stack.set_visible_child_name("label"); + if (stack != pgp_stack) pgp_stack.set_visible_child_name("label"); + } } } -- cgit v1.2.3-70-g09d2