aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/terminal.vala
diff options
context:
space:
mode:
authorJuhani Krekelä2021-07-24 19:15:10 +0300
committerWolfgang Müller2021-07-24 18:55:04 +0200
commit4295134455ea99ad14a0eb43ed31e03fbeebb623 (patch)
tree6d668dce7b207e6051ffde950ccafc12b041a092 /terminal.vala
parent8a87662e4d2be193e3110903e83f12347a12d4cb (diff)
downloadweltschmerz-4295134455ea99ad14a0eb43ed31e03fbeebb623.tar.gz
Unify context menus for URLs and OSC 8 hyperlinks
Currently weltschmerz has separate context menus for the two types of URIs one can interact with, even though they contain the same option with only a little different phrasing. This makes both use the same context menu, and standardizes terminology to "URI". This unification is in preparation for an upcoming "Open with …" feature which will programmatically add items to context menu for URIs. Without this, we would need to duplicate logic for each of the separate menus.
Diffstat (limited to '')
-rw-r--r--terminal.vala12
1 files changed, 4 insertions, 8 deletions
diff --git a/terminal.vala b/terminal.vala
index 076d665..13409f4 100644
--- a/terminal.vala
+++ b/terminal.vala
@@ -24,8 +24,7 @@ class Terminal : Gtk.Overlay {
[GtkChild] unowned Gtk.InfoBar infobar;
[GtkChild] unowned Gtk.Label infobar_label;
[GtkChild] unowned Gtk.Menu standard_context_menu;
- [GtkChild] unowned Gtk.Menu url_context_menu;
- [GtkChild] unowned Gtk.Menu hyperlink_context_menu;
+ [GtkChild] unowned Gtk.Menu uri_context_menu;
[GtkChild] unowned Gtk.MenuItem copy_item_text;
[GtkChild] unowned Gtk.MenuItem copy_item_html;
[GtkChild] unowned Gtk.MenuItem open_terminal_item;
@@ -62,8 +61,7 @@ class Terminal : Gtk.Overlay {
vte.search_set_wrap_around(true);
- url_context_menu.attach_to_widget(vte, null);
- hyperlink_context_menu.attach_to_widget(vte, null);
+ uri_context_menu.attach_to_widget(vte, null);
standard_context_menu.attach_to_widget(vte, null);
clipboard = Gtk.Clipboard.get_default(window.get_display());
@@ -403,10 +401,8 @@ class Terminal : Gtk.Overlay {
url_match = vte.match_check_event(event, null);
hyperlink_match = vte.hyperlink_check_event(event);
- if (url_match != null) {
- url_context_menu.popup_at_pointer(event);
- } else if (hyperlink_match != null) {
- hyperlink_context_menu.popup_at_pointer(event);
+ if (url_match != null || hyperlink_match != null) {
+ uri_context_menu.popup_at_pointer(event);
} else {
copy_item_text.set_sensitive(vte.get_has_selection());
copy_item_html.set_sensitive(vte.get_has_selection());