Compare commits
2 Commits
master
...
send-butto
Author | SHA1 | Date |
---|---|---|
Xavier Del Campo Romero | 1296084aee | |
Xavier Del Campo Romero | 59bed3f3c7 |
|
@ -23,7 +23,7 @@
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="margin-top">3</property>
|
<property name="margin-top">3</property>
|
||||||
<property name="relief">none</property>
|
<property name="relief">none</property>
|
||||||
<property name="valign">start</property>
|
<property name="valign">center</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="flat"/>
|
<class name="flat"/>
|
||||||
|
|
|
@ -76,12 +76,7 @@ public class ChatTextView : ScrolledWindow {
|
||||||
|
|
||||||
private bool on_text_input_key_press(EventKey event) {
|
private bool on_text_input_key_press(EventKey event) {
|
||||||
if (event.keyval in new uint[]{Key.Return, Key.KP_Enter}) {
|
if (event.keyval in new uint[]{Key.Return, Key.KP_Enter}) {
|
||||||
if ((event.state & ModifierType.SHIFT_MASK) > 0) {
|
text_view.buffer.insert_at_cursor("\n", 1);
|
||||||
text_view.buffer.insert_at_cursor("\n", 1);
|
|
||||||
} else if (text_view.buffer.text.strip() != "") {
|
|
||||||
send_text();
|
|
||||||
edit_history.reset_history();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.keyval == Key.Escape) {
|
if (event.keyval == Key.Escape) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class View : Box {
|
||||||
public View init(StreamInteractor stream_interactor) {
|
public View init(StreamInteractor stream_interactor) {
|
||||||
this.stream_interactor = stream_interactor;
|
this.stream_interactor = stream_interactor;
|
||||||
|
|
||||||
encryption_widget = new EncryptionButton(stream_interactor) { relief=ReliefStyle.NONE, margin_top=3, valign=Align.START, visible=true };
|
encryption_widget = new EncryptionButton(stream_interactor) { relief=ReliefStyle.NONE, margin_top=3, valign=Align.CENTER, visible=true };
|
||||||
|
|
||||||
file_button.get_style_context().add_class("dino-attach-button");
|
file_button.get_style_context().add_class("dino-attach-button");
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class View : Box {
|
||||||
|
|
||||||
// Emoji button for emoji picker (recents don't work < 3.22.19, category icons don't work <3.23.2)
|
// Emoji button for emoji picker (recents don't work < 3.22.19, category icons don't work <3.23.2)
|
||||||
if (Gtk.get_major_version() >= 3 && Gtk.get_minor_version() >= 24) {
|
if (Gtk.get_major_version() >= 3 && Gtk.get_minor_version() >= 24) {
|
||||||
MenuButton emoji_button = new MenuButton() { relief=ReliefStyle.NONE, margin_top=3, valign=Align.START, visible=true };
|
MenuButton emoji_button = new MenuButton() { relief=ReliefStyle.NONE, margin_top=3, valign=Align.CENTER, visible=true };
|
||||||
emoji_button.get_style_context().add_class("flat");
|
emoji_button.get_style_context().add_class("flat");
|
||||||
emoji_button.get_style_context().add_class("dino-chatinput-button");
|
emoji_button.get_style_context().add_class("dino-chatinput-button");
|
||||||
emoji_button.image = new Image.from_icon_name("dino-emoticon-symbolic", IconSize.BUTTON) { visible=true };
|
emoji_button.image = new Image.from_icon_name("dino-emoticon-symbolic", IconSize.BUTTON) { visible=true };
|
||||||
|
@ -55,6 +55,40 @@ public class View : Box {
|
||||||
|
|
||||||
outer_box.add(encryption_widget);
|
outer_box.add(encryption_widget);
|
||||||
|
|
||||||
|
{
|
||||||
|
MenuButton send_button = new MenuButton() {
|
||||||
|
tooltip_text="Send message",
|
||||||
|
relief=ReliefStyle.NONE,
|
||||||
|
margin_top=3,
|
||||||
|
valign=Align.CENTER,
|
||||||
|
visible=true,
|
||||||
|
sensitive=false
|
||||||
|
};
|
||||||
|
|
||||||
|
send_button.get_style_context().add_class("flat");
|
||||||
|
send_button.get_style_context().add_class("dino-chatinput-button");
|
||||||
|
send_button.image = new Image.from_icon_name("document-send", IconSize.BUTTON) {
|
||||||
|
visible=true,
|
||||||
|
icon_size=3
|
||||||
|
};
|
||||||
|
|
||||||
|
chat_text_view.text_view.buffer.changed.connect(() => {
|
||||||
|
if (chat_text_view.text_view.buffer.text != "") {
|
||||||
|
send_button.sensitive = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
send_button.sensitive = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
send_button.button_release_event.connect(() => {
|
||||||
|
chat_text_view.send_text();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
outer_box.add(send_button);
|
||||||
|
}
|
||||||
|
|
||||||
Util.force_css(frame, "* { border-radius: 3px; }");
|
Util.force_css(frame, "* { border-radius: 3px; }");
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in New Issue