static void view_cb_notify_load_status(WebKitWebView *view, GParamSpec *pspec, struct browser_context *ctx) { int status = webkit_web_view_get_load_status(view); wpa_printf(MSG_DEBUG, "BROWSER:%s load-status=%d uri=%s", __func__, status, webkit_web_view_get_uri(view)); }
bool cmd_bookmark_delete(girara_session_t* session, girara_list_t* argument_list) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); jumanji_t* jumanji = session->global.data; if (jumanji->database == NULL) { return false; } char* url = NULL; if (girara_list_size(argument_list) > 0) { url = girara_list_nth(argument_list, 0); } else { jumanji_tab_t* tab = jumanji_tab_get_current(jumanji); if (tab != NULL && tab->web_view != NULL) { url = (char*) webkit_web_view_get_uri(WEBKIT_WEB_VIEW(tab->web_view)); } } gchar* escaped_url = g_markup_escape_text(url, -1); jumanji_db_bookmark_remove(jumanji->database, url); girara_notify(session, GIRARA_INFO, "Removed bookmark: %s", escaped_url); g_free(escaped_url); return true; }
void hover_web_view(WebKitWebView *web_view, WebKitHitTestResult *ht, guint modifiers, gpointer data) { struct Client *c = (struct Client *)data; if (!gtk_widget_is_focus(c->location)) { if (webkit_hit_test_result_context_is_link(ht)) { gtk_entry_set_text(GTK_ENTRY(c->location), webkit_hit_test_result_get_link_uri(ht)); if (c->hover_uri != NULL) g_free(c->hover_uri); c->hover_uri = g_strdup(webkit_hit_test_result_get_link_uri(ht)); } else { gtk_entry_set_text(GTK_ENTRY(c->location), webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view))); if (c->hover_uri != NULL) g_free(c->hover_uri); c->hover_uri = NULL; } } }
static void load_status_notify_cb (GObject *object, GParamSpec *spec, EphyGreasemonkeyExtension *extension) { ApplyScriptCBData *data; WebKitWebView *web_view; WebKitLoadStatus status; const char *location; web_view = WEBKIT_WEB_VIEW (object); status = webkit_web_view_get_load_status (web_view); if (status != WEBKIT_LOAD_FINISHED) return; location = webkit_web_view_get_uri (web_view); if (location == NULL) return; data = g_new (ApplyScriptCBData, 1); data->web_view = web_view; data->location = location; g_hash_table_foreach (extension->priv->scripts, (GHFunc) maybe_apply_script, data); g_free (data); }
void sc_focus_inputbar(Browser *b, const Arg *arg) { char *data, *clipboard_text; if (arg->data) { if (arg->n == APPEND_URL) { asprintf(&data, "%s%s", arg->data, webkit_web_view_get_uri(b->UI.view)); } else { data = strdup(arg->data); } browser_notify(b, DEFAULT, data); free(data); /* save primary selection - will be overwritten on grab_focus */ clipboard_text = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY)); gtk_widget_grab_focus(GTK_WIDGET(b->UI.inputbar)); gtk_editable_set_position(GTK_EDITABLE(b->UI.inputbar), -1); if (clipboard_text) { /* restore primary selection */ gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), clipboard_text, -1); free(clipboard_text); } } else if (!gtk_widget_is_focus(GTK_WIDGET(b->UI.inputbar))) { gtk_widget_grab_focus(GTK_WIDGET(b->UI.inputbar)); } if (!gtk_widget_get_visible(GTK_WIDGET(b->UI.inputbar))) { gtk_widget_show(GTK_WIDGET(b->UI.inputbar)); } }
bool cmd_bookmark_add(girara_session_t* session, girara_list_t* argument_list) { g_return_val_if_fail(session != NULL, false); g_return_val_if_fail(session->global.data != NULL, false); jumanji_t* jumanji = session->global.data; if (jumanji->database == NULL) { return false; } int number_of_arguments = girara_list_size(argument_list); char* url = NULL; char* title = NULL; if (number_of_arguments > 0) { url = girara_list_nth(argument_list, 0); title = (number_of_arguments > 1) ? girara_list_nth(argument_list, 1) : NULL; } else { jumanji_tab_t* tab = jumanji_tab_get_current(jumanji); if (tab != NULL && tab->web_view != NULL) { url = (char*) webkit_web_view_get_uri(WEBKIT_WEB_VIEW(tab->web_view)); title = (char*) webkit_web_view_get_title(WEBKIT_WEB_VIEW(tab->web_view)); } } gchar* escaped_url = g_markup_escape_text(url, -1); jumanji_db_bookmark_add(jumanji->database, url, title); girara_notify(session, GIRARA_INFO, "Added bookmark: %s", escaped_url); g_free(escaped_url); return true; }
gboolean cmd_bookmark(Browser *b, int argc, char **argv) { GList *list; char *uri, *tags, *bookmark; uri = strdup(webkit_web_view_get_uri(b->UI.view)); /* check if bookmark already exists in list */ for (list = ripcurl->Global.bookmarks; list; list = g_list_next(list)) { if (!strcmp(uri, (char *) list->data)) { /* remove old bookmark so tags are updated */ free(list->data); ripcurl->Global.bookmarks = g_list_delete_link(ripcurl->Global.bookmarks, list); break; } } /* append any tags to the bookmark string */ /* NOTE: argv is null terminated */ if (argc > 0) { tags = strjoinv(argv, " "); bookmark = strconcat(uri, " ", tags, NULL); free(tags); } else { bookmark = strdup(uri); } ripcurl->Global.bookmarks = g_list_prepend(ripcurl->Global.bookmarks, bookmark); free(uri); return TRUE; }
void cb_wv_notify_load_status(WebKitWebView *view, GParamSpec *pspec, Browser *b) { WebKitWebFrame *frame; WebKitWebDataSource *source; WebKitNetworkRequest *request; SoupMessage *message; char *uri; switch (webkit_web_view_get_load_status(b->UI.view)) { case WEBKIT_LOAD_COMMITTED: uri = browser_get_uri(b); if (strstr(uri, "https://") == uri) { /* get ssl state */ frame = webkit_web_view_get_main_frame(b->UI.view); source = webkit_web_frame_get_data_source(frame); request = webkit_web_data_source_get_request(source); message = webkit_network_request_get_message(request); b->State.ssl = soup_message_get_flags(message) ^ SOUP_MESSAGE_CERTIFICATE_TRUSTED; } break; case WEBKIT_LOAD_FINISHED: /* add uri to history */ if (!private_browsing && (uri = (char *)webkit_web_view_get_uri(b->UI.view))) { history_add(uri); } b->State.progress = 100; break; default: break; } /* update browser (statusbar, progress, position) */ browser_update(b); }
gboolean cog_handle_web_view_web_process_terminated (WebKitWebView *web_view, WebKitWebProcessTerminationReason reason, void *userdata) { const char *message = NULL; const char *title = NULL; switch (reason) { case WEBKIT_WEB_PROCESS_CRASHED: message = "The renderer process crashed. Reloading the page may" " fix intermittent failures."; title = "Crash!"; break; case WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT: message = "The renderer process ran out of memory. You may try" " reloading the page to restart it."; title = "Out of memory!"; break; default: g_assert_not_reached (); } return load_error_page (web_view, webkit_web_view_get_uri (web_view), title, message); }
wxString wxWebViewWebKit::GetCurrentURL() const { // FIXME: check which encoding the web kit control uses instead of // assuming UTF8 (here and elsewhere too) return wxString::FromUTF8(webkit_web_view_get_uri( WEBKIT_WEB_VIEW(web_view))); }
char * geturi(Client *c) { char *uri; if(!(uri = (char *)webkit_web_view_get_uri(c->view))) uri = "about:blank"; return uri; }
gchar * geturi(Client *c) { gchar *uri; if(!(uri = (gchar *)webkit_web_view_get_uri(c->view))) uri = g_strdup("about:blank"); return uri; }
gchar * geturi(Client *c) { gchar *uri; if(!(uri = (gchar *)webkit_web_view_get_uri(c->view))) uri = copystr(NULL, "about:blank"); return uri; }
JNIEXPORT jintLong JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1get_1uri) (JNIEnv *env, jclass that, jintLong arg0) { jintLong rc = 0; WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1get_1uri_FUNC); rc = (jintLong)webkit_web_view_get_uri((WebKitWebView *)arg0); WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1get_1uri_FUNC); return rc; }
char *browser_get_uri(Browser *b) { char *uri; if (!(uri = (char *)webkit_web_view_get_uri(b->UI.view))) { uri = "about:blank"; } return uri; }
void clipboard(Client *c, const Arg *arg) { gboolean paste = *(gboolean *)arg; if(paste) gtk_clipboard_request_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), pasteurl, c); else gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), webkit_web_view_get_uri(c->view), -1); }
static void play_media(GtkWidget* item, WebKitWebView* webView) { const gchar* uri = webkit_web_view_get_uri(webView); int r = 0; r = fork(); if (r == 0) { execl("/usr/local/bin/omxplayergui.py", "omxplayergui.py", "ytdl", uri, NULL); } }
static void webViewURIChanged(WebKitWebView *webView, GParamSpec *pspec, BrowserWindow *window) { char *externalURI = getExternalURI(webkit_web_view_get_uri(webView)); if (!strstr(externalURI, "resources/assets/newtab.html")) gtk_entry_set_text(GTK_ENTRY(window->uriEntry), externalURI); else gtk_entry_set_text(GTK_ENTRY(window->uriEntry), ""); g_free(externalURI); }
void changed_uri(GObject *obj, GParamSpec *pspec, gpointer data) { const gchar *t; struct Client *c = (struct Client *)data; t = webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)); gtk_entry_set_text(GTK_ENTRY(c->location), (t == NULL ? __NAME__ : t)); }
void cb_wv_hover_link(WebKitWebView *view, char *title, char *uri, Browser *b) { const char *text; if (uri) { gtk_label_set_text(b->Statusbar.text, uri); } else if ((text = webkit_web_view_get_uri(b->UI.view))) { gtk_label_set_text(b->Statusbar.text, text); } }
static VALUE WebView_uri(VALUE self) { VALUE __p_retval = Qnil; WebKitWebView *_self = ((WebKitWebView*)RVAL2GOBJ(self)); #line 285 "/home/ngl/Progetti/gtk-webkit-ruby/ext/webkit/webkit.cr" do { __p_retval = rb_str_new2(webkit_web_view_get_uri(_self)); goto out; } while(0); out: return __p_retval; }
static void downloadPage(GtkWidget* item, WebKitWebView* webView) { const gchar* uri = webkit_web_view_get_uri(webView); if (strncmp(uri, "file://", 7) != 0) { int r = 0; r = fork(); if (r == 0) { execl("/usr/local/bin/kwebhelper.py", "kwebhelper.py", "dlp", uri, NULL); } } }
static void web_view_load_changed(WebKitWebView *web_view, WebKitLoadEvent load_event, gpointer user_data) { switch (load_event) { case WEBKIT_LOAD_STARTED: /* New load, we have now a provisional URI */ printf("%s: load start\n", webkit_web_view_get_uri(web_view)); /* Here we could start a spinner or update the * location bar with the provisional URI */ break; case WEBKIT_LOAD_REDIRECTED: printf("%s: redirect\n", webkit_web_view_get_uri(web_view)); break; case WEBKIT_LOAD_COMMITTED: /* The load is being performed. Current URI is * the final one and it won't change unless a new * load is requested or a navigation within the * same page is performed */ printf("%s: commit\n", webkit_web_view_get_uri(web_view)); break; case WEBKIT_LOAD_FINISHED: printf("%s: finished\n", webkit_web_view_get_uri(web_view)); /* Load finished, we can now stop the spinner */ webkit_web_view_get_snapshot(web_view, WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT, WEBKIT_SNAPSHOT_OPTIONS_NONE, NULL, get_snapshot_finish, web_view ); gchar *script; script = get_jsfile(config->jsfile); //const gchar *script = "JSON.stringify(window.performance.timing)"; //script = "console.log('@#@#@#----console-')"; webkit_web_view_run_javascript(web_view, script, NULL, web_view_javascript_finished, NULL); free(script); break; } }
gchar *document_webkit_get_filename (Documentable *doc) { if (!doc) return NULL; Document_WebkitDetails *docdet = DOCUMENT_WEBKIT_GET_PRIVATE(doc); GFile *file = NULL; gchar *uri = g_strdup(webkit_web_view_get_uri (WEBKIT_WEB_VIEW(docdet->help_view))); if (!uri){ g_object_get(doc, "GFile", &file, NULL); uri = g_file_get_uri(file); } return uri; }
void addressbarToggle(RuskWindow *rusk) { if(!gtk_widget_is_visible(GTK_WIDGET(rusk->addressbar))) { gtk_entry_set_text(rusk->addressbar, webkit_web_view_get_uri(rusk->webview)); gtk_widget_set_visible(GTK_WIDGET(rusk->addressbar), TRUE); gtk_window_set_focus(rusk->window, GTK_WIDGET(rusk->addressbar)); }else { gtk_widget_set_visible(GTK_WIDGET(rusk->addressbar), FALSE); gtk_window_set_focus(rusk->window, GTK_WIDGET(rusk->webview)); } }
void create_web_view_got_uri_cb (WebKitWebView* web_view, GParamSpec param_spec) { (void) web_view; (void) param_spec; webkit_web_view_stop_loading(web_view); const gchar* uri = webkit_web_view_get_uri(web_view); if (strncmp(uri, "javascript:", strlen("javascript:")) == 0) eval_js(uzbl.gui.web_view, (gchar*) uri + strlen("javascript:"), NULL, "javascript:"); else send_event(NEW_WINDOW, NULL, TYPE_STR, uri, NULL); }
void create_web_view_js2_cb (WebKitWebView* web_view, GParamSpec param_spec) { (void) web_view; (void) param_spec; const gchar* uri = webkit_web_view_get_uri(web_view); if (strncmp(uri, "javascript:", strlen("javascript:")) == 0) { eval_js(uzbl.gui.web_view, (gchar*) uri + strlen("javascript:"), NULL, "javascript:"); gtk_widget_destroy(GTK_WIDGET(web_view)); } else send_event(NEW_WINDOW, NULL, TYPE_STR, uri, NULL); }
static void load_changed (WebKitWebView *web_view, /*WebKitLoadEvent*/ int load_event, gpointer user_data) { g_print("LOAD %d\n", load_event); #if 0 gchar *provisional_uri; gchar *redirected_uri; gchar *uri; switch (load_event) { case WEBKIT_LOAD_STARTED: /* New load, we have now a provisional URI */ provisional_uri = webkit_web_view_get_uri (web_view); g_print("provisional_uri=%s\n", provisional_uri); /* Here we could start a spinner or update the * location bar with the provisional URI */ break; case WEBKIT_LOAD_REDIRECTED: redirected_uri = webkit_web_view_get_uri (web_view); g_print("redirected_uri=%s\n", redirected_uri); break; case WEBKIT_LOAD_COMMITTED: /* The load is being performed. Current URI is * the final one and it won't change unless a new * load is requested or a navigation within the * same page is performed */ uri = webkit_web_view_get_uri (web_view); g_print("uri=%s\n", uri); break; case WEBKIT_LOAD_FINISHED: /* Load finished, we can now stop the spinner */ g_print("finished\n"); break; } #endif }
static void load_status_cb (GObject* object, GParamSpec* pspec, gpointer data) { WebKitWebView *web_view; WebKitLoadStatus status; GMainLoop* loop; loop = (GMainLoop *) data; web_view = WEBKIT_WEB_VIEW(object); status = webkit_web_view_get_load_status(web_view); if (status == WEBKIT_LOAD_FINISHED) { printf("Finished with %s\n", webkit_web_view_get_uri(web_view)); g_main_loop_quit(loop); } }
void changed_title(GObject *obj, GParamSpec *pspec, gpointer data) { const gchar *t, *u; struct Client *c = (struct Client *)data; u = webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)); t = webkit_web_view_get_title(WEBKIT_WEB_VIEW(c->web_view)); u = u == NULL ? __NAME__ : u; u = u[0] == 0 ? __NAME__ : u; t = t == NULL ? u : t; t = t[0] == 0 ? u : t; gtk_window_set_title(GTK_WINDOW(c->win), t); }