Compare commits
6 Commits
master
...
desktop-fo
Author | SHA1 | Date |
---|---|---|
Xavier Del Campo | f2930849c0 | |
MarcoPolo-PasTonMolo | 9db3d08b51 | |
MarcoPolo-PasTonMolo | f9d769883c | |
Xavier Del Campo Romero | aa57100aad | |
Xavier Del Campo Romero | e5bf35c35d | |
Xavier Del Campo Romero | fe235628ae |
|
@ -58,6 +58,21 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="vexpand">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="button2_icon">
|
||||
<property name="icon-name">go-previous-symbolic-rtl</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="DinoUiManageAccountsDialog">
|
||||
<property name="width-request">700</property>
|
||||
<property name="height-request">400</property>
|
||||
<property name="modal">True</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
|
@ -25,14 +23,13 @@
|
|||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="expand">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">15</property>
|
||||
<property name="spacing">20</property>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="width-request">250</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="hexpand">False</property>
|
||||
<property name="visible">True</property>
|
||||
|
@ -41,6 +38,7 @@
|
|||
<property name="shadow-type">in</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="height-request">75</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
|
@ -184,7 +182,6 @@
|
|||
<child>
|
||||
<object class="DinoUiUtilEntryLabelHybrid" id="password_hybrid">
|
||||
<property name="xalign">0</property>
|
||||
<property name="width_request">200</property>
|
||||
<property name="visibility">False</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
|
@ -214,7 +211,6 @@
|
|||
<child>
|
||||
<object class="DinoUiUtilEntryLabelHybrid" id="alias_hybrid">
|
||||
<property name="xalign">0</property>
|
||||
<property name="width_request">200</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
|
@ -218,8 +218,6 @@ emoji_activated (GtkFlowBox *box,
|
|||
GVariant *item;
|
||||
gunichar modifier;
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (chooser));
|
||||
|
||||
ebox = gtk_bin_get_child (GTK_BIN (child));
|
||||
label = gtk_bin_get_child (GTK_BIN (ebox));
|
||||
text = g_strdup (gtk_label_get_label (GTK_LABEL (label)));
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace Dino.Ui.ConversationSummary {
|
|||
[GtkTemplate (ui = "/im/dino/Dino/conversation_content_view/view.ui")]
|
||||
public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins.NotificationCollection {
|
||||
|
||||
public signal void on_quote_text(string nick, string text);
|
||||
public Conversation? conversation { get; private set; }
|
||||
|
||||
[GtkChild] public unowned ScrolledWindow scrolled;
|
||||
|
@ -17,6 +18,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
|||
[GtkChild] private unowned Box message_menu_box;
|
||||
[GtkChild] private unowned Button button1;
|
||||
[GtkChild] private unowned Image button1_icon;
|
||||
[GtkChild] private unowned Button button2;
|
||||
[GtkChild] private unowned Image button2_icon;
|
||||
[GtkChild] private unowned Box notifications;
|
||||
[GtkChild] private unowned Box main;
|
||||
[GtkChild] private unowned EventBox main_event_box;
|
||||
|
@ -73,14 +76,20 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
|||
// the pointer motion events as long as the pointer is above the message menu.
|
||||
// This ensures that the currently highlighted item remains unchanged when the pointer
|
||||
// reaches the overlapping part of a button.
|
||||
main_wrap_event_box.events = EventMask.TOUCH_MASK;
|
||||
main_wrap_event_box.touch_event.connect(on_touch_event);
|
||||
main_event_box.events = EventMask.POINTER_MOTION_MASK;
|
||||
main_event_box.motion_notify_event.connect(on_motion_notify_event);
|
||||
|
||||
button1.clicked.connect(() => {
|
||||
current_meta_item.get_item_actions(Plugins.WidgetType.GTK)[0].callback(button1, current_meta_item, currently_highlighted.widget);
|
||||
current_meta_item.get_item_actions(Plugins.WidgetType.GTK)[1].callback(button1, current_meta_item, currently_highlighted.widget);
|
||||
update_message_menu();
|
||||
});
|
||||
|
||||
button2.clicked.connect(() => {
|
||||
current_meta_item.get_item_actions(Plugins.WidgetType.GTK)[0].callback(button2, current_meta_item, currently_highlighted.widget);
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -102,6 +111,11 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
|||
}
|
||||
}
|
||||
|
||||
private bool on_touch_event(Gdk.Event event) {
|
||||
update_highlight((int)event.touch.x_root, (int)event.touch.y_root);
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool on_enter_notify_event(Gdk.EventCrossing event) {
|
||||
update_highlight((int)event.x_root, (int)event.y_root);
|
||||
return false;
|
||||
|
@ -186,9 +200,14 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
|||
|
||||
var actions = current_meta_item.get_item_actions(Plugins.WidgetType.GTK);
|
||||
message_menu_box.visible = actions != null && actions.size > 0;
|
||||
|
||||
if (actions != null && actions.size == 1) {
|
||||
button1.visible = false;
|
||||
}
|
||||
|
||||
if (actions != null && actions.size == 2) {
|
||||
button1.visible = true;
|
||||
button1_icon.set_from_icon_name(actions[0].icon_name, IconSize.SMALL_TOOLBAR);
|
||||
button1_icon.set_from_icon_name(actions[1].icon_name, IconSize.SMALL_TOOLBAR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -308,6 +327,9 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
|||
insert_new(item);
|
||||
if (item as ContentMetaItem != null) {
|
||||
content_items.add(item);
|
||||
|
||||
MessageMetaItem current_item = item as MessageMetaItem;
|
||||
current_item.on_quote_text.connect((t, nick, text) => on_quote_text(nick, text));
|
||||
}
|
||||
meta_items.add(item);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace Dino.Ui.ConversationSummary {
|
|||
|
||||
public class MessageMetaItem : ContentMetaItem {
|
||||
|
||||
public signal void on_quote_text(string nick, string text);
|
||||
private StreamInteractor stream_interactor;
|
||||
private MessageItemWidget message_item_widget;
|
||||
private MessageItem message_item;
|
||||
|
@ -46,6 +47,16 @@ public class MessageMetaItem : ContentMetaItem {
|
|||
|
||||
bool allowed = stream_interactor.get_module(MessageCorrection.IDENTITY).is_own_correction_allowed(message_item.conversation, message_item.message);
|
||||
Gee.List<Plugins.MessageAction> actions = new ArrayList<Plugins.MessageAction>();
|
||||
|
||||
Plugins.MessageAction action2 = new Plugins.MessageAction();
|
||||
action2.icon_name = "go-previous-symbolic-rtl";
|
||||
action2.callback = (button, content_meta_item_activated, widget) => {
|
||||
string nick = Util.get_participant_display_name(stream_interactor, message_item.conversation, message_item.message.from);
|
||||
string text_to_quote = ((MessageItem) message_item_widget.content_item).message.body;
|
||||
on_quote_text(nick, text_to_quote);
|
||||
};
|
||||
actions.add(action2);
|
||||
|
||||
if (allowed && !in_edit_mode) {
|
||||
Plugins.MessageAction action1 = new Plugins.MessageAction();
|
||||
action1.icon_name = "document-edit-symbolic";
|
||||
|
@ -54,6 +65,7 @@ public class MessageMetaItem : ContentMetaItem {
|
|||
};
|
||||
actions.add(action1);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,33 @@ public class ConversationView : Gtk.Overlay {
|
|||
|
||||
construct {
|
||||
white_revealer.notify["child-revealed"].connect_after(on_child_revealed_changed);
|
||||
conversation_frame.on_quote_text.connect((t, nick, text) => on_quote_text(nick, text));
|
||||
}
|
||||
|
||||
public void on_quote_text(string nick, string text) {
|
||||
unowned TextBuffer buffer = chat_input.chat_text_view.text_view.buffer;
|
||||
string text_to_quote = text;
|
||||
|
||||
Regex quotes = new Regex("((?<=\n)>.*(\n|$))|(^>.*(\n|$))");
|
||||
Regex whitespace = new Regex("(\n *){2,}");
|
||||
Regex first_column = new Regex("(^|\n)(.+)");
|
||||
Regex end = new Regex("\n*$");
|
||||
|
||||
text_to_quote = quotes.replace(text_to_quote, -1, 0, "");
|
||||
text_to_quote = whitespace.replace(text_to_quote, -1, 0, "\n");
|
||||
text_to_quote = "%s".printf(text_to_quote);
|
||||
|
||||
text_to_quote = first_column.replace(text_to_quote, -1, 0, "\\1> \\2");
|
||||
|
||||
string to_replace = "\n";
|
||||
if(buffer.cursor_position > 0) {
|
||||
to_replace = "";
|
||||
text_to_quote = "\n" + text_to_quote;
|
||||
}
|
||||
|
||||
text_to_quote = end.replace(text_to_quote, -1, 0, to_replace);
|
||||
|
||||
buffer.insert_at_cursor(text_to_quote, -1);
|
||||
}
|
||||
|
||||
public void add_overlay_dialog(Widget widget) {
|
||||
|
|
Loading…
Reference in New Issue