commit cbefefb69b4db53fad2c01d45b66d9056bc98fdb
parent 1e666517d6f6bccb85b2a92fd51986efba2e2563
Author: TheJackiMonster <thejackimonster@gmail.com>
Date: Sun, 12 Dec 2021 22:31:42 +0100
Added chat details with a list of contacts for groups
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat:
10 files changed, 618 insertions(+), 387 deletions(-)
diff --git a/resources/css/style.css b/resources/css/style.css
@@ -69,7 +69,17 @@
font-size: large;
}
-.settings-entry {
+.settings-entry, .details-entry {
margin: 8px;
}
+.details-group {
+ margin-top: 16px;
+}
+
+.details-group-title {
+ margin-left: 8px;
+ margin-right: 8px;
+ margin-bottom: 4px;
+}
+
diff --git a/resources/ui/chat.ui b/resources/ui/chat.ui
@@ -22,53 +22,121 @@ Author: Tobias Frisch
-->
<interface>
<requires lib="gtk+" version="3.24"/>
+ <requires lib="libhandy" version="1.2"/>
<object class="GtkBox" id="chat_box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkBox">
+ <object class="HdyFlap" id="flap_chat_details">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="border-width">8</property>
- <property name="spacing">8</property>
- <child>
- <object class="GtkButton" id="back_button">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="relief">none</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="icon-name">go-previous-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="flap-position">end</property>
+ <property name="reveal-flap">False</property>
+ <property name="fold-policy">always</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="margin-start">4</property>
- <property name="margin-end">4</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="chat_title">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="label" translatable="yes">Chat title</property>
- <property name="xalign">0</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="border-width">8</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkButton" id="back_button">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">go-previous-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">start</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="chat_title">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="chat_subtitle">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="light"/>
+ </attributes>
+ <style>
+ <class name="header-subtitle"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="chat_details_button">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">view-more-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <style>
+ <class name=".header-box"/>
+ </style>
</object>
<packing>
<property name="expand">False</property>
@@ -77,17 +145,33 @@ Author: Tobias Frisch
</packing>
</child>
<child>
- <object class="GtkLabel" id="chat_subtitle">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label" translatable="yes">Chat subtitle</property>
- <property name="xalign">0</property>
- <attributes>
- <attribute name="weight" value="light"/>
- </attributes>
- <style>
- <class name="header-subtitle"/>
- </style>
+ <property name="can-focus">True</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkStack">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkListBox" id="messages_listbox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="selection-mode">none</property>
+ <property name="activate-on-single-click">False</property>
+ </object>
+ <packing>
+ <property name="name">page0</property>
+ <property name="title" translatable="yes">page0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">True</property>
@@ -95,197 +179,363 @@ Author: Tobias Frisch
<property name="position">1</property>
</packing>
</child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="chat_details_button">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="relief">none</property>
<child>
- <object class="GtkImage">
+ <object class="GtkRevealer" id="picker_revealer">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="icon-name">view-more-symbolic</property>
+ <property name="transition-type">slide-up</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">2</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack-type">end</property>
- <property name="position">1</property>
- </packing>
- </child>
- <style>
- <class name=".header-box"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <child>
- <object class="GtkViewport">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
<child>
- <object class="GtkStack">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
+ <property name="margin-start">4</property>
+ <property name="margin-end">4</property>
+ <property name="border-width">4</property>
+ <property name="spacing">4</property>
<child>
- <object class="GtkListBox" id="messages_listbox">
+ <object class="GtkButton" id="attach_file_button">
<property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="selection-mode">none</property>
- <property name="activate-on-single-click">False</property>
+ <property name="sensitive">False</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="valign">center</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">mail-attachment-symbolic</property>
+ </object>
+ </child>
</object>
<packing>
- <property name="name">page0</property>
- <property name="title" translatable="yes">page0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTextView" id="send_text_view">
+ <property name="width-request">210</property>
+ <property name="height-request">48</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can-focus">True</property>
+ <property name="valign">end</property>
+ <property name="editable">False</property>
+ <property name="wrap-mode">word-char</property>
+ <property name="left-margin">8</property>
+ <property name="right-margin">8</property>
+ <property name="top-margin">8</property>
+ <property name="bottom-margin">8</property>
+ <property name="input-hints">GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_WORD_COMPLETION | GTK_INPUT_HINT_INHIBIT_OSK | GTK_INPUT_HINT_EMOJI | GTK_INPUT_HINT_NONE</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="emoji_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="valign">center</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">face-smile-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="send_record_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="valign">center</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="send_record_symbol">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">audio-input-microphone-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">3</property>
+ </packing>
</child>
</object>
</child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkRevealer" id="picker_revealer">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="transition-type">slide-up</property>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack-type">end</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="margin-start">4</property>
- <property name="margin-end">4</property>
- <property name="border-width">4</property>
- <property name="spacing">4</property>
- <child>
- <object class="GtkButton" id="attach_file_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="valign">center</property>
- <property name="relief">none</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="icon-name">mail-attachment-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkTextView" id="send_text_view">
- <property name="width-request">210</property>
- <property name="height-request">48</property>
+ <child type="separator">
+ <object class="GtkSeparator">
<property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="valign">end</property>
- <property name="editable">False</property>
- <property name="wrap-mode">word-char</property>
- <property name="left-margin">8</property>
- <property name="right-margin">8</property>
- <property name="top-margin">8</property>
- <property name="bottom-margin">8</property>
- <property name="input-hints">GTK_INPUT_HINT_SPELLCHECK | GTK_INPUT_HINT_WORD_COMPLETION | GTK_INPUT_HINT_INHIBIT_OSK | GTK_INPUT_HINT_EMOJI | GTK_INPUT_HINT_NONE</property>
+ <property name="can-focus">False</property>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
- <child>
- <object class="GtkButton" id="emoji_button">
+ <child type="flap">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="valign">center</property>
- <property name="relief">none</property>
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkImage">
+ <object class="GtkBox" id="details-header-box">
+ <property name="width-request">250</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="icon-name">face-smile-symbolic</property>
+ <property name="border-width">8</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkLabel" id="chat_details_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="xpad">8</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="hide_chat_details_button">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">window-close-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="send_record_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="valign">center</property>
- <property name="relief">none</property>
<child>
- <object class="GtkImage" id="send_record_symbol">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="icon-name">audio-input-microphone-symbolic</property>
+ <property name="can-focus">True</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="shadow-type">none</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes">Notifications</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSwitch">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <style>
+ <class name="details-entry"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="chat_details_contacts_box">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes">Contacts</property>
+ <property name="xalign">0</property>
+ <attributes>
+ <attribute name="weight" value="semibold"/>
+ </attributes>
+ <style>
+ <class name="details-group-title"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkListBox" id="chat_contacts_listbox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="selection-mode">none</property>
+ <child>
+ <object class="GtkListBoxRow">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkImage">
+ <property name="width-request">36</property>
+ <property name="height-request">36</property>
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="icon-name">list-add-symbolic</property>
+ <property name="icon_size">3</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="label" translatable="yes">Invite Contact</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <style>
+ <class name="profile-entry"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <style>
+ <class name="details-group"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
+ <style>
+ <class name="flap-background"/>
+ </style>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
- <property name="pack-type">end</property>
- <property name="position">3</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
diff --git a/resources/ui/messenger.ui b/resources/ui/messenger.ui
@@ -718,164 +718,43 @@ Author: Tobias Frisch
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="HdyFlap" id="flap_chat_details">
+ <object class="GtkStack" id="chats_stack">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="flap-position">end</property>
- <property name="reveal-flap">False</property>
- <property name="fold-policy">always</property>
<child>
- <object class="GtkStack" id="chats_stack">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <property name="label" translatable="yes">Select a chat to start messaging...</property>
- <style>
- <class name="message-box"/>
- <class name="status"/>
- </style>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="name">page0</property>
- <property name="title" translatable="yes">page0</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="separator">
- <object class="GtkSeparator">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- </object>
- </child>
- <child type="flap">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="details-header-box">
- <property name="width-request">250</property>
+ <object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="border-width">8</property>
- <child>
- <object class="GtkStack">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="spacing">8</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="xpad">8</property>
- <property name="label" translatable="yes">Chat Details</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="hide_chat_details_button">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="relief">none</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="icon-name">window-close-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack-type">end</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="name">page0</property>
- <property name="title" translatable="yes">page0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <child>
- <object class="GtkViewport">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <child>
- <object class="GtkStack">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="label" translatable="yes">Select a chat to start messaging...</property>
+ <style>
+ <class name="message-box"/>
+ <class name="status"/>
+ </style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
- <style>
- <class name="flap-background"/>
- </style>
</object>
+ <packing>
+ <property name="name">page0</property>
+ <property name="title" translatable="yes">page0</property>
+ </packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
diff --git a/src/event.c b/src/event.c
@@ -35,31 +35,13 @@ _add_new_chat_entry(MESSENGER_Application *app,
{
UI_MESSENGER_Handle *ui = &(app->ui.messenger);
- const struct GNUNET_CHAT_Contact* contact;
- const struct GNUNET_CHAT_Group* group;
-
- contact = GNUNET_CHAT_context_get_contact(context);
- group = GNUNET_CHAT_context_get_group(context);
-
- const char *title = NULL;
+ UI_CHAT_ENTRY_Handle *entry = ui_chat_entry_new(app);
- if (contact)
- title = GNUNET_CHAT_contact_get_name(contact);
- else if (group)
- title = GNUNET_CHAT_group_get_name(group);
+ ui_chat_entry_update(entry, context);
- UI_CHAT_ENTRY_Handle *entry = ui_chat_entry_new(app);
gtk_container_add(GTK_CONTAINER(ui->chats_listbox), entry->entry_box);
GNUNET_CHAT_context_set_user_pointer(context, entry);
- if (title)
- {
- gtk_label_set_text(entry->title_label, title);
- hdy_avatar_set_text(entry->entry_avatar, title);
-
- gtk_label_set_text(entry->chat->chat_title, title);
- }
-
char context_id [9];
g_snprintf(context_id, sizeof(context_id), "%08lx", (gulong) context);
@@ -181,10 +163,7 @@ event_joining_contact(MESSENGER_Application *app,
if (!handle)
return;
- int status = GNUNET_CHAT_context_get_status(context);
-
- if (GNUNET_OK == status)
- ui_chat_entry_activate(handle);
+ ui_chat_entry_update(handle, context);
UI_MESSAGE_Handle *message = ui_message_new(app, UI_MESSAGE_STATUS);
diff --git a/src/ui/chat.c b/src/ui/chat.c
@@ -26,6 +26,7 @@
#include "messenger.h"
#include "picker.h"
+#include "profile_entry.h"
#include "../application.h"
static void
@@ -176,6 +177,10 @@ ui_chat_new(MESSENGER_Application *app)
messenger->leaflet_chat
);
+ handle->flap_chat_details = HDY_FLAP(
+ gtk_builder_get_object(handle->builder, "flap_chat_details")
+ );
+
handle->chat_title = GTK_LABEL(
gtk_builder_get_object(handle->builder, "chat_title")
);
@@ -192,7 +197,30 @@ ui_chat_new(MESSENGER_Application *app)
handle->chat_details_button,
"clicked",
G_CALLBACK(handle_flap_via_button_click),
- messenger->flap_chat_details
+ handle->flap_chat_details
+ );
+
+ handle->chat_details_label = GTK_LABEL(
+ gtk_builder_get_object(handle->builder, "chat_details_label")
+ );
+
+ handle->hide_chat_details_button = GTK_BUTTON(
+ gtk_builder_get_object(handle->builder, "hide_chat_details_button")
+ );
+
+ g_signal_connect(
+ handle->hide_chat_details_button,
+ "clicked",
+ G_CALLBACK(handle_flap_via_button_click),
+ handle->flap_chat_details
+ );
+
+ handle->chat_details_contacts_box = GTK_BOX(
+ gtk_builder_get_object(handle->builder, "chat_details_contacts_box")
+ );
+
+ handle->chat_contacts_listbox = GTK_LIST_BOX(
+ gtk_builder_get_object(handle->builder, "chat_contacts_listbox")
);
handle->messages_listbox = GTK_LIST_BOX(
@@ -271,15 +299,86 @@ ui_chat_new(MESSENGER_Application *app)
return handle;
}
+static int
+iterate_ui_chat_update_group_contacts(void *cls,
+ UNUSED const struct GNUNET_CHAT_Group *group,
+ struct GNUNET_CHAT_Contact *contact)
+{
+ GtkListBox *listbox = GTK_LIST_BOX(cls);
+ UI_PROFILE_ENTRY_Handle* entry = ui_profile_entry_new();
+
+ const char *name = GNUNET_CHAT_contact_get_name(contact);
+
+ if (name)
+ {
+ gtk_label_set_text(entry->entry_label, name);
+ hdy_avatar_set_text(entry->entry_avatar, name);
+ }
+
+ gtk_list_box_prepend(listbox, entry->entry_box);
+
+ ui_profile_entry_delete(entry);
+ return GNUNET_YES;
+}
+
void
-ui_chat_activate(UI_CHAT_Handle *handle)
+ui_chat_update(UI_CHAT_Handle *handle,
+ const struct GNUNET_CHAT_Context* context)
{
- gtk_text_view_set_editable(handle->send_text_view, TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(handle->send_text_view), TRUE);
+ const struct GNUNET_CHAT_Contact* contact;
+ const struct GNUNET_CHAT_Group* group;
+
+ contact = GNUNET_CHAT_context_get_contact(context);
+ group = GNUNET_CHAT_context_get_group(context);
+
+ const char *title = NULL;
+
+ if (contact)
+ title = GNUNET_CHAT_contact_get_name(contact);
+ else if (group)
+ title = GNUNET_CHAT_group_get_name(group);
+
+ if (title)
+ {
+ gtk_label_set_text(handle->chat_title, title);
+ gtk_label_set_text(handle->chat_details_label, title);
+ }
+
+ GList* children = gtk_container_get_children(
+ GTK_CONTAINER(handle->chat_contacts_listbox)
+ );
+
+ while ((children) && (children->next)) {
+ GtkWidget *widget = GTK_WIDGET(children->data);
+ children = children->next;
+
+ gtk_container_remove(
+ GTK_CONTAINER(handle->chat_contacts_listbox),
+ widget
+ );
+ }
+
+ if (group)
+ GNUNET_CHAT_group_iterate_contacts(
+ group,
+ iterate_ui_chat_update_group_contacts,
+ handle->chat_contacts_listbox
+ );
+
+ gtk_widget_set_visible(
+ GTK_WIDGET(handle->chat_details_contacts_box),
+ group? TRUE : FALSE
+ );
+
+ const int status = GNUNET_CHAT_context_get_status(context);
+ const gboolean activated = (GNUNET_OK == status? TRUE : FALSE);
+
+ gtk_text_view_set_editable(handle->send_text_view, activated);
+ gtk_widget_set_sensitive(GTK_WIDGET(handle->send_text_view), activated);
- gtk_widget_set_sensitive(GTK_WIDGET(handle->attach_file_button), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(handle->emoji_button), TRUE);
- gtk_widget_set_sensitive(GTK_WIDGET(handle->send_record_button), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(handle->attach_file_button), activated);
+ gtk_widget_set_sensitive(GTK_WIDGET(handle->emoji_button), activated);
+ gtk_widget_set_sensitive(GTK_WIDGET(handle->send_record_button), activated);
}
void
diff --git a/src/ui/chat.h b/src/ui/chat.h
@@ -29,6 +29,8 @@
#include <libhandy-1/handy.h>
#include <libnotify/notify.h>
+#include <gnunet/gnunet_chat_lib.h>
+
typedef struct MESSENGER_Application MESSENGER_Application;
typedef struct UI_PICKER_Handle UI_PICKER_Handle;
@@ -39,10 +41,17 @@ typedef struct UI_CHAT_Handle
GtkButton *back_button;
+ HdyFlap *flap_chat_details;
+
GtkLabel *chat_title;
GtkLabel *chat_subtitle;
GtkButton *chat_details_button;
+ GtkLabel *chat_details_label;
+ GtkButton *hide_chat_details_button;
+ GtkBox *chat_details_contacts_box;
+
+ GtkListBox *chat_contacts_listbox;
GtkListBox *messages_listbox;
GtkButton *attach_file_button;
@@ -60,7 +69,8 @@ UI_CHAT_Handle*
ui_chat_new(MESSENGER_Application *app);
void
-ui_chat_activate(UI_CHAT_Handle *handle);
+ui_chat_update(UI_CHAT_Handle *handle,
+ const struct GNUNET_CHAT_Context* context);
void
ui_chat_delete(UI_CHAT_Handle *handle);
diff --git a/src/ui/chat_entry.c b/src/ui/chat_entry.c
@@ -62,9 +62,30 @@ ui_chat_entry_new(MESSENGER_Application *app)
}
void
-ui_chat_entry_activate(UI_CHAT_ENTRY_Handle *handle)
+ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle,
+ const struct GNUNET_CHAT_Context *context)
{
- ui_chat_activate(handle->chat);
+ const struct GNUNET_CHAT_Contact* contact;
+ const struct GNUNET_CHAT_Group* group;
+
+ contact = GNUNET_CHAT_context_get_contact(context);
+ group = GNUNET_CHAT_context_get_group(context);
+
+ const char *title = NULL;
+
+ if (contact)
+ title = GNUNET_CHAT_contact_get_name(contact);
+ else if (group)
+ title = GNUNET_CHAT_group_get_name(group);
+
+ if (title)
+ {
+ gtk_label_set_text(handle->title_label, title);
+ hdy_avatar_set_text(handle->entry_avatar, title);
+ }
+
+ if (handle->chat)
+ ui_chat_update(handle->chat, context);
}
void
diff --git a/src/ui/chat_entry.h b/src/ui/chat_entry.h
@@ -47,7 +47,8 @@ UI_CHAT_ENTRY_Handle*
ui_chat_entry_new(MESSENGER_Application *app);
void
-ui_chat_entry_activate(UI_CHAT_ENTRY_Handle *handle);
+ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle,
+ const struct GNUNET_CHAT_Context *context);
void
ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle);
diff --git a/src/ui/messenger.c b/src/ui/messenger.c
@@ -218,10 +218,6 @@ ui_messenger_init(MESSENGER_Application *app,
gtk_builder_get_object(handle->builder, "flap_user_details")
);
- handle->flap_chat_details = HDY_FLAP(
- gtk_builder_get_object(handle->builder, "flap_chat_details")
- );
-
handle->title_bar = HDY_HEADER_BAR(
gtk_builder_get_object(handle->builder, "title_bar")
);
@@ -390,17 +386,6 @@ ui_messenger_init(MESSENGER_Application *app,
gtk_builder_get_object(handle->builder, "chats_stack")
);
- handle->hide_chat_details_button = GTK_BUTTON(
- gtk_builder_get_object(handle->builder, "hide_chat_details_button")
- );
-
- g_signal_connect(
- handle->hide_chat_details_button,
- "clicked",
- G_CALLBACK(handle_flap_via_button_click),
- handle->flap_chat_details
- );
-
gtk_widget_show(GTK_WIDGET(handle->main_window));
g_signal_connect(
diff --git a/src/ui/messenger.h b/src/ui/messenger.h
@@ -40,7 +40,6 @@ typedef struct UI_MESSENGER_Handle
HdyLeaflet *leaflet_chat;
HdyFlap *flap_user_details;
- HdyFlap *flap_chat_details;
HdyHeaderBar *title_bar;
@@ -68,8 +67,6 @@ typedef struct UI_MESSENGER_Handle
GtkListBox *chats_listbox;
GtkStack *chats_stack;
-
- GtkButton *hide_chat_details_button;
} UI_MESSENGER_Handle;
void