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 --- client/CMakeLists.txt | 6 +- client/data/manage_accounts/dialog.ui | 52 +++++++++++++ client/src/service/connection_manager.vala | 2 +- .../conversation_summary/merged_message_item.vala | 2 +- client/src/ui/manage_accounts/dialog.vala | 90 ++++++++-------------- 5 files changed, 89 insertions(+), 63 deletions(-) (limited to 'client') diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 574d603e..b86d63a5 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,5 +1,7 @@ find_package(Vala REQUIRED) find_package(PkgConfig REQUIRED) +find_package(GPGME REQUIRED) +find_package(LIBUUID REQUIRED) include(${VALA_USE_FILE}) include(GlibCompileResourcesSupport) @@ -138,9 +140,9 @@ OPTIONS ) -set(CFLAGS ${CLIENT_CFLAGS} ${GPGME_CFLAGS} ${LIBUUID_CFLAGS} -g -I${CMAKE_BINARY_DIR}/xmpp-vala -I${CMAKE_BINARY_DIR}/qlite ${VALA_CFLAGS}) +set(CFLAGS ${CLIENT_CFLAGS} -g -I${CMAKE_BINARY_DIR}/xmpp-vala -I${CMAKE_BINARY_DIR}/qlite ${VALA_CFLAGS}) add_definitions(${CFLAGS}) add_executable(dino ${CLIENT_VALA_C} ${CLIENT_GRESOURCES_TARGET}) add_dependencies(dino xmpp-vala-vapi qlite-vapi) -target_link_libraries(dino xmpp-vala qlite ${CLIENT_LIBRARIES} ${GPGME_LIBRARIES} ${LIBUUID_LIBRARIES} -lm) +target_link_libraries(dino xmpp-vala qlite ${CLIENT_LIBRARIES} -lm) diff --git a/client/data/manage_accounts/dialog.ui b/client/data/manage_accounts/dialog.ui index b3a99711..64397fb7 100644 --- a/client/data/manage_accounts/dialog.ui +++ b/client/data/manage_accounts/dialog.ui @@ -247,6 +247,58 @@ 1 + + + OpenPGP + 1 + True + + + + 0 + 4 + 1 + 1 + + + + + True + + + none + True + + + 0 + True + + + + + label + + + + + True + 200 + True + + + entry + + + + + 1 + 4 + 2 + 1 + + diff --git a/client/src/service/connection_manager.vala b/client/src/service/connection_manager.vala index 75155e98..92827296 100644 --- a/client/src/service/connection_manager.vala +++ b/client/src/service/connection_manager.vala @@ -92,7 +92,7 @@ public class ConnectionManager { foreach (Core.XmppStreamModule module in module_manager.get_modules(account, resource)) { stream.add_module(module); } - stream.debug = true; + stream.debug = false; Connection connection = new Connection(stream, new DateTime.now_local()); stream_states[account] = connection; 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-54-g00ecf