Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/resources/resources.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<file compressed="true" preprocess="xml-stripblanks">ui/content-message-text.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/content-send-photo-dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/login.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/message-list-view.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/message-menu.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/phone-number-input.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/preferences-window.ui</file>
Expand Down
4 changes: 2 additions & 2 deletions data/resources/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ sidebarsearchitemrow {
border-spacing: 12px;
}

listview.chat-history {
messagelistview listview.message {
background: transparent;
padding: 3px 0;
}

listview.chat-history > row {
messagelistview listview.message > row {
margin: 2px 4px;
border-radius: 9px;
}
Expand Down
100 changes: 7 additions & 93 deletions data/resources/ui/content-chat-history.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<property name="show-start-title-buttons" bind-source="ContentChatHistory" bind-property="compact" bind-flags="sync-create"/>
<child type="start">
<object class="GtkButton">
<property name="visible" bind-source="ContentChatHistory" bind-property="compact" bind-flags="sync-create"/>
<property name="icon-name">go-previous-symbolic</property>
<property name="action-name">content.go-back</property>
<property name="visible" bind-source="ContentChatHistory" bind-property="compact" bind-flags="sync-create"/>
<property name="icon-name">go-previous-symbolic</property>
<property name="action-name">session.go-back</property>
</object>
</child>
<child type="title">
Expand All @@ -33,97 +33,11 @@
</child>
</object>
</child>
<child type="top">
<object class="PinnedMessagesBar" id="pinned_messages_bar"/>
</child>
<property name="content">
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkRevealer">
<property name="transition-type">slide-up</property>
<property name="reveal-child" bind-source="ContentChatHistory" bind-property="sticky" bind-flags="sync-create|invert-boolean"/>
<property name="valign">end</property>
<property name="halign">end</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkLabel">
<property name="halign">center</property>
<property name="valign">start</property>
<property name="ellipsize">middle</property>
<binding name="label">
<lookup name="unread-count" type="Chat">
<lookup name="chat">ContentChatHistory</lookup>
</lookup>
</binding>
<binding name="visible">
<lookup name="unread-count" type="Chat">
<lookup name="chat">ContentChatHistory</lookup>
</lookup>
</binding>
<style>
<class name="unread-count"/>
</style>
</object>
</child>
<child>
<object class="GtkButton">
<property name="halign">center</property>
<property name="valign">end</property>
<property name="icon-name">go-down-symbolic</property>
<property name="action-name">chat-history.scroll-down</property>
<accessibility>
<property name="label" translatable="yes">Scroll to bottom</property>
</accessibility>
<style>
<class name="circular"/>
<class name="opaque"/>
<class name="scroll-to-bottom"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="vexpand">True</property>
<property name="hscrollbar-policy">never</property>
<property name="child">
<object class="AdwClampScrollable">
<property name="maximum-size">800</property>
<property name="tightening-threshold">600</property>
<property name="vscroll-policy">natural</property>
<property name="child">
<object class="GtkListView" id="list_view">
<property name="reversed">True</property>
<style>
<class name="chat-history"/>
</style>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="activatable">False</property>
<property name="child">
<object class="ContentChatHistoryRow">
<binding name="item">
<lookup name="item">GtkListItem</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</child>
</object>
<object class="MessageListView" id="message_list_view"/>
</property>
<child type="bottom">
<object class="AdwClamp">
Expand Down
2 changes: 1 addition & 1 deletion data/resources/ui/content-event-row.blp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Gtk 4.0;
using Adw 1;

template ContentEventRow : Adw.Bin {
template MessageListViewEventRow : Adw.Bin {
styles ["event-row"]

child: Label label {
Expand Down
10 changes: 7 additions & 3 deletions data/resources/ui/content.blp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ template Content : Adw.Bin {
};
}

.ContentChatHistory chat_history {
compact: bind Content.compact;
chat: bind Content.chat;
Adw.Leaflet chat_leaflet {
can-unfold: false;

.ContentChatHistory chat_history {
compact: bind Content.compact;
chat: bind Content.chat;
}
}
}
}
95 changes: 95 additions & 0 deletions data/resources/ui/message-list-view.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="MessageListView" parent="GtkWidget">
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkRevealer" id="scroll_to_bottom_revealer">
<property name="transition-type">slide-up</property>
<property name="valign">end</property>
<property name="halign">end</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkLabel">
<property name="halign">center</property>
<property name="valign">start</property>
<property name="ellipsize">middle</property>
<!-- <binding name="label"> -->
<!-- <lookup name="unread-count" type="Chat"> -->
<!-- <lookup name="chat">ContentChatHistory</lookup> -->
<!-- </lookup> -->
<!-- </binding> -->
<!-- <binding name="visible"> -->
<!-- <lookup name="unread-count" type="Chat"> -->
<!-- <lookup name="chat">ContentChatHistory</lookup> -->
<!-- </lookup> -->
<!-- </binding> -->
<style>
<class name="unread-count"/>
</style>
</object>
</child>
<child>
<object class="GtkButton">
<property name="halign">center</property>
<property name="valign">end</property>
<property name="icon-name">go-down-symbolic</property>
<property name="action-name">message-list-view.scroll-to-bottom</property>
<accessibility>
<property name="label" translatable="yes">Scroll to bottom</property>
</accessibility>
<style>
<class name="circular"/>
<class name="opaque"/>
<class name="scroll-to-bottom"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="hscrollbar-policy">never</property>
<property name="child">
<object class="AdwClampScrollable">
<property name="maximum-size">800</property>
<property name="tightening-threshold">600</property>
<property name="vscroll-policy">natural</property>
<property name="child">
<object class="GtkListView" id="list_view">
<property name="reversed">True</property>
<style>
<class name="message"/>
</style>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="activatable">False</property>
<property name="child">
<object class="MessageListViewRow">
<binding name="item">
<lookup name="item">GtkListItem</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
</template>
</interface>
4 changes: 2 additions & 2 deletions data/resources/ui/message-menu.blp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ menu model {

item {
label: _("Delete for Ever_yone");
action: "message-row.revoke-delete";
action: "message-list-view.revoke-delete";
hidden-when: "action-disabled";
}

item {
label: _("_Delete for Me");
action: "message-row.delete";
action: "message-list-view.delete";
hidden-when: "action-disabled";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ mod imp {

#[derive(Debug, Default, CompositeTemplate)]
#[template(resource = "/com/github/melix99/telegrand/ui/content-event-row.ui")]
pub(crate) struct EventRow {
pub(crate) struct MessageListViewEventRow {
#[template_child]
pub(super) label: TemplateChild<gtk::Label>,
}

#[glib::object_subclass]
impl ObjectSubclass for EventRow {
const NAME: &'static str = "ContentEventRow";
type Type = super::EventRow;
impl ObjectSubclass for MessageListViewEventRow {
const NAME: &'static str = "MessageListViewEventRow";
type Type = super::MessageListViewEventRow;
type ParentType = adw::Bin;

fn class_init(klass: &mut Self::Class) {
Expand All @@ -29,7 +29,7 @@ mod imp {
}
}

impl ObjectImpl for EventRow {
impl ObjectImpl for MessageListViewEventRow {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> =
Lazy::new(|| vec![glib::ParamSpecString::builder("label").build()]);
Expand All @@ -55,22 +55,22 @@ mod imp {
}
}

impl WidgetImpl for EventRow {}
impl BinImpl for EventRow {}
impl WidgetImpl for MessageListViewEventRow {}
impl BinImpl for MessageListViewEventRow {}
}

glib::wrapper! {
pub(crate) struct EventRow(ObjectSubclass<imp::EventRow>)
pub(crate) struct MessageListViewEventRow(ObjectSubclass<imp::MessageListViewEventRow>)
@extends gtk::Widget, adw::Bin;
}

impl Default for EventRow {
impl Default for MessageListViewEventRow {
fn default() -> Self {
Self::new()
}
}

impl EventRow {
impl MessageListViewEventRow {
pub(crate) fn new() -> Self {
glib::Object::new()
}
Expand Down
Loading