本文整理汇总了C++中WEBKIT_WEB_VIEW函数的典型用法代码示例。如果您正苦于以下问题:C++ WEBKIT_WEB_VIEW函数的具体用法?C++ WEBKIT_WEB_VIEW怎么用?C++ WEBKIT_WEB_VIEW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WEBKIT_WEB_VIEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: show_scrollbars
void
show_scrollbars(widget_t *w, gboolean show)
{
GtkWidget *view = g_object_get_data(G_OBJECT(w->widget), "webview");
WebKitWebFrame *mf = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(view));
gulong id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(view), "hide_handler_id"));
if (show) {
if (id)
g_signal_handler_disconnect((gpointer) mf, id);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
id = 0;
} else if (!id) {
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w->widget), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
id = g_signal_connect(G_OBJECT(mf), "scrollbars-policy-changed", G_CALLBACK(true_cb), NULL);
}
g_object_set_data(G_OBJECT(view), "hide_handler_id", GINT_TO_POINTER(id));
}
示例2: search_bar_show
static void
search_bar_show (GtkWidget *widget)
{
ESearchBar *search_bar;
EWebView *web_view;
search_bar = E_SEARCH_BAR (widget);
/* Chain up to parent's show() method. */
GTK_WIDGET_CLASS (e_search_bar_parent_class)->show (widget);
gtk_widget_grab_focus (search_bar->priv->entry);
web_view = e_search_bar_get_web_view (search_bar);
webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW (web_view));
search_bar_find (search_bar, TRUE);
}
示例3: ghtml_get_source
/* ghtml_get_source */
char const * ghtml_get_source(GtkWidget * widget)
{
#if WEBKIT_CHECK_VERSION(1, 1, 0)
GHtml * ghtml;
WebKitWebFrame * frame;
WebKitWebDataSource * source;
GString * str;
ghtml = g_object_get_data(G_OBJECT(widget), "ghtml");
frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(ghtml->view));
source = webkit_web_frame_get_data_source(frame);
if((str = webkit_web_data_source_get_data(source)) == NULL)
return NULL;
return str->str;
#else
return NULL;
#endif
}
示例4: dialog_unmap
static void
dialog_unmap (GtkWidget *window,
GtkWidget *paned)
{
DialogData data;
gtk_window_get_size (GTK_WINDOW (window), &data.width, &data.height);
data.paned_position = gtk_paned_get_position (GTK_PANED (paned));
data.show_index = gtk_widget_get_visible (sidebar);
data.zoom = (view ?
webkit_web_view_get_zoom_level (WEBKIT_WEB_VIEW (view)) : 1.0);
gimp_set_data (GIMP_HELP_BROWSER_DIALOG_DATA, &data, sizeof (data));
gtk_main_quit ();
}
示例5: _interface_tweaks_on_notify_view_load_status
/* Status of loading a site has changed */
static void _interface_tweaks_on_notify_view_load_status(InterfaceTweaks *self, GParamSpec *inSpec, gpointer inUserData)
{
g_return_if_fail(IS_INTERFACE_TWEAKS(self));
g_return_if_fail(WEBKIT_IS_WEB_VIEW(inUserData));
InterfaceTweaksPrivate *priv=self->priv;
WebKitWebView *webkitView=WEBKIT_WEB_VIEW(inUserData);
WebKitLoadStatus status;
/* Check load status */
status=webkit_web_view_get_load_status(webkitView);
/* If webview was prepared to start network request */
if(status==WEBKIT_LOAD_PROVISIONAL)
{
/* Show start-request throbber now if set */
if(priv->showStartRequestThrobber)
{
MidoriView *view;
KatzeThrobber *throbber;
/* Get Midori view and the size for icon in tab */
view=midori_view_get_for_widget(GTK_WIDGET(webkitView));
/* Start throbber animation of view */
throbber=_interface_tweaks_find_view_throbber(view);
if(throbber) katze_throbber_set_animated(throbber, TRUE);
}
}
/* First data of network response has been sent or first data of
* network response has been received
*/
if(status==WEBKIT_LOAD_COMMITTED)
{
const gchar *uri;
/* Get URI for current request */
uri=webkit_web_view_get_uri(webkitView);
/* Add URI to completion model */
_interface_tweaks_add_uri_to_completion_model(self, uri);
}
}
示例6: night_mode_tabs_view_notify_uri_cb
static void
night_mode_tabs_view_notify_uri_cb (MidoriView* view,
GParamSpec* pspec,
MidoriExtension* extension)
{
gchar* exception = NULL;
gchar *script=NULL;
FILE *fp;
int file_size;
gboolean result;
const gchar* uri = midori_view_get_display_uri (view);
if (!*uri)
return;
if (g_night_mode)
{
if (!midori_uri_is_blank (uri))
{
gchar* hostname = midori_uri_parse_hostname (uri, NULL);
if (hostname)
{
if((fp=fopen(midori_paths_get_res_filename("night_mode/nightingale_view_content.js"),"r"))!=NULL)
{
fseek(fp,0,SEEK_END);
file_size=ftell(fp);
fseek(fp,0,SEEK_SET);
script=(char *)malloc(file_size * sizeof(char)+1);
fread(script,file_size,sizeof(char),fp);
script[file_size*sizeof(char)]='\0';
fclose(fp);
result = midori_view_execute_script (view, script, &exception);
free(script);
script=NULL;
}
g_free (hostname);
}
}
}
else
{
GtkWidget* current_web_view = midori_view_get_web_view (MIDORI_VIEW (view));
webkit_web_view_run_javascript(WEBKIT_WEB_VIEW (current_web_view), night_mode_remove, NULL, NULL, NULL);
}
}
示例7: _interface_tweaks_on_add_tab
/* A tab of a browser was added */
static void _interface_tweaks_on_add_tab(InterfaceTweaks *self, MidoriView *inView, gpointer inUserData)
{
g_return_if_fail(IS_INTERFACE_TWEAKS(self));
g_return_if_fail(MIDORI_IS_VIEW(inView));
g_return_if_fail(MIDORI_IS_BROWSER(inUserData));
WebKitWebView *webkitView;
/* Connect signals to midori view and webkit webview to monitor loading state */
g_signal_connect_swapped(inView, "notify::minimized", G_CALLBACK(_interface_tweaks_on_notify_minimized_tab_for_close_button), self);
_interface_tweaks_on_notify_minimized_tab_for_close_button(self, NULL, inView);
g_signal_connect_swapped(inView, "notify::minimized", G_CALLBACK(_interface_tweaks_on_notify_minimized_tab_for_group_tabs), self);
_interface_tweaks_on_notify_minimized_tab_for_group_tabs(self, NULL, inView);
webkitView=WEBKIT_WEB_VIEW(midori_view_get_web_view(inView));
g_signal_connect_swapped(webkitView, "notify::load-status", G_CALLBACK(_interface_tweaks_on_notify_view_load_status), self);
_interface_tweaks_on_notify_view_load_status(self, NULL, webkitView);
}
示例8: test_webkit_download_perform
static void
test_webkit_download_perform(void)
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_object_ref_sink(G_OBJECT(webView));
g_signal_connect(webView, "navigation-policy-decision-requested",
G_CALLBACK(navigation_policy_decision_requested_cb),
NULL);
gboolean beenThere = FALSE;
g_signal_connect(webView, "download-requested",
G_CALLBACK(download_requested_cb),
&beenThere);
/* Preparation; FIXME: we should move this code to a test
* utilities file, because we have a very similar one in
* testwebframe.c */
GError *error = NULL;
int fd = g_file_open_tmp ("webkit-testwebdownload-XXXXXX",
&temporaryFilename, &error);
close(fd);
if (error)
g_critical("Failed to open a temporary file for writing: %s.", error->message);
if (g_unlink(temporaryFilename) == -1)
g_critical("Failed to delete the temporary file: %s.", g_strerror(errno));
loop = g_main_loop_new(NULL, TRUE);
webkit_web_view_load_uri(webView, "http://gnome.org/");
g_main_loop_run(loop);
g_assert_cmpint(beenThere, ==, TRUE);
g_assert_cmpint(g_file_test(temporaryFilename, G_FILE_TEST_IS_REGULAR), ==, TRUE);
g_unlink(temporaryFilename);
g_free(temporaryFilename);
g_main_loop_unref(loop);
g_object_unref(webView);
}
示例9: phidias_items_classic_set_model
static void phidias_items_classic_set_model (PhidiasItemsViewer *self, GtkTreeModel *items)
{
GtkTreeModel *sorter;
PhidiasItemsClassic *item;
item = PHIDIAS_ITEMS_CLASSIC (self);
webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (item->priv->description), "", "file://");
sorter = gtk_tree_view_get_model (GTK_TREE_VIEW (item->priv->list));
if (sorter != NULL)
g_object_unref (sorter);
sorter = gtk_tree_model_sort_new_with_model (items);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sorter), ITEM_INFO_DATE, GTK_SORT_DESCENDING);
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (sorter), ITEM_INFO_DATE, sort_items, NULL, NULL);
gtk_tree_view_set_model (GTK_TREE_VIEW (item->priv->list), sorter);
scroll_to_position (item);
}
示例10: WEBKIT_WEB_VIEW
gchar *webview_executeExpression(WebView *webview, const gchar *expr) {
WebKitWebView *widget = WEBKIT_WEB_VIEW(webview->widget);
/*
A "nicer" solution would be to catch "window-object-cleared" and add
a special property/function there, but that's much more work for little
practical benefit.
*/
// Use the title to store the value of the expression
webview_executeFormattedScript(webview, "var oldTitle = document.title;"
"document.title = encodeURIComponent(%s);", expr);
gchar *result = g_uri_unescape_string(webkit_web_view_get_title(widget), NULL);
// Restore old title
webview_executeScript(webview, "document.title = oldTitle; delete oldTitle;");
return result;
}
示例11: testWebkitAtkGetTextInParagraphAndBodyModerate
static void testWebkitAtkGetTextInParagraphAndBodyModerate(void)
{
WebKitWebView* webView;
AtkObject* obj;
AtkObject* obj1;
AtkObject* obj2;
GMainLoop* loop;
AtkText* textObj1;
AtkText* textObj2;
webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_object_ref_sink(webView);
GtkAllocation alloc = { 0, 0, 800, 600 };
gtk_widget_size_allocate(GTK_WIDGET(webView), &alloc);
webkit_web_view_load_string(webView, contentsInParagraphAndBodyModerate, NULL, NULL, NULL);
loop = g_main_loop_new(NULL, TRUE);
g_timeout_add(100, (GSourceFunc)bail_out, loop);
g_main_loop_run(loop);
/* Get to the inner AtkText object */
obj = gtk_widget_get_accessible(GTK_WIDGET(webView));
g_assert(obj);
obj1 = atk_object_ref_accessible_child(obj, 0);
g_assert(obj1);
obj2 = atk_object_ref_accessible_child(obj, 1);
g_assert(obj2);
textObj1 = ATK_TEXT(obj1);
g_assert(ATK_IS_TEXT(textObj1));
textObj2 = ATK_TEXT(obj2);
g_assert(ATK_IS_TEXT(textObj2));
char *text = atk_text_get_text(textObj1, 0, -1);
g_assert_cmpstr(text, ==, "This is a test.");
text = atk_text_get_text(textObj2, 0, 53);
g_assert_cmpstr(text, ==, "Hello world.\nThis sentence is green.\nThis one is not.");
g_object_unref(obj1);
g_object_unref(obj2);
g_object_unref(webView);
}
示例12: copy_location_callback
static void
copy_location_callback (GtkAction *action,
gpointer data)
{
WebKitWebFrame *frame;
const gchar *uri;
frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view));
uri = webkit_web_frame_get_uri (frame);
if (uri)
{
GtkClipboard *clipboard;
clipboard = gtk_clipboard_get_for_display (gtk_widget_get_display (view),
GDK_SELECTION_CLIPBOARD);
gtk_clipboard_set_text (clipboard, uri, -1);
}
}
示例13: main
int
main (int argc, gchar *argv[])
{
#ifndef NOX11
initialize_x11();
#endif
char *uri = "http://OSjs.local";
// Initialize GTK+
if ( !g_thread_supported() )
g_thread_init (NULL);
gtk_init_check (&argc, &argv);
// Create WebKit view
WebKitWebView *web_view;
web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
webkit_web_view_load_uri (web_view, uri);
// Create Window
GtkWidget *window;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET(web_view));
// Run
gtk_widget_show_all (window);
gtk_window_fullscreen (GTK_WINDOW(window));
gtk_main();
#ifndef NOX11
XCloseDisplay(d);
#endif
return 0;
}
示例14: liferea_webkit_launch_url
/**
* Launch URL
*/
static void
liferea_webkit_launch_url (GtkWidget *scrollpane, const gchar *url)
{
// FIXME: hack to make URIs like "gnome.org" work
// https://bugs.webkit.org/show_bug.cgi?id=24195
gchar *http_url;
if (!strstr (url, "://")) {
http_url = g_strdup_printf ("http://%s", url);
} else {
http_url = g_strdup (url);
}
webkit_web_view_load_uri (
WEBKIT_WEB_VIEW (gtk_bin_get_child (GTK_BIN (scrollpane))),
http_url
);
g_free (http_url);
}
示例15: night_mode_deactivated_cb
static void
night_mode_deactivated_cb (MidoriExtension* extension,
MidoriBrowser* browser)
{
if(night_mode_button)
gtk_widget_destroy (night_mode_button);
g_signal_handlers_disconnect_by_func (extension, night_mode_deactivated_cb, browser);
if(g_night_mode)
{
GList* children = midori_browser_get_tabs (MIDORI_BROWSER (browser));
for (; children; children = g_list_next (children))
{
GtkWidget* current_web_view = midori_view_get_web_view (MIDORI_VIEW (children->data));
webkit_web_view_run_javascript(WEBKIT_WEB_VIEW (current_web_view), night_mode_remove, NULL, NULL, NULL);
}
g_list_free (children);
g_signal_handlers_disconnect_by_func (browser, night_mode_extension_browser_add_tab_cb, NULL);
}
}