Merge branch 'origin/master' into master-windows-changes

This commit is contained in:
Maxim Logaev 2024-03-05 15:07:52 +03:00
commit f9fd66dba5
22 changed files with 192 additions and 67 deletions

2
configure vendored
View file

@ -106,7 +106,7 @@ while true; do
--enable-plugin ) if [ -z "$ENABLED_PLUGINS" ]; then ENABLED_PLUGINS="$2"; else ENABLED_PLUGINS="$ENABLED_PLUGINS;$2"; fi; shift; shift ;;
--disable-plugin ) if [ -z "$DISABLED_PLUGINS" ]; then DISABLED_PLUGINS="$2"; else DISABLED_PLUGINS="$DISABLED_PLUGINS;$2"; fi; shift; shift ;;
--valac ) VALA_EXECUTABLE="$2"; shift; shift ;;
--valac-flags ) VALAC_FLAGS="$2"; shift; shift ;;
--valac-flags ) VALACFLAGS="$2"; shift; shift ;;
--lib-suffix ) LIB_SUFFIX="$2"; shift; shift ;;
--with-libsoup3 ) USE_SOUP3=yes; shift ;;
--disable-fast-vapi ) DISABLE_FAST_VAPI=yes; shift ;;

View file

@ -39,6 +39,9 @@ set(RESOURCE_LIST
icons/scalable/mimetypes/dino-file-table-symbolic.svg
icons/scalable/mimetypes/dino-file-video-symbolic.svg
icons/scalable/status/dino-bell-large-none-symbolic.svg
icons/scalable/status/dino-bell-large-symbolic.svg
icons/scalable/status/dino-block-symbolic.svg
icons/scalable/status/dino-double-tick-symbolic.svg
icons/scalable/status/dino-party-popper-symbolic.svg
icons/scalable/status/dino-security-high-symbolic.svg
@ -189,6 +192,7 @@ SOURCES
src/ui/conversation_content_view/quote_widget.vala
src/ui/conversation_content_view/reactions_widget.vala
src/ui/conversation_content_view/subscription_notification.vala
src/ui/conversation_content_view/unread_indicator_populator.vala
src/ui/chat_input/chat_input_controller.vala
src/ui/chat_input/chat_text_view.vala

View file

@ -2,68 +2,72 @@
<interface>
<requires lib="gtk" version="4.0"/>
<template class="DinoUiSelectJidFragment">
<property name="height_request">500</property>
<property name="width_request">460</property>
<child>
<object class="GtkGrid">
<property name="hexpand">1</property>
<property name="margin-top">20</property>
<property name="margin-end">80</property>
<property name="margin-bottom">20</property>
<property name="margin-start">80</property>
<property name="orientation">vertical</property>
<property name="row-spacing">10</property>
<child>
<object class="GtkEntry" id="entry">
<property name="activates_default">1</property>
<property name="hexpand">1</property>
</object>
</child>
<object class="AdwClamp">
<property name="maximum-size">350</property>
<property name="tightening-threshold">300</property>
<child>
<object class="GtkBox">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkFrame">
<property name="child">
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="hscrollbar_policy">never</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="child">
<object class="GtkBox" id="box">
<property name="orientation">vertical</property>
</object>
</property>
</object>
</property>
<object class="GtkEntry" id="entry">
<property name="activates-default">1</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="css-classes">toolbar</property>
<style>
<class name="toolbar"/>
<class name="inline-toolbar"/>
</style>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton" id="add_button">
<child>
<object class="GtkImage">
<property name="icon-name">list-add-symbolic</property>
<property name="icon-size">normal</property>
<object class="GtkFrame">
<property name="child">
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="hscrollbar-policy">never</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="child">
<object class="GtkBox" id="box">
<property name="orientation">vertical</property>
</object>
</property>
</object>
</child>
</property>
</object>
</child>
<child>
<object class="GtkButton" id="remove_button">
<property name="sensitive">0</property>
<object class="GtkBox">
<property name="css-classes">toolbar</property>
<style>
<class name="toolbar"/>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkImage">
<property name="icon-name">list-remove-symbolic</property>
<property name="icon-size">normal</property>
<object class="GtkButton" id="add_button">
<child>
<object class="GtkImage">
<property name="icon-name">list-add-symbolic</property>
<property name="icon-size">normal</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="remove_button">
<property name="sensitive">0</property>
<child>
<object class="GtkImage">
<property name="icon-name">list-remove-symbolic</property>
<property name="icon-size">normal</property>
</object>
</child>
</object>
</child>
</object>

View file

@ -40,6 +40,9 @@
<file>icons/scalable/mimetypes/dino-file-table-symbolic.svg</file>
<file>icons/scalable/mimetypes/dino-file-video-symbolic.svg</file>
<file>icons/scalable/status/dino-double-tick-symbolic.svg</file>
<file>icons/scalable/status/dino-bell-large-none-symbolic.svg</file>
<file>icons/scalable/status/dino-bell-large-symbolic.svg</file>
<file>icons/scalable/status/dino-block-symbolic.svg</file>
<file>icons/scalable/status/dino-party-popper-symbolic.svg</file>
<file>icons/scalable/status/dino-security-high-symbolic.svg</file>
<file>icons/scalable/status/dino-status-away.svg</file>

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 8 0 c -0.828125 0 -1.5 0.671875 -1.5 1.5 c 0 0.078125 0.007812 0.15625 0.019531 0.234375 c -0.871093 0.269531 -1.652343 0.773437 -2.257812 1.453125 l -2.730469 -2.730469 l -1.0625 1.0625 l 2.957031 2.957031 l 8.527344 8.523438 l 2.515625 2.519531 l 1.0625 -1.0625 l -1.570312 -1.570312 c 0.320312 -0.167969 0.539062 -0.5 0.539062 -0.886719 c 0 -0.554688 -0.445312 -1 -1 -1 h -0.5 v -4.5 c 0 -2.191406 -1.425781 -4.125 -3.519531 -4.773438 c 0.011719 -0.074218 0.019531 -0.152343 0.019531 -0.226562 c 0 -0.828125 -0.671875 -1.5 -1.5 -1.5 z m -4.988281 6.183594 c -0.007813 0.105468 -0.011719 0.210937 -0.011719 0.316406 v 4.5 h -0.5 c -0.554688 0 -1 0.445312 -1 1 s 0.445312 1 1 1 h 7.328125 z m 2.988281 7.816406 c 0 0.714844 0.382812 1.375 1 1.730469 c 0.617188 0.359375 1.382812 0.359375 2 0 c 0.617188 -0.355469 1 -1.015625 1 -1.730469 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 1,007 B

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 8 0 c -0.828125 0 -1.5 0.671875 -1.5 1.5 c 0 0.078125 0.007812 0.152344 0.019531 0.230469 c -2.089843 0.648437 -3.515625 2.582031 -3.519531 4.769531 v 4.5 h -0.5 c -0.554688 0 -1 0.445312 -1 1 s 0.445312 1 1 1 h 11 c 0.554688 0 1 -0.445312 1 -1 s -0.445312 -1 -1 -1 h -0.5 v -4.5 c 0 -2.191406 -1.425781 -4.125 -3.519531 -4.773438 c 0.011719 -0.078124 0.019531 -0.152343 0.019531 -0.226562 c 0 -0.828125 -0.671875 -1.5 -1.5 -1.5 z m -2 14 c 0 0.714844 0.382812 1.375 1 1.734375 c 0.617188 0.355469 1.382812 0.355469 2 0 c 0.617188 -0.359375 1 -1.019531 1 -1.734375 z m 0 0" fill="#222222"/></svg>

After

Width:  |  Height:  |  Size: 734 B

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<g fill="#222">
<path d="m8 1c-3.8555 0-7 3.1445-7 7s3.1445 7 7 7 7-3.1445 7-7-3.1445-7-7-7zm0 2c2.7539 0 5 2.2461 5 5s-2.2461 5-5 5-5-2.2461-5-5 2.2461-5 5-5z"/>
<path d="m13.616 11.83-1.4375 1.4375-9.1054-9.0769 1.543-1.3323z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 369 B

View file

@ -282,6 +282,13 @@ window.dino-main .dino-chatinput-button button:checked:backdrop {
color: alpha(@theme_unfocused_selected_bg_color, 0.8);
}
.dino-unread-line label {
color: @theme_selected_bg_color;
}
.dino-unread-line separator {
background-color: @theme_selected_bg_color;
}
.dino-chatinput,
.dino-chatinput textview,

View file

@ -53,6 +53,7 @@ sources = files(
'src/ui/conversation_content_view/quote_widget.vala',
'src/ui/conversation_content_view/reactions_widget.vala',
'src/ui/conversation_content_view/subscription_notification.vala',
'src/ui/conversation_content_view/unread_indicator_populator.vala',
'src/ui/conversation_details.vala',
'src/ui/conversation_list_titlebar.vala',
'src/ui/conversation_selector/conversation_selector.vala',
@ -121,4 +122,4 @@ install_data('data/icons/scalable/apps/im.dino.Dino-symbolic.svg', install_dir:
install_data('data/icons/scalable/apps/im.dino.Dino.svg', install_dir: get_option('datadir') / 'hicolor/scalable/apps')
install_data('data/im.dino.Dino.appdata.xml', install_dir: get_option('datadir') / 'metainfo')
install_data('data/im.dino.Dino.desktop', install_dir: get_option('datadir') / 'applications')
install_data('data/im.dino.Dino.service', install_dir: get_option('datadir') / 'dbus-1/servces')
install_data('data/im.dino.Dino.service', install_dir: get_option('datadir') / 'dbus-1/services')

View file

@ -24,6 +24,8 @@ public class AddConferenceDialog : Gtk.Dialog {
Object(use_header_bar : Util.use_csd() ? 1 : 0);
this.title = _("Join Channel");
this.modal = true;
this.default_width = 460;
this.default_height = 550;
this.stream_interactor = stream_interactor;
stack.visible = true;
@ -101,6 +103,7 @@ public class AddConferenceDialog : Gtk.Dialog {
});
select_fragment.remove_jid.connect((row) => {
ConferenceListRow conference_row = row as ConferenceListRow;
if (conference_row == null) return;
stream_interactor.get_module(MucManager.IDENTITY).remove_bookmark(conference_row.account, conference_row.bookmark);
});

View file

@ -22,6 +22,8 @@ public class SelectContactDialog : Gtk.Dialog {
public SelectContactDialog(StreamInteractor stream_interactor, Gee.List<Account> accounts) {
Object(use_header_bar : Util.use_csd() ? 1 : 0);
modal = true;
this.default_width = 460;
this.default_height = 550;
this.stream_interactor = stream_interactor;
this.accounts = accounts;

View file

@ -87,6 +87,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug
Application app = GLib.Application.get_default() as Application;
app.plugin_registry.register_conversation_addition_populator(new ChatStatePopulator(stream_interactor));
app.plugin_registry.register_conversation_addition_populator(new DateSeparatorPopulator(stream_interactor));
app.plugin_registry.register_conversation_addition_populator(new UnreadIndicatorPopulator(stream_interactor));
// Rather than connecting to the leave event of the main_event_box directly,
// we connect to the parent event box that also wraps the overlaying message_menu_box.
@ -382,6 +383,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug
foreach (ContentMetaItem item in items) {
do_insert_item(item);
}
Application app = GLib.Application.get_default() as Application;
foreach (Plugins.NotificationPopulator populator in app.plugin_registry.notification_populators) {
populator.init(conversation, this, Plugins.WidgetType.GTK4);
@ -398,6 +400,7 @@ public class ConversationView : Widget, Plugins.ConversationItemCollection, Plug
return;
}
}
do_insert_item(item);
}

View file

@ -0,0 +1,88 @@
using Gee;
using Gtk;
using Dino.Entities;
using Xmpp;
namespace Dino.Ui.ConversationSummary {
class UnreadIndicatorPopulator : Plugins.ConversationItemPopulator, Plugins.ConversationAdditionPopulator, Object {
public string id { get { return "unread_indicator"; } }
private StreamInteractor stream_interactor;
private Conversation? current_conversation;
private UnreadIndicatorItem? unread_indicator = null;
Plugins.ConversationItemCollection item_collection = null;
public UnreadIndicatorPopulator(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
stream_interactor.get_module(ChatInteraction.IDENTITY).focused_out.connect(() => {
update_unread_indicator();
});
stream_interactor.get_module(ContentItemStore.IDENTITY).new_item.connect(() => {
if (!stream_interactor.get_module(ChatInteraction.IDENTITY).is_active_focus(current_conversation)) {
update_unread_indicator();
}
});
}
private void update_unread_indicator() {
if (current_conversation == null) return;
ContentItem? read_up_to_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_item_by_id(current_conversation, current_conversation.read_up_to_item);
int current_num_unread = stream_interactor.get_module(ChatInteraction.IDENTITY).get_num_unread(current_conversation);
if (current_num_unread == 0 && unread_indicator != null) {
item_collection.remove_item(unread_indicator);
unread_indicator = null;
}
if (read_up_to_item != null && current_num_unread > 0) {
if (unread_indicator != null) {
item_collection.remove_item(unread_indicator);
}
unread_indicator = new UnreadIndicatorItem(read_up_to_item);
item_collection.insert_item(unread_indicator);
}
}
public void init(Conversation conversation, Plugins.ConversationItemCollection item_collection, Plugins.WidgetType type) {
current_conversation = conversation;
this.item_collection = item_collection;
update_unread_indicator();
}
public void close(Conversation conversation) { }
public void populate_timespan(Conversation conversation, DateTime after, DateTime before) { }
}
private class UnreadIndicatorItem : Plugins.MetaConversationItem {
public UnreadIndicatorItem(ContentItem after_item) {
this.time = after_item.time;
this.secondary_sort_indicator = int.MAX;
}
public override Object? get_widget(Plugins.ConversationItemWidgetInterface outer, Plugins.WidgetType type) {
Box box = new Box(Orientation.HORIZONTAL, 10) { hexpand=true };
box.get_style_context().add_class("dino-unread-line");
Separator sep = new Separator(Orientation.HORIZONTAL) { valign=Align.CENTER, hexpand=true };
box.append(sep);
Label label = new Label(_("New")) { halign=Align.END, hexpand=false };
label.attributes = new Pango.AttrList();
label.attributes.insert(Pango.attr_weight_new(Pango.Weight.BOLD));
box.append(label);
return box;
}
public override Gee.List<Plugins.MessageAction>? get_item_actions(Plugins.WidgetType type) {
return null;
}
}
}

View file

@ -90,7 +90,7 @@ public class ConversationTitlebarCsd : ConversationTitlebar, Object {
public Adw.HeaderBar header_bar = new Adw.HeaderBar();
private Label title_label = new Label("") { ellipsize=EllipsizeMode.END };
private Label subtitle_label = new Label("") { ellipsize=EllipsizeMode.END, visible=false };
private Label subtitle_label = new Label("") { use_markup=true, ellipsize=EllipsizeMode.END, visible=false };
private Revealer back_revealer;
public ConversationTitlebarCsd() {

View file

@ -177,11 +177,13 @@ public class ConversationViewController : Object {
private void update_conversation_topic(string? subtitle = null) {
if (subtitle != null) {
conversation_topic = Util.summarize_whitespaces_to_space(subtitle);
string summarized_topic = Util.summarize_whitespaces_to_space(subtitle);
conversation_topic = Util.parse_add_markup(summarized_topic, null, true, true);
} else if (conversation.type_ == Conversation.Type.GROUPCHAT) {
string? subject = stream_interactor.get_module(MucManager.IDENTITY).get_groupchat_subject(conversation.counterpart, conversation.account);
if (subject != null) {
conversation_topic = Util.summarize_whitespaces_to_space(subject);
string summarized_topic = Util.summarize_whitespaces_to_space(subject);
conversation_topic = Util.parse_add_markup(summarized_topic, null, true, true);
} else {
conversation_topic = null;
}

View file

@ -260,7 +260,8 @@ public class GlobalSearch {
for (; match_info.matches(); match_info.next()) {
int start, end;
match_info.fetch_pos(0, out start, out end);
markup_text += Markup.escape_text(text[last_end:start]) + "<span bgcolor=\"yellow\">" + Markup.escape_text(text[start:end]) + "</span>";
string themed_span = Util.is_dark_theme(label) ? "<span color=\"black\" bgcolor=\"yellow\">" : "<span bgcolor=\"yellow\">";
markup_text += Markup.escape_text(text[last_end:start]) + themed_span + Markup.escape_text(text[start:end]) + "</span>";
last_end = end;
}
markup_text += Markup.escape_text(text[last_end:text.length]);

View file

@ -64,7 +64,7 @@ namespace Dino.Ui.ConversationDetails {
}
private void update_blocked_button() {
block_button_content.icon_name = "action-unavailable-symbolic";
block_button_content.icon_name = "dino-block-symbolic";
block_button_content.label = model.blocked ? _("Blocked") : _("Block");
if (model.blocked) {
block_button.add_css_class("error");
@ -75,7 +75,7 @@ namespace Dino.Ui.ConversationDetails {
private void update_notification_button() {
string icon_name = model.notification == OFF ?
"notifications-disabled-symbolic" : "notification-symbolic";
"dino-bell-large-none-symbolic" : "dino-bell-large-symbolic";
notification_button_toggle_content.icon_name = icon_name;
notification_button_split_content.icon_name = icon_name;
notification_button_menu_content.icon_name = icon_name;

View file

@ -17,19 +17,11 @@ foreach plugin : ['plugin-ice', 'plugin-omemo', 'plugin-rtp']
endif
endforeach
if get_option('plugin-ice').enabled() and not get_option('plugin-rtp').enabled()
dep_gnutls_required = get_option('plugin-ice')
elif get_option('plugin-ice').allowed() and not get_option('plugin-rtp').allowed()
dep_gnutls_required = get_option('plugin-ice')
else
dep_gnutls_required = get_option('plugin-rtp')
endif
dep_gdk_pixbuf = dependency('gdk-pixbuf-2.0')
dep_gee = dependency('gee-0.8')
dep_gio = dependency('gio-2.0')
dep_glib = dependency('glib-2.0')
dep_gnutls = dependency('gnutls', disabler: true, required: dep_gnutls_required)
dep_gnutls = dependency('gnutls', disabler: true, required: get_option('plugin-ice'))
dep_gmodule = dependency('gmodule-2.0')
dep_gpgme = dependency('gpgme', disabler: true, required: get_option('plugin-openpgp'))
dep_gstreamer = dependency('gstreamer-1.0', disabler: true, required: get_option('plugin-rtp'))

View file

@ -4,7 +4,6 @@ find_packages(RTP_PACKAGES REQUIRED
Gee
GLib
GModule
GnuTLS
GObject
GTK4
Gst

View file

@ -4,7 +4,6 @@ dependencies = [
dep_gee,
dep_glib,
dep_gmodule,
dep_gnutls,
dep_gstreamer,
dep_gstreamer_app,
dep_gstreamer_audio,

View file

@ -12,7 +12,11 @@ public class Module : XmppStreamModule, Iq.Handler {
public signal void unblock_all_received(XmppStream stream);
public bool is_blocked(XmppStream stream, string jid) {
return stream.get_flag(Flag.IDENTITY).blocklist.contains(jid);
if (is_supported(stream)) {
return stream.get_flag(Flag.IDENTITY).blocklist.contains(jid);
} else {
return false;
}
}
public bool block(XmppStream stream, string[] jids) {

View file

@ -181,7 +181,9 @@ public class Module : XmppStreamModule {
}
}
if (max_file_size_str != null) return long.parse(max_file_size_str);
return -1;
// If there is no max-file-size node, there is no file size limit
return long.MAX;
}
}