Merge branch 'mjog/1118-composer-insert-link' into 'mainline'

Components.WebView: Remove selection_changed signal

Closes #1058 and #1118

See merge request GNOME/geary!627
This commit is contained in:
Michael Gratton 2021-01-15 13:46:45 +00:00
commit 9cbaaf8f25
4 changed files with 11 additions and 20 deletions

View file

@ -296,9 +296,6 @@ public abstract class Components.WebView : WebKit.WebView, Geary.BaseInterface {
/** Emitted when the web view's content has changed. */
public signal void document_modified();
/** Emitted when the view's selection has changed. */
public signal void selection_changed(bool has_selection);
/** Emitted when a user clicks a link in the view. */
public signal void link_activated(string uri);
@ -801,7 +798,7 @@ public abstract class Components.WebView : WebKit.WebView, Geary.BaseInterface {
private void on_selection_changed(GLib.Variant? parameters) {
if (parameters != null && parameters.classify() == BOOLEAN) {
selection_changed(parameters.get_boolean());
this.has_selection = parameters.get_boolean();
} else {
warning("Could not get JS selection value");
}

View file

@ -168,7 +168,7 @@ public class Composer.Editor : Gtk.Grid, Geary.BaseInterface {
this.body.cursor_context_changed.connect(on_cursor_context_changed);
this.body.get_editor_state().notify["typing-attributes"].connect(on_typing_attributes_changed);
this.body.mouse_target_changed.connect(on_mouse_target_changed);
this.body.selection_changed.connect(on_selection_changed);
this.body.notify["has-selection"].connect(on_selection_changed);
this.body.set_hexpand(true);
this.body.set_vexpand(true);
this.body.show();
@ -534,7 +534,7 @@ public class Composer.Editor : Gtk.Grid, Geary.BaseInterface {
get_action(Action.Edit.REDO).set_enabled(can_redo);
}
private void on_selection_changed(bool has_selection) {
private void on_selection_changed() {
update_cursor_actions();
}
@ -624,9 +624,9 @@ public class Composer.Editor : Gtk.Grid, Geary.BaseInterface {
// the URL entry, then the editor will lose its
// selection, the inset link action will become
// disabled, and the popover will disappear
this.body.selection_changed.disconnect(on_selection_changed);
this.body.notify["has-selection"].disconnect(on_selection_changed);
popover.closed.connect(() => {
this.body.selection_changed.connect(on_selection_changed);
this.body.notify["has-selection"].connect(on_selection_changed);
style.set_state(NORMAL);
});

View file

@ -1145,10 +1145,8 @@ public class Composer.Widget : Gtk.EventBox, Geary.BaseInterface {
private void on_content_loaded() {
this.update_signature.begin(null);
if (this.can_delete_quote) {
this.editor.body.selection_changed.connect(
() => {
this.can_delete_quote = false;
}
this.editor.body.notify["has-selection"].connect(
() => { this.can_delete_quote = false; }
);
}
}

View file

@ -499,10 +499,6 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
content_loaded();
}
private void trigger_selection_changed(bool has_selection) {
selection_changed(has_selection);
}
private ConversationMessage(Geary.EmailHeaderSet headers,
string? preview,
bool load_remote_resources,
@ -616,13 +612,12 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
on_link_activated(new GLib.Variant("s", link));
});
this.web_view.mouse_target_changed.connect(on_mouse_target_changed);
this.web_view.notify["has-selection"].connect(on_selection_changed);
this.web_view.notify["is-loading"].connect(on_is_loading_notify);
this.web_view.resource_load_started.connect(on_resource_load_started);
this.web_view.remote_image_load_blocked.connect(on_remote_images_blocked);
this.web_view.selection_changed.connect(on_selection_changed);
this.web_view.internal_resource_loaded.connect(trigger_internal_resource_loaded);
this.web_view.content_loaded.connect(trigger_content_loaded);
this.web_view.selection_changed.connect(trigger_selection_changed);
this.web_view.set_hexpand(true);
this.web_view.set_vexpand(true);
this.web_view.show();
@ -1431,8 +1426,9 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
link_popover.popup();
}
private void on_selection_changed(bool has_selection) {
set_action_enabled(ACTION_COPY_SELECTION, has_selection);
private void on_selection_changed() {
set_action_enabled(ACTION_COPY_SELECTION, this.web_view.has_selection);
selection_changed(this.web_view.has_selection);
}
private void on_remote_images_blocked() {