hide search bar when clicking outside of it, only reset search entry on conversation change
This commit is contained in:
parent
e376a577b6
commit
a645728624
|
@ -36,6 +36,7 @@ window.dino-main .dino-conversation textview, window.dino-main .dino-conversatio
|
||||||
window.dino-main .dino-sidebar frame {
|
window.dino-main .dino-sidebar frame {
|
||||||
background: @insensitive_bg_color;
|
background: @insensitive_bg_color;
|
||||||
border-left: 1px solid @borders;
|
border-left: 1px solid @borders;
|
||||||
|
border-bottom: 1px solid @borders;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.dino-main .dino-sidebar frame.collapsed {
|
window.dino-main .dino-sidebar frame.collapsed {
|
||||||
|
|
|
@ -112,7 +112,6 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
|
||||||
widget.get_preferred_height_for_width(main.get_allocated_width() - 2 * main.margin, out minimum_height, out natural_height);
|
widget.get_preferred_height_for_width(main.get_allocated_width() - 2 * main.margin, out minimum_height, out natural_height);
|
||||||
h += minimum_height + 15;
|
h += minimum_height + 15;
|
||||||
});
|
});
|
||||||
print(@"height_for_w: $(h)\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reload_messages = false;
|
reload_messages = false;
|
||||||
|
@ -124,7 +123,6 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
|
||||||
i += sk != null ? sk.items.size : 1;
|
i += sk != null ? sk.items.size : 1;
|
||||||
h += widget.get_allocated_height() + 15;
|
h += widget.get_allocated_height() + 15;
|
||||||
});
|
});
|
||||||
print(@"timeout: $(h)\n");
|
|
||||||
scrolled.vadjustment.value = h - scrolled.vadjustment.page_size * 1/3;
|
scrolled.vadjustment.value = h - scrolled.vadjustment.page_size * 1/3;
|
||||||
w.get_style_context().add_class("highlight-once");
|
w.get_style_context().add_class("highlight-once");
|
||||||
reload_messages = true;
|
reload_messages = true;
|
||||||
|
@ -334,15 +332,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
|
||||||
private void load_later_messages() {
|
private void load_later_messages() {
|
||||||
if (!reloading_mutex.trylock()) return;
|
if (!reloading_mutex.trylock()) return;
|
||||||
if (meta_items.size > 0 && !at_current_content) {
|
if (meta_items.size > 0 && !at_current_content) {
|
||||||
foreach (Plugins.MetaConversationItem a in content_items) {
|
|
||||||
ContentMetaItem b = a as ContentMetaItem;
|
|
||||||
MessageItem c = b.content_item as MessageItem;
|
|
||||||
}
|
|
||||||
Gee.List<ContentMetaItem> items = content_populator.populate_after(conversation, (content_items.last() as ContentMetaItem).content_item, 20);
|
Gee.List<ContentMetaItem> items = content_populator.populate_after(conversation, (content_items.last() as ContentMetaItem).content_item, 20);
|
||||||
|
|
||||||
ContentMetaItem b = content_items.last() as ContentMetaItem;
|
|
||||||
MessageItem c = b.content_item as MessageItem;
|
|
||||||
|
|
||||||
if (items.size == 0) {
|
if (items.size == 0) {
|
||||||
at_current_content = true;
|
at_current_content = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
using Gee;
|
using Gee;
|
||||||
|
using Gdk;
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
|
||||||
using Dino.Entities;
|
using Dino.Entities;
|
||||||
|
|
||||||
namespace Dino.Ui {
|
namespace Dino.Ui {
|
||||||
|
|
||||||
public class UnifiedWindow : Window {
|
public class UnifiedWindow : Gtk.Window {
|
||||||
|
|
||||||
private NoAccountsPlaceholder accounts_placeholder = new NoAccountsPlaceholder() { visible=true };
|
private NoAccountsPlaceholder accounts_placeholder = new NoAccountsPlaceholder() { visible=true };
|
||||||
private NoConversationsPlaceholder conversations_placeholder = new NoConversationsPlaceholder() { visible=true };
|
private NoConversationsPlaceholder conversations_placeholder = new NoConversationsPlaceholder() { visible=true };
|
||||||
|
@ -45,26 +46,30 @@ public class UnifiedWindow : Window {
|
||||||
});
|
});
|
||||||
search_revealer.notify["child-revealed"].connect(() => {
|
search_revealer.notify["child-revealed"].connect(() => {
|
||||||
if (search_revealer.child_revealed) {
|
if (search_revealer.child_revealed) {
|
||||||
if (conversation_frame.conversation != null) {
|
if (conversation_frame.conversation != null && search_box.search_entry.text == "") {
|
||||||
switch (conversation_frame.conversation.type_) {
|
reset_search_entry();
|
||||||
case Conversation.Type.CHAT:
|
|
||||||
case Conversation.Type.GROUPCHAT_PM:
|
|
||||||
search_box.search_entry.text = @"with:$(conversation_frame.conversation.counterpart) ";
|
|
||||||
break;
|
|
||||||
case Conversation.Type.GROUPCHAT:
|
|
||||||
search_box.search_entry.text = @"in:$(conversation_frame.conversation.counterpart) ";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
search_box.search_entry.grab_focus();
|
search_box.search_entry.grab_focus();
|
||||||
} else {
|
|
||||||
search_box.search_entry.text = "";
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
search_box.selected_item.connect((item) => {
|
search_box.selected_item.connect((item) => {
|
||||||
on_conversation_selected(item.conversation, false, false);
|
on_conversation_selected(item.conversation, false, false);
|
||||||
conversation_frame.initialize_around_message(item.conversation, item);
|
conversation_frame.initialize_around_message(item.conversation, item);
|
||||||
});
|
});
|
||||||
|
event.connect((event) => {
|
||||||
|
if (event.type == EventType.BUTTON_PRESS) {
|
||||||
|
int dest_x, dest_y;
|
||||||
|
bool ret = search_box.translate_coordinates(this, 0, 0, out dest_x, out dest_y);
|
||||||
|
if (ret && event.button.x_root < dest_x) {
|
||||||
|
close_search();
|
||||||
|
}
|
||||||
|
} else if (event.type == EventType.KEY_RELEASE) {
|
||||||
|
if (event.key.keyval == Gdk.Key.Escape) {
|
||||||
|
close_search();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
paned.bind_property("position", headerbar_paned, "position", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
|
paned.bind_property("position", headerbar_paned, "position", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
|
||||||
|
|
||||||
|
@ -84,28 +89,29 @@ public class UnifiedWindow : Window {
|
||||||
check_stack();
|
check_stack();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hide_search_results() {
|
private void reset_search_entry() {
|
||||||
search_revealer.get_style_context().add_class("collapsed");
|
if (conversation_frame.conversation != null) {
|
||||||
search_revealer.valign = Align.START;
|
switch (conversation_frame.conversation.type_) {
|
||||||
// TODO: Make search results box inivisble
|
case Conversation.Type.CHAT:
|
||||||
|
case Conversation.Type.GROUPCHAT_PM:
|
||||||
|
search_box.search_entry.text = @"with:$(conversation_frame.conversation.counterpart) ";
|
||||||
|
break;
|
||||||
|
case Conversation.Type.GROUPCHAT:
|
||||||
|
search_box.search_entry.text = @"in:$(conversation_frame.conversation.counterpart) ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void show_search_results() {
|
public void on_conversation_selected(Conversation conversation, bool do_reset_search = true, bool default_initialize_conversation = true) {
|
||||||
// TODO: Make search results box visible
|
|
||||||
search_revealer.get_style_context().remove_class("collapsed");
|
|
||||||
search_revealer.valign = Align.FILL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void on_conversation_selected(Conversation conversation, bool close_search = true, bool default_initialize_conversation = true) {
|
|
||||||
if (this.conversation == null || !this.conversation.equals(conversation)) {
|
if (this.conversation == null || !this.conversation.equals(conversation)) {
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
stream_interactor.get_module(ChatInteraction.IDENTITY).on_conversation_selected(conversation);
|
stream_interactor.get_module(ChatInteraction.IDENTITY).on_conversation_selected(conversation);
|
||||||
conversation.active = true; // only for conversation_selected
|
conversation.active = true; // only for conversation_selected
|
||||||
filterable_conversation_list.conversation_list.on_conversation_selected(conversation); // only for conversation_opened
|
filterable_conversation_list.conversation_list.on_conversation_selected(conversation); // only for conversation_opened
|
||||||
|
|
||||||
if (close_search) {
|
if (do_reset_search) {
|
||||||
conversation_titlebar.search_button.active = false;
|
reset_search_entry();
|
||||||
search_revealer.reveal_child = false;
|
|
||||||
}
|
}
|
||||||
chat_input.initialize_for_conversation(conversation);
|
chat_input.initialize_for_conversation(conversation);
|
||||||
if (default_initialize_conversation) {
|
if (default_initialize_conversation) {
|
||||||
|
@ -115,6 +121,11 @@ public class UnifiedWindow : Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void close_search() {
|
||||||
|
conversation_titlebar.search_button.active = false;
|
||||||
|
search_revealer.reveal_child = false;
|
||||||
|
}
|
||||||
|
|
||||||
private void setup_unified() {
|
private void setup_unified() {
|
||||||
Builder builder = new Builder.from_resource("/im/dino/Dino/unified_main_content.ui");
|
Builder builder = new Builder.from_resource("/im/dino/Dino/unified_main_content.ui");
|
||||||
paned = (Paned) builder.get_object("paned");
|
paned = (Paned) builder.get_object("paned");
|
||||||
|
|
Loading…
Reference in a new issue