_midori_browser_update_interface (MidoriBrowser* browser,
MidoriView* view)
{
- gboolean loading = midori_view_get_load_status (view) != MIDORI_LOAD_FINISHED;
- gboolean can_reload = midori_view_can_reload (view);
GtkAction* action;
- _action_set_sensitive (browser, "Reload", can_reload);
- _action_set_sensitive (browser, "Stop", can_reload && loading);
_action_set_sensitive (browser, "Back", midori_view_can_go_back (view));
_action_set_sensitive (browser, "Forward", midori_view_can_go_forward (view));
_action_set_sensitive (browser, "Previous",
midori_findbar_set_can_find (MIDORI_FINDBAR (browser->find),
midori_view_can_find (view));
- action = _action_by_name (browser, "ReloadStop");
- if (!loading)
- {
- g_object_set (action,
- "stock-id", GTK_STOCK_REFRESH,
- "tooltip", _("Reload the current page"),
- "sensitive", can_reload, NULL);
- katze_item_set_meta_integer (midori_view_get_proxy_item (view),
- "dont-write-history", -1);
- }
- else
- {
- g_object_set (action,
- "stock-id", GTK_STOCK_STOP,
- "tooltip", _("Stop loading the current page"), NULL);
- }
-
action = _action_by_name (browser, "NextForward");
if (midori_view_can_go_forward (view))
{
"sensitive", midori_view_get_next_page (view) != NULL, NULL);
}
-
- #if HAVE_HILDON
- #if HILDON_CHECK_VERSION (2, 2, 0)
- hildon_gtk_window_set_progress_indicator (GTK_WINDOW (browser), loading);
- #endif
- #else
- gtk_widget_set_sensitive (browser->throbber, loading);
- katze_throbber_set_animated (KATZE_THROBBER (browser->throbber), loading);
- #endif
-
action = _action_by_name (browser, "Location");
midori_location_action_set_security_hint (
MIDORI_LOCATION_ACTION (action), midori_view_get_security (view));
_midori_browser_update_progress (MidoriBrowser* browser,
MidoriView* view)
{
- MidoriLocationAction* action;
- gdouble progress;
+ GtkAction* action;
+ gdouble progress = midori_view_get_progress (view);
+ gboolean loading = progress > 0.0;
+
+ action = _action_by_name (browser, "Location");
+ midori_location_action_set_progress (MIDORI_LOCATION_ACTION (action), progress);
+
+ _action_set_sensitive (browser, "Reload", !loading);
+ _action_set_sensitive (browser, "Stop", loading);
- action = MIDORI_LOCATION_ACTION (_action_by_name (browser, "Location"));
- progress = midori_view_get_progress (view);
- /* When we are finished, we don't want to *see* progress anymore */
- if (midori_view_get_load_status (view) == MIDORI_LOAD_FINISHED)
- progress = 0.0;
- /* When loading we want to see at minimum 10% progress */
+ action = _action_by_name (browser, "ReloadStop");
+ if (!loading)
+ {
+ g_object_set (action,
+ "stock-id", GTK_STOCK_REFRESH,
+ "tooltip", _("Reload the current page"), NULL);
+ katze_item_set_meta_integer (midori_view_get_proxy_item (view),
+ "dont-write-history", -1);
+ }
else
- progress = CLAMP (progress, 0.1, 1.0);
- midori_location_action_set_progress (action, progress);
+ {
+ g_object_set (action,
+ "stock-id", GTK_STOCK_STOP,
+ "tooltip", _("Stop loading the current page"), NULL);
+ }
+
+ gtk_widget_set_sensitive (browser->throbber, loading);
+ katze_throbber_set_animated (KATZE_THROBBER (browser->throbber), loading);
}
/**
#ifdef HAVE_GRANITE
if (view->tab)
- g_object_set (view->tab,
- "working", view->load_status != MIDORI_LOAD_FINISHED, NULL);
+ g_object_set (view->tab, "working",
+ midori_view_get_progress (view) > 0.0, NULL);
#else
if (view->tab_icon)
katze_throbber_set_animated (KATZE_THROBBER (view->tab_icon),
- view->load_status != MIDORI_LOAD_FINISHED);
+ midori_view_get_progress (view) > 0.0);
#endif
}
midori_view_apply_scroll_position (view);
- view->progress = 1.0;
- g_object_notify (G_OBJECT (view), "progress");
- midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
-
if (web_frame == webkit_web_view_get_main_frame (web_view))
{
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
g_object_set_data_full (G_OBJECT (view), "news-feeds", default_uri, g_free);
g_free (value);
- /* Ensure load-status is notified again, whether it changed or not */
- g_object_notify (G_OBJECT (view), "load-status");
#if !WEBKIT_CHECK_VERSION (1, 4, 3)
_midori_web_view_load_icon (view);
#endif
}
+ view->progress = 1.0;
+ g_object_notify (G_OBJECT (view), "progress");
+ midori_view_update_load_status (view, MIDORI_LOAD_FINISHED);
+
g_object_thaw_notify (G_OBJECT (view));
}
{
g_return_val_if_fail (MIDORI_IS_VIEW (view), 0.0);
- return view->progress;
+ /* When we are finished, we don't want to *see* progress anymore */
+ if (view->load_status == MIDORI_LOAD_FINISHED)
+ return 0.0;
+ /* Full progress but not finished: presumably all loaded */
+ if (view->progress == 1.0)
+ return 0.0;
+ /* When loading we want to see at minimum 10% progress */
+ return CLAMP (view->progress, 0.1, 1.0);
}
static void