int main(int argc, char *argv[]) { //GtkBuilder *builder; //GtkWidget *scrolledWindow; //gtk_init (&argc, &argv); ///* Construct a GtkBuilder instance and load our UI description */ //builder = gtk_builder_new (); //gtk_builder_add_from_file (builder, "builder.ui", NULL); // Create a browser instance /* Connect signal handlers to the constructed widgets. */ //main_window = gtk_builder_get_object (builder, "main_window"); //g_signal_connect (main_window, "destroy", G_CALLBACK (gtk_main_quit), NULL); //scrolledWindow = GTK_WIDGET(gtk_builder_get_object (builder, "scrolledWindow")); //gtk_container_add(GTK_CONTAINER(scrolledWindow), GTK_WIDGET(webView)); //// Set up callbacks so that if either the main window or the browser instance is //// closed, the program will exit //g_signal_connect(main_window, "destroy", G_CALLBACK(destroyWindowCb), NULL); //g_signal_connect(webView, "close-web-view", G_CALLBACK(closeWebViewCb), main_window); // Load a web page into the browser instance gtk_init(0, NULL); GtkWidget *main_window = gtk_offscreen_window_new(); WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); gtk_container_add(GTK_CONTAINER(main_window), GTK_WIDGET(webView)); webkit_web_view_load_uri(webView, "http://www.baidu.com/"); gtk_widget_grab_focus(GTK_WIDGET(webView)); // webView in not shown yet gtk_widget_show_all(GTK_WIDGET(main_window)); webkit_web_view_get_snapshot(webView, WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT, WEBKIT_SNAPSHOT_OPTIONS_NONE, NULL, get_snapshot_finish, webView ); gtk_main(); return 0; }
void KidGames( GtkWidget* widget , gpointer* wid) { gtk_entry_set_text(GTK_ENTRY(UrlText),"https://www.gofundme.com/blackberrycreek"); gtk_widget_show_all(UrlText); uri = gtk_entry_get_text(GTK_ENTRY(UrlText)); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),uri); }
void WarGame(GtkWidget* widget , gpointer* wid) { gtk_entry_set_text(GTK_ENTRY(UrlText),"http://armorgames.com/category/war-games"); gtk_widget_show_all(UrlText); uri = gtk_entry_get_text(GTK_ENTRY(UrlText)); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),uri); }
void KidsMovies() { char url[45]; strcpy(url,"http://pbskids.org/video/"); gtk_entry_set_text(GTK_ENTRY(UrlText),url); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),url); }
//fun void NijiaBoys() { gtk_entry_set_text(GTK_ENTRY(UrlText),"http://www.gq234.com/basketmouth-night-of-a-thousand-laughs-vol-19/"); gtk_widget_show_all(UrlText); uri = gtk_entry_get_text(GTK_ENTRY(UrlText)); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),uri); }
void Bollywood( ) { char url[45]; strcpy(url,"http://www.bollywood.com"); gtk_entry_set_text(GTK_ENTRY(UrlText),url); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),url); }
void HipHopMusic( ) { char url[45]; strcpy(url,"http://allhiphop.com/"); gtk_entry_set_text(GTK_ENTRY(UrlText),url); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),url); }
void browser_dialog_load (const gchar *uri) { g_return_if_fail (uri != NULL); webkit_web_view_load_uri (WEBKIT_WEB_VIEW (view), uri); select_index (uri); gtk_window_present (GTK_WINDOW (gtk_widget_get_toplevel (view))); }
JNIEXPORT void JNICALL WebKitGTK_NATIVE(_1webkit_1web_1view_1load_1uri) (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) { jbyte *lparg1=NULL; WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1web_1view_1load_1uri_FUNC); if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; webkit_web_view_load_uri((WebKitWebView *)arg0, (const gchar *)lparg1); fail: if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1web_1view_1load_1uri_FUNC); }
static void test_webkit_web_view_grab_focus() { char* uri = g_strconcat(base_uri, "iframe.html", NULL); GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP); GtkWidget* scrolled_window = gtk_scrolled_window_new(NULL, NULL); WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new()); GtkAdjustment* adjustment; gtk_window_set_default_size(GTK_WINDOW(window), 400, 200); gtk_container_add(GTK_CONTAINER(window), scrolled_window); gtk_container_add(GTK_CONTAINER(scrolled_window), GTK_WIDGET(view)); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); loop = g_main_loop_new(NULL, TRUE); g_signal_connect(view, "notify::progress", G_CALLBACK (idle_quit_loop_cb), NULL); /* Wait for window to show up */ gtk_widget_show_all(window); g_signal_connect(window, "map-event", G_CALLBACK(map_event_cb), loop); g_main_loop_run(loop); /* Load a page with a big div that will cause scrollbars to appear */ webkit_web_view_load_uri(view, uri); g_main_loop_run(loop); adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolled_window)); g_assert_cmpfloat(gtk_adjustment_get_value(adjustment), ==, 0.0); /* Since webkit_web_view_execute_script does not return a value, it is impossible to know if an inner document has focus after a node of it was focused via .focus() method. The code below is an workaround: if the node has focus, a scroll action is performed and afterward it is checked if the adjustment has to be different from 0. */ char script[] = "var innerDoc = document.defaultView.frames[0].document; \ innerDoc.getElementById(\"link\").focus(); \ if (innerDoc.hasFocus()) \ window.scrollBy(0, 100);"; /* Focus an element using JavaScript */ webkit_web_view_execute_script(view, script); /* Make sure the ScrolledWindow noticed the scroll */ g_assert_cmpfloat(gtk_adjustment_get_value(adjustment), !=, 0.0); g_free(uri); gtk_widget_destroy(window); }
void on_exitbuttonclicked(GtkWidget *widget, gpointer data) { TRACEINFO; int posx,posy; sPlayerInterface* player_interf = (sPlayerInterface*)data; //~ gtk_window_set_transient_for(GTK_WINDOW(player_interf->ui->pWebWindow),GTK_WINDOW(player_interf->ui->pTVWindow)); get_window_position(player_interf->ui->pWebWindow, &posx, &posy); resizevideoplayer(player_interf, HBBTV_VIDEO_WIDTH, HBBTV_VIDEO_HEIGHT); set_window_position(player_interf->ui->pTVWindow, posx, posy); gtk_window_set_position(GTK_WINDOW(player_interf->ui->pTVWindow),GTK_WIN_POS_CENTER_ALWAYS); webkit_web_view_load_uri(player_interf->ui->pWebView, player_interf->url); }
void AfricaFun() { gtk_entry_set_text(GTK_ENTRY(UrlText),"https://www.youtube.com/watch?v=sPLVhVutaHE"); gtk_widget_show_all(UrlText); uri = gtk_entry_get_text(GTK_ENTRY(UrlText)); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),uri); }
//Movies void Nollywood( ) { char url[45]; strcpy(url,"http://www.nollywoodmovies.tv/files/index.php"); gtk_entry_set_text(GTK_ENTRY(UrlText),url); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),url); }
static PyObject * _webview_load_document(WebViewObject *self, PyObject* args) { gchar *url = NULL; if (!PyArg_ParseTuple(args, "s", &url)) return NULL; webkit_web_view_load_uri(self->webview, url); Py_INCREF(Py_None); return Py_None; }
void Home() { char url[200]="file://"; char name[200]; getcwd(name,200); strcat(name,"/bolf/bolfhome.html"); strcat(url,name); gtk_entry_set_text(GTK_ENTRY(UrlText),url); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),url); }
static VALUE WebView_load_uri(VALUE self, VALUE __v_uri) { char * uri; char * __orig_uri; WebKitWebView *_self = ((WebKitWebView*)RVAL2GOBJ(self)); __orig_uri = uri = ( NIL_P(__v_uri) ? NULL : StringValuePtr(__v_uri) ); #line 268 "/home/ngl/Progetti/gtk-webkit-ruby/ext/webkit/webkit.cr" webkit_web_view_load_uri(_self, uri); return Qnil; }
gboolean contents_click_handler( WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer data) { webkit_web_view_load_uri(WEBKIT_WEB_VIEW(data), webkit_network_request_get_uri(request)); return TRUE; }
//Internet Functions void InputConnect( GtkWidget* widget,gpointer* wid) { /* char url[35]="http://"; Widget InputText = GTK_WIDGET(wid); uri = gtk_entry_get_text(GTK_ENTRY(InputText)); strcat(url,uri); gtk_entry_set_text(GTK_ENTRY(UrlText),url); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web),url); */ //Checking if the web address already has http attached to if, if not it is attached to the address Widget Input = GTK_WIDGET(wid); uri = gtk_entry_get_text(GTK_ENTRY(Input)); //These if constructs ensure that the url is in order //If address is online or on user's machine //seting the count of the notebook if( (uri[0] == 'h' && uri[1] == 't' && uri[2] == 't' && uri[3] == 'p') || (uri[0] == 'f' && uri[1] == 'i' && uri[2] == 'l' && uri[3] == 'e')){ //The address is in the correct format // uri = gtk_entry__text(GTK_ENTRY(InputText)); } else{ if( uri[0] == 'w' && uri[1] == 'w' && uri[2] == 'w'){ //address lacks http://, which is added gtk_entry_prepend_text(GTK_ENTRY(Input),"http://"); uri = gtk_entry_get_text(GTK_ENTRY(Input)); } else{ if( strstr(uri, ".com") && uri[0] != '.'){ //if address ends with .com like youtube.com gtk_entry_prepend_text(GTK_ENTRY(Input),"http://www."); uri = gtk_entry_get_text(GTK_ENTRY(Input)); } else{ //if address has none of the above, google is used to search for the user's text gtk_entry_prepend_text(GTK_ENTRY(Input),"http://www.google.com/"); uri = gtk_entry_get_text(GTK_ENTRY(Input)); } } } gtk_entry_set_text(GTK_ENTRY(UrlText),uri); //gtk_entry_set_text(GTK_ENTRY(Input),"."); gtk_entry_progress_pulse(GTK_ENTRY(UrlText)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(web[count]),uri); }
void loaduri(Client *c, const Arg *arg) { char *u; const char *uri = (char *)arg->v; u = g_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("http://%s", uri); webkit_web_view_load_uri(c->view, u); c->progress = 0; c->title = copystr(&c->title, u); g_free(u); update(c); }
/** * html_load_file_at_anchor: * @html: a #WebKitWebView * @file: a #GFile * @anchor: a tag on the page * * Have @html display the HTML file referenced by @file, and jump to the tag * specified by @anchor. */ void html_load_file_at_anchor(WebKitWebView *html, GFile *file, const char *anchor) { g_return_if_fail(html); g_return_if_fail(file); g_return_if_fail(anchor); char *uri = g_file_get_uri(file); char *real_uri = g_strconcat(uri, "#", anchor, NULL); g_free(uri); webkit_web_view_load_uri(html, real_uri); g_free(real_uri); }
GtkWidget * oauth_ask_authorization_dialog_new (const char *uri) { OAuthAskAuthorizationDialog *self; self = g_object_new (OAUTH_TYPE_ASK_AUTHORIZATION_DIALOG, "title", _("Authorization Required"), NULL); if (uri != NULL) webkit_web_view_load_uri (WEBKIT_WEB_VIEW (self->priv->view), uri); return (GtkWidget *) self; }
static void loadURI(const char *uri) { WebKitWebView *view = WEBKIT_WEB_VIEW(webkit_web_view_new()); gboolean iconOrPageLoaded = FALSE; webkit_web_view_load_uri(view, uri); g_signal_connect(view, "notify::load-status", G_CALLBACK(idleQuitLoopCallback), &iconOrPageLoaded); g_signal_connect(view, "icon-loaded", G_CALLBACK(webkitWebViewIconLoaded), &iconOrPageLoaded); g_main_loop_run(loop); g_signal_handlers_disconnect_matched(view, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, &iconOrPageLoaded); }
int main(int argc, char* argv[]) { // Initialize GTK+ gtk_init(&argc, &argv); if (argc < 2) { printf("Usage: solar-webkitgtk <uri>\n"); return 1; } const gchar *uri = argv[1]; // Create an 800x600 window that will contain the browser instance GtkWidget *main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* gtk_window_set_default_size(GTK_WINDOW(main_window), 7205, 2598); */ gtk_window_set_default_size(GTK_WINDOW(main_window), 7205, 2598); gtk_window_set_decorated(GTK_WINDOW(main_window), FALSE); gtk_widget_set_size_request(main_window, 7205, 2598); gtk_window_set_resizable(GTK_WINDOW(main_window), FALSE); // Create a browser instance WebKitWebView *web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); // Put the browser area into the main window gtk_container_add(GTK_CONTAINER(main_window), GTK_WIDGET(web_view)); g_object_set(webkit_web_view_get_settings(web_view), "enable-webgl", TRUE, NULL); g_object_set(webkit_web_view_get_settings(web_view), "enable-write-console-messages-to-stdout", TRUE, NULL); // Set up callbacks so that if either the main window or the browser instance is // closed, the program will exit g_signal_connect(main_window, "destroy", G_CALLBACK(destroyWindowCb), NULL); g_signal_connect(web_view, "close", G_CALLBACK(closeWebViewCb), main_window); g_signal_connect(web_view, "load-changed", G_CALLBACK(load_status_cb), NULL); g_signal_connect(web_view, "button-press-event", G_CALLBACK(button_click_cb), NULL); // Load a web page into the browser instance webkit_web_view_load_uri(web_view, uri); // Make sure that when the browser area becomes visible, it will get mouse // and keyboard events gtk_widget_grab_focus(GTK_WIDGET(web_view)); // Make sure the main window and all its contents are visible gtk_widget_show_all(main_window); // Run the main GTK+ event loop gtk_main(); return 0; }
void loaduri(Client *c, const Arg *arg) { gchar *u; const gchar *uri = (gchar *)arg->v; if(!uri) uri = gtk_entry_get_text(GTK_ENTRY(c->urlbar)); u = g_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("http://%s", uri); webkit_web_view_load_uri(c->view, u); c->progress = 0; c->title = copystr(&c->title, u); g_free(u); update(c); }
void browser_load_uri(Browser * b, char *uri) { char *new_uri = NULL; if (!uri) { new_uri = strdup(home_page); } else { new_uri = strdup(uri); } webkit_web_view_load_uri(b->UI.view, new_uri); free(new_uri); }
int main(int argc, char* argv[]) { gtk_init(&argc, &argv); if (argc == 1) { printf("Usage: URI\n"); return 1; } const char *uri = argv[1]; if(!g_thread_supported()) g_thread_init(NULL); // Create a Window, set colormap to RGBA GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL); GdkScreen *screen = gtk_widget_get_screen(window); #if GTK_CHECK_VERSION(3, 0, 0) GdkVisual *visual = gdk_screen_get_rgba_visual(screen); if (visual && gdk_screen_is_composited (screen)) { gtk_widget_set_visual(GTK_WIDGET(window), visual); } #else GdkColormap *rgba = gdk_screen_get_rgba_colormap (screen);s if (rgba && gdk_screen_is_composited (screen)) { gtk_widget_set_default_colormap(rgba); gtk_widget_set_default_colormap(rgba); } #endif gtk_window_set_default_size(GTK_WINDOW(window), 600, 400); g_signal_connect(window, "destroy", G_CALLBACK(destroy_cb), NULL); // Optional: for dashboard style borderless windows gtk_window_set_decorated(GTK_WINDOW(window), FALSE); // Create a WebView, set it transparent, add it to the window WebKitWebView* web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); webkit_web_view_set_transparent(web_view, TRUE); gtk_container_add (GTK_CONTAINER(window), GTK_WIDGET(web_view)); // Load a default page webkit_web_view_load_uri(web_view, uri); // Show it and continue running until the window closes gtk_widget_grab_focus(GTK_WIDGET(web_view)); gtk_widget_show_all(window); gtk_main(); return 0; }
bool Dedika::Run() { gtk_container_add(GTK_CONTAINER(window), webContainer); gtk_container_add(GTK_CONTAINER(webContainer), GTK_WIDGET(webView)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webView), baseurl.c_str()); gtk_widget_show_all(window); gtk_widget_grab_focus(webView); gtk_main(); return true; }
int main(int argc, char** argv) { gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(window, "key-press-event", G_CALLBACK(on_key_press), NULL); g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); web_view = WEBKIT_WEB_VIEW(webkit_web_view_new()); webFrame = webkit_web_view_get_main_frame (web_view); context = webkit_web_frame_get_global_context(webFrame); globalObject = JSContextGetGlobalObject(context); setlogmask (LOG_UPTO (LOG_NOTICE)); openlog ("kioskbrowser", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); signal(SIGHUP, reload_browser); signal(SIGUSR1, jsmessage); signal(SIGUSR2, jsmessage); gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(web_view)); if(argc > 1) { webkit_web_view_load_uri(web_view, argv[1]); } else { webkit_web_view_load_uri(web_view, default_url); } maximize(); gtk_widget_show_all(window); gtk_main(); return 0; }
static void test_loading_cancelled(WebLoadingFixture* fixture, gconstpointer data) { char* uri_string; g_test_bug("29644"); g_signal_connect(fixture->webView, "load-error", G_CALLBACK(load_cancelled_cb), fixture); g_signal_connect(fixture->webView, "notify::load-status", G_CALLBACK(load_cancelled_status_changed_cb), fixture); uri_string = get_uri_for_path("/test_loading_cancelled"); webkit_web_view_load_uri(fixture->webView, uri_string); g_free(uri_string); g_main_loop_run(fixture->loop); }
void *GtkMain(void * argument) { printf("%s:%d\n", __func__, __LINE__); int argc = 0; char**argv = NULL; unsigned char haveUrl = 0; int argCount = 0; gtk_init (&argc, &argv); if (!g_thread_supported ()) g_thread_init (NULL); GtkWidget* fixed = gtk_fixed_new(); //screen_changed(fixed, NULL, NULL); g_vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (g_vbox), create_toolbar (), FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (g_vbox), GTK_WIDGET (create_browser ()), TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (g_vbox), create_statusbar (), FALSE, FALSE, 0); g_window = create_window (); gtk_fixed_put(GTK_FIXED(fixed), g_vbox, 0, 0); gtk_widget_set_size_request(g_vbox, g_framebuffer_width, g_framebuffer_height); GtkWidget* statusLabel = gtk_label_new ("Status"); gtk_fixed_put(GTK_FIXED(fixed), statusLabel, g_framebuffer_width - 200, 0); gtk_widget_set_size_request(statusLabel, 200, 100); gtk_container_add (GTK_CONTAINER (g_window), fixed); webkit_web_view_load_uri (g_web_view, g_url); gtk_widget_grab_focus (GTK_WIDGET (g_web_view)); gtk_widget_show_all (g_window); toogleMode(); g_default_scale = g_framebuffer_width / 1280.0f; handleZoomLock(0); g_Callback(1); gtk_main (); return NULL; }