From f1a802e41b1604e81536f6b8acc1429e919b8e9f Mon Sep 17 00:00:00 2001 From: Peter Hofmann Date: Sat, 13 Jan 2018 07:12:24 +0100 Subject: [PATCH] Use full signature for external_handler_run Yes, this needs the two void casts to make the compiler not complain about unused parameters, but I think "explicit is better than implicit" here. And none of the other callbacks use this trick. --- browser.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/browser.c b/browser.c index 00697d1..5212c0c 100644 --- a/browser.c +++ b/browser.c @@ -32,7 +32,7 @@ static void downloadmanager_cancel(GtkToolButton *, gpointer data); static gboolean downloadmanager_delete(GtkWidget *, gpointer); static void downloadmanager_setup(void); static gchar *ensure_uri_scheme(const gchar *); -static void external_handler_run(gpointer); +static void external_handler_run(GSimpleAction *, GVariant *, gpointer); static void grab_environment_configuration(void); static void hover_web_view(WebKitWebView *, WebKitHitTestResult *, guint, gpointer); static gboolean key_common(GtkWidget *, GdkEvent *, gpointer); @@ -563,13 +563,16 @@ ensure_uri_scheme(const gchar *t) } void -external_handler_run(gpointer data) +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)) @@ -709,7 +712,7 @@ key_common(GtkWidget *widget, GdkEvent *event, gpointer data) 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(c); + external_handler_run(NULL, NULL, c); return TRUE; } } @@ -933,8 +936,8 @@ menu_web_view(WebKitWebView *web_view, WebKitContextMenu *menu, GdkEvent *ev, g_free(c->external_handler_uri); c->external_handler_uri = g_strdup(uri); action = g_simple_action_new("external_handler", NULL); - g_signal_connect_swapped(G_OBJECT(action), "activate", - G_CALLBACK(external_handler_run), data); + 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); -- 2.39.2