Commit 1f95c240 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

Revert "Move progress bar into url box"

This reverts commit 250bb7f8.
parent 3fc9df2e
......@@ -87,7 +87,6 @@ struct _EphyEmbed {
gulong status_handler_id;
gulong progress_update_handler_id;
gboolean inspector_loaded;
gboolean progress_bar_enabled;
};
G_DEFINE_TYPE (EphyEmbed, ephy_embed, GTK_TYPE_BOX)
......@@ -96,7 +95,6 @@ enum {
PROP_0,
PROP_WEB_VIEW,
PROP_TITLE,
PROP_PROGRESS_BAR_ENABLED,
LAST_PROP
};
......@@ -446,9 +444,6 @@ ephy_embed_set_property (GObject *object,
case PROP_TITLE:
ephy_embed_set_title (embed, g_value_get_string (value));
break;
case PROP_PROGRESS_BAR_ENABLED:
embed->progress_bar_enabled = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -470,9 +465,6 @@ ephy_embed_get_property (GObject *object,
case PROP_TITLE:
g_value_set_string (value, ephy_embed_get_title (embed));
break;
case PROP_PROGRESS_BAR_ENABLED:
g_value_set_boolean (value, embed->progress_bar_enabled);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -515,13 +507,6 @@ ephy_embed_class_init (EphyEmbedClass *klass)
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_PROGRESS_BAR_ENABLED] =
g_param_spec_boolean ("progress-bar-enabled",
"Progress bar",
"Whether to show progress bar within embed",
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, LAST_PROP, obj_properties);
}
......@@ -751,14 +736,12 @@ ephy_embed_constructed (GObject *object)
gtk_overlay_add_overlay (GTK_OVERLAY (embed->overlay), embed->floating_bar);
if (embed->progress_bar_enabled) {
embed->progress = gtk_progress_bar_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (embed->progress),
GTK_STYLE_CLASS_OSD);
gtk_widget_set_halign (embed->progress, GTK_ALIGN_FILL);
gtk_widget_set_valign (embed->progress, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (embed->overlay), embed->progress);
}
embed->progress = gtk_progress_bar_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (embed->progress),
GTK_STYLE_CLASS_OSD);
gtk_widget_set_halign (embed->progress, GTK_ALIGN_FILL);
gtk_widget_set_valign (embed->progress, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (embed->overlay), embed->progress);
embed->find_toolbar = ephy_find_toolbar_new (embed->web_view);
g_signal_connect (embed->find_toolbar, "close",
......@@ -771,10 +754,8 @@ ephy_embed_constructed (GObject *object)
paned = GTK_WIDGET (embed->paned);
if (embed->progress_bar_enabled)
embed->progress_update_handler_id = g_signal_connect (embed->web_view, "notify::estimated-load-progress",
G_CALLBACK (progress_update), object);
embed->progress_update_handler_id = g_signal_connect (embed->web_view, "notify::estimated-load-progress",
G_CALLBACK (progress_update), object);
gtk_paned_pack1 (GTK_PANED (paned), GTK_WIDGET (embed->overlay),
TRUE, FALSE);
......
......@@ -57,7 +57,6 @@ struct _EphyLocationEntry {
GtkOverlay parent_instance;
GtkWidget *url_entry;
GtkWidget *progress_bar;
GtkWidget *bookmark;
GtkWidget *bookmark_event_box;
GtkWidget *reader_mode;
......@@ -85,9 +84,6 @@ struct _EphyLocationEntry {
guint hash;
guint progress_timeout;
gdouble progress_fraction;
gulong dns_prefetch_handler;
guint user_changed : 1;
......@@ -387,20 +383,6 @@ ephy_location_entry_title_widget_interface_init (EphyTitleWidgetInterface *iface
iface->set_security_level = ephy_location_entry_title_widget_set_security_level;
}
static void
ephy_location_entry_dispose (GObject *object)
{
EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (object);
if (entry->progress_timeout) {
g_source_remove (entry->progress_timeout);
entry->progress_timeout = 0;
}
G_OBJECT_CLASS (ephy_location_entry_parent_class)->dispose (object);
}
static void
ephy_location_entry_class_init (EphyLocationEntryClass *klass)
{
......@@ -411,7 +393,6 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
object_class->set_property = ephy_location_entry_set_property;
object_class->constructed = ephy_location_entry_constructed;
object_class->finalize = ephy_location_entry_finalize;
object_class->dispose = ephy_location_entry_dispose;
widget_class->get_preferred_width = ephy_location_entry_get_preferred_width;
widget_class->get_preferred_height = ephy_location_entry_get_preferred_height;
......@@ -819,14 +800,6 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
gtk_widget_show (entry->url_entry);
gtk_overlay_add_overlay (GTK_OVERLAY (entry), entry->url_entry);
/* Progress bar */
entry->progress_bar = gtk_progress_bar_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (entry->progress_bar), "url_progress");
gtk_widget_set_halign (entry->progress_bar, GTK_ALIGN_FILL);
gtk_widget_set_valign (entry->progress_bar, GTK_ALIGN_END);
gtk_widget_show (entry->progress_bar);
gtk_overlay_add_overlay (GTK_OVERLAY (entry), entry->progress_bar);
/* Button Box */
button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_set_homogeneous (GTK_BOX (button_box), FALSE);
......@@ -1421,72 +1394,3 @@ ephy_location_entry_get_reader_mode_state (EphyLocationEntry *entry)
{
return entry->reader_mode_active;
}
static gboolean
progress_hide (gpointer user_data)
{
EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (user_data);
gtk_widget_hide (entry->progress_bar);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (entry->progress_bar), 0);
if (entry->progress_timeout) {
g_source_remove (entry->progress_timeout);
entry->progress_timeout = 0;
}
return G_SOURCE_REMOVE;
}
static gboolean
ephy_location_entry_set_fraction_internal (gpointer user_data)
{
EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (user_data);
gint ms;
gdouble progress;
gdouble current;
entry->progress_timeout = 0;
current = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (entry->progress_bar));
if ((entry->progress_fraction - current) > 0.5 || entry->progress_fraction == 1.0)
ms = 10;
else
ms = 25;
progress = current + 0.025;
if (progress < entry->progress_fraction) {
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (entry->progress_bar),
progress);
entry->progress_timeout = g_timeout_add (ms, ephy_location_entry_set_fraction_internal, entry);
} else {
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (entry->progress_bar),
entry->progress_fraction);
if (entry->progress_fraction == 1.0)
entry->progress_timeout = g_timeout_add (500, progress_hide, entry);
}
return G_SOURCE_REMOVE;
}
void
ephy_location_entry_set_progress (EphyLocationEntry *entry,
gdouble fraction,
gboolean loading)
{
if (entry->progress_timeout) {
g_source_remove (entry->progress_timeout);
entry->progress_timeout = 0;
}
if (!loading) {
gtk_widget_hide (entry->progress_bar);
return;
}
if (!gtk_widget_is_visible (entry->progress_bar))
gtk_widget_show (entry->progress_bar);
entry->progress_fraction = fraction;
ephy_location_entry_set_fraction_internal (entry);
}
......@@ -93,8 +93,4 @@ void ephy_location_entry_set_reader_mode_state (EphyLocationEntr
gboolean ephy_location_entry_get_reader_mode_state (EphyLocationEntry *entry);
void ephy_location_entry_set_progress (EphyLocationEntry *entry,
gdouble progress,
gboolean loading);
G_END_DECLS
......@@ -798,7 +798,6 @@ ephy_shell_new_tab_full (EphyShell *shell,
embed = EPHY_EMBED (g_object_new (EPHY_TYPE_EMBED,
"web-view", web_view,
"title", title,
"progress-bar-enabled", ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION,
NULL));
gtk_widget_show (GTK_WIDGET (embed));
ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (window), embed, position, jump_to);
......
......@@ -2098,31 +2098,12 @@ decide_policy_cb (WebKitWebView *web_view,
return decide_navigation_policy (web_view, decision, decision_type, window);
}
static void
progress_update (WebKitWebView *web_view,
GParamSpec *pspec,
EphyWindow *window)
{
EphyTitleWidget *title_widget;
gdouble progress;
gboolean loading;
progress = webkit_web_view_get_estimated_load_progress (web_view);
loading = ephy_web_view_is_loading (EPHY_WEB_VIEW (web_view));
title_widget = ephy_header_bar_get_title_widget (EPHY_HEADER_BAR (window->header_bar));
ephy_location_entry_set_progress (EPHY_LOCATION_ENTRY (title_widget), progress, loading);
}
static void
ephy_window_connect_active_embed (EphyWindow *window)
{
EphyEmbed *embed;
WebKitWebView *web_view;
EphyWebView *view;
EphyTitleWidget *title_widget;
g_assert (window->active_embed != NULL);
......@@ -2145,18 +2126,6 @@ ephy_window_connect_active_embed (EphyWindow *window)
sync_tab_zoom (web_view, NULL, window);
title_widget = ephy_header_bar_get_title_widget (EPHY_HEADER_BAR (window->header_bar));
if (EPHY_IS_LOCATION_ENTRY (title_widget)) {
gdouble progress = webkit_web_view_get_estimated_load_progress (web_view);
gboolean loading = ephy_web_view_is_loading (EPHY_WEB_VIEW (web_view));
ephy_location_entry_set_progress (EPHY_LOCATION_ENTRY (title_widget), progress, loading);
g_signal_connect_object (web_view, "notify::estimated-load-progress",
G_CALLBACK (progress_update),
window, 0);
}
g_signal_connect_object (web_view, "notify::zoom-level",
G_CALLBACK (sync_tab_zoom),
window, 0);
......@@ -2223,9 +2192,6 @@ ephy_window_disconnect_active_embed (EphyWindow *window)
ephy_embed_detach_notification_container (window->active_embed);
g_signal_handlers_disconnect_by_func (web_view,
G_CALLBACK (progress_update),
window);
g_signal_handlers_disconnect_by_func (web_view,
G_CALLBACK (sync_tab_zoom),
window);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment