From 4295134455ea99ad14a0eb43ed31e03fbeebb623 Mon Sep 17 00:00:00 2001 From: Juhani Krekelä Date: Sat, 24 Jul 2021 19:15:10 +0300 Subject: 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. --- po/de.po | 46 +++++++++++++++++++--------------------------- po/fi.po | 42 +++++++++++++++++------------------------- po/weltschmerz.pot | 36 ++++++++++++++---------------------- terminal.ui | 34 ++++++---------------------------- terminal.vala | 12 ++++-------- 5 files changed, 60 insertions(+), 110 deletions(-) diff --git a/po/de.po b/po/de.po index 5d6bb1d..c62f019 100644 --- a/po/de.po +++ b/po/de.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: weltschmerz\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-06-26 20:31+0200\n" -"PO-Revision-Date: 2021-06-26 20:35+0200\n" -"Last-Translator: Wolfgang Müller \n" +"POT-Creation-Date: 2021-07-20 20:19+0300\n" +"PO-Revision-Date: 2021-07-20 20:22+0300\n" +"Last-Translator: Juhani Krekelä \n" "Language-Team: Wolfgang Müller\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 2.2.4\n" +"X-Generator: Poedit 2.3\n" #. TRANSLATORS: %s is the list of unknown keys joined with ', ' #: configreader.vala:111 @@ -45,62 +45,54 @@ msgid "invalid cursor blink setting '%s' in %s.%s" msgstr "ungültige Cursor-Blinkeinstellung '%s' in %s.%s" #: terminal.ui:16 -msgid "_Copy hyperlink" -msgstr "Hyperlink _kopieren" +msgid "_Copy URI" +msgstr "URI _kopieren" #: terminal.ui:19 -msgid "Copy the hyperlink's URI to the clipboard" -msgstr "Kopiert die URL des Hyperlinks in die Zwischenablage" +msgid "Copy the URI to the clipboard" +msgstr "Kopiert die URI in die Zwischenablage" -#: terminal.ui:38 -msgid "_Copy URL" -msgstr "URL _kopieren" - -#: terminal.ui:41 -msgid "Copy the URL to the clipboard" -msgstr "Kopiert die URL in die Zwischenablage" - -#: terminal.ui:75 +#: terminal.ui:53 msgid "Copy as _HTML" msgstr "Als _HTML kopieren" -#: terminal.ui:78 +#: terminal.ui:56 msgid "Copy the selection as HTML" msgstr "Kopiert die Auswahl als HTML" -#: terminal.ui:102 +#: terminal.ui:80 msgid "Open _terminal" msgstr "_Terminal öffnen" -#: terminal.ui:105 +#: terminal.ui:83 msgid "Open new terminal window in the current directory" msgstr "Öffnet ein neues Terminalfenster im aktuellen Verzeichnis" -#: terminal.ui:115 +#: terminal.ui:93 msgid "_Open directory" msgstr "_Verzeichnis öffnen" -#: terminal.ui:118 +#: terminal.ui:96 msgid "Open current directory in the file manager" msgstr "Öffnet das aktuelle Verzeichnis im Dateimanager" -#: terminal.ui:193 +#: terminal.ui:171 msgid "Search..." msgstr "Suchen..." -#: terminal.ui:212 +#: terminal.ui:190 msgid "Go to next result" msgstr "Gehe zum nächsten Suchergebnis" -#: terminal.ui:228 +#: terminal.ui:206 msgid "Go to previous result" msgstr "Gehe zum vorherigen Suchergebnis" -#: terminal.vala:141 +#: terminal.vala:139 msgid "Configuration loaded with warnings:" msgstr "Konfiguration wurde mit Warnungen geladen:" -#: terminal.vala:144 +#: terminal.vala:142 msgid "Configuration loaded successfully." msgstr "Konfiguration wurde erfolgreich geladen." diff --git a/po/fi.po b/po/fi.po index a1f582a..0372708 100644 --- a/po/fi.po +++ b/po/fi.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: weltschmerz\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-06-26 20:31+0200\n" -"PO-Revision-Date: 2021-06-28 15:43+0300\n" +"POT-Creation-Date: 2021-07-20 20:19+0300\n" +"PO-Revision-Date: 2021-07-20 20:22+0300\n" "Last-Translator: Juhani Krekelä \n" "Language-Team: nortti\n" "Language: fi\n" @@ -45,62 +45,54 @@ msgid "invalid cursor blink setting '%s' in %s.%s" msgstr "tuntematon osoitiimen välkkymisasetus '%s' asetuksessa %s.%s" #: terminal.ui:16 -msgid "_Copy hyperlink" -msgstr "_Kopioi hyperlinkki" +msgid "_Copy URI" +msgstr "_Kopioi URI" #: terminal.ui:19 -msgid "Copy the hyperlink's URI to the clipboard" -msgstr "Kopioi hyperlinkin URI leikepöydälle" +msgid "Copy the URI to the clipboard" +msgstr "Kopioi URI leikepöydälle" -#: terminal.ui:38 -msgid "_Copy URL" -msgstr "_Kopioi URL" - -#: terminal.ui:41 -msgid "Copy the URL to the clipboard" -msgstr "Kopioi URL leikepöydälle" - -#: terminal.ui:75 +#: terminal.ui:53 msgid "Copy as _HTML" msgstr "Kopioi _HTML:nä" -#: terminal.ui:78 +#: terminal.ui:56 msgid "Copy the selection as HTML" msgstr "Kopioi valinta HTML:nä" -#: terminal.ui:102 +#: terminal.ui:80 msgid "Open _terminal" msgstr "Avaa _pääte" -#: terminal.ui:105 +#: terminal.ui:83 msgid "Open new terminal window in the current directory" msgstr "Avaa pääteikkuna tämänhetkisessä hakemistossa" -#: terminal.ui:115 +#: terminal.ui:93 msgid "_Open directory" msgstr "_Avaa hakemisto" -#: terminal.ui:118 +#: terminal.ui:96 msgid "Open current directory in the file manager" msgstr "Avaa tämänhetkinen hakemisto tiedostoselaimessa" -#: terminal.ui:193 +#: terminal.ui:171 msgid "Search..." msgstr "Etsi..." -#: terminal.ui:212 +#: terminal.ui:190 msgid "Go to next result" msgstr "Seuraava osuma" -#: terminal.ui:228 +#: terminal.ui:206 msgid "Go to previous result" msgstr "Edellinen osuma" -#: terminal.vala:141 +#: terminal.vala:139 msgid "Configuration loaded with warnings:" msgstr "Asetukset ladattu varoituksin:" -#: terminal.vala:144 +#: terminal.vala:142 msgid "Configuration loaded successfully." msgstr "Asetukset ladattu onnistuneesti." diff --git a/po/weltschmerz.pot b/po/weltschmerz.pot index 4029cc6..fd35ae0 100644 --- a/po/weltschmerz.pot +++ b/po/weltschmerz.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: weltschmerz\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-06-26 20:31+0200\n" +"POT-Creation-Date: 2021-07-20 20:19+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -45,62 +45,54 @@ msgid "invalid cursor blink setting '%s' in %s.%s" msgstr "" #: terminal.ui:16 -msgid "_Copy hyperlink" +msgid "_Copy URI" msgstr "" #: terminal.ui:19 -msgid "Copy the hyperlink's URI to the clipboard" +msgid "Copy the URI to the clipboard" msgstr "" -#: terminal.ui:38 -msgid "_Copy URL" -msgstr "" - -#: terminal.ui:41 -msgid "Copy the URL to the clipboard" -msgstr "" - -#: terminal.ui:75 +#: terminal.ui:53 msgid "Copy as _HTML" msgstr "" -#: terminal.ui:78 +#: terminal.ui:56 msgid "Copy the selection as HTML" msgstr "" -#: terminal.ui:102 +#: terminal.ui:80 msgid "Open _terminal" msgstr "" -#: terminal.ui:105 +#: terminal.ui:83 msgid "Open new terminal window in the current directory" msgstr "" -#: terminal.ui:115 +#: terminal.ui:93 msgid "_Open directory" msgstr "" -#: terminal.ui:118 +#: terminal.ui:96 msgid "Open current directory in the file manager" msgstr "" -#: terminal.ui:193 +#: terminal.ui:171 msgid "Search..." msgstr "" -#: terminal.ui:212 +#: terminal.ui:190 msgid "Go to next result" msgstr "" -#: terminal.ui:228 +#: terminal.ui:206 msgid "Go to previous result" msgstr "" -#: terminal.vala:141 +#: terminal.vala:139 msgid "Configuration loaded with warnings:" msgstr "" -#: terminal.vala:144 +#: terminal.vala:142 msgid "Configuration loaded successfully." msgstr "" diff --git a/terminal.ui b/terminal.ui index 68a36b7..57e4ad9 100644 --- a/terminal.ui +++ b/terminal.ui @@ -3,44 +3,22 @@ - + True False edit-copy - + True False - - _Copy hyperlink + + _Copy URI True False - Copy the hyperlink's URI to the clipboard + Copy the URI to the clipboard True - copy_hyperlink_image - False - True - - - - - - True - False - edit-copy - - - True - False - - - _Copy URL - True - False - Copy the URL to the clipboard - True - copy_url_image + copy_uri_image False True 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()); -- cgit v1.2.3-2-gb3c3