[epiphany] Use a chromium-like status bar by default
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Use a chromium-like status bar by default
- Date: Tue, 18 May 2010 16:16:22 +0000 (UTC)
commit 67a2d9af6414a981c02142ec195199b584b60a9d
Author: Xan Lopez <xan gnome org>
Date: Mon May 17 21:30:33 2010 +0200
Use a chromium-like status bar by default
Get rid of our statusbar for good and switch to something like what
Chromium uses, since it takes less vertical space.
The only regression is that we lose the resize grip, but that should
be re-added to GtkWindow soon.
Bug #609713
data/ui/epiphany-ui.xml | 1 -
doc/reference/epiphany-docs.sgml | 1 -
doc/reference/epiphany-sections.txt | 10 --
doc/reference/epiphany.types | 2 -
doc/reference/tmpl/ephy-window.sgml | 9 --
embed/ephy-web-view.c | 259 +++++++++++++++++++++++++++++++++++
embed/ephy-web-view.h | 127 +++++++++--------
src/Makefile.am | 4 -
src/ephy-lockdown.c | 4 -
src/ephy-statusbar.c | 181 ------------------------
src/ephy-statusbar.h | 69 ---------
src/ephy-window.c | 231 +++++--------------------------
src/ephy-window.h | 2 -
13 files changed, 358 insertions(+), 542 deletions(-)
---
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index 5be9e4f..c2a9b44 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -46,7 +46,6 @@
<menuitem name="ViewToolbarEditorMenu" action="ViewToolbarEditor"/>
<separator/>
</menu>
- <menuitem name="ViewStatusbarMenu" action="ViewStatusbar"/>
</placeholder>
<separator name="ViewSep1"/>
<menuitem name="ViewPopupsMenu" action="ViewPopupWindows"/>
diff --git a/doc/reference/epiphany-docs.sgml b/doc/reference/epiphany-docs.sgml
index 9ce575a..402a946 100644
--- a/doc/reference/epiphany-docs.sgml
+++ b/doc/reference/epiphany-docs.sgml
@@ -10,7 +10,6 @@
<title>Epiphany</title>
<xi:include href="xml/ephy-web-view.xml"/>
<xi:include href="xml/ephy-location-action.xml"/>
- <xi:include href="xml/ephy-statusbar.xml"/>
<xi:include href="xml/ephy-toolbar.xml"/>
<xi:include href="xml/ephy-window.xml"/>
</chapter>
diff --git a/doc/reference/epiphany-sections.txt b/doc/reference/epiphany-sections.txt
index 72479d9..75f7826 100644
--- a/doc/reference/epiphany-sections.txt
+++ b/doc/reference/epiphany-sections.txt
@@ -215,15 +215,6 @@ ephy_location_action_set_address
</SECTION>
<SECTION>
-<FILE>ephy-statusbar</FILE>
-<TITLE>EphyStatusbar</TITLE>
-EphyStatusbar
-ephy_statusbar_new
-ephy_statusbar_add_widget
-ephy_statusbar_remove_widget
-</SECTION>
-
-<SECTION>
<FILE>ephy-toolbar</FILE>
<TITLE>EphyToolbar</TITLE>
EphyToolbar
@@ -251,7 +242,6 @@ ephy_window_get_ui_manager
ephy_window_get_toolbar
ephy_window_get_notebook
ephy_window_get_find_toolbar
-ephy_window_get_statusbar
ephy_window_load_url
ephy_window_set_zoom
ephy_window_activate_location
diff --git a/doc/reference/epiphany.types b/doc/reference/epiphany.types
index 21e23be..c9637f5 100644
--- a/doc/reference/epiphany.types
+++ b/doc/reference/epiphany.types
@@ -24,11 +24,9 @@ ephy_zoom_control_get_type
ephy_dialog_get_type
#include <ephy-location-action.h>
-#include <ephy-statusbar.h>
#include <ephy-toolbar.h>
#include <ephy-window.h>
ephy_location_action_get_type
-ephy_statusbar_get_type
ephy_toolbar_get_type
ephy_window_get_type
diff --git a/doc/reference/tmpl/ephy-window.sgml b/doc/reference/tmpl/ephy-window.sgml
index 9e59c49..8610652 100644
--- a/doc/reference/tmpl/ephy-window.sgml
+++ b/doc/reference/tmpl/ephy-window.sgml
@@ -79,15 +79,6 @@ EphyWindow
@Returns:
-<!-- ##### FUNCTION ephy_window_get_statusbar ##### -->
-<para>
-
-</para>
-
- window:
- Returns:
-
-
<!-- ##### FUNCTION ephy_window_load_url ##### -->
<para>
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index c51b81b..65298eb 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -98,6 +98,15 @@ struct _EphyWebViewPrivate {
GSList *hidden_popups;
GSList *shown_popups;
+ GSList *messages;
+ GSList *keys;
+
+ guint seq_context_id;
+ guint seq_message_id;
+
+ char *text;
+ GdkRectangle text_rectangle;
+
GtkWidget *password_info_bar;
};
@@ -107,6 +116,12 @@ typedef struct {
char *features;
} PopupInfo;
+typedef struct {
+ gchar *text;
+ guint context_id;
+ guint message_id;
+} EphyWebViewStatusbarMsg;
+
enum {
PROP_0,
PROP_ADDRESS,
@@ -1276,6 +1291,7 @@ static void
ephy_web_view_finalize (GObject *object)
{
EphyWebViewPrivate *priv = EPHY_WEB_VIEW (object)->priv;
+ GSList *list;
if (priv->icon != NULL) {
g_object_unref (priv->icon);
@@ -1287,6 +1303,26 @@ ephy_web_view_finalize (GObject *object)
priv->non_search_regex = NULL;
}
+ for (list = priv->messages; list; list = list->next) {
+ EphyWebViewStatusbarMsg *msg;
+
+ msg = list->data;
+ g_free (msg->text);
+ g_slice_free (EphyWebViewStatusbarMsg, msg);
+ }
+
+ g_slist_free (priv->messages);
+ priv->messages = NULL;
+
+
+ for (list = priv->keys; list; list = list->next)
+ g_free (list->data);
+
+ g_slist_free (priv->keys);
+ priv->keys = NULL;
+
+ g_free (priv->text);
+
ephy_web_view_popups_manager_reset (EPHY_WEB_VIEW (object));
g_free (priv->address);
@@ -1364,6 +1400,59 @@ ephy_web_view_constructed (GObject *object)
NULL);
}
+static gboolean
+ephy_web_view_expose_event (GtkWidget *widget, GdkEventExpose *event)
+{
+ EphyWebViewPrivate *priv;
+
+ GTK_WIDGET_CLASS (ephy_web_view_parent_class)->expose_event (widget, event);
+
+ priv = EPHY_WEB_VIEW (widget)->priv;
+
+ if (priv->text && priv->text[0] != '\0') {
+ gint x, y, width, height;
+ guint border_width;
+ PangoLayout *layout;
+ GtkAllocation allocation;
+ GdkWindow *window;
+ GtkStyle *style;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ layout = gtk_widget_create_pango_layout (widget, priv->text);
+ pango_layout_set_width (layout, PANGO_SCALE * (allocation.width * 0.9));
+ pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
+
+ pango_layout_get_pixel_size (layout, &width, &height);
+
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+ x = border_width;
+ y = allocation.height - height - border_width;
+
+ window = gtk_widget_get_window (widget);
+ style = gtk_widget_get_style (widget);
+ gtk_paint_box (style, window,
+ GTK_STATE_NORMAL, GTK_SHADOW_IN,
+ NULL, widget, NULL,
+ x, allocation.height - height - border_width,
+ width, height);
+
+ priv->text_rectangle.x = x;
+ priv->text_rectangle.y = allocation.height - height - border_width;
+ priv->text_rectangle.width = width;
+ priv->text_rectangle.height = height;
+
+ gtk_paint_layout (style, window,
+ GTK_STATE_NORMAL, FALSE,
+ NULL, widget, NULL,
+ x, y, layout);
+
+ g_object_unref (layout);
+ }
+
+ return FALSE;
+}
+
static void
ephy_web_view_class_init (EphyWebViewClass *klass)
{
@@ -1378,6 +1467,7 @@ ephy_web_view_class_init (EphyWebViewClass *klass)
widget_class->button_press_event = ephy_web_view_button_press_event;
widget_class->key_press_event = ephy_web_view_key_press_event;
+ widget_class->expose_event = ephy_web_view_expose_event;
/**
* EphyWebView:address:
@@ -2164,6 +2254,30 @@ close_web_view_cb (WebKitWebView *web_view,
}
static void
+adj_changed_cb (GtkAdjustment *adj, EphyWebView *view)
+{
+ EphyWebViewPrivate *priv;
+ GdkWindow *window;
+
+ priv = view->priv;
+
+ window = gtk_widget_get_window (GTK_WIDGET (view));
+
+ if (view && window)
+ gdk_window_invalidate_rect (window, &priv->text_rectangle, TRUE);
+}
+
+static void
+set_scroll_adjustments_cb (EphyWebView *view, GtkAdjustment *hadj, GtkAdjustment *vadj)
+{
+ if (hadj)
+ g_signal_connect (hadj, "value-changed", G_CALLBACK (adj_changed_cb), view);
+
+ if (vadj)
+ g_signal_connect (vadj, "value-changed", G_CALLBACK (adj_changed_cb), view);
+}
+
+static void
ephy_web_view_init (EphyWebView *web_view)
{
EphyWebViewPrivate *priv;
@@ -2178,6 +2292,8 @@ ephy_web_view_init (EphyWebView *web_view)
priv->document_type = EPHY_WEB_VIEW_DOCUMENT_HTML;
priv->security_level = EPHY_WEB_VIEW_STATE_IS_UNKNOWN;
priv->monitor_directory = FALSE;
+ priv->seq_context_id = 1;
+ priv->seq_message_id = 1;
priv->non_search_regex = g_regex_new ("(^localhost(\\.[^[:space:]]+)?(:\\d+)?(/.*)?$|"
"^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]$|"
@@ -2218,6 +2334,10 @@ ephy_web_view_init (EphyWebView *web_view)
G_CALLBACK (ge_popup_blocked_cb),
web_view, (GConnectFlags)0);
+ g_signal_connect (web_view, "set-scroll-adjustments",
+ G_CALLBACK (set_scroll_adjustments_cb),
+ NULL);
+
cache = EPHY_FAVICON_CACHE
(ephy_embed_shell_get_favicon_cache (embed_shell));
g_signal_connect_object (G_OBJECT (cache), "changed",
@@ -3618,3 +3738,142 @@ ephy_web_view_load_homepage (EphyWebView *view)
return is_empty;
}
+static void
+ephy_web_view_statusbar_update (EphyWebView *view, const char *text)
+{
+ EphyWebViewPrivate *priv;
+ GdkWindow *window;
+ GdkRectangle rect;
+
+ priv = view->priv;
+
+ if (priv->text)
+ g_free (priv->text);
+
+ priv->text = g_strdup (text);
+
+ /* FIXME: we should invalidate the union of the sizes of the
+ * rectangles of the previous and next statusbar text */
+ window = gtk_widget_get_window (GTK_WIDGET (view));
+ if (window) {
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (GTK_WIDGET (view), &allocation);
+
+ rect = priv->text_rectangle;
+ rect.width = allocation.width;
+ if (rect.height == 0)
+ rect.height = allocation.height;
+
+ gdk_window_invalidate_rect (window, &rect, TRUE);
+ }
+}
+
+/* Portions of the following code based on GTK+.
+ * License block as follows:
+ *
+ * GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ * GtkStatusbar Copyright (C) 1998 Shawn T. Amundson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ *
+ */
+
+guint
+ephy_web_view_statusbar_get_context_id (EphyWebView *view, const char *context_description)
+{
+ char *string;
+ guint id;
+
+ g_return_val_if_fail (EPHY_IS_WEB_VIEW (view), 0);
+ g_return_val_if_fail (context_description != NULL, 0);
+
+ /* we need to preserve namespaces on object datas */
+ string = g_strconcat ("ephy-web-view-status-bar-context:", context_description, NULL);
+
+ id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (view), string));
+ if (id == 0) {
+ EphyWebViewPrivate *priv = view->priv;
+
+ id = priv->seq_context_id++;
+ g_object_set_data_full (G_OBJECT (view), string, GUINT_TO_POINTER (id), NULL);
+ priv->keys = g_slist_prepend (priv->keys, string);
+ } else
+ g_free (string);
+
+ return id;
+}
+
+guint
+ephy_web_view_statusbar_push (EphyWebView *view, guint context_id, const char *text)
+{
+ EphyWebViewPrivate *priv;
+ EphyWebViewStatusbarMsg *msg;
+
+ g_return_val_if_fail (EPHY_IS_WEB_VIEW (view), 0);
+ g_return_val_if_fail (context_id != 0, 0);
+ g_return_val_if_fail (text != NULL, 0);
+
+ priv = view->priv;
+
+ msg = g_slice_new (EphyWebViewStatusbarMsg);
+ msg->text = g_strdup (text);
+ msg->context_id = context_id;
+ msg->message_id = priv->seq_message_id++;
+
+ priv->messages = g_slist_prepend (priv->messages, msg);
+
+ ephy_web_view_statusbar_update (view, text);
+
+ return msg->message_id;
+}
+
+void
+ephy_web_view_statusbar_pop (EphyWebView *view, guint context_id)
+{
+ EphyWebViewPrivate *priv;
+ EphyWebViewStatusbarMsg *msg;
+ GSList *list;
+
+ g_return_if_fail (EPHY_IS_WEB_VIEW (view));
+ g_return_if_fail (context_id != 0);
+
+ priv = view->priv;
+
+ for (list = priv->messages; list; list = list->next) {
+ EphyWebViewStatusbarMsg *msg = list->data;
+
+ if (msg->context_id == context_id) {
+ priv->messages = g_slist_remove_link (priv->messages, list);
+ g_free (msg->text);
+ g_slice_free (EphyWebViewStatusbarMsg, msg);
+ g_slist_free_1 (list);
+ break;
+ }
+ }
+
+ msg = priv->messages ? priv->messages->data : NULL;
+ ephy_web_view_statusbar_update (view, msg ? msg->text : NULL);
+}
+
+
+
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 6ccaaf6..5243aa7 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -128,69 +128,74 @@ struct _EphyWebViewClass
const char *uri);
};
-GType ephy_web_view_get_type (void);
-GType ephy_web_view_chrome_get_type (void);
-GType ephy_web_view_security_level_get_type (void);
-GtkWidget * ephy_web_view_new (void);
-void ephy_web_view_load_request (EphyWebView *view,
- WebKitNetworkRequest *request);
-void ephy_web_view_load_url (EphyWebView *view,
- const char *url);
-void ephy_web_view_copy_back_history (EphyWebView *source,
- EphyWebView *dest);
-void ephy_web_view_clear_history (EphyWebView *view);
-gboolean ephy_web_view_is_loading (EphyWebView *view);
-const char * ephy_web_view_get_loading_title (EphyWebView *view);
-GdkPixbuf * ephy_web_view_get_icon (EphyWebView *view);
-EphyWebViewDocumentType ephy_web_view_get_document_type (EphyWebView *view);
-EphyWebViewNavigationFlags ephy_web_view_get_navigation_flags (EphyWebView *view);
-const char * ephy_web_view_get_status_message (EphyWebView *view);
-const char * ephy_web_view_get_link_message (EphyWebView *view);
-gboolean ephy_web_view_get_visibility (EphyWebView *view);
-void ephy_web_view_set_link_message (EphyWebView *view,
- char *link_message);
-void ephy_web_view_set_security_level (EphyWebView *view,
- EphyWebViewSecurityLevel level);
-void ephy_web_view_set_visibility (EphyWebView *view,
- gboolean visibility);
-const char * ephy_web_view_get_typed_address (EphyWebView *view);
-void ephy_web_view_set_typed_address (EphyWebView *view,
- const char *address);
-gboolean ephy_web_view_get_is_blank (EphyWebView *view);
-gboolean ephy_web_view_has_modified_forms (EphyWebView *view);
-char * ephy_web_view_get_location (EphyWebView *view,
- gboolean toplevel);
-void ephy_web_view_go_up (EphyWebView *view);
-char * ephy_web_view_get_js_status (EphyWebView *view);
-void ephy_web_view_get_security_level (EphyWebView *view,
- EphyWebViewSecurityLevel *level,
- char **description);
-void ephy_web_view_show_page_certificate (EphyWebView *view);
-void ephy_web_view_show_print_preview (EphyWebView *view);
-void ephy_web_view_print (EphyWebView *view);
-GSList * ephy_web_view_get_go_up_list (EphyWebView *view);
-void ephy_web_view_set_title (EphyWebView *view,
- const char *view_title);
-const char * ephy_web_view_get_title (EphyWebView *view);
-gboolean ephy_web_view_can_go_up (EphyWebView *view);
-const char * ephy_web_view_get_address (EphyWebView *view);
-const char * ephy_web_view_get_title_composite (EphyWebView *view);
+GType ephy_web_view_get_type (void);
+GType ephy_web_view_chrome_get_type (void);
+GType ephy_web_view_security_level_get_type (void);
+GtkWidget * ephy_web_view_new (void);
+void ephy_web_view_load_request (EphyWebView *view,
+ WebKitNetworkRequest *request);
+void ephy_web_view_load_url (EphyWebView *view,
+ const char *url);
+void ephy_web_view_copy_back_history (EphyWebView *source,
+ EphyWebView *dest);
+void ephy_web_view_clear_history (EphyWebView *view);
+gboolean ephy_web_view_is_loading (EphyWebView *view);
+const char * ephy_web_view_get_loading_title (EphyWebView *view);
+GdkPixbuf * ephy_web_view_get_icon (EphyWebView *view);
+EphyWebViewDocumentType ephy_web_view_get_document_type (EphyWebView *view);
+EphyWebViewNavigationFlags ephy_web_view_get_navigation_flags (EphyWebView *view);
+const char * ephy_web_view_get_status_message (EphyWebView *view);
+const char * ephy_web_view_get_link_message (EphyWebView *view);
+gboolean ephy_web_view_get_visibility (EphyWebView *view);
+void ephy_web_view_set_link_message (EphyWebView *view,
+ char *link_message);
+void ephy_web_view_set_security_level (EphyWebView *view,
+ EphyWebViewSecurityLevel level);
+void ephy_web_view_set_visibility (EphyWebView *view,
+ gboolean visibility);
+const char * ephy_web_view_get_typed_address (EphyWebView *view);
+void ephy_web_view_set_typed_address (EphyWebView *view,
+ const char *address);
+gboolean ephy_web_view_get_is_blank (EphyWebView *view);
+gboolean ephy_web_view_has_modified_forms (EphyWebView *view);
+char * ephy_web_view_get_location (EphyWebView *view,
+ gboolean toplevel);
+void ephy_web_view_go_up (EphyWebView *view);
+char * ephy_web_view_get_js_status (EphyWebView *view);
+void ephy_web_view_get_security_level (EphyWebView *view,
+ EphyWebViewSecurityLevel *level,
+ char **description);
+void ephy_web_view_show_page_certificate (EphyWebView *view);
+void ephy_web_view_show_print_preview (EphyWebView *view);
+void ephy_web_view_print (EphyWebView *view);
+GSList * ephy_web_view_get_go_up_list (EphyWebView *view);
+void ephy_web_view_set_title (EphyWebView *view,
+ const char *view_title);
+const char * ephy_web_view_get_title (EphyWebView *view);
+gboolean ephy_web_view_can_go_up (EphyWebView *view);
+const char * ephy_web_view_get_address (EphyWebView *view);
+const char * ephy_web_view_get_title_composite (EphyWebView *view);
-/* These should be private */
-void ephy_web_view_set_address (EphyWebView *view,
- const char *address);
-void ephy_web_view_location_changed (EphyWebView *view,
- const char *location);
-void ephy_web_view_set_loading_title (EphyWebView *view,
- const char *title,
- gboolean is_address);
-void ephy_web_view_popups_manager_reset (EphyWebView *view);
-
-void ephy_web_view_save (EphyWebView *view,
- const char *uri);
-
-gboolean ephy_web_view_load_homepage (EphyWebView *view);
+/* These should be private */
+void ephy_web_view_set_address (EphyWebView *view,
+ const char *address);
+void ephy_web_view_location_changed (EphyWebView *view,
+ const char *location);
+void ephy_web_view_set_loading_title (EphyWebView *view,
+ const char *title,
+ gboolean is_address);
+void ephy_web_view_popups_manager_reset (EphyWebView *view);
+void ephy_web_view_save (EphyWebView *view,
+ const char *uri);
+gboolean ephy_web_view_load_homepage (EphyWebView *view);
+void ephy_web_view_statusbar_pop (EphyWebView *view,
+ guint context_id);
+guint ephy_web_view_statusbar_push (EphyWebView *view,
+ guint context_id,
+ const char *text);
+guint ephy_web_view_statusbar_get_context_id (EphyWebView *view,
+ const char *context_description);
G_END_DECLS
#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index e9d3715..219b083 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,7 +48,6 @@ INST_H_FILES = \
ephy-notebook.h \
ephy-session.h \
ephy-shell.h \
- ephy-statusbar.h \
ephy-window.h \
epiphany.h \
$(NULL)
@@ -80,7 +79,6 @@ libephymain_la_SOURCES = \
ephy-password-info.c \
ephy-session.c \
ephy-shell.c \
- ephy-statusbar.c \
ephy-tabs-menu.c \
ephy-toolbars-model.c \
ephy-toolbar.c \
@@ -298,7 +296,6 @@ EPHY_GIR_H_FILES = \
$(top_srcdir)/src/ephy-notebook.h \
$(top_srcdir)/src/ephy-session.h \
$(top_srcdir)/src/ephy-shell.h \
- $(top_srcdir)/src/ephy-statusbar.h \
$(top_srcdir)/src/ephy-toolbar.h \
$(top_srcdir)/src/ephy-window.h \
$(NULL)
@@ -332,7 +329,6 @@ EPHY_GIR_C_FILES = \
$(top_srcdir)/src/ephy-notebook.c \
$(top_srcdir)/src/ephy-session.c \
$(top_srcdir)/src/ephy-shell.c \
- $(top_srcdir)/src/ephy-statusbar.c \
$(top_srcdir)/src/ephy-toolbar.c \
$(top_srcdir)/src/ephy-window.c \
$(NULL)
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 37a4eb2..1910aca 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -151,10 +151,6 @@ update_window (EphyWindow *window,
action = gtk_action_group_get_action (action_group, "ViewToolbar");
ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, !writable);
- writable = eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_STATUSBAR);
- action = gtk_action_group_get_action (action_group, "ViewStatusbar");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, !writable);
-
disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL);
action = gtk_action_group_get_action (action_group, "GoLocation");
ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 4b394ae..b5d7434 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -38,7 +38,6 @@
#include "ephy-zoom.h"
#include "ephy-debug.h"
#include "ephy-file-helpers.h"
-#include "ephy-statusbar.h"
#include "egg-editable-toolbar.h"
#include "ephy-toolbar.h"
#include "popup-commands.h"
@@ -90,8 +89,6 @@ static void notebook_switch_page_cb (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num,
EphyWindow *window);
-static void ephy_window_view_statusbar_cb (GtkAction *action,
- EphyWindow *window);
static void ephy_window_view_toolbar_cb (GtkAction *action,
EphyWindow *window);
static void ephy_window_view_popup_windows_cb (GtkAction *action,
@@ -282,9 +279,6 @@ static const GtkToggleActionEntry ephy_menu_toggle_entries [] =
{ "ViewToolbar", NULL, N_("_Hide Toolbars"), NULL,
N_("Show or hide toolbar"),
G_CALLBACK (ephy_window_view_toolbar_cb), FALSE },
- { "ViewStatusbar", NULL, N_("St_atusbar"), NULL,
- N_("Show or hide statusbar"),
- G_CALLBACK (ephy_window_view_statusbar_cb), TRUE },
{ "ViewFullscreen", GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
N_("Browse at full screen"),
G_CALLBACK (window_cmd_view_fullscreen), FALSE },
@@ -434,7 +428,6 @@ struct _EphyWindowPrivate
GtkWidget *menu_dock;
GtkWidget *fullscreen_popup;
EphyToolbar *toolbar;
- GtkWidget *statusbar;
GtkUIManager *manager;
GtkActionGroup *action_group;
GtkActionGroup *popups_action_group;
@@ -494,10 +487,18 @@ impl_add_child (EphyEmbedContainer *container,
gboolean jump_to)
{
EphyWindow *window = EPHY_WINDOW (container);
+ EphyWebView *view;
g_return_val_if_fail (!window->priv->is_popup ||
gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) < 1, -1);
+ view = ephy_embed_get_web_view (child);
+
+ window->priv->tab_message_cid = ephy_web_view_statusbar_get_context_id
+ (view, "tab_message");
+ window->priv->help_message_cid = ephy_web_view_statusbar_get_context_id
+ (view, "help_message");
+
return ephy_notebook_add_tab (EPHY_NOTEBOOK (window->priv->notebook),
child, position, jump_to);
}
@@ -749,7 +750,6 @@ get_toolbar_visibility (EphyWindow *window)
static void
get_chromes_visibility (EphyWindow *window,
gboolean *show_menubar,
- gboolean *show_statusbar,
gboolean *show_toolbar,
gboolean *show_tabsbar)
{
@@ -759,13 +759,12 @@ get_chromes_visibility (EphyWindow *window,
if (window->priv->fullscreen_mode)
{
*show_toolbar = (flags & EPHY_WEB_VIEW_CHROME_TOOLBAR) != 0;
- *show_menubar = *show_statusbar = FALSE;
+ *show_menubar = FALSE;
*show_tabsbar = !priv->is_popup;
}
else
{
*show_menubar = (flags & EPHY_WEB_VIEW_CHROME_MENUBAR) != 0;
- *show_statusbar = (flags & EPHY_WEB_VIEW_CHROME_STATUSBAR) != 0;
*show_toolbar = (flags & EPHY_WEB_VIEW_CHROME_TOOLBAR) != 0;
*show_tabsbar = !priv->is_popup;
}
@@ -777,12 +776,12 @@ sync_chromes_visibility (EphyWindow *window)
EphyWindowPrivate *priv = window->priv;
GtkWidget *menubar;
GtkAction *action;
- gboolean show_statusbar, show_menubar, show_toolbar, show_tabsbar;
+ gboolean show_menubar, show_toolbar, show_tabsbar;
if (priv->closing) return;
get_chromes_visibility (window, &show_menubar,
- &show_statusbar, &show_toolbar,
+ &show_toolbar,
&show_tabsbar);
menubar = gtk_ui_manager_get_widget (window->priv->manager, "/menubar");
@@ -790,7 +789,6 @@ sync_chromes_visibility (EphyWindow *window)
g_object_set (menubar, "visible", show_menubar, NULL);
g_object_set (priv->toolbar, "visible", show_toolbar, NULL);
- g_object_set (priv->statusbar, "visible", show_statusbar, NULL);
ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (priv->notebook), show_tabsbar);
@@ -1218,6 +1216,13 @@ init_menu_updaters (EphyWindow *window)
G_CALLBACK (edit_menu_hide_cb), window);
}
+static EphyWebView*
+ephy_window_get_active_web_view (EphyWindow *window)
+{
+ EphyEmbed *active_embed = window->priv->active_embed;
+ return ephy_embed_get_web_view (active_embed);
+}
+
static void
menu_item_select_cb (GtkMenuItem *proxy,
EphyWindow *window)
@@ -1231,8 +1236,8 @@ menu_item_select_cb (GtkMenuItem *proxy,
g_object_get (action, "tooltip", &message, NULL);
if (message)
{
- gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar),
- window->priv->help_message_cid, message);
+ EphyWebView *view = ephy_window_get_active_web_view (window);
+ ephy_web_view_statusbar_push (view, window->priv->help_message_cid, message);
g_free (message);
}
}
@@ -1241,8 +1246,8 @@ static void
menu_item_deselect_cb (GtkMenuItem *proxy,
EphyWindow *window)
{
- gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
- window->priv->help_message_cid);
+ EphyWebView *view = ephy_window_get_active_web_view (window);
+ ephy_web_view_statusbar_pop (view, window->priv->help_message_cid);
}
static gboolean
@@ -1264,8 +1269,8 @@ tool_item_enter_cb (GtkWidget *proxy,
g_object_get (action, "tooltip", &message, NULL);
if (message)
{
- gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar),
- window->priv->help_message_cid, message);
+ EphyWebView *view = ephy_window_get_active_web_view (window);
+ ephy_web_view_statusbar_push (view, window->priv->help_message_cid, message);
g_free (message);
}
}
@@ -1280,8 +1285,8 @@ tool_item_leave_cb (GtkWidget *proxy,
{
if (event->mode == GDK_CROSSING_NORMAL)
{
- gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
- window->priv->help_message_cid);
+ EphyWebView *view = ephy_window_get_active_web_view (window);
+ ephy_web_view_statusbar_pop (view, window->priv->help_message_cid);
}
return FALSE;
@@ -1292,8 +1297,8 @@ tool_item_drag_begin_cb (GtkWidget *widget,
GdkDragContext *context,
EphyWindow *window)
{
- gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
- window->priv->help_message_cid);
+ EphyWebView *view = ephy_window_get_active_web_view (window);
+ ephy_web_view_statusbar_pop (view, window->priv->help_message_cid);
}
@@ -1374,10 +1379,10 @@ update_chromes_actions (EphyWindow *window)
{
GtkActionGroup *action_group = window->priv->action_group;
GtkAction *action;
- gboolean show_statusbar, show_menubar, show_toolbar, show_tabsbar;
+ gboolean show_menubar, show_toolbar, show_tabsbar;
get_chromes_visibility (window, &show_menubar,
- &show_statusbar, &show_toolbar,
+ &show_toolbar,
&show_tabsbar);
action = gtk_action_group_get_action (action_group, "ViewToolbar");
@@ -1388,15 +1393,6 @@ update_chromes_actions (EphyWindow *window)
g_signal_handlers_unblock_by_func (G_OBJECT (action),
G_CALLBACK (ephy_window_view_toolbar_cb),
window);
-
- action = gtk_action_group_get_action (action_group, "ViewStatusbar");
- g_signal_handlers_block_by_func (G_OBJECT (action),
- G_CALLBACK (ephy_window_view_statusbar_cb),
- window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show_statusbar);
- g_signal_handlers_unblock_by_func (G_OBJECT (action),
- G_CALLBACK (ephy_window_view_statusbar_cb),
- window);
}
static void
@@ -1608,18 +1604,17 @@ sync_tab_load_progress (EphyWebView *view, GParamSpec *pspec, EphyWindow *window
static void
sync_tab_message (EphyWebView *view, GParamSpec *pspec, EphyWindow *window)
{
- GtkStatusbar *s = GTK_STATUSBAR (window->priv->statusbar);
const char *message;
if (window->priv->closing) return;
message = ephy_web_view_get_status_message (view);
- gtk_statusbar_pop (s, window->priv->tab_message_cid);
+ ephy_web_view_statusbar_pop (view, window->priv->tab_message_cid);
if (message)
{
- gtk_statusbar_push (s, window->priv->tab_message_cid, message);
+ ephy_web_view_statusbar_push (view, window->priv->tab_message_cid, message);
}
}
@@ -2369,12 +2364,11 @@ web_view_ready_cb (WebKitWebView *web_view,
{
int width, height;
gboolean toolbar_visible;
- gboolean statusbar_visible;
gboolean menubar_visible;
EphyWebViewChrome chrome_mask;
WebKitWebWindowFeatures *features;
- toolbar_visible = statusbar_visible = menubar_visible = TRUE;
+ toolbar_visible = menubar_visible = TRUE;
features = webkit_web_view_get_window_features (web_view);
chrome_mask = window->priv->chrome;
@@ -2383,7 +2377,6 @@ web_view_ready_cb (WebKitWebView *web_view,
"width", &width,
"height", &height,
"toolbar-visible", &toolbar_visible,
- "statusbar-visible", &statusbar_visible,
"menubar-visible", &menubar_visible,
NULL);
@@ -2392,9 +2385,6 @@ web_view_ready_cb (WebKitWebView *web_view,
if (!toolbar_visible)
chrome_mask &= ~EPHY_WEB_VIEW_CHROME_TOOLBAR;
- if (!statusbar_visible)
- chrome_mask &= ~EPHY_WEB_VIEW_CHROME_STATUSBAR;
-
if (!menubar_visible)
chrome_mask &= ~EPHY_WEB_VIEW_CHROME_MENUBAR;
@@ -2525,106 +2515,6 @@ policy_decision_required_cb (WebKitWebView *web_view,
return FALSE;
}
-/* FIXME: get rid of this stuff when the DOM API lands */
-/* FIXME: would be nice to get transparent background/opaque text, but
- not sure if I can be bothered */
-const char *add_node_string =
- "var node = document.getElementById('epiphanyWebKitFloatingStatusBar');"\
- "if (node) node.parentNode.removeChild(node);"\
- "var node = document.createElement('div');"\
- "node.id = 'epiphanyWebKitFloatingStatusBar';"\
- "node.style.padding = '0.4em';"\
- "node.style.zIndex = '9999';"\
- "node.style.border = '1px solid black';"\
- "node.style.background = 'rgb(%d,%d,%d)';"\
- "node.style.color = 'rgb(%d,%d,%d)';"\
- "node.style.position = 'fixed';"\
- "node.style.left = '0';"\
- "node.style.bottom = '0';"\
- "node.style.opacity = 0.95;"\
- "var text = document.createTextNode('%s');"\
- "var body = document.getElementsByTagName('body')[0];"\
- "node.appendChild(text);"\
- "body.appendChild(node);";
-
-const char *remove_node_string =
- "var node = document.getElementById('epiphanyWebKitFloatingStatusBar');"\
- "if (node) node.parentNode.removeChild(node);";
-
-static void
-ephy_window_link_message_cb (EphyWebView *web_view, GParamSpec *spec, EphyWindow *window)
-{
- gboolean visible;
- const char *link_message;
- WebKitWebView *view;
-
- g_object_get (window->priv->statusbar, "visible", &visible, NULL);
-
- view = WEBKIT_WEB_VIEW (web_view);
- link_message = ephy_web_view_get_link_message (web_view);
-
- /* If the statusbar is visible remove the test, it might get
- stuck otherwise */
- if (link_message && visible == FALSE)
- {
- char *script;
- GdkColor bg, fg;
- GtkWidget *widget;
- GtkAllocation allocation;
- GtkStyle *style;
- GtkStateType state;
- PangoLayout *layout;
- PangoLayoutLine *line;
- PangoLayoutRun *run;
- PangoItem *item;
- const char *text;
- char *freeme;
-
- widget = GTK_WIDGET (view);
- layout = gtk_widget_create_pango_layout (widget, link_message);
- gtk_widget_get_allocation (widget, &allocation);
- pango_layout_set_width (layout, PANGO_SCALE * (allocation.width * 0.9));
- pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
-
- line = pango_layout_get_line_readonly (layout, 0);
- run = line->runs->data;
- item = run->item;
-
- freeme = NULL;
- text = pango_layout_get_text (layout);
- if (item->num_chars < g_utf8_strlen (text, -1))
- {
- char buffer[2048]; /* Should be enough ... */
- g_utf8_strncpy (buffer, text, item->num_chars - 3);
- freeme = g_strconcat (buffer, "...", NULL);
- }
-
- g_utf8_strncpy ((gchar *)text, pango_layout_get_text (layout), item->num_chars);
- style = gtk_widget_get_style (widget);
- state = gtk_widget_get_state (widget);
- bg = style->bg[state];
- fg = style->fg[state];
-
- script = g_strdup_printf(add_node_string,
- (int) (bg.red / 65535. * 255),
- (int) (bg.green / 65535. * 255),
- (int) (bg.blue / 65535. * 255),
- (int) (fg.red / 65535. * 255),
- (int) (fg.green / 65535. * 255),
- (int) (fg.blue / 65535. * 255),
- freeme ? freeme : text);
- webkit_web_view_execute_script (view, script);
- g_object_unref (layout);
- g_free (script);
- g_free (freeme);
- }
- else
- {
- const char *script = remove_node_string;
- webkit_web_view_execute_script (view, script);
- }
-}
-
static void
ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
{
@@ -2712,9 +2602,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
g_signal_handlers_disconnect_by_func (view,
G_CALLBACK (ephy_window_visibility_cb),
window);
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (ephy_window_link_message_cb),
- window);
g_signal_handlers_disconnect_by_func
(view, G_CALLBACK (ephy_window_dom_mouse_click_cb), window);
@@ -2814,9 +2701,6 @@ ephy_window_set_active_tab (EphyWindow *window, EphyEmbed *new_embed)
g_signal_connect_object (view, "notify::visibility",
G_CALLBACK (ephy_window_visibility_cb),
window, 0);
- g_signal_connect_object (view, "notify::link-message",
- G_CALLBACK (ephy_window_link_message_cb),
- window, 0);
g_object_notify (G_OBJECT (window), "active-child");
}
@@ -3184,11 +3068,6 @@ ephy_window_set_chrome (EphyWindow *window, EphyWebViewChrome mask)
chrome_mask &= ~EPHY_WEB_VIEW_CHROME_TOOLBAR;
}
- if (!eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR))
- {
- chrome_mask &= ~EPHY_WEB_VIEW_CHROME_STATUSBAR;
- }
-
if (eel_gconf_get_boolean (CONF_LOCKDOWN_HIDE_MENUBAR))
{
chrome_mask &= ~EPHY_WEB_VIEW_CHROME_MENUBAR;
@@ -3356,15 +3235,6 @@ ephy_window_state_event (GtkWidget *widget,
window_state_event (widget, event);
}
- if (event->changed_mask & (GDK_WINDOW_STATE_MAXIMIZED))
- {
- gboolean show;
-
- show = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) == 0;
-
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (priv->statusbar), show);
- }
-
if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
{
GtkActionGroup *action_group;
@@ -3630,15 +3500,6 @@ ephy_window_constructor (GType type,
GTK_WIDGET (priv->find_toolbar), FALSE, FALSE, 0);
/* don't show the find toolbar here! */
- priv->statusbar = ephy_statusbar_new ();
- gtk_box_pack_end (GTK_BOX (priv->main_vbox),
- GTK_WIDGET (priv->statusbar),
- FALSE, TRUE, 0);
- priv->tab_message_cid = gtk_statusbar_get_context_id
- (GTK_STATUSBAR (priv->statusbar), "tab_message");
- priv->help_message_cid = gtk_statusbar_get_context_id
- (GTK_STATUSBAR (priv->statusbar), "help_message");
-
/* get the toolbars model *before* getting the bookmarksbar model
* (via ephy_bookmarsbar_new()), so that the toolbars model is
* instantiated *before* the bookmarksbarmodel, to make forwarding
@@ -3856,22 +3717,6 @@ ephy_window_get_find_toolbar (EphyWindow *window)
return GTK_WIDGET (window->priv->find_toolbar);
}
-/**
- * ephy_window_get_statusbar:
- * @window: an #EphyWindow
- *
- * Returns this window's statusbar as an #EphyStatusbar.
- *
- * Return value: (transfer none): This window's statusbar
- **/
-GtkWidget *
-ephy_window_get_statusbar (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL);
-
- return GTK_WIDGET (window->priv->statusbar);
-}
-
static EphyEmbed *
real_get_active_tab (EphyWindow *window, int page_num)
{
@@ -4025,8 +3870,6 @@ sync_prefs_with_chrome (EphyWindow *window)
{
eel_gconf_set_boolean (CONF_WINDOWS_SHOW_TOOLBARS,
flags & EPHY_WEB_VIEW_CHROME_TOOLBAR);
- eel_gconf_set_boolean (CONF_WINDOWS_SHOW_STATUSBAR,
- flags & EPHY_WEB_VIEW_CHROME_STATUSBAR);
}
}
@@ -4048,14 +3891,6 @@ sync_chrome_with_view_toggle (GtkAction *action,
}
static void
-ephy_window_view_statusbar_cb (GtkAction *action,
- EphyWindow *window)
-{
- sync_chrome_with_view_toggle (action, window,
- EPHY_WEB_VIEW_CHROME_STATUSBAR, FALSE);
-}
-
-static void
ephy_window_view_toolbar_cb (GtkAction *action,
EphyWindow *window)
{
diff --git a/src/ephy-window.h b/src/ephy-window.h
index ab0e35b..4daa96c 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -71,8 +71,6 @@ GtkWidget *ephy_window_get_notebook (EphyWindow *window);
GtkWidget *ephy_window_get_find_toolbar (EphyWindow *window);
-GtkWidget *ephy_window_get_statusbar (EphyWindow *window);
-
void ephy_window_load_url (EphyWindow *window,
const char *url);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]