summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2020-04-29 18:05:09 +0200
committerPeter Hofmann <scm@uninformativ.de>2020-04-29 18:05:09 +0200
commit2f6298ae945dfb94f99d1707446b5e559dc0dac3 (patch)
treea4fbaec9720c182c269c2436fd712924d652f9bc
parent649a067929656183ca6d194536b5927bf84daf82 (diff)
downloadlariza-2f6298ae945dfb94f99d1707446b5e559dc0dac3.tar.gz
Remove external URI handler
-rw-r--r--CHANGES2
-rw-r--r--browser.c74
-rw-r--r--man1/lariza.16
-rw-r--r--man1/lariza.usage.132
4 files changed, 4 insertions, 110 deletions
diff --git a/CHANGES b/CHANGES
index d0d4464..275a703 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,8 @@ next
https://www.uninformativ.de/blog/postings/2020-04-26/0/POSTING-en.html
- Keyword searches have been removed, as these code paths were
unmaintained.
+ - The "external URI handler" has been removed, as these code paths
+ were unmaintained.
v20.04 2020-04-22
[Fixed]
diff --git a/browser.c b/browser.c
index 3c68dd3..2390b1c 100644
--- a/browser.c
+++ b/browser.c
@@ -34,7 +34,6 @@ void downloadmanager_cancel(GtkToolButton *, gpointer);
gboolean downloadmanager_delete(GtkWidget *, gpointer);
void downloadmanager_setup(void);
gchar *ensure_uri_scheme(const gchar *);
-void external_handler_run(GSimpleAction *, GVariant *, gpointer);
void grab_environment_configuration(void);
void grab_feeds_finished(GObject *, GAsyncResult *, gpointer);
void hover_web_view(WebKitWebView *, WebKitHitTestResult *, guint, gpointer);
@@ -45,8 +44,6 @@ gboolean key_location(GtkWidget *, GdkEvent *, gpointer);
gboolean key_tablabel(GtkWidget *, GdkEvent *, gpointer);
gboolean key_web_view(GtkWidget *, GdkEvent *, gpointer);
void mainwindow_setup(void);
-gboolean menu_web_view(WebKitWebView *, WebKitContextMenu *, GdkEvent *,
- WebKitHitTestResult *, gpointer);
gboolean quit_if_nothing_active(void);
gboolean remote_msg(GIOChannel *, GIOCondition, gpointer);
void run_user_scripts(WebKitWebView *);
@@ -165,8 +162,6 @@ client_new(const gchar *uri, WebKitWebView *related_wv, gboolean show,
G_CALLBACK(changed_load_progress), c);
g_signal_connect(G_OBJECT(c->web_view), "create",
G_CALLBACK(client_new_request), NULL);
- g_signal_connect(G_OBJECT(c->web_view), "context-menu",
- G_CALLBACK(menu_web_view), c);
g_signal_connect(G_OBJECT(c->web_view), "close",
G_CALLBACK(client_destroy), c);
g_signal_connect(G_OBJECT(c->web_view), "decide-policy",
@@ -666,29 +661,6 @@ ensure_uri_scheme(const gchar *t)
}
void
-external_handler_run(GSimpleAction *simple, GVariant *param, gpointer data)
-{
- struct Client *c = (struct Client *)data;
- gchar *argv[] = { "lariza-external-handler", "-u", NULL, NULL };
- GPid pid;
- GError *err = NULL;
-
- (void)simple;
- (void)param;
-
- argv[2] = c->external_handler_uri;
- if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
- &pid, &err))
- {
- fprintf(stderr, __NAME__": Could not launch key handler: %s\n",
- err->message);
- g_error_free(err);
- }
- else
- g_spawn_close_pid(pid);
-}
-
-void
grab_environment_configuration(void)
{
const gchar *e;
@@ -923,13 +895,6 @@ key_common(GtkWidget *widget, GdkEvent *event, gpointer data)
case GDK_KEY_c: /* reload trusted certs (left hand) */
trust_user_certs(wc);
return TRUE;
- case GDK_KEY_x: /* launch external handler (left hand) */
- if (c->external_handler_uri != NULL)
- g_free(c->external_handler_uri);
- c->external_handler_uri = g_strdup(
- webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)));
- external_handler_run(NULL, NULL, c);
- return TRUE;
case GDK_KEY_a: /* go one tab to the left (left hand) */
gtk_notebook_prev_page(GTK_NOTEBOOK(mw.notebook));
return TRUE;
@@ -1120,45 +1085,6 @@ mainwindow_setup(void)
}
gboolean
-menu_web_view(WebKitWebView *web_view, WebKitContextMenu *menu, GdkEvent *ev,
- WebKitHitTestResult *ht, gpointer data)
-{
- struct Client *c = (struct Client *)data;
- GSimpleAction *action = NULL;
- WebKitContextMenuItem *mi = NULL;
- const gchar *uri = NULL;
-
- (void)ev;
-
- if (webkit_hit_test_result_context_is_link(ht))
- uri = webkit_hit_test_result_get_link_uri(ht);
- else if (webkit_hit_test_result_context_is_image(ht))
- uri = webkit_hit_test_result_get_image_uri(ht);
- else if (webkit_hit_test_result_context_is_media(ht))
- uri = webkit_hit_test_result_get_media_uri(ht);
-
- if (uri != NULL)
- {
- webkit_context_menu_append(menu, webkit_context_menu_item_new_separator());
-
- if (c->external_handler_uri != NULL)
- g_free(c->external_handler_uri);
- c->external_handler_uri = g_strdup(uri);
- action = g_simple_action_new("external_handler", NULL);
- g_signal_connect(G_OBJECT(action), "activate",
- G_CALLBACK(external_handler_run), data);
- mi = webkit_context_menu_item_new_from_gaction(G_ACTION(action),
- "Open with external handler",
- NULL);
- webkit_context_menu_append(menu, mi);
- g_object_unref(action);
- }
-
- /* FALSE = Show the menu. (TRUE = Don't ever show it.) */
- return FALSE;
-}
-
-gboolean
quit_if_nothing_active(void)
{
if (clients == 0)
diff --git a/man1/lariza.1 b/man1/lariza.1
index a3cbb3f..7931338 100644
--- a/man1/lariza.1
+++ b/man1/lariza.1
@@ -1,4 +1,4 @@
-.TH lariza 1 "2020-04-28" "lariza" "User Commands"
+.TH lariza 1 "2020-04-29" "lariza" "User Commands"
.\" --------------------------------------------------------------------
.SH NAME
lariza \- simple web browser
@@ -97,10 +97,6 @@ Directory to store user-supplied JavaScript snippets. See
\fI~/.local\:/share\:/lariza\:/web_extensions\fP
Sets the directory where WebKit will look for web extensions. See
\fBlariza.usage\fP(1).
-.P
-The executable \fIlariza-external-handler\fP must be located somewhere
-in your $\fBPATH\fP, if you want to make use of the external URI
-handler. See \fBlariza.usage\fP(1) for details.
.\" --------------------------------------------------------------------
.SH LICENSE
\fBlariza\fP is released under the MIT license. See the accompanying
diff --git a/man1/lariza.usage.1 b/man1/lariza.usage.1
index b1162a6..336acaf 100644
--- a/man1/lariza.usage.1
+++ b/man1/lariza.usage.1
@@ -1,4 +1,4 @@
-.TH lariza 1 "2020-04-28" "lariza" "User Commands"
+.TH lariza 1 "2020-04-29" "lariza" "User Commands"
.\" --------------------------------------------------------------------
.SH NAME
lariza.usage \- extended usage hints
@@ -12,9 +12,6 @@ This manpage contains additional hints and pointers regarding its usage.
These hotkeys work when either the location bar or the web view is being
focused.
.TP
-\fBMod1\fP + \fBx\fP
-Launch the external handler for the currently loaded URI.
-.TP
\fBMod1\fP + \fBq\fP
Close the current window. Quits the entire program if this was the last
window and if there are no more active downloads (download manager is
@@ -155,33 +152,6 @@ Those bundled web extensions are automatically compiled when you run
\fBmake\fP and installed on \fBmake install\fP. To use them, though,
make sure to link them to the directory mentioned above.
.\" --------------------------------------------------------------------
-.SH "EXTERNAL URI HANDLER"
-\fBlariza\fP can launch an executable called
-\fIlariza-external-handler\fP. It will be passed the \(lqselected\(rq
-URI as a command line argument:
-.P
-\f(CW
-.nf
-$ lariza-external-handler -u https://github.com
-.fi
-\fP
-.P
-This executable must be a user-supplied program. It can do anything it
-wants to with that URI. \fBlariza\fP ignores the exit code of the
-handler.
-.P
-The \fB\-u\fP will always be set. This allows you to use \fBgetopt\fP(1)
-like parameter parsing in your program.
-.P
-You can either use the appropriate hotkey (see list above) to launch the
-handler with the currently loaded URI, or you can perform a right click
-on any link, image or media file to use that URI.
-.P
-This mechanism allows you to implement a variety of functions. You might
-want to implement a bookmarking script or a password manager or you
-might simply load the current URI in a different browser. That's up to
-you.
-.\" --------------------------------------------------------------------
.SH "TRUSTED CERTIFICATES"
By default, \fBlariza\fP trusts whatever CAs are trusted by WebKit, i.e.
by your GnuTLS installation. If you wish to trust additional