Commit 67a2d9af authored by Xan Lopez's avatar Xan Lopez

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
parent 0a318912
......@@ -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"/>
......
......@@ -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>
......
......@@ -214,15 +214,6 @@ ephy_location_action_get_address
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>
......@@ -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
......
......@@ -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
......@@ -79,15 +79,6 @@ EphyWindow
@Returns:
<!-- ##### FUNCTION ephy_window_get_statusbar ##### -->
<para>
</para>
@window:
@Returns:
<!-- ##### FUNCTION ephy_window_load_url ##### -->
<para>
......
......@@ -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:
......@@ -2163,6 +2253,30 @@ close_web_view_cb (WebKitWebView *web_view,
return TRUE;
}
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)
{
......@@ -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);
}
......@@ -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
......@@ -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)
......
......@@ -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);
......
/*
* 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 ().