WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

@@bool ChromeClient::runJavaScriptPrompt(F
236236void ChromeClient::setStatusbarText(const String& string)
237237{
238238 CString stringMessage = string.utf8();
239  g_signal_emit_by_name(m_webView, "status-bar-text-changed", stringMessage.data());
 239 g_signal_emit_by_name(m_webView, "statusbar-text-changed", stringMessage.data());
240240}
241241
242242bool ChromeClient::shouldInterruptJavaScript()
Revision 30037

WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

11/*
22 * Copyright (C) 2007 Alp Toker <[email protected]>
33 * Copyright (C) 2007 Holger Hans Peter Freyther
4  * Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
 4 * Copyright (C) 2007, 2008 Christian Dywan <christian@imendio.com>
55 *
66 * This library is free software; you can redistribute it and/or
77 * modify it under the terms of the GNU Lesser General Public

4949#include <sys/utsname.h>
5050#endif
5151
 52#include <glib/gi18n.h>
 53
5254using namespace WebCore;
5355
5456namespace WebKit {

@@void FrameLoaderClient::assignIdentifier
188190void FrameLoaderClient::postProgressStartedNotification()
189191{
190192 WebKitWebView* webView = getViewFromFrame(m_frame);
191  g_signal_emit_by_name(webView, "load-started", m_frame);
 193 unsigned progress = lround(core(webView)->progress()->estimatedProgress() * 100);
 194 g_signal_emit_by_name(webView, "progress-started", progress);
192195}
193196
194197void FrameLoaderClient::postProgressEstimateChangedNotification()
195198{
196199 WebKitWebView* webView = getViewFromFrame(m_frame);
197  Page* corePage = core(webView);
198 
199  g_signal_emit_by_name(webView, "load-progress-changed", lround(corePage->progress()->estimatedProgress()*100));
 200 unsigned progress = lround(core(webView)->progress()->estimatedProgress() * 100);
 201 g_signal_emit_by_name(webView, "progress-changed", progress);
200202}
201203
202204void FrameLoaderClient::postProgressFinishedNotification()
203205{
204206 WebKitWebView* webView = getViewFromFrame(m_frame);
205 
206  g_signal_emit_by_name(webView, "load-finished", m_frame);
 207 unsigned progress = lround(core(webView)->progress()->estimatedProgress() * 100);
 208 g_signal_emit_by_name(webView, "progress-done", progress);
207209}
208210
209211void FrameLoaderClient::frameLoaderDestroyed()

@@String FrameLoaderClient::overrideMediaT
338340
339341void FrameLoaderClient::windowObjectCleared()
340342{
341  // Is this obsolete now?
342  g_signal_emit_by_name(m_frame, "cleared");
343 
344343 Frame* coreFrame = core(webFrame());
345344 ASSERT(coreFrame);
346345

@@void FrameLoaderClient::windowObjectClea
354353 JSObjectRef windowObject = toRef(KJS::Window::retrieve(coreFrame)->getObject());
355354 ASSERT(windowObject);
356355
 356 g_signal_emit_by_name(m_frame, "window-object-cleared", context, windowObject);
357357 WebKitWebView* webView = getViewFromFrame(m_frame);
358358 g_signal_emit_by_name(webView, "window-object-cleared", m_frame, context, windowObject);
359359

@@bool FrameLoaderClient::hasFrameView() c
387387 return true;
388388}
389389
 390static void emitLoadDoneEvent(WebKitWebFrame* frame, const ResourceError& error=ResourceError(), bool isProvisional=false)
 391{
 392 gchar* request_uri = g_strdup(core(frame)->loader()->originalRequestURL().string().utf8().data());
 393 GError* gerror = error.toGError();
 394
 395 g_signal_emit_by_name(frame, "load-done", request_uri, isProvisional, gerror);
 396
 397 WebKitWebView* webView = getViewFromFrame(frame);
 398 if (frame == webkit_web_view_get_main_frame(webView))
 399 g_signal_emit_by_name(webView, "load-done", frame, request_uri, isProvisional, gerror);
 400
 401 g_free(request_uri);
 402 if (gerror)
 403 g_error_free(gerror);
 404}
 405
390406void FrameLoaderClient::dispatchDidFinishLoad()
391407{
392  g_signal_emit_by_name(m_frame, "load-done", true);
 408 emitLoadDoneEvent(m_frame);
393409}
394410
395411void FrameLoaderClient::frameLoadCompleted()

@@void FrameLoaderClient::dispatchDidHandl
467483
468484void FrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
469485{
470  notImplemented();
 486 g_signal_emit_by_name(m_frame, "redirect-done");
 487
 488 WebKitWebView* webView = getViewFromFrame(m_frame);
 489 if (m_frame == webkit_web_view_get_main_frame(webView))
 490 g_signal_emit_by_name(webView, "redirect-done", m_frame);
471491}
472492
473493void FrameLoaderClient::dispatchDidCancelClientRedirect()
474494{
475  notImplemented();
 495 g_signal_emit_by_name(m_frame, "redirect-cancelled");
 496
 497 WebKitWebView* webView = getViewFromFrame(m_frame);
 498 if (m_frame == webkit_web_view_get_main_frame(webView))
 499 g_signal_emit_by_name(webView, "redirect-cancelled", m_frame);
476500}
477501
478 void FrameLoaderClient::dispatchWillPerformClientRedirect(const KURL&, double, double)
 502void FrameLoaderClient::dispatchWillPerformClientRedirect(const KURL& destination, double time, double delay)
479503{
480  notImplemented();
 504 gchar* destination_uri = g_strdup(destination.prettyURL().utf8().data());
 505 guint timeStamp = time;
 506 guint delaySeconds = delay;
 507
 508 g_signal_emit_by_name(m_frame, "redirect-scheduled", destination_uri, timeStamp, delaySeconds);
 509
 510 WebKitWebView* webView = getViewFromFrame(m_frame);
 511 if (m_frame == webkit_web_view_get_main_frame(webView))
 512 g_signal_emit_by_name(webView, "redirect-scheduled", m_frame, destination_uri, timeStamp, delaySeconds);
 513
 514 g_free(destination_uri);
481515}
482516
483517void FrameLoaderClient::dispatchDidChangeLocationWithinPage()

@@void FrameLoaderClient::dispatchWillClos
492526
493527void FrameLoaderClient::dispatchDidReceiveIcon()
494528{
495  WebKitWebView* webView = getViewFromFrame(m_frame);
496 
497  g_signal_emit_by_name(webView, "icon-loaded", m_frame);
 529 notImplemented();
498530}
499531
500532void FrameLoaderClient::dispatchDidStartProvisionalLoad()
501533{
 534 g_signal_emit_by_name(m_frame, "load-started");
 535
 536 WebKitWebView* webView = getViewFromFrame(m_frame);
 537 if (m_frame == webkit_web_view_get_main_frame(webView))
 538 g_signal_emit_by_name(webView, "load-started", m_frame);
502539}
503540
504541void FrameLoaderClient::dispatchDidReceiveTitle(const String& title)

@@void FrameLoaderClient::dispatchDidCommi
528565
529566void FrameLoaderClient::dispatchDidFinishDocumentLoad()
530567{
531  notImplemented();
 568 g_signal_emit_by_name(m_frame, "document-load-done");
 569
 570 WebKitWebView* webView = getViewFromFrame(m_frame);
 571 if (m_frame == webkit_web_view_get_main_frame(webView))
 572 g_signal_emit_by_name(webView, "document-load-done", m_frame);
532573}
533574
534575void FrameLoaderClient::dispatchDidFirstLayout()

@@bool FrameLoaderClient::dispatchDidLoadR
673714 return false;
674715}
675716
676 void FrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError&)
 717void FrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error)
677718{
678  g_signal_emit_by_name(m_frame, "load-done", false);
 719 emitLoadDoneEvent(m_frame, error, true);
679720}
680721
681 void FrameLoaderClient::dispatchDidFailLoad(const ResourceError&)
 722void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
682723{
683  g_signal_emit_by_name(m_frame, "load-done", false);
 724 emitLoadDoneEvent(m_frame, error);
684725}
685726
686727void FrameLoaderClient::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&)

@@void FrameLoaderClient::download(Resourc
688729 notImplemented();
689730}
690731
691 ResourceError FrameLoaderClient::cancelledError(const ResourceRequest&)
 732ResourceError FrameLoaderClient::cancelledError(const ResourceRequest& request)
692733{
693  notImplemented();
694  return ResourceError();
 734 return ResourceError("Error", WEBKIT_RESOURCE_ERROR_CANCELLED, request.url().prettyURL(), String::fromUTF8(_("Request cancelled")));
695735}
696736
697 ResourceError FrameLoaderClient::blockedError(const ResourceRequest&)
 737ResourceError FrameLoaderClient::blockedError(const ResourceRequest& request)
698738{
699  notImplemented();
700  return ResourceError();
 739 return ResourceError("Error", WEBKIT_RESOURCE_ERROR_RESTRICTED_PORT, request.url().prettyURL(), String::fromUTF8(_("Request blocked")));
701740}
702741
703 ResourceError FrameLoaderClient::cannotShowURLError(const ResourceRequest&)
 742ResourceError FrameLoaderClient::cannotShowURLError(const ResourceRequest& request)
704743{
705  notImplemented();
706  return ResourceError();
 744 return ResourceError("Error", WEBKIT_RESOURCE_ERROR_URI, request.url().prettyURL(), String::fromUTF8(_("Unable to display URI")));
707745}
708746
709 ResourceError FrameLoaderClient::interruptForPolicyChangeError(const ResourceRequest&)
 747ResourceError FrameLoaderClient::interruptForPolicyChangeError(const ResourceRequest& request)
710748{
711  notImplemented();
712  return ResourceError();
 749 return ResourceError("Error", WEBKIT_RESOURCE_ERROR_POLICY_CHANGED, request.url().prettyURL(), String::fromUTF8(_("Load interrupted by policy change")));
713750}
714751
715 ResourceError FrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse&)
 752ResourceError FrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse& request)
716753{
717  notImplemented();
718  return ResourceError();
 754 return ResourceError("Error", WEBKIT_RESOURCE_ERROR_MIME_TYPE, request.url().prettyURL(), String::fromUTF8(_("Unable to display MIME type")));
719755}
720756
721 ResourceError FrameLoaderClient::fileDoesNotExistError(const ResourceResponse&)
 757ResourceError FrameLoaderClient::fileDoesNotExistError(const ResourceResponse& request)
722758{
723  notImplemented();
724  return ResourceError();
 759 return ResourceError("Error", WEBKIT_RESOURCE_ERROR_FILE_NOT_FOUND, request.url().prettyURL(), String::fromUTF8(_("File not found")));
725760}
726761
727762bool FrameLoaderClient::shouldFallBack(const ResourceError&)
Revision 30037

WebKit/gtk/webkit/webkitwebframe.cpp

@@using namespace WebCore;
4747extern "C" {
4848
4949enum {
50  CLEARED,
 50 WINDOW_OBJECT_CLEARED,
 51 LOAD_STARTED,
5152 LOAD_COMMITTED,
5253 LOAD_DONE,
 54 REDIRECT_SCHEDULED,
 55 REDIRECT_DONE,
 56 REDIRECT_CANCELLED,
 57 DOCUMENT_LOAD_DONE,
5358 TITLE_CHANGED,
5459 HOVERING_OVER_LINK,
5560 LAST_SIGNAL

@@static void webkit_web_frame_class_init(
108113 /*
109114 * signals
110115 */
111  webkit_web_frame_signals[CLEARED] = g_signal_new("cleared",
 116 webkit_web_frame_signals[WINDOW_OBJECT_CLEARED] = g_signal_new("window-object-cleared",
 117 G_TYPE_FROM_CLASS(frameClass),
 118 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 119 0,
 120 NULL,
 121 NULL,
 122 webkit_marshal_VOID__POINTER_POINTER,
 123 G_TYPE_NONE, 2,
 124 G_TYPE_POINTER,
 125 G_TYPE_POINTER);
 126
 127 webkit_web_frame_signals[LOAD_STARTED] = g_signal_new("load-started",
112128 G_TYPE_FROM_CLASS(frameClass),
113129 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
114130 0,

@@static void webkit_web_frame_class_init(
132148 0,
133149 NULL,
134150 NULL,
135  g_cclosure_marshal_VOID__BOOLEAN,
136  G_TYPE_NONE, 1,
137  G_TYPE_BOOLEAN);
 151 webkit_marshal_VOID__STRING_BOOLEAN_BOXED,
 152 G_TYPE_NONE, 3,
 153 WEBKIT_TYPE_WEB_FRAME,
 154 G_TYPE_STRING,
 155 G_TYPE_BOOLEAN,
 156 G_TYPE_POINTER);
 157
 158 webkit_web_frame_signals[REDIRECT_SCHEDULED] = g_signal_new("redirect-scheduled",
 159 G_TYPE_FROM_CLASS(frameClass),
 160 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 161 0,
 162 NULL,
 163 NULL,
 164 webkit_marshal_VOID__STRING_UINT_UINT,
 165 G_TYPE_NONE, 3,
 166 G_TYPE_STRING,
 167 G_TYPE_UINT,
 168 G_TYPE_UINT);
 169
 170 webkit_web_frame_signals[REDIRECT_DONE] = g_signal_new("redirect-done",
 171 G_TYPE_FROM_CLASS(frameClass),
 172 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 173 0,
 174 NULL,
 175 NULL,
 176 g_cclosure_marshal_VOID__VOID,
 177 G_TYPE_NONE, 0);
 178
 179 webkit_web_frame_signals[REDIRECT_CANCELLED] = g_signal_new("redirect-cancelled",
 180 G_TYPE_FROM_CLASS(frameClass),
 181 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 182 0,
 183 NULL,
 184 NULL,
 185 g_cclosure_marshal_VOID__VOID,
 186 G_TYPE_NONE, 0);
 187
 188 webkit_web_frame_signals[DOCUMENT_LOAD_DONE] = g_signal_new("document-load-done",
 189 G_TYPE_FROM_CLASS(frameClass),
 190 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 191 0,
 192 NULL,
 193 NULL,
 194 g_cclosure_marshal_VOID__VOID,
 195 G_TYPE_NONE, 0);
138196
139197 webkit_web_frame_signals[TITLE_CHANGED] = g_signal_new("title-changed",
140198 G_TYPE_FROM_CLASS(frameClass),
Revision 30037

WebKit/gtk/webkit/webkit-marshal.list

11VOID:OBJECT
22VOID:STRING
 3VOID:STRING,BOOLEAN,BOXED
34VOID:STRING,STRING
 5VOID:STRING,UINT,UINT
46VOID:OBJECT,BOOLEAN
57VOID:OBJECT,STRING
68VOID:OBJECT,OBJECT
79VOID:OBJECT,POINTER,POINTER
 10VOID:OBJECT,STRING,BOOLEAN,POINTER
 11VOID:OBJECT,STRING,UINT,UINT
 12VOID:POINTER,POINTER
813BOOLEAN:STRING,INT,STRING
914BOOLEAN:OBJECT,STRING
1015BOOLEAN:OBJECT,STRING,BOOLEAN
Revision 30037

WebKit/gtk/webkit/webkitwebview.cpp

3636#include "ContextMenuClientGtk.h"
3737#include "ContextMenuController.h"
3838#include "Cursor.h"
 39#include "DocumentLoader.h"
3940#include "DragClientGtk.h"
4041#include "Editor.h"
4142#include "EditorClientGtk.h"

5253#include "PasteboardHelper.h"
5354#include "PlatformKeyboardEvent.h"
5455#include "PlatformWheelEvent.h"
 56#include "ProgressTracker.h"
5557#include "SubstituteData.h"
5658
5759#include <gdk/gdkkeysyms.h>

@@enum {
6769 WINDOW_OBJECT_CLEARED,
6870 LOAD_STARTED,
6971 LOAD_COMMITTED,
70  LOAD_PROGRESS_CHANGED,
71  LOAD_FINISHED,
 72 PROGRESS_STARTED,
 73 PROGRESS_CHANGED,
 74 PROGRESS_DONE,
 75 LOAD_DONE,
 76 REDIRECT_SCHEDULED,
 77 REDIRECT_DONE,
 78 REDIRECT_CANCELLED,
 79 DOCUMENT_LOAD_DONE,
7280 TITLE_CHANGED,
7381 HOVERING_OVER_LINK,
7482 POPULATE_POPUP,
75  STATUS_BAR_TEXT_CHANGED,
76  ICOND_LOADED,
77  SELECTION_CHANGED,
 83 STATUSBAR_TEXT_CHANGED,
7884 CONSOLE_MESSAGE,
7985 SCRIPT_ALERT,
8086 SCRIPT_CONFIRM,

@@static void webkit_web_view_real_window_
473479 notImplemented();
474480}
475481
476 static gchar* webkit_web_view_real_choose_file(WebKitWebView*, WebKitWebFrame*, const gchar* old_name)
477 {
478  notImplemented();
479  return g_strdup(old_name);
480 }
481 
482482typedef enum {
483483 WEBKIT_SCRIPT_DIALOG_ALERT,
484484 WEBKIT_SCRIPT_DIALOG_CONFIRM,

@@static void webkit_web_view_class_init(W
686686 /**
687687 * WebKitWebView::load-started:
688688 * @web_view: the object on which the signal is emitted
689  * @frame: the frame going to do the load
 689 * @frame: the frame that started to load
690690 *
691  * When a #WebKitWebFrame begins to load this signal is emitted.
 691 * When a #WebKitWebFrame starts to load this signal is emitted.
692692 */
693693 webkit_web_view_signals[LOAD_STARTED] = g_signal_new("load-started",
694694 G_TYPE_FROM_CLASS(webViewClass),
695695 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
696  0,
 696 G_STRUCT_OFFSET(WebKitWebViewClass, load_started),
697697 NULL,
698698 NULL,
699699 g_cclosure_marshal_VOID__OBJECT,

@@static void webkit_web_view_class_init(W
703703 /**
704704 * WebKitWebView::load-committed:
705705 * @web_view: the object on which the signal is emitted
706  * @frame: the main frame that received the first data
 706 * @frame: the frame that received the first data
707707 *
708708 * When a #WebKitWebFrame loaded the first data this signal is emitted.
709709 */
710710 webkit_web_view_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
711711 G_TYPE_FROM_CLASS(webViewClass),
712712 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
713  0,
 713 G_STRUCT_OFFSET(WebKitWebViewClass, load_committed),
714714 NULL,
715715 NULL,
716716 g_cclosure_marshal_VOID__OBJECT,
717717 G_TYPE_NONE, 1,
718718 WEBKIT_TYPE_WEB_FRAME);
719719
 720 /**
 721 * WebKitWebView::progress-started:
 722 * @web_view: the object on which the signal is emitted
 723 * @progress: the current loading progress
 724 *
 725 * When a loading progress starts this signal is emitted.
 726 */
 727 webkit_web_view_signals[PROGRESS_STARTED] = g_signal_new("progress-started",
 728 G_TYPE_FROM_CLASS(webViewClass),
 729 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 730 G_STRUCT_OFFSET(WebKitWebViewClass, progress_started),
 731 NULL,
 732 NULL,
 733 g_cclosure_marshal_VOID__INT,
 734 G_TYPE_NONE, 1,
 735 G_TYPE_INT);
 736
 737 /**
 738 * WebKitWebView::progress-changed:
 739 * @web_view: the #WebKitWebView
 740 * @progress: the current loading progress
 741 *
 742 * When the global loading progress changes this signal is emitted.
 743 */
 744 webkit_web_view_signals[PROGRESS_CHANGED] = g_signal_new("progress-changed",
 745 G_TYPE_FROM_CLASS(webViewClass),
 746 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 747 G_STRUCT_OFFSET(WebKitWebViewClass, progress_changed),
 748 NULL,
 749 NULL,
 750 g_cclosure_marshal_VOID__INT,
 751 G_TYPE_NONE, 1,
 752 G_TYPE_INT);
720753
721754 /**
722  * WebKitWebView::load-progress-changed:
 755 * WebKitWebView::progress-done:
723756 * @web_view: the #WebKitWebView
724  * @progress: the global progress
 757 * @progress: the current loading progress
 758 *
 759 * When the global loading process is done this signal is emitted.
725760 */
726  webkit_web_view_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load-progress-changed",
 761 webkit_web_view_signals[PROGRESS_DONE] = g_signal_new("progress-done",
727762 G_TYPE_FROM_CLASS(webViewClass),
728763 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
729  0,
 764 G_STRUCT_OFFSET(WebKitWebViewClass, progress_done),
730765 NULL,
731766 NULL,
732767 g_cclosure_marshal_VOID__INT,
733768 G_TYPE_NONE, 1,
734769 G_TYPE_INT);
735770
736  webkit_web_view_signals[LOAD_FINISHED] = g_signal_new("load-finished",
 771 /**
 772 * WebKitWebView::load-done:
 773 * @web_view: the #WebKitWebView
 774 * @frame: the frame the that is done loading
 775 * @request_uri: the originally requested uri
 776 * @provisional: whether the load was provisional, i.e. no data received
 777 * @error: an error if applicable, or %NULL
 778 *
 779 * When a #WebKitWebFrame is done loading this signal is emitted.
 780 *
 781 * If the loading failed for some reason, error is not %NULL.
 782 */
 783 webkit_web_view_signals[LOAD_DONE] = g_signal_new("load-done",
 784 G_TYPE_FROM_CLASS(webViewClass),
 785 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 786 G_STRUCT_OFFSET(WebKitWebViewClass, load_done),
 787 NULL,
 788 NULL,
 789 webkit_marshal_VOID__OBJECT_STRING_BOOLEAN_POINTER,
 790 G_TYPE_NONE, 4,
 791 WEBKIT_TYPE_WEB_FRAME,
 792 G_TYPE_STRING,
 793 G_TYPE_BOOLEAN,
 794 G_TYPE_POINTER);
 795
 796 /**
 797 * WebKitWebView::redirect-scheduled:
 798 * @web_view: the #WebKitWebView
 799 * @frame: the frame the redirect was scheduled for
 800 * @destination_uri: the destination of the redirect
 801 * @time: the time the redirect was scheduled
 802 * @delay: the time in seconds remaining until the redirect
 803 *
 804 * When a server redirect on #WebKitWebFrame is scheduled this signal
 805 * is emitted. You can use the provided information to provide an
 806 * interface with visual information about the redirect.
 807 */
 808 webkit_web_view_signals[REDIRECT_SCHEDULED] = g_signal_new("redirect-scheduled",
 809 G_TYPE_FROM_CLASS(webViewClass),
 810 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 811 G_STRUCT_OFFSET(WebKitWebViewClass, redirect_scheduled),
 812 NULL,
 813 NULL,
 814 webkit_marshal_VOID__OBJECT_STRING_UINT_UINT,
 815 G_TYPE_NONE, 4,
 816 WEBKIT_TYPE_WEB_FRAME,
 817 G_TYPE_STRING,
 818 G_TYPE_UINT,
 819 G_TYPE_UINT);
 820
 821 /**
 822 * WebKitWebView::redirect-done:
 823 * @web_view: the #WebKitWebView
 824 * @frame: the frame the redirect occured to
 825 *
 826 * When a server redirect on #WebKitWebFrame was performed
 827 * successfully this signal is emitted.
 828 */
 829 webkit_web_view_signals[REDIRECT_DONE] = g_signal_new("redirect-done",
 830 G_TYPE_FROM_CLASS(webViewClass),
 831 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 832 G_STRUCT_OFFSET(WebKitWebViewClass, redirect_done),
 833 NULL,
 834 NULL,
 835 g_cclosure_marshal_VOID__OBJECT,
 836 G_TYPE_NONE, 1,
 837 WEBKIT_TYPE_WEB_FRAME);
 838
 839 /**
 840 * WebKitWebView::redirect-cancelled:
 841 * @web_view: the #WebKitWebView
 842 * @frame: the frame the redirect was cancelled in
 843 *
 844 * When a server redirect on #WebKitWebFrame was cancelled this signal is emitted.
 845 */
 846 webkit_web_view_signals[REDIRECT_CANCELLED] = g_signal_new("redirect-cancelled",
 847 G_TYPE_FROM_CLASS(webViewClass),
 848 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 849 G_STRUCT_OFFSET(WebKitWebViewClass, redirect_cancelled),
 850 NULL,
 851 NULL,
 852 g_cclosure_marshal_VOID__OBJECT,
 853 G_TYPE_NONE, 1,
 854 WEBKIT_TYPE_WEB_FRAME);
 855
 856 /**
 857 * WebKitWebView::document-load-done:
 858 * @web_view: the #WebKitWebView
 859 * @frame: the frame the document was loaded of
 860 *
 861 * When the document of a #WebKitWebFrame was loaded this signal is
 862 * emitted. This does not necessarily mean that all subresources were loaded.
 863 */
 864 webkit_web_view_signals[DOCUMENT_LOAD_DONE] = g_signal_new("document-load-done",
737865 G_TYPE_FROM_CLASS(webViewClass),
738866 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
739  0,
 867 G_STRUCT_OFFSET(WebKitWebViewClass, document_load_done),
740868 NULL,
741869 NULL,
742870 g_cclosure_marshal_VOID__OBJECT,

@@static void webkit_web_view_class_init(W
754882 webkit_web_view_signals[TITLE_CHANGED] = g_signal_new("title-changed",
755883 G_TYPE_FROM_CLASS(webViewClass),
756884 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
757  0,
 885 G_STRUCT_OFFSET(WebKitWebViewClass, title_changed),
758886 NULL,
759887 NULL,
760888 webkit_marshal_VOID__OBJECT_STRING,

@@static void webkit_web_view_class_init(W
765893 webkit_web_view_signals[HOVERING_OVER_LINK] = g_signal_new("hovering-over-link",
766894 G_TYPE_FROM_CLASS(webViewClass),
767895 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
768  0,
 896 G_STRUCT_OFFSET(WebKitWebViewClass, hovering_over_link),
769897 NULL,
770898 NULL,
771899 webkit_marshal_VOID__STRING_STRING,

@@static void webkit_web_view_class_init(W
785913 webkit_web_view_signals[POPULATE_POPUP] = g_signal_new("populate-popup",
786914 G_TYPE_FROM_CLASS(webViewClass),
787915 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
788  0,
 916 G_STRUCT_OFFSET(WebKitWebViewClass, populate_popup),
789917 NULL,
790918 NULL,
791919 g_cclosure_marshal_VOID__OBJECT,
792920 G_TYPE_NONE, 1,
793921 GTK_TYPE_MENU);
794922
795  webkit_web_view_signals[STATUS_BAR_TEXT_CHANGED] = g_signal_new("status-bar-text-changed",
 923 /**
 924 * WebKitWebView:::statusbar-text-changed
 925 * @web_view: the object on which the signal is emitted
 926 * @message: the statusbar text
 927 *
 928 * The text that is usually displayed in the statusbar has changed.
 929 */
 930 webkit_web_view_signals[STATUSBAR_TEXT_CHANGED] = g_signal_new("statusbar-text-changed",
796931 G_TYPE_FROM_CLASS(webViewClass),
797932 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
798  0,
 933 G_STRUCT_OFFSET(WebKitWebViewClass, statusbar_text_changed),
799934 NULL,
800935 NULL,
801936 g_cclosure_marshal_VOID__STRING,
802937 G_TYPE_NONE, 1,
803938 G_TYPE_STRING);
804939
805  webkit_web_view_signals[ICOND_LOADED] = g_signal_new("icon-loaded",
806  G_TYPE_FROM_CLASS(webViewClass),
807  (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
808  0,
809  NULL,
810  NULL,
811  g_cclosure_marshal_VOID__VOID,
812  G_TYPE_NONE, 0);
813 
814  webkit_web_view_signals[SELECTION_CHANGED] = g_signal_new("selection-changed",
815  G_TYPE_FROM_CLASS(webViewClass),
816  (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
817  0,
818  NULL,
819  NULL,
820  g_cclosure_marshal_VOID__VOID,
821  G_TYPE_NONE, 0);
822 
823940 /**
824941 * WebKitWebView::console-message:
825942 * @web_view: the object on which the signal is emitted

@@static void webkit_web_view_class_init(W
828945 * @source_id: the source id
829946 * @return: TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
830947 *
831  * A JavaScript console message was created.
 948 * A JavaScript console message was created. By default the message is
 949 * printed to the standard output. If you don't want that to happen
 950 * simply connect the signal to #gtk_true.
832951 */
833952 webkit_web_view_signals[CONSOLE_MESSAGE] = g_signal_new("console-message",
834953 G_TYPE_FROM_CLASS(webViewClass),

@@static void webkit_web_view_class_init(W
9681087 g_cclosure_marshal_VOID__VOID,
9691088 G_TYPE_NONE, 0);
9701089
 1090 /**
 1091 * WebKitWebView::set-scroll-adjustments:
 1092 * @web_view: the object which received the signal
 1093 * @hadjustment: the horizontal adjustment
 1094 * @vadjustment: the vertical adjustment
 1095 */
 1096 GTK_WIDGET_CLASS(webViewClass)->set_scroll_adjustments_signal = g_signal_new("set-scroll-adjustments",
 1097 G_TYPE_FROM_CLASS(webViewClass),
 1098 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 1099 G_STRUCT_OFFSET(WebKitWebViewClass, set_scroll_adjustments),
 1100 NULL, NULL,
 1101 webkit_marshal_VOID__OBJECT_OBJECT,
 1102 G_TYPE_NONE, 2,
 1103 GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
 1104
9711105 /*
9721106 * implementations of virtual methods
9731107 */
9741108 webViewClass->create_web_view = webkit_web_view_real_create_web_view;
9751109 webViewClass->navigation_requested = webkit_web_view_real_navigation_requested;
9761110 webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared;
977  webViewClass->choose_file = webkit_web_view_real_choose_file;
 1111 webViewClass->load_started = 0;
 1112 webViewClass->load_committed = 0;
 1113 webViewClass->progress_started = 0;
 1114 webViewClass->progress_changed = 0;
 1115 webViewClass->progress_done = 0;
 1116 webViewClass->load_done = 0;
 1117 webViewClass->redirect_scheduled = 0;
 1118 webViewClass->redirect_done = 0;
 1119 webViewClass->redirect_cancelled = 0;
 1120 webViewClass->document_load_done = 0;
 1121 webViewClass->title_changed = 0;
 1122 webViewClass->hovering_over_link = 0;
 1123 webViewClass->populate_popup = 0;
 1124 webViewClass->statusbar_text_changed = 0;
 1125 webViewClass->console_message = webkit_web_view_real_console_message;
9781126 webViewClass->script_alert = webkit_web_view_real_script_alert;
9791127 webViewClass->script_confirm = webkit_web_view_real_script_confirm;
9801128 webViewClass->script_prompt = webkit_web_view_real_script_prompt;
981  webViewClass->console_message = webkit_web_view_real_console_message;
9821129 webViewClass->select_all = webkit_web_view_real_select_all;
9831130 webViewClass->cut_clipboard = webkit_web_view_real_cut_clipboard;
9841131 webViewClass->copy_clipboard = webkit_web_view_real_copy_clipboard;
9851132 webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard;
 1133 webViewClass->set_scroll_adjustments = webkit_web_view_set_scroll_adjustments;
9861134
9871135 GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass);
9881136 objectClass->finalize = webkit_web_view_finalize;

@@static void webkit_web_view_class_init(W
10081156 containerClass->forall = webkit_web_view_container_forall;
10091157
10101158 /*
1011  * make us scrollable (e.g. addable to a GtkScrolledWindow)
1012  */
1013  webViewClass->set_scroll_adjustments = webkit_web_view_set_scroll_adjustments;
1014  GTK_WIDGET_CLASS(webViewClass)->set_scroll_adjustments_signal = g_signal_new("set-scroll-adjustments",
1015  G_TYPE_FROM_CLASS(webViewClass),
1016  (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
1017  G_STRUCT_OFFSET(WebKitWebViewClass, set_scroll_adjustments),
1018  NULL, NULL,
1019  webkit_marshal_VOID__OBJECT_OBJECT,
1020  G_TYPE_NONE, 2,
1021  GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
1022 
1023  /*
10241159 * Key bindings
10251160 */
10261161

@@void webkit_web_view_load_html_string(We
15001635 webkit_web_view_load_string(webView, content, NULL, NULL, baseUri);
15011636}
15021637
 1638/**
 1639 * webkit_web_view_is_loading:
 1640 * @web_view: a #WebKitWebView
 1641 *
 1642 * Determines whether #web_view is currently loading.
 1643 *
 1644 * Return value: %TRUE if a load is in progress, %FALSE otherwise
 1645 */
 1646gboolean webkit_web_view_is_loading(WebKitWebView* webView)
 1647{
 1648 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
 1649
 1650 return core(webView)->mainFrame()->loader()->documentLoader()->isLoadingInAPISense();
 1651}
 1652
 1653/**
 1654 * webkit_web_view_get_progress:
 1655 * @web_view: a #WebKitWebView
 1656 *
 1657 * Determines what the current loading progress of a #web_view is or -1
 1658 * if either the value is unknown because a load is provisional or the
 1659 * web view just isn't loading anything.
 1660 *
 1661 * Return value: The progress in percent, or -1
 1662 */
 1663gint webkit_web_view_get_progress(WebKitWebView* webView)
 1664{
 1665 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), -1);
 1666
 1667 return lround(core(webView)->progress()->estimatedProgress() * 100);
 1668}
 1669
15031670void webkit_web_view_stop_loading(WebKitWebView* webView)
15041671{
15051672 g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
Revision 30037

WebKit/gtk/webkit/webkitwebview.h

11/*
22 * Copyright (C) 2007 Holger Hans Peter Freyther
 3 * Copyright (C) 2008 Christian Dywan <[email protected]>
34 *
45 * This library is free software; you can redistribute it and/or
56 * modify it under the terms of the GNU Library General Public

@@typedef enum {
4546 WEBKIT_NAVIGATION_RESPONSE_DOWNLOAD
4647} WebKitNavigationResponse;
4748
48 typedef enum
49 {
 49typedef enum {
 50 WEBKIT_RESOURCE_ERROR_CANCELLED,
 51 WEBKIT_RESOURCE_ERROR_RESTRICTED_PORT,
 52 WEBKIT_RESOURCE_ERROR_URI,
 53 WEBKIT_RESOURCE_ERROR_POLICY_CHANGED,
 54 WEBKIT_RESOURCE_ERROR_MIME_TYPE,
 55 WEBKIT_RESOURCE_ERROR_FILE_NOT_FOUND
 56} WebKitResourceError;
 57
 58#define WEBKIT_RESOURCE_ERROR g_quark_from_string("WEBKIT_RESOURCE_ERROR")
 59
 60typedef enum {
5061 WEBKIT_WEB_VIEW_TARGET_INFO_HTML = - 1,
5162 WEBKIT_WEB_VIEW_TARGET_INFO_TEXT = - 2
5263} WebKitWebViewTargetInfo;

@@struct _WebKitWebView {
6071struct _WebKitWebViewClass {
6172 GtkContainerClass parent_class;
6273
63  /*
64  * default handler/virtual methods
65  * DISCUSS: create_web_view needs a request and should we make this a signal with default handler? this would
66  * require someone doing a g_signal_stop_emission_by_name
67  * WebUIDelegate has nothing for create_frame, WebPolicyDelegate as well...
68  */
69  WebKitWebView* (*create_web_view) (WebKitWebView* web_view);
70 
71  /*
72  * TODO: FIXME: Create something like WebPolicyDecisionListener_Protocol instead
73  */
 74 WebKitWebView* (*create_web_view) (WebKitWebView* web_view);
7475 WebKitNavigationResponse (*navigation_requested) (WebKitWebView* web_view, WebKitWebFrame* frame, WebKitNetworkRequest* request);
75 
7676 void (*window_object_cleared) (WebKitWebView* web_view, WebKitWebFrame* frame, JSGlobalContextRef context, JSObjectRef window_object);
77  gchar* (*choose_file) (WebKitWebView* web_view, WebKitWebFrame* frame, const gchar* old_file);
 77 void (*load_started) (WebKitWebView* web_view, WebKitWebFrame* frame);
 78 void (*load_committed) (WebKitWebView* web_view, WebKitWebFrame* frame);
 79 void (*progress_started) (WebKitWebView* web_view, gint progress);
 80 void (*progress_changed) (WebKitWebView* web_view, gint progress);
 81 void (*progress_done) (WebKitWebView* web_view, gint progress);
 82 void (*load_done) (WebKitWebView* web_view, WebKitWebFrame* frame, const gchar* request_uri, gboolean provisional, GError* error);
 83 void (*redirect_scheduled) (WebKitWebView* web_view, WebKitWebFrame* frame, gchar* destination_uri, guint time, guint delay);
 84 void (*redirect_done) (WebKitWebView* web_view, WebKitWebFrame* frame);
 85 void (*redirect_cancelled) (WebKitWebView* web_view, WebKitWebFrame* frame);
 86 void (*document_load_done) (WebKitWebView* web_view, WebKitWebFrame* frame);
 87 void (*title_changed) (WebKitWebView* web_view, WebKitWebFrame* frame, const gchar* title);
 88 void (*hovering_over_link) (WebKitWebView* web_view, const gchar* tooltip, const gchar* title);
 89 void (*populate_popup) (WebKitWebView* web_view, GtkMenu* menu);
 90 void (*statusbar_text_changed) (WebKitWebView* web_view, const gchar* text);
 91 gboolean (*console_message) (WebKitWebView* web_view, const gchar* message, unsigned int line_number, const gchar* source_id);
7892 gboolean (*script_alert) (WebKitWebView* web_view, WebKitWebFrame* frame, const gchar* alert_message);
7993 gboolean (*script_confirm) (WebKitWebView* web_view, WebKitWebFrame* frame, const gchar* confirm_message, gboolean* did_confirm);
8094 gboolean (*script_prompt) (WebKitWebView* web_view, WebKitWebFrame* frame, const gchar* message, const gchar* default_value, gchar** value);
81  gboolean (*console_message) (WebKitWebView* web_view, const gchar* message, unsigned int line_number, const gchar* source_id);
8295 void (*select_all) (WebKitWebView* web_view);
8396 void (*cut_clipboard) (WebKitWebView* web_view);
8497 void (*copy_clipboard) (WebKitWebView* web_view);
8598 void (*paste_clipboard) (WebKitWebView* web_view);
 99 void (*set_scroll_adjustments) (WebKitWebView* web_view, GtkAdjustment* hadjustment, GtkAdjustment* vadjustment);
86100
87  /*
88  * internal
89  */
90  void (*set_scroll_adjustments) (WebKitWebView*, GtkAdjustment*, GtkAdjustment*);
 101 /* Padding for future expansion */
 102 void (*_webkit_reserved1) (void);
 103 void (*_webkit_reserved2) (void);
 104 void (*_webkit_reserved3) (void);
 105 void (*_webkit_reserved4) (void);
 106 void (*_webkit_reserved5) (void);
 107 void (*_webkit_reserved6) (void);
 108 void (*_webkit_reserved7) (void);
 109 void (*_webkit_reserved8) (void);
91110};
92111
93112WEBKIT_API GType

@@webkit_web_view_go_forward (WebKitWebVie
126145WEBKIT_API void
127146webkit_web_view_stop_loading (WebKitWebView* web_view);
128147
 148WEBKIT_API gboolean
 149webkit_web_view_is_loading (WebKitWebView* web_view);
 150
 151WEBKIT_API gint
 152webkit_web_view_get_progress (WebKitWebView* web_view);
 153
129154WEBKIT_API void
130155webkit_web_view_open (WebKitWebView* web_view, const gchar* uri);
131156
Revision 30037

WebCore/GNUmakefile.am

@@webkitgtk_sources += \
982982 WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp \
983983 WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp \
984984 WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp \
985  WebCore/platform/image-decoders/xbm/XBMImageDecoder.cpp
 985 WebCore/platform/image-decoders/xbm/XBMImageDecoder.cpp \
 986 WebCore/platform/network/gtk/ResourceErrorGtk.cpp
986987
987988# ----
988989# curl http backend
Revision 30037

WebCore/platform/network/gtk/ResourceErrorGtk.cpp

 1/*
 2 * Copyright (C) 2008 Christian Dywan <[email protected]>
 3 *
 4 * This library is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU Library General Public
 6 * License as published by the Free Software Foundation; either
 7 * version 2 of the License, or (at your option) any later version.
 8 *
 9 * This library is distributed in the hope that it will be useful,
 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12 * Library General Public License for more details.
 13 *
 14 * You should have received a copy of the GNU Library General Public License
 15 * along with this library; see the file COPYING.LIB. If not, write to
 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 17 * Boston, MA 02110-1301, USA.
 18 */
 19
 20#include "config.h"
 21#include "ResourceError.h"
 22#include "CString.h"
 23#include "PlatformString.h"
 24
 25#include "webkitwebview.h"
 26
 27namespace WebCore {
 28
 29GError* ResourceError::toGError() const
 30{
 31 if (m_isNull)
 32 return NULL;
 33
 34 GError* error = g_error_new(WEBKIT_RESOURCE_ERROR, m_errorCode,
 35 m_localizedDescription.utf8().data());
 36
 37 return error;
 38}
 39
 40} // namespace WebCore
Revision 0

WebCore/platform/network/ResourceError.h

@@class NSError;
4343#include <CoreFoundation/CFStream.h>
4444#endif
4545
 46#if PLATFORM(GTK)
 47#include "glib.h"
 48#endif
 49
4650namespace WebCore {
4751
4852 class ResourceError {

@@namespace WebCore {
105109 operator CFStreamError() const;
106110#endif
107111#endif
 112#if PLATFORM(GTK)
 113 GError* toGError() const;
 114#endif
108115
109116 private:
110117 void unpackPlatformErrorIfNeeded() const
Revision 30037

WebCore/WebCore.pro

@@gtk-port {
145145 $$PWD/platform/graphics/cairo \
146146 $$PWD/svg/graphics/cairo \
147147 $$PWD/platform/network/curl \
 148 $$PWD/platform/network/gtk \
148149 $$PWD/platform/image-decoders \
149150 $$PWD/platform/image-decoders/bmp \
150151 $$PWD/platform/image-decoders/gif \

@@gtk-port {
10571058 platform/graphics/gtk/IntRectGtk.cpp \
10581059 platform/network/curl/ResourceHandleCurl.cpp \
10591060 platform/network/curl/ResourceHandleManager.cpp \
 1061 platform/network/gtk/ResourceErrorGtk.cpp \
10601062 platform/graphics/cairo/AffineTransformCairo.cpp \
10611063 platform/graphics/cairo/GraphicsContextCairo.cpp \
10621064 platform/graphics/cairo/ImageBufferCairo.cpp \
Revision 30037

WebKitTools/GtkLauncher/main.c

11/*
22 * Copyright (C) 2006, 2007 Apple Inc.
33 * Copyright (C) 2007 Alp Toker <[email protected]>
 4 * Copyright (C) 2008 Christian Dywan <[email protected]>
45 *
56 * Redistribution and use in source and binary forms, with or without
67 * modification, are permitted provided that the following conditions

2930
3031static GtkWidget* main_window;
3132static GtkWidget* uri_entry;
32 static GtkStatusbar* main_statusbar;
33 static WebKitWebView* web_view;
 33static GtkWidget* main_statusbar;
 34static GtkWidget* web_view;
3435static gchar* main_title;
35 static gint load_progress;
36 static guint status_context_id;
 36static guint status_id;
3737
3838static void
3939activate_uri_entry_cb (GtkWidget* entry, gpointer data)
4040{
4141 const gchar* uri = gtk_entry_get_text (GTK_ENTRY (entry));
4242 g_assert (uri);
43  webkit_web_view_open (web_view, uri);
 43 webkit_web_view_open (WEBKIT_WEB_VIEW (web_view), uri);
4444}
4545
4646static void

@@update_title (GtkWindow* window)
4848{
4949 GString* string = g_string_new (main_title);
5050 g_string_append (string, " - WebKit Launcher");
51  if (load_progress < 100)
52  g_string_append_printf (string, " (%d%%)", load_progress);
 51 if (webkit_web_view_is_loading (WEBKIT_WEB_VIEW (web_view)))
 52 {
 53 gint progress = webkit_web_view_get_progress (WEBKIT_WEB_VIEW (web_view));
 54 g_string_append_printf (string, " (%d%%)", progress);
 55 }
5356 gchar* title = g_string_free (string, FALSE);
5457 gtk_window_set_title (window, title);
5558 g_free (title);
5659}
5760
5861static void
59 link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data)
 62link_hover_cb (WebKitWebView* web_view, const gchar* title, const gchar* link, gpointer data)
6063{
6164 /* underflow is allowed */
62  gtk_statusbar_pop (main_statusbar, status_context_id);
 65 gtk_statusbar_pop (GTK_STATUSBAR (main_statusbar), status_id);
6366 if (link)
64  gtk_statusbar_push (main_statusbar, status_context_id, link);
 67 gtk_statusbar_push (GTK_STATUSBAR (main_statusbar), status_id, link);
6568}
6669
6770static void
68 title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data)
 71title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame,
 72 const gchar* title, gpointer data)
6973{
7074 if (main_title)
7175 g_free (main_title);

@@title_change_cb (WebKitWebView* web_view
7478}
7579
7680static void
77 progress_change_cb (WebKitWebView* page, gint progress, gpointer data)
 81progress_change_cb (WebKitWebView* page, guint progress, gpointer data)
7882{
79  load_progress = progress;
8083 update_title (GTK_WINDOW (main_window));
8184}
8285

@@load_commit_cb (WebKitWebView* page, Web
8992}
9093
9194static void
 95redirect_scheduled_cb (WebKitWebView* page, WebKitWebFrame* frame,
 96 const gchar* destination_uri, guint time, guint delay,
 97 gpointer data)
 98{
 99 GString* string = g_string_new (main_title);
 100 g_string_append_printf (string, " - Redirecting in %d seconds", delay);
 101 gchar* title = g_string_free (string, FALSE);
 102 gtk_window_set_title (GTK_WINDOW (main_window), title);
 103 g_free (title);
 104}
 105
 106static void
92107destroy_cb (GtkWidget* widget, gpointer data)
93108{
94109 gtk_main_quit ();

@@destroy_cb (GtkWidget* widget, gpointer
97112static void
98113go_back_cb (GtkWidget* widget, gpointer data)
99114{
100  webkit_web_view_go_back (web_view);
 115 webkit_web_view_go_back (WEBKIT_WEB_VIEW (web_view));
101116}
102117
103118static void
104119go_forward_cb (GtkWidget* widget, gpointer data)
105120{
106  webkit_web_view_go_forward (web_view);
 121 webkit_web_view_go_forward (WEBKIT_WEB_VIEW(web_view));
107122}
108123
109124static GtkWidget*

@@create_browser ()
112127 GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);
113128 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
114129
115  web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
 130 web_view = webkit_web_view_new ();
116131 gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));
117132
118  g_signal_connect (G_OBJECT (web_view), "title-changed", G_CALLBACK (title_change_cb), web_view);
119  g_signal_connect (G_OBJECT (web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), web_view);
120  g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (load_commit_cb), web_view);
121  g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
 133 g_signal_connect (web_view, "title-changed", G_CALLBACK (title_change_cb), web_view);
 134 g_signal_connect (web_view, "progress-changed", G_CALLBACK (progress_change_cb), web_view);
 135 g_signal_connect (web_view, "load-committed", G_CALLBACK (load_commit_cb), web_view);
 136 g_signal_connect (web_view, "redirect-scheduled", G_CALLBACK (redirect_scheduled_cb), web_view);
 137 g_signal_connect (web_view, "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
122138
123139 return scrolled_window;
124140}

@@create_browser ()
126142static GtkWidget*
127143create_statusbar ()
128144{
129  main_statusbar = GTK_STATUSBAR (gtk_statusbar_new ());
130  status_context_id = gtk_statusbar_get_context_id (main_statusbar, "Link Hover");
 145 main_statusbar = gtk_statusbar_new ();
 146 status_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (main_statusbar),
 147 "Link Hover");
131148
132  return (GtkWidget*)main_statusbar;
 149 return main_statusbar;
133150}
134151
135152static GtkWidget*

@@create_toolbar ()
144161
145162 /* the back button */
146163 item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_BACK);
147  g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_back_cb), NULL);
 164 g_signal_connect (item, "clicked", G_CALLBACK (go_back_cb), NULL);
148165 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
149166
150167 /* The forward button */
151168 item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD);
152  g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_forward_cb), NULL);
 169 g_signal_connect (item, "clicked", G_CALLBACK (go_forward_cb), NULL);
153170 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
154171
155172 /* The URL entry */

@@create_toolbar ()
157174 gtk_tool_item_set_expand (item, TRUE);
158175 uri_entry = gtk_entry_new ();
159176 gtk_container_add (GTK_CONTAINER (item), uri_entry);
160  g_signal_connect (G_OBJECT (uri_entry), "activate", G_CALLBACK (activate_uri_entry_cb), NULL);
 177 g_signal_connect (uri_entry, "activate", G_CALLBACK (activate_uri_entry_cb), NULL);
161178 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
162179
163180 /* The go button */
164181 item = gtk_tool_button_new_from_stock (GTK_STOCK_OK);
165  g_signal_connect_swapped (G_OBJECT (item), "clicked", G_CALLBACK (activate_uri_entry_cb), (gpointer)uri_entry);
 182 g_signal_connect_swapped (item, "clicked", G_CALLBACK (activate_uri_entry_cb), (gpointer)uri_entry);
166183 gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
167184
168185 return toolbar;

@@create_window ()
174191 GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
175192 gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
176193 gtk_widget_set_name (window, "GtkLauncher");
177  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL);
 194 g_signal_connect (window, "destroy", G_CALLBACK (destroy_cb), NULL);
178195
179196 return window;
180197}

@@main (int argc, char* argv[])
193210 gtk_container_add (GTK_CONTAINER (main_window), vbox);
194211
195212 gchar* uri = (gchar*) (argc > 1 ? argv[1] : "http://www.google.com/");
196  webkit_web_view_open (web_view, uri);
 213 webkit_web_view_open (WEBKIT_WEB_VIEW (web_view), uri);
197214
198  gtk_widget_grab_focus (GTK_WIDGET (web_view));
 215 gtk_widget_grab_focus (web_view);
199216 gtk_widget_show_all (main_window);
200217 gtk_main ();
201218
Revision 30037

WebKit.pri

@@qt-port:INCLUDEPATH += \
6969 $$PWD/WebKit/qt/Api
7070gtk-port:INCLUDEPATH += \
7171 $$BASE_DIR/WebCore/platform/gtk \
 72 $$BASE_DIR/WebCore/platform/network/gtk \
7273 $$BASE_DIR/WebCore/platform/network/curl \
7374 $$BASE_DIR/WebCore/platform/graphics/cairo \
7475 $$BASE_DIR/WebCore/loader/gtk \
Revision 30037