diff options
author | fiaxh <git@mx.ax.lt> | 2017-09-05 23:53:18 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-09-06 00:15:18 +0200 |
commit | 8944029128e3d0f9e32b61e00e880d92fceabb31 (patch) | |
tree | 8cf872969d3349c61278b19273e76c65036c429d /main/src | |
parent | 312372350e24d1ebd8afbb0029fac04f2b64eb83 (diff) | |
download | dino-8944029128e3d0f9e32b61e00e880d92fceabb31.tar.gz dino-8944029128e3d0f9e32b61e00e880d92fceabb31.zip |
Move encryption menu into ChatInput, PGP support for MUCs
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/ui/application.vala | 4 | ||||
-rw-r--r-- | main/src/ui/chat_input/encryption_button.vala (renamed from main/src/ui/conversation_titlebar/encryption_entry.vala) | 40 | ||||
-rw-r--r-- | main/src/ui/chat_input/view.vala | 5 | ||||
-rw-r--r-- | main/src/ui/conversation_summary/conversation_item_skeleton.vala | 2 | ||||
-rw-r--r-- | main/src/ui/conversation_summary/conversation_view.vala | 2 | ||||
-rw-r--r-- | main/src/ui/conversation_titlebar/view.vala | 2 | ||||
-rw-r--r-- | main/src/ui/notifications.vala | 1 | ||||
-rw-r--r-- | main/src/ui/unified_window.vala | 1 |
8 files changed, 26 insertions, 31 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 708c63b0..65bb8743 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -21,8 +21,8 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { Window.set_default_icon_name("dino"); CssProvider provider = new CssProvider(); - provider.load_from_resource("/im/dino/pre_theme.css"); - StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, STYLE_PROVIDER_PRIORITY_THEME - 1); + provider.load_from_resource("/im/dino/theme.css"); + StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, STYLE_PROVIDER_PRIORITY_APPLICATION); activate.connect(() => { if (window == null) { diff --git a/main/src/ui/conversation_titlebar/encryption_entry.vala b/main/src/ui/chat_input/encryption_button.vala index 16cc5fdd..6ae3e8af 100644 --- a/main/src/ui/conversation_titlebar/encryption_entry.vala +++ b/main/src/ui/chat_input/encryption_button.vala @@ -5,32 +5,26 @@ using Dino.Entities; namespace Dino.Ui { -class EncryptionEntry : Plugins.ConversationTitlebarEntry, Object { - public string id { get { return "encryption"; } } - - public double order { get { return 2; } } - public Plugins.ConversationTitlebarWidget get_widget(Plugins.WidgetType type) { - if (type == Plugins.WidgetType.GTK) { - return new EncryptionWidget() { visible=true }; - } - return null; - } -} - -class EncryptionWidget : MenuButton, Plugins.ConversationTitlebarWidget { +public class EncryptionButton : MenuButton { private Conversation? conversation; private RadioButton? button_unencrypted; private Map<RadioButton, Plugins.EncryptionListEntry> encryption_radios = new HashMap<RadioButton, Plugins.EncryptionListEntry>(); - public EncryptionWidget() { + public EncryptionButton() { + relief = ReliefStyle.NONE; + use_popover = true; + image = new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON); + get_style_context().add_class("flat"); + Builder builder = new Builder.from_resource("/im/dino/menu_encryption.ui"); - PopoverMenu menu = builder.get_object("menu_encryption") as PopoverMenu; + popover = builder.get_object("menu_encryption") as PopoverMenu; Box encryption_box = builder.get_object("encryption_box") as Box; button_unencrypted = builder.get_object("button_unencrypted") as RadioButton; button_unencrypted.toggled.connect(encryption_changed); + Application app = GLib.Application.get_default() as Application; - foreach(var e in app.plugin_registry.encryption_list_entries) { + foreach (var e in app.plugin_registry.encryption_list_entries) { RadioButton btn = new RadioButton.with_label(button_unencrypted.get_group(), e.name); encryption_radios[btn] = e; btn.toggled.connect(encryption_changed); @@ -38,9 +32,6 @@ class EncryptionWidget : MenuButton, Plugins.ConversationTitlebarWidget { encryption_box.pack_end(btn, false); } clicked.connect(update_encryption_menu_state); - set_use_popover(true); - set_popover(menu); - set_image(new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON)); } private void encryption_changed() { @@ -66,13 +57,10 @@ class EncryptionWidget : MenuButton, Plugins.ConversationTitlebarWidget { } private void update_encryption_menu_icon() { - visible = (conversation.type_ == Conversation.Type.CHAT); - if (conversation.type_ == Conversation.Type.CHAT) { - if (conversation.encryption == Encryption.NONE) { - set_image(new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON)); - } else { - set_image(new Image.from_icon_name("changes-prevent-symbolic", IconSize.BUTTON)); - } + if (conversation.encryption == Encryption.NONE) { + set_image(new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON)); + } else { + set_image(new Image.from_icon_name("changes-prevent-symbolic", IconSize.BUTTON)); } } diff --git a/main/src/ui/chat_input/view.vala b/main/src/ui/chat_input/view.vala index 06e59e54..ef749505 100644 --- a/main/src/ui/chat_input/view.vala +++ b/main/src/ui/chat_input/view.vala @@ -12,6 +12,7 @@ public class View : Box { [GtkChild] private ScrolledWindow scrolled; [GtkChild] private TextView text_input; + [GtkChild] private Box box; public string text { owned get { return text_input.buffer.text; } @@ -25,6 +26,7 @@ public class View : Box { private OccupantsTabCompletor occupants_tab_completor; private SmileyConverter smiley_converter; private EditHistory edit_history; + private EncryptionButton encryption_widget = new EncryptionButton() { yalign=0, visible=true }; public View(StreamInteractor stream_interactor) { this.stream_interactor = stream_interactor; @@ -32,6 +34,8 @@ public class View : Box { smiley_converter = new SmileyConverter(stream_interactor, text_input); edit_history = new EditHistory(text_input, GLib.Application.get_default()); + box.add(encryption_widget); + encryption_widget.get_style_context().add_class("dino-chatinput-button"); scrolled.get_vscrollbar().get_preferred_height(out vscrollbar_min_height, null); scrolled.vadjustment.notify["upper"].connect_after(on_upper_notify); text_input.key_press_event.connect(on_text_input_key_press); @@ -41,6 +45,7 @@ public class View : Box { public void initialize_for_conversation(Conversation conversation) { occupants_tab_completor.initialize_for_conversation(conversation); edit_history.initialize_for_conversation(conversation); + encryption_widget.set_conversation(conversation); if (this.conversation != null) entry_cache[this.conversation] = text_input.buffer.text; this.conversation = conversation; diff --git a/main/src/ui/conversation_summary/conversation_item_skeleton.vala b/main/src/ui/conversation_summary/conversation_item_skeleton.vala index 1eb76840..03114227 100644 --- a/main/src/ui/conversation_summary/conversation_item_skeleton.vala +++ b/main/src/ui/conversation_summary/conversation_item_skeleton.vala @@ -39,7 +39,7 @@ public class ConversationItemSkeleton : Grid { } else { set_title_widget(widget); } - item.notify["mark"].connect_after(update_received); + item.notify["mark"].connect_after(() => { Idle.add(() => { update_received(); return false; }); }); update_received(); } diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala index 3f5a85b6..dcd24652 100644 --- a/main/src/ui/conversation_summary/conversation_view.vala +++ b/main/src/ui/conversation_summary/conversation_view.vala @@ -98,7 +98,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection { item.display_time.difference(lower_start_item.display_time) < TimeSpan.MINUTE && lower_start_item.jid.equals(item.jid) && lower_start_item.encryption == item.encryption && - item.mark != Message.Marked.WONTSEND) { + (item.mark == Message.Marked.WONTSEND) == (lower_start_item.mark == Message.Marked.WONTSEND)) { lower_skeleton.add_meta_item(item); force_alloc_width(lower_skeleton, main.get_allocated_width()); item_item_skeletons[item] = lower_skeleton; diff --git a/main/src/ui/conversation_titlebar/view.vala b/main/src/ui/conversation_titlebar/view.vala index 9949f4fc..32d829fb 100644 --- a/main/src/ui/conversation_titlebar/view.vala +++ b/main/src/ui/conversation_titlebar/view.vala @@ -22,7 +22,6 @@ public class ConversationTitlebar : Gtk.HeaderBar { Application app = GLib.Application.get_default() as Application; app.plugin_registry.register_contact_titlebar_entry(new MenuEntry(stream_interactor)); - app.plugin_registry.register_contact_titlebar_entry(new EncryptionEntry()); app.plugin_registry.register_contact_titlebar_entry(new OccupantsEntry(stream_interactor, window)); foreach(var e in app.plugin_registry.conversation_titlebar_entries) { @@ -33,6 +32,7 @@ public class ConversationTitlebar : Gtk.HeaderBar { } } + stream_interactor.get_module(MucManager.IDENTITY).subject_set.connect((account, jid, subject) => { Idle.add(() => { if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) { diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index 02f0b1de..470f9d6d 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -63,6 +63,7 @@ public class Notifications : Object { try { notifications[conversation].show(); } catch (Error error) { } + window.urgency_hint = true; } } diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala index b3c02189..69b530d7 100644 --- a/main/src/ui/unified_window.vala +++ b/main/src/ui/unified_window.vala @@ -126,6 +126,7 @@ public class UnifiedWindow : Window { private bool on_focus_in_event() { stream_interactor.get_module(ChatInteraction.IDENTITY).on_window_focus_in(conversation); + urgency_hint = false; return false; } |