summaryrefslogtreecommitdiffstats
path: root/WebKitTools/GtkLauncher
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-11 17:01:47 +0100
committerBen Murdoch <benm@google.com>2009-08-11 18:21:02 +0100
commit0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch)
tree2943df35f62d885c89d01063cc528dd73b480fea /WebKitTools/GtkLauncher
parent7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff)
downloadexternal_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2
Merge in WebKit r47029.
Diffstat (limited to 'WebKitTools/GtkLauncher')
-rw-r--r--WebKitTools/GtkLauncher/main.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/WebKitTools/GtkLauncher/main.c b/WebKitTools/GtkLauncher/main.c
index 0c8c785..6994674 100644
--- a/WebKitTools/GtkLauncher/main.c
+++ b/WebKitTools/GtkLauncher/main.c
@@ -32,7 +32,7 @@ static GtkWidget* uri_entry;
static GtkStatusbar* main_statusbar;
static WebKitWebView* web_view;
static gchar* main_title;
-static gint load_progress;
+static gdouble load_progress;
static guint status_context_id;
static void
@@ -49,7 +49,7 @@ update_title (GtkWindow* window)
GString* string = g_string_new (main_title);
g_string_append (string, " - WebKit Launcher");
if (load_progress < 100)
- g_string_append_printf (string, " (%d%%)", load_progress);
+ g_string_append_printf (string, " (%f%%)", load_progress);
gchar* title = g_string_free (string, FALSE);
gtk_window_set_title (window, title);
g_free (title);
@@ -74,18 +74,21 @@ title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar
}
static void
-progress_change_cb (WebKitWebView* page, gint progress, gpointer data)
+notify_load_status_cb (WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
{
- load_progress = progress;
- update_title (GTK_WINDOW (main_window));
+ if (webkit_web_view_get_load_status (web_view) == WEBKIT_LOAD_COMMITTED) {
+ WebKitWebFrame* frame = webkit_web_view_get_main_frame (web_view);
+ const gchar* uri = webkit_web_frame_get_uri (frame);
+ if (uri)
+ gtk_entry_set_text (GTK_ENTRY (uri_entry), uri);
+ }
}
static void
-load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data)
+notify_progress_cb (WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
{
- const gchar* uri = webkit_web_frame_get_uri(frame);
- if (uri)
- gtk_entry_set_text (GTK_ENTRY (uri_entry), uri);
+ load_progress = webkit_web_view_get_progress (web_view) * 100;
+ update_title (GTK_WINDOW (main_window));
}
static void
@@ -115,10 +118,10 @@ create_browser ()
web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));
- g_signal_connect (G_OBJECT (web_view), "title-changed", G_CALLBACK (title_change_cb), web_view);
- g_signal_connect (G_OBJECT (web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), web_view);
- g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (load_commit_cb), web_view);
- g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
+ g_signal_connect (web_view, "title-changed", G_CALLBACK (title_change_cb), web_view);
+ g_signal_connect (web_view, "notify::load-status", G_CALLBACK (notify_load_status_cb), web_view);
+ g_signal_connect (web_view, "notify::progress", G_CALLBACK (notify_progress_cb), web_view);
+ g_signal_connect (web_view, "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
return scrolled_window;
}
@@ -137,7 +140,11 @@ create_toolbar ()
{
GtkWidget* toolbar = gtk_toolbar_new ();
+#if GTK_CHECK_VERSION(2,15,0)
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar), GTK_ORIENTATION_HORIZONTAL);
+#else
gtk_toolbar_set_orientation (GTK_TOOLBAR (toolbar), GTK_ORIENTATION_HORIZONTAL);
+#endif
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
GtkToolItem* item;
@@ -174,7 +181,7 @@ create_window ()
GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
gtk_widget_set_name (window, "GtkLauncher");
- g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL);
+ g_signal_connect (window, "destroy", G_CALLBACK (destroy_cb), NULL);
return window;
}