Skip to content

Commit 07a75f5

Browse files
authored
Merge pull request #463 from melix99/melix99/misc-improvements
General misc improvements
2 parents 3d48fb7 + 7c71ab2 commit 07a75f5

File tree

14 files changed

+87
-89
lines changed

14 files changed

+87
-89
lines changed

data/resources/style.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ sidebarsearchitemrow {
128128
margin: 0 6px;
129129
}
130130

131-
.scroll-to-bottom-button {
132-
margin: 12px;
133-
padding: 3px;
131+
button.scroll-to-bottom {
132+
background-color: @window_bg_color;
133+
box-shadow: inset 0 0 0 1px @borders;
134+
margin: 6px;
134135
}
135136

136137
messagebubble {
@@ -265,7 +266,7 @@ messageindicators,
265266

266267
.message-entry > overlay > entry {
267268
padding: 0 9px;
268-
border-radius: 15px;
269+
border-radius: 18px;
269270
}
270271

271272
.message-entry > overlay > entry > scrolledwindow > scrollbar {

data/resources/ui/content-chat-history.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@
7474
<property name="label" translatable="yes">Scroll to bottom</property>
7575
</accessibility>
7676
<style>
77-
<class name="osd"/>
7877
<class name="circular"/>
79-
<class name="scroll-to-bottom-button"/>
78+
<class name="opaque"/>
79+
<class name="scroll-to-bottom"/>
8080
</style>
8181
</object>
8282
</child>

data/resources/ui/sidebar-row-menu.ui

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
</menu>
2727
<object class="GtkPopoverMenu" id="menu">
2828
<property name="menu-model">model</property>
29+
<property name="has-arrow">False</property>
2930
</object>
3031
</interface>

data/resources/ui/sidebar-row.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<child>
1616
<object class="GtkGestureLongPress">
1717
<property name="touch-only">True</property>
18-
<signal name="pressed" handler="on_pressed" swapped="true"/>
18+
<signal name="pressed" handler="on_long_pressed" swapped="true"/>
1919
</object>
2020
</child>
2121
<child>

src/login.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,14 @@ mod imp {
108108

109109
fn class_init(klass: &mut Self::Class) {
110110
klass.bind_template();
111-
klass.install_action("login.previous", None, move |widget, _, _| {
112-
spawn(clone!(@weak widget => async move {
113-
widget.previous().await;
114-
}));
111+
klass.install_action_async("login.previous", None, |widget, _, _| async move {
112+
widget.previous().await;
115113
});
116-
klass.install_action("login.next", None, move |widget, _, _| {
117-
spawn(clone!(@weak widget => async move {
118-
widget.next().await;
119-
}));
114+
klass.install_action_async("login.next", None, |widget, _, _| async move {
115+
widget.next().await;
120116
});
121-
klass.install_action("login.use-qr-code", None, move |widget, _, _| {
122-
spawn(clone!(@weak widget => async move {
123-
widget.request_qr_code().await;
124-
}));
117+
klass.install_action_async("login.use-qr-code", None, |widget, _, _| async move {
118+
widget.request_qr_code().await;
125119
});
126120
klass.install_action(
127121
"login.go-to-forgot-password-page",
@@ -155,10 +149,8 @@ mod imp {
155149
klass.install_action("login.show-tos-dialog", None, move |widget, _, _| {
156150
widget.show_tos_dialog(false)
157151
});
158-
klass.install_action("login.resend-auth-code", None, move |widget, _, _| {
159-
spawn(clone!(@weak widget => async move {
160-
widget.resend_auth_code().await;
161-
}));
152+
klass.install_action_async("login.resend-auth-code", None, |widget, _, _| async move {
153+
widget.resend_auth_code().await;
162154
});
163155
}
164156

src/session/content/chat_action_bar.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ mod imp {
7878
widget.cancel_action();
7979
},
8080
);
81-
klass.install_action("chat-action-bar.select-file", None, move |widget, _, _| {
82-
spawn(clone!(@weak widget => async move {
81+
klass.install_action_async(
82+
"chat-action-bar.select-file",
83+
None,
84+
|widget, _, _| async move {
8385
widget.select_file().await;
84-
}));
85-
});
86+
},
87+
);
8688
klass.install_action_async(
8789
"chat-action-bar.send-message",
8890
None,
@@ -94,7 +96,6 @@ mod imp {
9496
}
9597
},
9698
);
97-
9899
klass.install_action_async(
99100
"chat-action-bar.join-chat",
100101
None,
@@ -111,7 +112,6 @@ mod imp {
111112
}
112113
},
113114
);
114-
115115
klass.install_action_async(
116116
"chat-action-bar.toggle-mute",
117117
None,
@@ -125,7 +125,6 @@ mod imp {
125125
}
126126
},
127127
);
128-
129128
klass.install_action_async(
130129
"chat-action-bar.unblock-chat",
131130
None,
@@ -225,8 +224,8 @@ mod imp {
225224
}
226225

227226
fn dispose(&self) {
228-
self.message_entry.unparent();
229-
self.send_message_button.unparent();
227+
self.top_bar_revealer.unparent();
228+
self.action_bar_stack.unparent();
230229
if let Some(emoji_chooser) = self.emoji_chooser.take() {
231230
emoji_chooser.unparent();
232231
}

src/session/content/chat_history.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mod imp {
2020
use once_cell::unsync::OnceCell;
2121
use std::cell::{Cell, RefCell};
2222

23-
#[derive(Debug, CompositeTemplate)]
23+
#[derive(Debug, Default, CompositeTemplate)]
2424
#[template(resource = "/com/github/melix99/telegrand/ui/content-chat-history.ui")]
2525
pub(crate) struct ChatHistory {
2626
pub(super) compact: Cell<bool>,
@@ -38,22 +38,6 @@ mod imp {
3838
pub(super) chat_action_bar: TemplateChild<ChatActionBar>,
3939
}
4040

41-
impl Default for ChatHistory {
42-
fn default() -> Self {
43-
Self {
44-
compact: Default::default(),
45-
chat: Default::default(),
46-
message_menu: Default::default(),
47-
is_auto_scrolling: Default::default(),
48-
sticky: Cell::new(false),
49-
window_title: Default::default(),
50-
scrolled_window: Default::default(),
51-
list_view: Default::default(),
52-
chat_action_bar: Default::default(),
53-
}
54-
}
55-
}
56-
5741
#[glib::object_subclass]
5842
impl ObjectSubclass for ChatHistory {
5943
const NAME: &'static str = "ContentChatHistory";

src/session/content/message_row/video.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,9 @@ mod imp {
8080
impl ObjectImpl for MessageVideo {
8181
fn properties() -> &'static [glib::ParamSpec] {
8282
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
83-
vec![glib::ParamSpecObject::new(
84-
"message",
85-
"Message",
86-
"The message represented by this row",
87-
Message::static_type(),
88-
glib::ParamFlags::READWRITE | glib::ParamFlags::EXPLICIT_NOTIFY,
89-
)]
83+
vec![glib::ParamSpecObject::builder::<Message>("message")
84+
.explicit_notify()
85+
.build()]
9086
});
9187
PROPERTIES.as_ref()
9288
}

src/session/content/send_photo_dialog.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use tdlib::types::{InputFileLocal, InputMessagePhoto};
99
use crate::components::MessageEntry;
1010
use crate::expressions;
1111
use crate::tdlib::Chat;
12-
use crate::utils::spawn;
1312

1413
mod imp {
1514
use super::*;
@@ -40,13 +39,11 @@ mod imp {
4039
fn class_init(klass: &mut Self::Class) {
4140
klass.bind_template();
4241

43-
klass.install_action(
42+
klass.install_action_async(
4443
"send-photo-dialog.send-message",
4544
None,
46-
move |widget, _, _| {
47-
spawn(clone!(@weak widget => async move {
48-
widget.send_message().await;
49-
}));
45+
|widget, _, _| async move {
46+
widget.send_message().await;
5047
},
5148
);
5249
}

src/session/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ mod imp {
7676
.leaflet
7777
.navigate(adw::NavigationDirection::Back);
7878
});
79-
klass.install_action("session.log-out", None, move |widget, _, _| {
80-
spawn(clone!(@weak widget => async move {
81-
log_out(widget.client_id()).await;
82-
}));
79+
klass.install_action_async("session.log-out", None, |widget, _, _| async move {
80+
log_out(widget.client_id()).await;
8381
});
8482
klass.install_action("session.show-preferences", None, move |widget, _, _| {
8583
let parent_window = widget.root().and_then(|r| r.downcast().ok());

0 commit comments

Comments
 (0)