diff options
-rw-r--r-- | browser.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -1153,22 +1153,30 @@ notebook_switch_page(GtkNotebook *nb, GtkWidget *p, guint idx, gpointer data) gboolean permission_request(WebKitWebView *v, WebKitPermissionRequest *r, gpointer data) { + struct Client *c = (struct Client *)data; + const gchar *h; char *permission_str; + + h = g_uri_get_host(g_uri_parse( + webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)), + G_URI_FLAGS_PARSE_RELAXED, + NULL)); + if (WEBKIT_IS_GEOLOCATION_PERMISSION_REQUEST(r)) { - permission_str = "Allow this site to see your location?"; + permission_str = "Allow '%s' to see your location?"; } else if (WEBKIT_IS_NOTIFICATION_PERMISSION_REQUEST(r)) { - permission_str = "Allow notifications from this website?"; + permission_str = "Allow notifications from '%s'?"; } else if (WEBKIT_IS_USER_MEDIA_PERMISSION_REQUEST(r)) { if (webkit_user_media_permission_is_for_audio_device( WEBKIT_USER_MEDIA_PERMISSION_REQUEST(r))) - permission_str = "Allow this site to access your microphone?"; + permission_str = "Allow '%s' to access your microphone?"; else if (webkit_user_media_permission_is_for_video_device( WEBKIT_USER_MEDIA_PERMISSION_REQUEST(r))) - permission_str = "Allow this site to access your webcam?"; + permission_str = "Allow '%s' to access your webcam?"; else return FALSE; } @@ -1180,7 +1188,7 @@ permission_request(WebKitWebView *v, WebKitPermissionRequest *r, gpointer data) GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, - permission_str); + g_strdup_printf(permission_str, h)); gtk_widget_show(dialog); gint result = gtk_dialog_run(GTK_DIALOG(dialog)); switch(result) { |