Changeset 88912 in webkit
- Timestamp:
- Jun 15, 2011 12:51:35 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r88857 r88912 1 2011-06-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Add a statusbar to MiniBrowser 6 https://bugs.webkit.org/show_bug.cgi?id=62634 7 8 It shows the url of the current hovered link. 9 10 * MiniBrowser/gtk/BrowserWindow.c: 11 (browserWindowConstructed): Create the GtkSatusbar. 12 (mouseDidMoveOverElement): Update statusbar text. 13 (browserWindowUIClientInit): Add implementation for 14 mouseDidMoveOverElement(). 15 * MiniBrowser/gtk/GNUmakefile.am: Add new files to compilation. 16 * MiniBrowser/gtk/WebBundle/WebBundleMain.c: Added. 17 (mouseDidMoveOverElement): Pass the url of the current hovered 18 link to the UI process. 19 (didCreatePage): Set the UI client adding an implementation for 20 mouseDidMoveOverElement(). 21 (WKBundleInitialize): 22 * MiniBrowser/gtk/main.c: 23 (createWKContextWithInjectedBundle): Create a global context with 24 the injected bundle. 25 (loadURI): Use the global context. 26 (main): 27 1 28 2011-06-14 Lucas Forschler <lforschler@apple.com> 2 29 -
trunk/Tools/MiniBrowser/gtk/BrowserWindow.c
r87690 r88912 37 37 GtkWindow parent; 38 38 39 GtkWidget* mainBox; 40 GtkWidget* uriEntry; 39 GtkWidget *mainBox; 40 GtkWidget *uriEntry; 41 GtkWidget *statusBar; 41 42 WKViewRef webView; 42 43 43 gchar* title; 44 guint statusBarContextId; 45 46 gchar *title; 44 47 gdouble loadProgress; 45 48 }; … … 164 167 gtk_box_pack_start(GTK_BOX(window->mainBox), GTK_WIDGET(window->webView), TRUE, TRUE, 0); 165 168 gtk_widget_show(GTK_WIDGET(window->webView)); 169 170 window->statusBar = gtk_statusbar_new(); 171 window->statusBarContextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(window->statusBar), "Link Hover"); 172 gtk_box_pack_start(GTK_BOX(window->mainBox), window->statusBar, FALSE, FALSE, 0); 173 gtk_widget_show(window->statusBar); 166 174 167 175 browserWindowLoaderClientInit(window); … … 464 472 } 465 473 474 static void mouseDidMoveOverElement(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo) 475 { 476 BrowserWindow *window = BROWSER_WINDOW(clientInfo); 477 gtk_statusbar_pop(GTK_STATUSBAR(window->statusBar), window->statusBarContextId); 478 479 if (!userData) 480 return; 481 482 if (WKGetTypeID(userData) != WKURLGetTypeID()) 483 return; 484 485 gchar *link = WKURLGetCString((WKURLRef)userData); 486 gtk_statusbar_push(GTK_STATUSBAR(window->statusBar), window->statusBarContextId, link); 487 g_free(link); 488 } 489 466 490 static void browserWindowUIClientInit(BrowserWindow *window) 467 491 { … … 479 503 runJavaScriptPrompt, 480 504 0, /* setStatusText */ 481 0, /* mouseDidMoveOverElement */505 mouseDidMoveOverElement, 482 506 0, /* missingPluginButtonClicked */ 483 507 0, /* didNotHandleKeyEvent */ -
trunk/Tools/MiniBrowser/gtk/GNUmakefile.am
r85311 r88912 34 34 CLEANFILES += \ 35 35 $(top_builddir)/Programs/MiniBrowser 36 37 # Injected bundle 38 noinst_LTLIBRARIES += Libraries/libMiniBrowserWebBundle.la 39 Libraries_libMiniBrowserWebBundle_la_SOURCES = \ 40 Tools/MiniBrowser/gtk/WebBundle/WebBundleMain.c 41 42 Libraries_libMiniBrowserWebBundle_la_LDFLAGS = \ 43 -rpath ${shell pwd}/$(top_builddir)/../unix/TestNetscapePlugin/.libs \ 44 $(no_undefined) \ 45 -avoid-version \ 46 -module 47 48 Libraries_libMiniBrowserWebBundle_la_CPPFLAGS = \ 49 -I$(top_builddir)/DerivedSources/InjectedBundle \ 50 -I$(top_builddir)/DerivedSources/WebKit2/include \ 51 $(global_cppflags) \ 52 $(javascriptcore_cppflags) \ 53 $(GLIB_CFLAGS) -
trunk/Tools/MiniBrowser/gtk/main.c
r85583 r88912 32 32 static const gchar **uriArguments = NULL; 33 33 34 static WKContextRef createWKContextWithInjectedBundle() 35 { 36 WKStringRef bundlePath = WKStringCreateWithUTF8CString("Libraries/.libs/libMiniBrowserWebBundle.so"); 37 WKContextRef processContext = WKContextCreateWithInjectedBundlePath(bundlePath); 38 WKContextInjectedBundleClient bundleClient = { 39 0, /* version */ 40 0, /* clientInfo */ 41 0, /* didRecieveMessageFromInjectedBundle,*/ 42 0 43 }; 44 WKContextSetInjectedBundleClient(processContext, &bundleClient); 45 WKRelease(bundlePath); 46 47 return processContext; 48 } 49 34 50 static gchar *argumentToURL(const char *filename) 35 51 { … … 41 57 } 42 58 43 static void loadURI(const gchar *uri )59 static void loadURI(const gchar *uri, WKContextRef processContext) 44 60 { 45 WKViewRef webView = WKViewCreate( WKContextGetSharedProcessContext(), 0);61 WKViewRef webView = WKViewCreate(processContext, 0); 46 62 GtkWidget *mainWindow = browser_window_new(webView); 47 63 gchar *url = argumentToURL(uri); … … 78 94 g_option_context_free (context); 79 95 96 WKContextRef processContext = createWKContextWithInjectedBundle(); 97 80 98 if (uriArguments) { 81 99 int i; 82 100 83 101 for (i = 0; uriArguments[i]; i++) 84 loadURI(uriArguments[i] );102 loadURI(uriArguments[i], processContext); 85 103 } else 86 loadURI("http://www.webkitgtk.org/" );104 loadURI("http://www.webkitgtk.org/", processContext); 87 105 88 106 gtk_main();
Note: See TracChangeset
for help on using the changeset viewer.