diff options
author | Xan Lopez <xan@gnome.org> | 2010-05-18 03:30:33 +0800 |
---|---|---|
committer | Xan Lopez <xan@gnome.org> | 2010-05-19 00:08:47 +0800 |
commit | 67a2d9af6414a981c02142ec195199b584b60a9d (patch) | |
tree | 9ea5ce5e0105d66d430c932ceef5fb5ea5bf7a79 /src | |
parent | 0a3189127756d119ae87a3af8893e35161fcde8c (diff) | |
download | gsoc2013-epiphany-67a2d9af6414a981c02142ec195199b584b60a9d.tar gsoc2013-epiphany-67a2d9af6414a981c02142ec195199b584b60a9d.tar.gz gsoc2013-epiphany-67a2d9af6414a981c02142ec195199b584b60a9d.tar.bz2 gsoc2013-epiphany-67a2d9af6414a981c02142ec195199b584b60a9d.tar.lz gsoc2013-epiphany-67a2d9af6414a981c02142ec195199b584b60a9d.tar.xz gsoc2013-epiphany-67a2d9af6414a981c02142ec195199b584b60a9d.tar.zst gsoc2013-epiphany-67a2d9af6414a981c02142ec195199b584b60a9d.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/ephy-lockdown.c | 4 | ||||
-rw-r--r-- | src/ephy-statusbar.c | 181 | ||||
-rw-r--r-- | src/ephy-statusbar.h | 69 | ||||
-rw-r--r-- | src/ephy-window.c | 231 | ||||
-rw-r--r-- | src/ephy-window.h | 2 |
6 files changed, 33 insertions, 458 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index e9d3715f4..219b083f4 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 37a4eb27f..1910aca2c 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-statusbar.c b/src/ephy-statusbar.c deleted file mode 100644 index 1fbcb555e..000000000 --- a/src/ephy-statusbar.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright © 2002 Jorn Baayen - * Copyright © 2003, 2004 Marco Pesenti Gritti - * Copyright © 2004, 2007 Christian Persch - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include "ephy-statusbar.h" -#include "ephy-stock-icons.h" - -#include <string.h> -#include <glib/gi18n.h> -#include <gtk/gtk.h> - -/** - * SECTION:ephy-statusbar - * @short_description: A statusbar widget for Epiphany - * - * #EphyStatusbar is Epiphany's default statusbar for all windows. - */ - -static void ephy_statusbar_class_init (EphyStatusbarClass *klass); -static void ephy_statusbar_init (EphyStatusbar *t); - -#define EPHY_STATUSBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_STATUSBAR, EphyStatusbarPrivate)) - -struct _EphyStatusbarPrivate -{ - GtkWidget *hbox; - GtkWidget *icon_container; -}; - -G_DEFINE_TYPE (EphyStatusbar, ephy_statusbar, GTK_TYPE_STATUSBAR) - -static void -ephy_statusbar_class_init (EphyStatusbarClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (object_class, sizeof (EphyStatusbarPrivate)); -} - -static void -ephy_statusbar_init (EphyStatusbar *t) -{ - GtkStatusbar *gstatusbar = GTK_STATUSBAR (t); - EphyStatusbarPrivate *priv; - - priv = t->priv = EPHY_STATUSBAR_GET_PRIVATE (t); - - gtk_statusbar_set_has_resize_grip (gstatusbar, TRUE); - -#if GTK_CHECK_VERSION (2, 19, 1) - priv->hbox = gtk_statusbar_get_message_area (gstatusbar); -#else - priv->hbox = gtk_hbox_new (FALSE, 4); -#endif - priv->icon_container = gtk_hbox_new (FALSE, 4); - gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_container, - FALSE, FALSE, 0); - gtk_widget_show (priv->icon_container); - -#if GTK_CHECK_VERSION (2, 19, 1) - gtk_box_reorder_child (GTK_BOX (priv->hbox), priv->icon_container, 0); -#else - /* Put the label in the hbox, and substitute the hbox into the frame */ - g_object_ref (gstatusbar->label); - gtk_container_remove (GTK_CONTAINER (gstatusbar->frame), gstatusbar->label); - gtk_box_pack_start (GTK_BOX (priv->hbox), gstatusbar->label, TRUE, TRUE, 0); - g_object_unref (gstatusbar->label); - gtk_container_add (GTK_CONTAINER (gstatusbar->frame), priv->hbox); - gtk_widget_show (priv->hbox); -#endif -} - -/** - * ephy_statusbar_new: - * - * Creates a new #EphyStatusbar. - * - * Return value: the new #EphyStatusbar object - **/ -GtkWidget * -ephy_statusbar_new (void) -{ - return GTK_WIDGET (g_object_new (EPHY_TYPE_STATUSBAR, NULL)); -} - -static void -sync_visibility (GtkWidget *widget, - GParamSpec *pspec, - GtkWidget *separator) -{ - if (gtk_widget_get_visible (widget)) - { - gtk_widget_show (separator); - } - else - { - gtk_widget_hide (separator); - } -} - -/** - * ephy_statusbar_add_widget: - * @statusbar: an #EphyStatusbar - * @widget: a #GtkWidget - * - * Adds the @widget to the statusbar. Use this function whenever you want to - * add a widget to the statusbar. You can remove the widget again with - * ephy_statusbar_remove_widget(). - **/ -void -ephy_statusbar_add_widget (EphyStatusbar *statusbar, - GtkWidget *widget) -{ - EphyStatusbarPrivate *priv; - GtkWidget *vsep; - - g_return_if_fail (EPHY_IS_STATUSBAR (statusbar)); - g_return_if_fail (GTK_IS_WIDGET (widget)); - - priv = statusbar->priv; - - gtk_box_pack_start (GTK_BOX (priv->icon_container), - widget, FALSE, FALSE, 0); - - vsep = gtk_vseparator_new (); - gtk_box_pack_start (GTK_BOX (priv->icon_container), - vsep, FALSE, FALSE, 0); - sync_visibility (widget, NULL, vsep); - g_object_set_data (G_OBJECT (widget), "EphyStatusbar::separator", vsep); - g_signal_connect (widget, "notify::visible", - G_CALLBACK (sync_visibility), vsep); -} - -/** - * ephy_statusbar_remove_widget: - * @statusbar: an #EphyStatusbar - * @widget: a #GtkWidget - * - * Removes @widget, which must have been added to @statusbar using - * ephy_statusbar_add_widget (). - */ -void -ephy_statusbar_remove_widget (EphyStatusbar *statusbar, - GtkWidget *widget) -{ - EphyStatusbarPrivate *priv; - GtkWidget *vsep; - - g_return_if_fail (EPHY_IS_STATUSBAR (statusbar)); - g_return_if_fail (GTK_IS_WIDGET (widget)); - - priv = statusbar->priv; - - vsep = g_object_steal_data (G_OBJECT (widget), "EphyStatusbar::separator"); - g_return_if_fail (vsep != NULL); - - g_signal_handlers_disconnect_by_func - (widget, G_CALLBACK (sync_visibility), vsep); - - gtk_container_remove (GTK_CONTAINER (priv->icon_container), vsep); - gtk_container_remove (GTK_CONTAINER (priv->icon_container), widget); -} diff --git a/src/ephy-statusbar.h b/src/ephy-statusbar.h deleted file mode 100644 index 1cef654e9..000000000 --- a/src/ephy-statusbar.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright © 2002 Jorn Baayen - * Copyright © 2003, 2004 Marco Pesenti Gritti - * Copyright © 2004 Christian Persch - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) -#error "Only <epiphany/epiphany.h> can be included directly." -#endif - -#ifndef EPHY_STATUSBAR_H -#define EPHY_STATUSBAR_H - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define EPHY_TYPE_STATUSBAR (ephy_statusbar_get_type ()) -#define EPHY_STATUSBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_STATUSBAR, EphyStatusbar)) -#define EPHY_STATUSBAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_STATUSBAR, EphyStatusbarClass)) -#define EPHY_IS_STATUSBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_STATUSBAR)) -#define EPHY_IS_STATUSBAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_STATUSBAR)) -#define EPHY_STATUSBAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_STATUSBAR, EphyStatusbarClass)) - -typedef struct _EphyStatusbar EphyStatusbar; -typedef struct _EphyStatusbarPrivate EphyStatusbarPrivate; -typedef struct _EphyStatusbarClass EphyStatusbarClass; - -struct _EphyStatusbar -{ - GtkStatusbar parent; - - /*< private >*/ - EphyStatusbarPrivate *priv; -}; - -struct _EphyStatusbarClass -{ - GtkStatusbarClass parent_class; -}; - -GType ephy_statusbar_get_type (void); - -GtkWidget *ephy_statusbar_new (void); - -void ephy_statusbar_add_widget (EphyStatusbar *statusbar, - GtkWidget *widget); - -void ephy_statusbar_remove_widget (EphyStatusbar *statusbar, - GtkWidget *widget); - -G_END_DECLS - -#endif diff --git a/src/ephy-window.c b/src/ephy-window.c index 4b394ae11..b5d7434e8 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 ab0e35b29..4daa96cdf 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); |