Rework no-open-conversation placeholder

This commit is contained in:
fiaxh 2019-09-30 02:11:23 +02:00
parent 5d65f047d0
commit df3716622a
11 changed files with 191 additions and 45 deletions

View file

@ -70,6 +70,7 @@ public interface ConversationTitlebarEntry : Object {
public interface ConversationTitlebarWidget : Object { public interface ConversationTitlebarWidget : Object {
public abstract void set_conversation(Conversation conversation); public abstract void set_conversation(Conversation conversation);
public abstract void unset_conversation();
} }
public abstract interface ConversationItemPopulator : Object { public abstract interface ConversationItemPopulator : Object {

View file

@ -143,6 +143,7 @@ public class ConversationManager : StreamInteractionModule, Object {
if(conversation.active) conversation_deactivated(conversation); if(conversation.active) conversation_deactivated(conversation);
} }
} }
conversations.unset(account);
} }
private class MessageListener : Dino.MessageListener { private class MessageListener : Dino.MessageListener {

View file

@ -14,6 +14,7 @@ find_packages(MAIN_PACKAGES REQUIRED
set(RESOURCE_LIST set(RESOURCE_LIST
icons/dino-changes-prevent-symbolic.svg icons/dino-changes-prevent-symbolic.svg
icons/dino-conversation-list-placeholder-arrow.svg
icons/dino-double-tick-symbolic.svg icons/dino-double-tick-symbolic.svg
icons/dino-emoticon-symbolic.svg icons/dino-emoticon-symbolic.svg
icons/dino-qr-code-symbolic.svg icons/dino-qr-code-symbolic.svg

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="14.423mm" height="25.742mm" version="1.1" viewBox="0 0 14.422716 25.741774" xmlns="http://www.w3.org/2000/svg">
<defs>
<marker id="a" overflow="visible" orient="auto">
<path transform="scale(.6)" d="m8.7186 4.0337-10.926-4.0177 10.926-4.0177c-1.7455 2.3721-1.7354 5.6175-6e-7 8.0354z" fill-rule="evenodd" stroke="#000" stroke-linejoin="round" stroke-width=".625"/>
</marker>
</defs>
<g transform="translate(-76.236 -40.41)">
<path d="m77.066 41.011c1.1174 11.205 6.3598 21.407 13.389 24.939" fill="none" marker-start="url(#a)" stroke="#000" stroke-linecap="round" stroke-width=".4"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 673 B

View file

@ -5,14 +5,56 @@
<property name="orientation">horizontal</property> <property name="orientation">horizontal</property>
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkScrolledWindow" id="scrolled"> <object class="GtkStack" id="left_stack">
<property name="expand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="DinoUiConversationSelector" id="conversation_list"> <object class="GtkScrolledWindow" id="scrolled">
<property name="expand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="visible">True</property> <property name="visible">True</property>
<child>
<object class="DinoUiConversationSelector" id="conversation_list">
<property name="visible">True</property>
</object>
</child>
</object> </object>
<packing>
<property name="name">content</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="margin">20</property>
<property name="spacing">10</property>
<property name="valign">start</property>
<property name="halign">start</property>
<property name="visible">True</property>
<child>
<object class="GtkImage" id="conversation_list_placeholder_image">
<property name="visible">True</property>
<property name="valign">start</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="wrap">True</property>
<property name="margin-top">70</property>
<property name="margin-right">50</property>
<property name="visible">True</property>
<property name="valign">end</property>
<property name="label">Click here to start a conversation or join a channel</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
</object>
<packing>
<property name="name">placeholder</property>
</packing>
</child> </child>
</object> </object>
<packing> <packing>
@ -24,54 +66,99 @@
<object class="GtkOverlay"> <object class="GtkOverlay">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkOverlay"> <object class="GtkStack" id="right_stack">
<property name="visible">True</property> <property name="visible">True</property>
<child> <child>
<object class="GtkBox"> <object class="GtkOverlay">
<property name="orientation">vertical</property>
<property name="visible">True</property> <property name="visible">True</property>
<style>
<class name="dino-conversation"/>
</style>
<child> <child>
<object class="DinoUiConversationSummaryConversationView" id="conversation_frame"> <object class="GtkBox">
<property name="visible">True</property> <property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="DinoUiChatInputView" id="chat_input">
<property name="visible">True</property>
</object>
</child>
</object>
</child>
<child type="overlay">
<object class="GtkRevealer" id="goto_end_revealer">
<property name="halign">end</property>
<property name="valign">end</property>
<property name="transition-type">crossfade</property>
<property name="visible">True</property>
<property name="margin-end">30</property>
<property name="margin-bottom">70</property>
<child>
<object class="GtkButton" id="goto_end_button">
<property name="vexpand">False</property>
<property name="halign">end</property>
<property name="valign">end</property>
<property name="visible">True</property> <property name="visible">True</property>
<style> <style>
<class name="circular"/> <class name="dino-conversation"/>
</style> </style>
<child> <child>
<object class="GtkImage"> <object class="DinoUiConversationSummaryConversationView" id="conversation_frame">
<property name="icon-name">go-down-symbolic</property> <property name="visible">True</property>
<property name="icon-size">1</property> </object>
</child>
<child>
<object class="DinoUiChatInputView" id="chat_input">
<property name="visible">True</property> <property name="visible">True</property>
</object> </object>
</child> </child>
</object> </object>
</child> </child>
<child type="overlay">
<object class="GtkRevealer" id="goto_end_revealer">
<property name="halign">end</property>
<property name="valign">end</property>
<property name="transition-type">crossfade</property>
<property name="visible">True</property>
<property name="margin-end">30</property>
<property name="margin-bottom">70</property>
<child>
<object class="GtkButton" id="goto_end_button">
<property name="vexpand">False</property>
<property name="halign">end</property>
<property name="valign">end</property>
<property name="visible">True</property>
<style>
<class name="circular"/>
</style>
<child>
<object class="GtkImage">
<property name="icon-name">go-down-symbolic</property>
<property name="icon-size">1</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object> </object>
<packing>
<property name="name">content</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="expand">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="visible">True</property>
<child>
<object class="GtkImage">
<property name="icon-name">im.dino.Dino-symbolic</property>
<property name="pixel-size">144</property>
<property name="margin-bottom">30</property>
<property name="visible">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label">You have no open chats</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<style>
<class name="dim-label"/>
</style>
<attributes>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="name">placeholder</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View file

@ -6,7 +6,6 @@
<child> <child>
<object class="GtkBox" id="box"> <object class="GtkBox" id="box">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">10</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
@ -38,6 +37,7 @@
<object class="GtkLabel" id="label"> <object class="GtkLabel" id="label">
<property name="xalign">0.5</property> <property name="xalign">0.5</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="margin-top">5</property>
<property name="visible">True</property> <property name="visible">True</property>
<style> <style>
<class name="dim-label"/> <class name="dim-label"/>
@ -46,6 +46,7 @@
</child> </child>
<child> <child>
<object class="GtkButton" id="primary_button"> <object class="GtkButton" id="primary_button">
<property name="margin-top">15</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="visible">True</property> <property name="visible">True</property>
<style> <style>

View file

@ -18,7 +18,7 @@ class MenuEntry : Plugins.ConversationTitlebarEntry, Object {
public Plugins.ConversationTitlebarWidget? get_widget(Plugins.WidgetType type) { public Plugins.ConversationTitlebarWidget? get_widget(Plugins.WidgetType type) {
if (type == Plugins.WidgetType.GTK) { if (type == Plugins.WidgetType.GTK) {
if (widget == null) { if (widget == null) {
widget = new MenuWidget(stream_interactor) { visible=true }; widget = new MenuWidget(stream_interactor) { visible=true, sensitive=false };
} }
return widget; return widget;
} }
@ -41,6 +41,7 @@ class MenuWidget : Button, Plugins.ConversationTitlebarWidget {
} }
public new void set_conversation(Conversation conversation) { public new void set_conversation(Conversation conversation) {
this.sensitive = true;
this.conversation = conversation; this.conversation = conversation;
if (conversation.type_ == Conversation.Type.GROUPCHAT) { if (conversation.type_ == Conversation.Type.GROUPCHAT) {
tooltip_text = "Channel details"; tooltip_text = "Channel details";
@ -48,6 +49,11 @@ class MenuWidget : Button, Plugins.ConversationTitlebarWidget {
tooltip_text = "Conversation details"; tooltip_text = "Conversation details";
} }
} }
public new void unset_conversation() {
this.sensitive = false;
}
} }
} }

View file

@ -18,7 +18,7 @@ class OccupantsEntry : Plugins.ConversationTitlebarEntry, Object {
public Plugins.ConversationTitlebarWidget? get_widget(Plugins.WidgetType type) { public Plugins.ConversationTitlebarWidget? get_widget(Plugins.WidgetType type) {
if (type == Plugins.WidgetType.GTK) { if (type == Plugins.WidgetType.GTK) {
if (widget == null) { if (widget == null) {
widget = new OccupantsWidget(stream_interactor) { visible=true }; widget = new OccupantsWidget(stream_interactor);
} }
return widget; return widget;
} }
@ -51,6 +51,10 @@ class OccupantsWidget : MenuButton, Plugins.ConversationTitlebarWidget {
menu = new_menu; menu = new_menu;
} }
} }
public new void unset_conversation() {
visible = false;
}
} }
} }

View file

@ -25,6 +25,7 @@ public class SearchMenuEntry : Plugins.ConversationTitlebarEntry, Object {
public class GlobalSearchButton : Plugins.ConversationTitlebarWidget, Gtk.ToggleButton { public class GlobalSearchButton : Plugins.ConversationTitlebarWidget, Gtk.ToggleButton {
public new void set_conversation(Conversation conversation) { } public new void set_conversation(Conversation conversation) { }
public new void unset_conversation() { }
} }
} }

View file

@ -32,6 +32,8 @@ public class UnifiedWindow : Gtk.Window {
public SearchEntry search_entry; public SearchEntry search_entry;
public GlobalSearch search_box; public GlobalSearch search_box;
private Stack stack = new Stack() { visible=true }; private Stack stack = new Stack() { visible=true };
private Stack left_stack;
private Stack right_stack;
private StreamInteractor stream_interactor; private StreamInteractor stream_interactor;
private Conversation? conversation; private Conversation? conversation;
@ -74,6 +76,8 @@ public class UnifiedWindow : Gtk.Window {
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");
box.add(paned); box.add(paned);
left_stack = (Stack) builder.get_object("left_stack");
right_stack = (Stack) builder.get_object("right_stack");
chat_input = ((ChatInput.View) builder.get_object("chat_input")).init(stream_interactor); chat_input = ((ChatInput.View) builder.get_object("chat_input")).init(stream_interactor);
chat_input.key_press_event.connect(forward_key_press_to_chat_input); chat_input.key_press_event.connect(forward_key_press_to_chat_input);
conversation_frame = ((ConversationSummary.ConversationView) builder.get_object("conversation_frame")).init(stream_interactor); conversation_frame = ((ConversationSummary.ConversationView) builder.get_object("conversation_frame")).init(stream_interactor);
@ -84,6 +88,8 @@ public class UnifiedWindow : Gtk.Window {
search_box = ((GlobalSearch) builder.get_object("search_box")).init(stream_interactor); search_box = ((GlobalSearch) builder.get_object("search_box")).init(stream_interactor);
search_revealer = (Revealer) builder.get_object("search_revealer"); search_revealer = (Revealer) builder.get_object("search_revealer");
search_entry = (SearchEntry) builder.get_object("search_entry"); search_entry = (SearchEntry) builder.get_object("search_entry");
Image conversation_list_placeholder_image = (Image) builder.get_object("conversation_list_placeholder_image");
conversation_list_placeholder_image.set_from_pixbuf(new Pixbuf.from_resource("/im/dino/Dino/icons/dino-conversation-list-placeholder-arrow.svg"));
} }
private void setup_headerbar() { private void setup_headerbar() {
@ -136,11 +142,16 @@ public class UnifiedWindow : Gtk.Window {
set_titlebar(placeholder_headerbar); set_titlebar(placeholder_headerbar);
} }
} else if (stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations().size == 0) { } else if (stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations().size == 0) {
stack.set_visible_child_name("conversations_placeholder"); stack.set_visible_child_name("main");
left_stack.set_visible_child_name("placeholder");
right_stack.set_visible_child_name("placeholder");
if (Util.use_csd()) { if (Util.use_csd()) {
set_titlebar(placeholder_headerbar); set_titlebar(headerbar_paned);
} }
} else { } else {
left_stack.set_visible_child_name("content");
right_stack.set_visible_child_name("content");
stack.set_visible_child_name("main"); stack.set_visible_child_name("main");
if (Util.use_csd()) { if (Util.use_csd()) {
set_titlebar(headerbar_paned); set_titlebar(headerbar_paned);
@ -171,7 +182,7 @@ public class UnifiedWindow : Gtk.Window {
public class WelcomePlceholder : UnifiedWindowPlaceholder { public class WelcomePlceholder : UnifiedWindowPlaceholder {
public WelcomePlceholder() { public WelcomePlceholder() {
title_label.label = _("Welcome to Dino!"); title_label.label = _("Welcome to Dino!");
label.label = "Communicating happiness."; label.label = "Create or log in to your account to get started.";
primary_button.label = _("Set up account"); primary_button.label = _("Set up account");
title_label.visible = true; title_label.visible = true;
secondary_button.visible = false; secondary_button.visible = false;

View file

@ -43,6 +43,8 @@ public class UnifiedWindowController : Object {
update_conversation_topic(subject); update_conversation_topic(subject);
} }
}); });
stream_interactor.get_module(ConversationManager.IDENTITY).conversation_deactivated.connect(check_unset_conversation);
stream_interactor.account_removed.connect(check_unset_conversation);
app.plugin_registry.register_contact_titlebar_entry(new MenuEntry(stream_interactor)); app.plugin_registry.register_contact_titlebar_entry(new MenuEntry(stream_interactor));
app.plugin_registry.register_contact_titlebar_entry(search_menu_entry); app.plugin_registry.register_contact_titlebar_entry(search_menu_entry);
@ -120,7 +122,7 @@ public class UnifiedWindowController : Object {
restore_window_size(); restore_window_size();
} }
public void select_conversation(Conversation conversation, bool do_reset_search = true, bool default_initialize_conversation = true) { public void select_conversation(Conversation? conversation, bool do_reset_search = true, bool default_initialize_conversation = true) {
this.conversation = conversation; this.conversation = conversation;
update_conversation_display_name(); update_conversation_display_name();
@ -147,6 +149,26 @@ public class UnifiedWindowController : Object {
} }
} }
private void check_unset_conversation() {
if (stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations().size == 0) {
unset_conversation();
}
}
private void unset_conversation() {
this.conversation = null;
conversation_display_name = null;
conversation_topic = null;
foreach(var e in this.app.plugin_registry.conversation_titlebar_entries) {
Plugins.ConversationTitlebarWidget widget = e.get_widget(Plugins.WidgetType.GTK);
if (widget != null) {
widget.unset_conversation();
}
}
}
private void update_conversation_display_name() { private void update_conversation_display_name() {
conversation_display_name = Util.get_conversation_display_name(stream_interactor, conversation); conversation_display_name = Util.get_conversation_display_name(stream_interactor, conversation);
} }