aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_content_view
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-05-14 14:45:59 +0200
committerfiaxh <git@lightrise.org>2022-07-27 20:34:20 +0200
commitf44cbe02c17df1f02ad49c63cd784fec0ea02d85 (patch)
tree4cab9b5f84d88769d19b0698e24b318f50b6144e /main/src/ui/conversation_content_view
parent2b3ce5fc95c63ed7d54e207db0585c8b8bbcd603 (diff)
downloaddino-f44cbe02c17df1f02ad49c63cd784fec0ea02d85.tar.gz
dino-f44cbe02c17df1f02ad49c63cd784fec0ea02d85.zip
Improve Gtk4 port
Diffstat (limited to 'main/src/ui/conversation_content_view')
-rw-r--r--main/src/ui/conversation_content_view/call_widget.vala16
-rw-r--r--main/src/ui/conversation_content_view/chat_state_populator.vala8
-rw-r--r--main/src/ui/conversation_content_view/conversation_item_skeleton.vala40
-rw-r--r--main/src/ui/conversation_content_view/conversation_view.vala9
-rw-r--r--main/src/ui/conversation_content_view/date_separator_populator.vala8
-rw-r--r--main/src/ui/conversation_content_view/file_default_widget.vala4
-rw-r--r--main/src/ui/conversation_content_view/file_image_widget.vala4
-rw-r--r--main/src/ui/conversation_content_view/file_widget.vala12
-rw-r--r--main/src/ui/conversation_content_view/message_item_widget.vala229
-rw-r--r--main/src/ui/conversation_content_view/message_widget.vala2
-rw-r--r--main/src/ui/conversation_content_view/subscription_notification.vala8
11 files changed, 59 insertions, 281 deletions
diff --git a/main/src/ui/conversation_content_view/call_widget.vala b/main/src/ui/conversation_content_view/call_widget.vala
index 645c31c1..df4b7386 100644
--- a/main/src/ui/conversation_content_view/call_widget.vala
+++ b/main/src/ui/conversation_content_view/call_widget.vala
@@ -20,7 +20,7 @@ namespace Dino.Ui {
public override Object? get_widget(Plugins.ConversationItemWidgetInterface outer, Plugins.WidgetType type) {
CallItem call_item = content_item as CallItem;
CallState? call_state = stream_interactor.get_module(Calls.IDENTITY).call_states[call_item.call];
- return new CallWidget(stream_interactor, call_item.call, call_state, call_item.conversation) { visible=true };
+ return new CallWidget(stream_interactor, call_item.call, call_state, call_item.conversation);
}
public override Gee.List<Plugins.MessageAction>? get_item_actions(Plugins.WidgetType type) { return null; }
@@ -94,17 +94,17 @@ namespace Dino.Ui {
}
foreach (Jid counterpart in call.counterparts) {
- AvatarImage image = new AvatarImage() { force_gray=true, margin_top=2, visible=true };
+ AvatarImage image = new AvatarImage() { force_gray=true, margin_top=2 };
image.set_conversation_participant(stream_interactor, conversation, counterpart.bare_jid);
multiparty_peer_box.append(image);
multiparty_peer_widgets.add(image);
}
- AvatarImage image2 = new AvatarImage() { force_gray=true, margin_top=2, visible=true };
+ AvatarImage image2 = new AvatarImage() { force_gray=true, margin_top=2 };
image2.set_conversation_participant(stream_interactor, conversation, call.account.bare_jid);
multiparty_peer_box.append(image2);
multiparty_peer_widgets.add(image2);
- outer_additional_box.get_style_context().add_class("multiparty-participants");
+ outer_additional_box.add_css_class("multiparty-participants");
multiparty_peer_box.visible = true;
incoming_call_box.visible = false;
@@ -113,8 +113,8 @@ namespace Dino.Ui {
private void update_call_state() {
incoming_call_revealer.reveal_child = false;
- incoming_call_revealer.get_style_context().remove_class("incoming");
- outer_additional_box.get_style_context().remove_class("incoming-call-box");
+ incoming_call_revealer.remove_css_class("incoming");
+ outer_additional_box.remove_css_class("incoming-call-box");
// It doesn't make sense to display MUC calls as missed or declined by the whole MUC. Just display as ended.
// TODO: maybe not let them be missed/declined in first place.
@@ -139,8 +139,8 @@ namespace Dino.Ui {
subtitle_label.label = "Ring ring…!";
incoming_call_box.visible = true;
incoming_call_revealer.reveal_child = true;
- incoming_call_revealer.get_style_context().add_class("incoming");
- outer_additional_box.get_style_context().add_class("incoming-call-box");
+ incoming_call_revealer.add_css_class("incoming");
+ outer_additional_box.add_css_class("incoming-call-box");
} else {
subtitle_label.label = "Dependencies for call support not met";
}
diff --git a/main/src/ui/conversation_content_view/chat_state_populator.vala b/main/src/ui/conversation_content_view/chat_state_populator.vala
index 0665caac..803739c8 100644
--- a/main/src/ui/conversation_content_view/chat_state_populator.vala
+++ b/main/src/ui/conversation_content_view/chat_state_populator.vala
@@ -77,11 +77,11 @@ private class MetaChatStateItem : Plugins.MetaConversationItem {
}
public override Object? get_widget(Plugins.ConversationItemWidgetInterface outer, Plugins.WidgetType widget_type) {
- label = new Label("") { xalign=0, vexpand=true, visible=true };
- label.get_style_context().add_class("dim-label");
- image = new AvatarImage() { margin_top=2, valign=Align.START, visible=true };
+ label = new Label("") { xalign=0, vexpand=true };
+ label.add_css_class("dim-label");
+ image = new AvatarImage() { margin_top=2, valign=Align.START };
- Box image_content_box = new Box(Orientation.HORIZONTAL, 8) { visible=true };
+ Box image_content_box = new Box(Orientation.HORIZONTAL, 8);
image_content_box.append(image);
image_content_box.append(label);
diff --git a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
index 3e4ce88b..ae2d835f 100644
--- a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
+++ b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
@@ -18,7 +18,12 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
public Widget? content_widget = null;
- public bool show_skeleton { get; set; default=false; }
+ private bool show_skeleton_ = false;
+ public bool show_skeleton {
+ get { return show_skeleton_; }
+ set {
+ show_skeleton_ = value && content_meta_item != null && content_meta_item.requires_header && content_meta_item.requires_avatar; }
+ }
public bool last_group_item { get; set; default=true; }
public StreamInteractor stream_interactor;
@@ -26,7 +31,7 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
public Plugins.MetaConversationItem item;
public bool item_in_edit_mode { get; set; }
public Entities.Message.Marked item_mark { get; set; }
- public ContentMetaItem? content_meta_item = null;
+ public ContentMetaItem content_meta_item = null;
public Widget? widget = null;
private uint time_update_timeout = 0;
@@ -40,7 +45,7 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
Builder builder = new Builder.from_resource("/im/dino/Dino/conversation_item_widget.ui");
main_grid = (Grid) builder.get_object("main_grid");
- main_grid.get_style_context().add_class("message-box");
+ main_grid.add_css_class("message-box");
name_label = (Label) builder.get_object("name_label");
time_label = (Label) builder.get_object("time_label");
avatar_image = (AvatarImage) builder.get_object("avatar_image");
@@ -65,7 +70,7 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
}
private void set_header() {
- if (!show_skeleton || !item.requires_header) return;
+ if (!show_skeleton) return;
update_name_label();
// name_label.style_updated.connect(update_name_label);
@@ -102,34 +107,32 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
encryption_image.visible = show_skeleton;
received_image.visible = show_skeleton;
- if (show_skeleton) {
- main_grid.get_style_context().add_class("has-skeleton");
+ if (show_skeleton || content_meta_item == null) {
+ main_grid.add_css_class("has-skeleton");
}
if (last_group_item) {
- main_grid.get_style_context().add_class("last-group-item");
+ main_grid.add_css_class("last-group-item");
}
}
private void update_edit_mode() {
if (item.in_edit_mode) {
- main_grid.get_style_context().add_class("edit-mode");
+ main_grid.add_css_class("edit-mode");
} else {
- main_grid.get_style_context().remove_class("edit-mode");
+ main_grid.remove_css_class("edit-mode");
}
}
private void update_error_mode() {
if (item_mark == Message.Marked.ERROR) {
- main_grid.get_style_context().add_class("error");
+ main_grid.add_css_class("error");
} else {
- main_grid.get_style_context().remove_class("error");
+ main_grid.remove_css_class("error");
}
}
private void update_encryption_icon() {
- encryption_image.visible = true;
-
Application app = GLib.Application.get_default() as Application;
ContentMetaItem ci = item as ContentMetaItem;
@@ -141,7 +144,8 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
break;
}
}
- encryption_image.icon_name = icon_name ?? "dino-changes-prevent-symbolic";
+ encryption_image.icon_name = icon_name ?? "changes-prevent-symbolic";
+ encryption_image.visible = true;
}
if (item.encryption == Encryption.NONE) {
@@ -149,6 +153,7 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
encryption_image.icon_name = "dino-changes-allowed-symbolic";
encryption_image.tooltip_text = _("Unencrypted");
Util.force_error_color(encryption_image);
+ encryption_image.visible = true;
} else if (conversation.encryption == Encryption.NONE) {
encryption_image.icon_name = null;
encryption_image.visible = false;
@@ -176,8 +181,11 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
case Message.Marked.READ: received_image.icon_name = "dino-double-tick-symbolic"; break;
case Message.Marked.WONTSEND:
received_image.icon_name = "dialog-warning-symbolic";
- received_image.icon_name = _("Unable to send message");
- // TODO error color on marked icon and time
+ Util.force_error_color(received_image);
+ Util.force_error_color(time_label);
+ string error_text = _("Unable to send message");
+ received_image.tooltip_text = error_text;
+ time_label.tooltip_text = error_text;
break;
default: received_image.icon_name = null; break;
}
diff --git a/main/src/ui/conversation_content_view/conversation_view.vala b/main/src/ui/conversation_content_view/conversation_view.vala
index 8d46281f..bfee3cbb 100644
--- a/main/src/ui/conversation_content_view/conversation_view.vala
+++ b/main/src/ui/conversation_content_view/conversation_view.vala
@@ -108,7 +108,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug
private void on_leave_notify_event() {
if (currently_highlighted != null) {
- currently_highlighted.get_style_context().remove_class("highlight");
+ currently_highlighted.remove_css_class("highlight");
currently_highlighted = null;
}
message_menu_box.visible = false;
@@ -134,7 +134,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug
}
};
- if (currently_highlighted != null) currently_highlighted.get_style_context().remove_class("highlight");
+ if (currently_highlighted != null) currently_highlighted.remove_css_class("highlight");
currently_highlighted = null;
current_meta_item = null;
@@ -160,7 +160,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug
if (current_meta_item != null) {
// Highlight widget
currently_highlighted = w;
- currently_highlighted.get_style_context().add_class("highlight");
+ currently_highlighted.add_css_class("highlight");
// Move message menu
message_menu_box.margin_top = (int)(widget_y - 10);
@@ -233,7 +233,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug
i++;
}
scrolled.vadjustment.value = h - scrolled.vadjustment.page_size * 1/3;
- w.get_style_context().add_class("highlight-once");
+ w.add_css_class("highlight-once");
reload_messages = true;
stack.set_visible_child_name("main");
return false;
@@ -414,6 +414,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug
});
}
} else if (scrolled.vadjustment.value < scrolled.vadjustment.upper - scrolled.vadjustment.page_size - 1) {
+ print("move!\n");
scrolled.vadjustment.value = scrolled.vadjustment.upper - was_upper + scrolled.vadjustment.value; // stay at same content
}
was_upper = scrolled.vadjustment.upper;
diff --git a/main/src/ui/conversation_content_view/date_separator_populator.vala b/main/src/ui/conversation_content_view/date_separator_populator.vala
index 40bf0693..25ef7a51 100644
--- a/main/src/ui/conversation_content_view/date_separator_populator.vala
+++ b/main/src/ui/conversation_content_view/date_separator_populator.vala
@@ -83,12 +83,12 @@ public class DateSeparatorWidget : Box {
visible = true;
this.date = date;
- label = new Label("") { use_markup=true, halign=Align.CENTER, hexpand=false, visible=true };
- label.get_style_context().add_class("dim-label");
+ label = new Label("") { use_markup=true, halign=Align.CENTER, hexpand=false };
+ label.add_css_class("dim-label");
- this.append(new Separator(Orientation.HORIZONTAL) { valign=Align.CENTER, hexpand=true, visible=true });
+ this.append(new Separator(Orientation.HORIZONTAL) { valign=Align.CENTER, hexpand=true });
this.append(label);
- this.append(new Separator(Orientation.HORIZONTAL) { valign=Align.CENTER, hexpand=true, visible=true });
+ this.append(new Separator(Orientation.HORIZONTAL) { valign=Align.CENTER, hexpand=true });
update_time();
}
diff --git a/main/src/ui/conversation_content_view/file_default_widget.vala b/main/src/ui/conversation_content_view/file_default_widget.vala
index 3bd5842f..9efc130f 100644
--- a/main/src/ui/conversation_content_view/file_default_widget.vala
+++ b/main/src/ui/conversation_content_view/file_default_widget.vala
@@ -9,6 +9,7 @@ namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/Dino/file_default_widget.ui")]
public class FileDefaultWidget : Box {
+ public signal void clicked();
public signal void open_file();
public signal void save_file_as();
public signal void cancel_download();
@@ -35,6 +36,7 @@ public class FileDefaultWidget : Box {
this_motion_events.leave.connect(on_pointer_left_event);
GestureClick gesture_click_controller = new GestureClick();
+ gesture_click_controller.set_button(1); // listen for left clicks
this.add_controller(gesture_click_controller);
gesture_click_controller.pressed.connect((n_press, x, y) => {
// Check whether the click was inside the file menu. Otherwise, open the file.
@@ -42,7 +44,7 @@ public class FileDefaultWidget : Box {
this.translate_coordinates(file_menu, x, y, out x_button, out y_button);
if (file_menu.contains(x_button, y_button)) return;
- this.open_file();
+ this.clicked();
});
}
diff --git a/main/src/ui/conversation_content_view/file_image_widget.vala b/main/src/ui/conversation_content_view/file_image_widget.vala
index aad220e8..285e397e 100644
--- a/main/src/ui/conversation_content_view/file_image_widget.vala
+++ b/main/src/ui/conversation_content_view/file_image_widget.vala
@@ -15,7 +15,7 @@ public class FileImageWidget : Box {
public FileImageWidget() {
this.halign = Align.START;
- this.get_style_context().add_class("file-image-widget");
+ this.add_css_class("file-image-widget");
}
public async void load_from_file(File file, string file_name, int MAX_WIDTH=600, int MAX_HEIGHT=300) throws GLib.Error {
@@ -52,7 +52,7 @@ public class FileImageWidget : Box {
file_default_widget_controller = new FileDefaultWidgetController(file_default_widget);
file_default_widget_controller.set_file(file, file_name, mime_type);
- Overlay overlay = new Overlay() { visible=true };
+ Overlay overlay = new Overlay();
overlay.set_child(image);
overlay.add_overlay(file_default_widget);
overlay.set_measure_overlay(image, true);
diff --git a/main/src/ui/conversation_content_view/file_widget.vala b/main/src/ui/conversation_content_view/file_widget.vala
index 6378c298..8dbc3dc8 100644
--- a/main/src/ui/conversation_content_view/file_widget.vala
+++ b/main/src/ui/conversation_content_view/file_widget.vala
@@ -19,7 +19,7 @@ public class FileMetaItem : ConversationSummary.ContentMetaItem {
public override Object? get_widget(Plugins.ConversationItemWidgetInterface outer, Plugins.WidgetType type) {
FileItem file_item = content_item as FileItem;
FileTransfer transfer = file_item.file_transfer;
- return new FileWidget(stream_interactor, transfer) { visible=true };
+ return new FileWidget(stream_interactor, transfer);
}
public override Gee.List<Plugins.MessageAction>? get_item_actions(Plugins.WidgetType type) { return null; }
@@ -70,7 +70,7 @@ public class FileWidget : SizeRequestBox {
FileImageWidget file_image_widget = null;
try {
- file_image_widget = new FileImageWidget() { visible=true };
+ file_image_widget = new FileImageWidget();
yield file_image_widget.load_from_file(file_transfer.get_file(), file_transfer.file_name);
// If the widget changed in the meanwhile, stop
@@ -86,7 +86,7 @@ public class FileWidget : SizeRequestBox {
if (state != State.DEFAULT) {
if (content != null) this.remove(content);
- FileDefaultWidget default_file_widget = new FileDefaultWidget() { visible=true };
+ FileDefaultWidget default_file_widget = new FileDefaultWidget();
default_widget_controller = new FileDefaultWidgetController(default_file_widget);
default_widget_controller.set_file_transfer(file_transfer, stream_interactor);
content = default_file_widget;
@@ -129,14 +129,10 @@ public class FileDefaultWidgetController : Object {
public FileDefaultWidgetController(FileDefaultWidget widget) {
this.widget = widget;
+ widget.clicked.connect(on_clicked);
widget.open_file.connect(open_file);
widget.save_file_as.connect(save_file);
widget.cancel_download.connect(cancel_download);
-
- var gesture_controller = new GestureClick();
- gesture_controller.set_button(1); // listen for left clicks
- gesture_controller.released.connect(on_clicked);
- widget.add_controller(gesture_controller);
}
public void set_file_transfer(FileTransfer file_transfer, StreamInteractor stream_interactor) {
diff --git a/main/src/ui/conversation_content_view/message_item_widget.vala b/main/src/ui/conversation_content_view/message_item_widget.vala
deleted file mode 100644
index 23a499d9..00000000
--- a/main/src/ui/conversation_content_view/message_item_widget.vala
+++ /dev/null
@@ -1,229 +0,0 @@
-using Dino.Entities;
-using Gtk;
-
-namespace Dino.Ui {
- public class MessageItemWidget : SizeRequestBin {
-
- public signal void edit_cancelled();
- public signal void edit_sent(string text);
-
- enum AdditionalInfo {
- NONE,
- PENDING,
- DELIVERY_FAILED
- }
-
- StreamInteractor stream_interactor;
- public ContentItem content_item;
- public Message.Marked marked { get; set; }
-
- Label label = new Label("") { use_markup=true, xalign=0, selectable=true, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, vexpand=true, visible=true };
- MessageItemEditMode? edit_mode = null;
- ChatTextViewController? controller = null;
- AdditionalInfo additional_info = AdditionalInfo.NONE;
-
- ulong realize_id = -1;
- ulong style_updated_id = -1;
- ulong marked_notify_handler_id = -1;
-
- construct {
- this.append(label);
- label.activate_link.connect(on_label_activate_link);
- this.size_request_mode = SizeRequestMode.HEIGHT_FOR_WIDTH;
- }
-
- public MessageItemWidget(StreamInteractor stream_interactor, ContentItem content_item) {
- this.stream_interactor = stream_interactor;
- this.content_item = content_item;
-
- Message message = ((MessageItem) content_item).message;
- if (message.direction == Message.DIRECTION_SENT && !(message.marked in Message.MARKED_RECEIVED)) {
- var binding = message.bind_property("marked", this, "marked");
- marked_notify_handler_id = this.notify["marked"].connect(() => {
- // Currently "pending", but not anymore
- if (additional_info == AdditionalInfo.PENDING &&
- message.marked != Message.Marked.SENDING && message.marked != Message.Marked.UNSENT) {
- update_label();
- }
-
- // Currently "error", but not anymore
- if (additional_info == AdditionalInfo.DELIVERY_FAILED && message.marked != Message.Marked.ERROR) {
- update_label();
- }
-
- // Currently not error, but should be
- if (additional_info != AdditionalInfo.DELIVERY_FAILED && message.marked == Message.Marked.ERROR) {
- update_label();
- }
-
- // Nothing bad can happen anymore
- if (message.marked in Message.MARKED_RECEIVED) {
- binding.unbind();
- this.disconnect(marked_notify_handler_id);
- }
- });
- }
-
- update_label();
- }
-
- public void set_edit_mode() {
-
- MessageItem message_item = content_item as MessageItem;
- Message message = message_item.message;
-
- if (edit_mode == null) {
- edit_mode = new MessageItemEditMode();
- controller = new ChatTextViewController(edit_mode.chat_text_view, stream_interactor);
- Conversation conversation = message_item.conversation;
- controller.initialize_for_conversation(conversation);
-
- edit_mode.cancelled.connect(() => {
- edit_cancelled();
- unset_edit_mode();
- });
- edit_mode.send.connect(() => {
- if (((MessageItem) content_item).message.body != edit_mode.chat_text_view.text_view.buffer.text) {
- edit_sent(edit_mode.chat_text_view.text_view.buffer.text);
- } else {
- edit_cancelled();
- }
- unset_edit_mode();
- });
- }
-
- edit_mode.chat_text_view.text_view.buffer.text = message.body;
-
- this.remove(label);
- this.append(edit_mode);
-
- edit_mode.chat_text_view.text_view.grab_focus();
- }
-
- public void unset_edit_mode() {
- this.remove(edit_mode);
- this.append(label);
- label.grab_focus();
- label.selectable = false;
- label.selectable = true;
- }
-
- public void update_label() {
- label.label = generate_markup_text(content_item);
- }
-
- private string generate_markup_text(ContentItem item) {
- MessageItem message_item = item as MessageItem;
- Conversation conversation = message_item.conversation;
- Message message = message_item.message;
-
- bool theme_dependent = false;
-
- string markup_text = message.body;
- if (markup_text.length > 10000) {
- markup_text = markup_text.substring(0, 10000) + " [" + _("Message too long") + "]";
- }
- if (message.body.has_prefix("/me ")) {
- markup_text = markup_text.substring(4);
- }
-
- if (conversation.type_ == Conversation.Type.GROUPCHAT) {
- markup_text = Util.parse_add_markup_theme(markup_text, conversation.nickname, true, true, true, Util.is_dark_theme(this), ref theme_dependent);
- } else {
- markup_text = Util.parse_add_markup_theme(markup_text, null, true, true, true, Util.is_dark_theme(this), ref theme_dependent);
- }
-
- if (message.body.has_prefix("/me ")) {
- string display_name = Util.get_participant_display_name(stream_interactor, conversation, message.from);
- markup_text = @"<i><b>$(Markup.escape_text(display_name))</b> " + markup_text + "</i>";
- }
-
- int only_emoji_count = Util.get_only_emoji_count(markup_text);
- if (only_emoji_count != -1) {
- string size_str = only_emoji_count < 5 ? "xx-large" : "large";
- markup_text = @"<span size=\'$size_str\'>" + markup_text + "</span>";
- }
-
- string dim_color = Util.is_dark_theme(this) ? "#BDBDBD" : "#707070";
-
- if (message.edit_to != null) {
- markup_text += @" <span size='small' color='$dim_color'>(%s)</span>".printf(_("edited"));
- theme_dependent = true;
- }
-
- // Append message status info
- additional_info = AdditionalInfo.NONE;
- if (message.direction == Message.DIRECTION_SENT && (message.marked == Message.Marked.SENDING || message.marked == Message.Marked.UNSENT)) {
- // Append "pending..." iff message has not been sent yet
- if (message.time.compare(new DateTime.now_utc().add_seconds(-10)) < 0) {
- markup_text += @" <span size='small' color='$dim_color'>%s</span>".printf(_("pending…"));
- theme_dependent = true;
- additional_info = AdditionalInfo.PENDING;
- } else {
- int time_diff = (- (int) message.time.difference(new DateTime.now_utc()) / 1000);
- Timeout.add(10000 - time_diff, () => {
- update_label();
- return false;
- });
- }
- } else if (message.direction == Message.DIRECTION_SENT && message.marked == Message.Marked.ERROR) {
- // Append "delivery failed" if there was a server error
- string error_color = Util.rgba_to_hex(Util.get_label_pango_color(label, "@error_color"));
- markup_text += " <span size='small' color='%s'>%s</span>".printf(error_color, _("delivery failed"));
- theme_dependent = true;
- additional_info = AdditionalInfo.DELIVERY_FAILED;
- }
-
- if (theme_dependent && realize_id == -1) {
- realize_id = label.realize.connect(update_label);
- // style_updated_id = label.style_updated.connect(update_label);
- } else if (!theme_dependent && realize_id != -1) {
- label.disconnect(realize_id);
- label.disconnect(style_updated_id);
- }
- return markup_text;
- }
-
- public static bool on_label_activate_link(string uri) {
- // Always handle xmpp URIs with Dino
- if (!uri.has_prefix("xmpp:")) return false;
- File file = File.new_for_uri(uri);
- Dino.Application.get_default().open(new File[]{file}, "");
- return true;
- }
- }
-
- [GtkTemplate (ui = "/im/dino/Dino/message_item_widget_edit_mode.ui")]
- public class MessageItemEditMode : Box {
-
- public signal void cancelled();
- public signal void send();
-
- [GtkChild] public unowned MenuButton emoji_button;
- [GtkChild] public unowned ChatTextView chat_text_view;
- [GtkChild] public unowned Button cancel_button;
- [GtkChild] public unowned Button send_button;
- [GtkChild] public unowned Frame frame;
-
- construct {
- Util.force_css(frame, "* { border-radius: 3px; }");
-
- EmojiChooser chooser = new EmojiChooser();
- chooser.emoji_picked.connect((emoji) => {
- chat_text_view.text_view.buffer.insert_at_cursor(emoji, emoji.data.length);
- });
- emoji_button.set_popover(chooser);
-
- chat_text_view.text_view.buffer.changed.connect_after(on_text_view_changed);
-
- cancel_button.clicked.connect(() => cancelled());
- send_button.clicked.connect(() => send());
- chat_text_view.cancel_input.connect(() => cancelled());
- chat_text_view.send_text.connect(() => send());
- }
-
- private void on_text_view_changed() {
- send_button.sensitive = chat_text_view.text_view.buffer.text != "";
- }
- }
-} \ No newline at end of file
diff --git a/main/src/ui/conversation_content_view/message_widget.vala b/main/src/ui/conversation_content_view/message_widget.vala
index 3ebce0ee..346a6f71 100644
--- a/main/src/ui/conversation_content_view/message_widget.vala
+++ b/main/src/ui/conversation_content_view/message_widget.vala
@@ -28,7 +28,7 @@ public class MessageMetaItem : ContentMetaItem {
ulong style_updated_id = -1;
ulong marked_notify_handler_id = -1;
- public Label label = new Label("") { use_markup=true, xalign=0, selectable=true, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, hexpand=true, vexpand=true, can_focus=false };
+ public Label label = new Label("") { use_markup=true, xalign=0, selectable=true, wrap=true, wrap_mode=Pango.WrapMode.WORD_CHAR, hexpand=true, vexpand=true };
public MessageMetaItem(ContentItem content_item, StreamInteractor stream_interactor) {
base(content_item);
diff --git a/main/src/ui/conversation_content_view/subscription_notification.vala b/main/src/ui/conversation_content_view/subscription_notification.vala
index 1f0f39d8..b825f4ad 100644
--- a/main/src/ui/conversation_content_view/subscription_notification.vala
+++ b/main/src/ui/conversation_content_view/subscription_notification.vala
@@ -33,9 +33,9 @@ public class SubscriptionNotitication : Object {
}
private void show_notification() {
- Box box = new Box(Orientation.HORIZONTAL, 5) { visible=true };
- Button accept_button = new Button.with_label(_("Accept")) { visible=true };
- Button deny_button = new Button.with_label(_("Deny")) { visible=true };
+ Box box = new Box(Orientation.HORIZONTAL, 5);
+ Button accept_button = new Button.with_label(_("Accept"));
+ Button deny_button = new Button.with_label(_("Deny"));
GLib.Application app = GLib.Application.get_default();
accept_button.clicked.connect(() => {
app.activate_action("accept-subscription", conversation.id);
@@ -45,7 +45,7 @@ public class SubscriptionNotitication : Object {
app.activate_action("deny-subscription", conversation.id);
conversation_view.remove_notification(box);
});
- box.append(new Label(_("This contact would like to add you to their contact list")) { margin_end=10, visible=true });
+ box.append(new Label(_("This contact would like to add you to their contact list")) { margin_end=10 });
box.append(accept_button);
box.append(deny_button);
conversation_view.add_notification(box);