Commit 2cd8b6ce authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

chat-view: Show empty status page if no chat is selected

parent f4593e97
......@@ -28,7 +28,10 @@
struct _ChattyChatView
GtkBox parent_instance;
GtkStack parent_instance;
GtkWidget *message_view;
GtkWidget *empty_view;
GtkWidget *message_list;
GtkWidget *loading_spinner;
......@@ -59,7 +62,7 @@ struct _ChattyChatView
G_DEFINE_TYPE (ChattyChatView, chatty_chat_view, GTK_TYPE_BOX)
G_DEFINE_TYPE (ChattyChatView, chatty_chat_view, GTK_TYPE_STACK)
const char *emoticons[][2] = {
......@@ -654,6 +657,9 @@ chatty_chat_view_class_init (ChattyChatViewClass *klass)
gtk_widget_class_bind_template_child (widget_class, ChattyChatView, message_view);
gtk_widget_class_bind_template_child (widget_class, ChattyChatView, empty_view);
gtk_widget_class_bind_template_child (widget_class, ChattyChatView, scroll_down_button);
gtk_widget_class_bind_template_child (widget_class, ChattyChatView, message_list);
gtk_widget_class_bind_template_child (widget_class, ChattyChatView, loading_spinner);
......@@ -690,6 +696,7 @@ chatty_chat_view_init (ChattyChatView *self)
gtk_widget_init_template (GTK_WIDGET (self));
gtk_list_box_set_placeholder (GTK_LIST_BOX (self->message_list), self->no_message_status);
gtk_stack_set_visible_child (GTK_STACK (self), self->empty_view);
vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (self->scrolled_window));
g_signal_connect_after (G_OBJECT (vadjustment), "notify::upper",
......@@ -741,6 +748,11 @@ chatty_chat_view_set_chat (ChattyChatView *self,
if (!g_set_object (&self->chat, chat))
if (chat)
gtk_stack_set_visible_child (GTK_STACK (self), self->message_view);
gtk_stack_set_visible_child (GTK_STACK (self), self->empty_view);
if (!chat) {
gtk_list_box_bind_model (GTK_LIST_BOX (self->message_list),
......@@ -19,7 +19,7 @@ G_BEGIN_DECLS
#define CHATTY_TYPE_CHAT_VIEW (chatty_chat_view_get_type ())
G_DECLARE_FINAL_TYPE (ChattyChatView, chatty_chat_view, CHATTY, CHAT_VIEW, GtkBox)
G_DECLARE_FINAL_TYPE (ChattyChatView, chatty_chat_view, CHATTY, CHAT_VIEW, GtkStack)
GtkWidget *chatty_chat_view_new (void);
void chatty_chat_view_set_chat (ChattyChatView *self,
<?xml version="1.0" encoding="UTF-8"?>
<template class="ChattyChatView" parent="GtkBox">
<template class="ChattyChatView" parent="GtkStack">
<property name="visible">True</property>
<property name="expand">True</property>
<property name="orientation">vertical</property>
<object class="GtkBox" id="message_view">
<property name="visible">True</property>
<property name="expand">True</property>
<property name="orientation">vertical</property>
<object class="GtkOverlay">
<property name="visible">True</property>
......@@ -212,6 +216,17 @@
</object> <!-- ./HdyClamp -->
<object class="HdyStatusPage" id="empty_view">
<property name="visible">True</property>
<property name="icon-name">sm.puri.Chatty-symbolic</property>
<property name="title" translatable="yes">No chat selected</property>
  • According to it looks like src/ui/chatty-chat-view.ui and src/ui/chatty-file-item.ui needs to be added to po/ so they can be translated.

  • @mohammed.sadiq seems so. Phosh has a CI check for that that would also work for chatty:

    $  ../phosh/tools/check-po 
    The following files contain translations and are currently not in use. Please
    consider adding these to the file, located in the po/ directory.
    If some of these files are left out on purpose then please add them to
    POTFILES.skip instead of A file 'missing' containing this list
    of left out files has been written in the current directory.
Please register or sign in to reply
<object class="GtkTextBuffer" id="message_input_buffer">
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment