aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_titlebar/menu_entry.vala8
-rw-r--r--main/src/ui/conversation_titlebar/occupants_entry.vala6
-rw-r--r--main/src/ui/conversation_titlebar/search_entry.vala1
-rw-r--r--main/src/ui/unified_window.vala17
-rw-r--r--main/src/ui/unified_window_controller.vala24
5 files changed, 50 insertions, 6 deletions
diff --git a/main/src/ui/conversation_titlebar/menu_entry.vala b/main/src/ui/conversation_titlebar/menu_entry.vala
index daee48c2..e72cb629 100644
--- a/main/src/ui/conversation_titlebar/menu_entry.vala
+++ b/main/src/ui/conversation_titlebar/menu_entry.vala
@@ -18,7 +18,7 @@ class MenuEntry : Plugins.ConversationTitlebarEntry, Object {
public Plugins.ConversationTitlebarWidget? get_widget(Plugins.WidgetType type) {
if (type == Plugins.WidgetType.GTK) {
if (widget == null) {
- widget = new MenuWidget(stream_interactor) { visible=true };
+ widget = new MenuWidget(stream_interactor) { visible=true, sensitive=false };
}
return widget;
}
@@ -41,6 +41,7 @@ class MenuWidget : Button, Plugins.ConversationTitlebarWidget {
}
public new void set_conversation(Conversation conversation) {
+ this.sensitive = true;
this.conversation = conversation;
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
tooltip_text = "Channel details";
@@ -48,6 +49,11 @@ class MenuWidget : Button, Plugins.ConversationTitlebarWidget {
tooltip_text = "Conversation details";
}
}
+
+ public new void unset_conversation() {
+ this.sensitive = false;
+ }
+
}
}
diff --git a/main/src/ui/conversation_titlebar/occupants_entry.vala b/main/src/ui/conversation_titlebar/occupants_entry.vala
index b5c4c228..facaa50f 100644
--- a/main/src/ui/conversation_titlebar/occupants_entry.vala
+++ b/main/src/ui/conversation_titlebar/occupants_entry.vala
@@ -18,7 +18,7 @@ class OccupantsEntry : Plugins.ConversationTitlebarEntry, Object {
public Plugins.ConversationTitlebarWidget? get_widget(Plugins.WidgetType type) {
if (type == Plugins.WidgetType.GTK) {
if (widget == null) {
- widget = new OccupantsWidget(stream_interactor) { visible=true };
+ widget = new OccupantsWidget(stream_interactor);
}
return widget;
}
@@ -51,6 +51,10 @@ class OccupantsWidget : MenuButton, Plugins.ConversationTitlebarWidget {
menu = new_menu;
}
}
+
+ public new void unset_conversation() {
+ visible = false;
+ }
}
}
diff --git a/main/src/ui/conversation_titlebar/search_entry.vala b/main/src/ui/conversation_titlebar/search_entry.vala
index 9fab0614..109c54d7 100644
--- a/main/src/ui/conversation_titlebar/search_entry.vala
+++ b/main/src/ui/conversation_titlebar/search_entry.vala
@@ -25,6 +25,7 @@ public class SearchMenuEntry : Plugins.ConversationTitlebarEntry, Object {
public class GlobalSearchButton : Plugins.ConversationTitlebarWidget, Gtk.ToggleButton {
public new void set_conversation(Conversation conversation) { }
+ public new void unset_conversation() { }
}
}
diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala
index 6e0a1070..9e8c4484 100644
--- a/main/src/ui/unified_window.vala
+++ b/main/src/ui/unified_window.vala
@@ -32,6 +32,8 @@ public class UnifiedWindow : Gtk.Window {
public SearchEntry search_entry;
public GlobalSearch search_box;
private Stack stack = new Stack() { visible=true };
+ private Stack left_stack;
+ private Stack right_stack;
private StreamInteractor stream_interactor;
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");
paned = (Paned) builder.get_object("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.key_press_event.connect(forward_key_press_to_chat_input);
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_revealer = (Revealer) builder.get_object("search_revealer");
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() {
@@ -136,11 +142,16 @@ public class UnifiedWindow : Gtk.Window {
set_titlebar(placeholder_headerbar);
}
} 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()) {
- set_titlebar(placeholder_headerbar);
+ set_titlebar(headerbar_paned);
}
} else {
+ left_stack.set_visible_child_name("content");
+ right_stack.set_visible_child_name("content");
+
stack.set_visible_child_name("main");
if (Util.use_csd()) {
set_titlebar(headerbar_paned);
@@ -171,7 +182,7 @@ public class UnifiedWindow : Gtk.Window {
public class WelcomePlceholder : UnifiedWindowPlaceholder {
public WelcomePlceholder() {
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");
title_label.visible = true;
secondary_button.visible = false;
diff --git a/main/src/ui/unified_window_controller.vala b/main/src/ui/unified_window_controller.vala
index 2fd8eb0d..6ac941cc 100644
--- a/main/src/ui/unified_window_controller.vala
+++ b/main/src/ui/unified_window_controller.vala
@@ -43,6 +43,8 @@ public class UnifiedWindowController : Object {
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(search_menu_entry);
@@ -120,7 +122,7 @@ public class UnifiedWindowController : Object {
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;
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() {
conversation_display_name = Util.get_conversation_display_name(stream_interactor, conversation);
}