aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog44
-rw-r--r--data/ui/epiphany-ui.xml36
-rwxr-xr-xlib/egg/egg-editable-toolbar.c44
-rwxr-xr-xlib/egg/egg-editable-toolbar.h18
-rw-r--r--lib/widgets/ephy-location-entry.c4
-rw-r--r--lib/widgets/ephy-location-entry.h4
-rw-r--r--lib/widgets/ephy-search-entry.h28
-rw-r--r--po/POTFILES.in3
-rw-r--r--src/Makefile.am6
-rw-r--r--src/ephy-fullscreen-popup.c466
-rw-r--r--src/ephy-fullscreen-popup.h71
-rw-r--r--src/ephy-history-window.c1
-rw-r--r--src/ephy-shell.c6
-rwxr-xr-xsrc/ephy-toolbar.c807
-rw-r--r--src/ephy-toolbar.h100
-rw-r--r--src/ephy-window.c218
-rwxr-xr-xsrc/toolbar.c671
-rw-r--r--src/toolbar.h90
-rw-r--r--src/window-commands.c6
19 files changed, 1680 insertions, 943 deletions
diff --git a/ChangeLog b/ChangeLog
index d3679cbf7..728df4fa6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2005-01-12 Christian Persch <chpe@cvs.gnome.org>
+
+ * data/ui/epiphany-ui.xml:
+
+ Add Toolbar toggle to document context menu in fullscreen mode.
+
+ * lib/egg/egg-editable-toolbar.c: (set_fixed_style),
+ (update_fixed), (egg_editable_toolbar_set_fixed):
+ * lib/egg/egg-editable-toolbar.h:
+
+ Changed to allow setting a toolbar as fixed, not just one item.
+
+ * lib/widgets/ephy-search-entry.h:
+
+ Add _ prefixed struct declarations.
+
+ * po/POTFILES.in:
+
+ Updated.
+
+ * src/Makefile.am:
+ A src/ephy-fullscreen-popup.c:
+ A src/ephy-fullscreen-popup.h:
+ * src/ephy-history-window.c:
+ * src/ephy-shell.c: (ephy_shell_new_tab):
+ A src/ephy-toolbar.c:
+ A src/ephy-toolbar.h:
+ * src/ephy-window.c: (destroy_fullscreen_popup),
+ (ephy_window_destroy), (exit_fullscreen_clicked_cb),
+ (get_toolbar_visibility), (sync_chromes_visibility),
+ (ephy_window_fullscreen), (ephy_window_unfullscreen),
+ (sync_tab_address), (sync_tab_icon), (sync_tab_navigation),
+ (sync_tab_security), (sync_tab_load_status), (sync_tab_zoom),
+ (show_embed_popup), (modal_alert_cb), (ephy_window_focus_in_event),
+ (ephy_window_focus_out_event), (ephy_window_init),
+ (ephy_window_activate_location):
+ R src/toolbar.c:
+ R src/toolbar.h:
+ * src/window-commands.c: (window_cmd_load_location):
+
+ Implemented in-toolbar exit button, and integrated status indicator in
+ the exit fullscreen popup. Moved toolbar.[ch] to ephy-toolbar.[ch] for
+ namespace correcness, and much-needed code cleanup.
+
2005-01-12 Matthew Schick <matt@breakmygentoo.net>
* configure.ac:
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index a5dc99572..520dfeb6b 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -116,20 +116,50 @@
<menuitem name="BookmarkPageDP" action="ContextBookmarkPage"/>
</popup>
+<popup name="EphyFullscreenDocumentPopup" action="PopupAction">
+ <menuitem name="GoBackFSDP" action="GoBack"/>
+ <menuitem name="GoForwardFSDP" action="GoForward"/>
+ <menuitem name="GoReloadFSDP" action="ViewReload"/>
+ <separator />
+ <menuitem name="EditCopyFSDP" action="EditCopy"/>
+ <separator />
+ <menuitem name="SavePageAsFSDP" action="FileSaveAs"/>
+ <menuitem name="SaveBackgroundAsFSDP" action="SaveBackgroundAs"/>
+ <menuitem name="BookmarkPageFSDP" action="ContextBookmarkPage"/>
+ <separator />
+ <menuitem name="ViewToolbarFSDP" action="ViewToolbar"/>
+</popup>
+
<popup name="EphyFramedDocumentPopup" action="PopupAction">
<menuitem name="GoBackFDP" action="GoBack"/>
<menuitem name="GoForwardFDP" action="GoForward"/>
<menuitem name="GoReloadFDP" action="ViewReload"/>
- <separator name="FDPSep1"/>
+ <separator />
<menuitem name="EditCopyFDP" action="EditCopy"/>
- <separator name="FDPSep2"/>
+ <separator />
<menuitem name="SavePageAsFDP" action="FileSaveAs"/>
<menuitem name="SaveBackgroundAsFDP" action="SaveBackgroundAs"/>
<menuitem name="BookmarkPageFDP" action="ContextBookmarkPage"/>
- <separator name="FDBSep3"/>
+ <separator />
<menuitem name="OpenFrameFDP" action="OpenFrame"/>
</popup>
+<popup name="EphyFullscreenFramedDocumentPopup" action="PopupAction">
+ <menuitem name="GoBackFSFDP" action="GoBack"/>
+ <menuitem name="GoForwardFSFDP" action="GoForward"/>
+ <menuitem name="GoReloadFSFDP" action="ViewReload"/>
+ <separator />
+ <menuitem name="EditCopyFSFDP" action="EditCopy"/>
+ <separator />
+ <menuitem name="SavePageAsFSFDP" action="FileSaveAs"/>
+ <menuitem name="SaveBackgroundAsFSFDP" action="SaveBackgroundAs"/>
+ <menuitem name="BookmarkPageFSFDP" action="ContextBookmarkPage"/>
+ <separator />
+ <menuitem name="OpenFrameFSFDP" action="OpenFrame"/>
+ <separator />
+ <menuitem name="ViewToolbarFSFDP" action="ViewToolbar"/>
+</popup>
+
<popup name="EphyLinkPopup" action="PopupAction">
<menuitem name="OpenLinkLP" action="OpenLink"/>
<menuitem name="OpenLinkInNewWindowLP" action="OpenLinkInNewWindow"/>
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index 72884e5f7..58a9c67b2 100755
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2003-2004 Marco Pesenti Gritti
- * Copyright (C) 2004 Christian Persch
+ * Copyright (C) 2003, 2004 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004, 2005 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
@@ -71,13 +71,12 @@ static GObjectClass *parent_class = NULL;
#define EGG_EDITABLE_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EGG_TYPE_EDITABLE_TOOLBAR, EggEditableToolbarPrivate))
-struct EggEditableToolbarPrivate
+struct _EggEditableToolbarPrivate
{
GtkUIManager *manager;
EggToolbarsModel *model;
gboolean edit_mode;
GtkWidget *selected_toolbar;
- GtkToolItem *fixed;
GtkWidget *fixed_toolbar;
gboolean pending;
@@ -723,7 +722,8 @@ static void
set_fixed_style (EggEditableToolbar *t, GtkToolbarStyle style)
{
g_return_if_fail (GTK_IS_TOOLBAR (t->priv->fixed_toolbar));
- gtk_toolbar_set_style (GTK_TOOLBAR (t->priv->fixed_toolbar), style);
+ gtk_toolbar_set_style (GTK_TOOLBAR (t->priv->fixed_toolbar),
+ style == GTK_TOOLBAR_ICONS ? GTK_TOOLBAR_BOTH_HORIZ : style);
}
static void
@@ -806,7 +806,7 @@ update_fixed (EggEditableToolbar *t)
{
gtk_box_pack_end (GTK_BOX (dock), toolbar, FALSE, TRUE, 0);
- gtk_widget_show_all (toolbar);
+ gtk_widget_show (toolbar);
}
}
@@ -1260,35 +1260,27 @@ egg_editable_toolbar_hide (EggEditableToolbar *etoolbar,
void
egg_editable_toolbar_set_fixed (EggEditableToolbar *toolbar,
- GtkToolItem *fixed)
+ GtkToolbar *fixed_toolbar)
{
g_return_if_fail (EGG_IS_EDITABLE_TOOLBAR (toolbar));
- g_return_if_fail (!fixed || GTK_IS_TOOL_ITEM (fixed));
+ g_return_if_fail (!fixed_toolbar || GTK_IS_TOOLBAR (fixed_toolbar));
- if (!toolbar->priv->fixed_toolbar)
+ if (toolbar->priv->fixed_toolbar)
{
- toolbar->priv->fixed_toolbar = gtk_toolbar_new ();
- gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar->priv->fixed_toolbar), FALSE);
- g_object_ref (toolbar->priv->fixed_toolbar);
- gtk_object_sink (GTK_OBJECT (toolbar->priv->fixed_toolbar));
+ unparent_fixed (toolbar);
+ g_object_unref (toolbar->priv->fixed_toolbar);
+ toolbar->priv->fixed_toolbar = NULL;
}
- if (toolbar->priv->fixed)
+ if (fixed_toolbar)
{
- gtk_container_remove (GTK_CONTAINER (toolbar->priv->fixed_toolbar),
- GTK_WIDGET (toolbar->priv->fixed));
- g_object_unref (toolbar->priv->fixed);
+ toolbar->priv->fixed_toolbar = GTK_WIDGET (fixed_toolbar);
+ gtk_toolbar_set_show_arrow (fixed_toolbar, FALSE);
+ g_object_ref (fixed_toolbar);
+ gtk_object_sink (GTK_OBJECT (fixed_toolbar));
}
- toolbar->priv->fixed = fixed;
-
- if (fixed)
- {
- g_object_ref (fixed);
- gtk_object_sink (GTK_OBJECT (fixed));
-
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar->priv->fixed_toolbar), fixed, 0);
- }
+ update_fixed (toolbar);
}
void
diff --git a/lib/egg/egg-editable-toolbar.h b/lib/egg/egg-editable-toolbar.h
index 2aa087b5f..9f143da70 100755
--- a/lib/egg/egg-editable-toolbar.h
+++ b/lib/egg/egg-editable-toolbar.h
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2003-2004 Marco Pesenti Gritti
- * Copyright (C) 2004 Christian Persch
+ * Copyright (C) 2003, 2004 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004, 2005 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
@@ -32,8 +32,6 @@
G_BEGIN_DECLS
-typedef struct EggEditableToolbarClass EggEditableToolbarClass;
-
#define EGG_TYPE_EDITABLE_TOOLBAR (egg_editable_toolbar_get_type ())
#define EGG_EDITABLE_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_EDITABLE_TOOLBAR, EggEditableToolbar))
#define EGG_EDITABLE_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_EDITABLE_TOOLBAR, EggEditableToolbarClass))
@@ -41,11 +39,11 @@ typedef struct EggEditableToolbarClass EggEditableToolbarClass;
#define EGG_IS_EDITABLE_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_EDITABLE_TOOLBAR))
#define EGG_EDITABLE_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_EDITABLE_TOOLBAR, EggEditableToolbarClass))
+typedef struct _EggEditableToolbar EggEditableToolbar;
+typedef struct _EggEditableToolbarPrivate EggEditableToolbarPrivate;
+typedef struct _EggEditableToolbarClass EggEditableToolbarClass;
-typedef struct EggEditableToolbar EggEditableToolbar;
-typedef struct EggEditableToolbarPrivate EggEditableToolbarPrivate;
-
-struct EggEditableToolbar
+struct _EggEditableToolbar
{
GtkVBox parent_object;
@@ -53,7 +51,7 @@ struct EggEditableToolbar
EggEditableToolbarPrivate *priv;
};
-struct EggEditableToolbarClass
+struct _EggEditableToolbarClass
{
GtkVBoxClass parent_class;
@@ -80,7 +78,7 @@ void egg_editable_toolbar_set_drag_dest (EggEditableToolbar *etoolbar,
gint n_targets,
const char *toolbar_name);
void egg_editable_toolbar_set_fixed (EggEditableToolbar *etoolbar,
- GtkToolItem *fixed);
+ GtkToolbar *fixed_toolbar);
/* Private Functions */
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 889b23003..be5394692 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -1,8 +1,8 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2002 Ricardo Fernández Pascual
- * Copyright (C) 2003 Marco Pesenti Gritti
- * Copyright (C) 2003 Christian Persch
+ * Copyright (C) 2003, 2004 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004, 2005 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
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index c4a44addc..f8c8dfad0 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2002 Ricardo Fernández Pascual
- * Copyright (C) 2003 Marco Pesenti Gritti
- * Copyright (C) 2003 Christian Persch
+ * Copyright (C) 2003, 2004 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004, 2005 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
diff --git a/lib/widgets/ephy-search-entry.h b/lib/widgets/ephy-search-entry.h
index d641ac043..47e18280a 100644
--- a/lib/widgets/ephy-search-entry.h
+++ b/lib/widgets/ephy-search-entry.h
@@ -25,29 +25,31 @@
G_BEGIN_DECLS
-#define EPHY_TYPE_SEARCH_ENTRY (ephy_search_entry_get_type ())
-#define EPHY_SEARCH_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntry))
-#define EPHY_SEARCH_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryClass))
-#define EPHY_IS_SEARCH_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SEARCH_ENTRY))
-#define EPHY_IS_SEARCH_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SEARCH_ENTRY))
-#define EPHY_SEARCH_ENTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryClass))
-
-typedef struct _EphySearchEntryPrivate EphySearchEntryPrivate;
-
-typedef struct
+#define EPHY_TYPE_SEARCH_ENTRY (ephy_search_entry_get_type ())
+#define EPHY_SEARCH_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntry))
+#define EPHY_SEARCH_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryClass))
+#define EPHY_IS_SEARCH_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_SEARCH_ENTRY))
+#define EPHY_IS_SEARCH_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SEARCH_ENTRY))
+#define EPHY_SEARCH_ENTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SEARCH_ENTRY, EphySearchEntryClass))
+
+typedef struct _EphySearchEntry EphySearchEntry;
+typedef struct _EphySearchEntryPrivate EphySearchEntryPrivate;
+typedef struct _EphySearchEntryClass EphySearchEntryClass;
+
+struct _EphySearchEntry
{
GtkEntry parent;
/*< private >*/
EphySearchEntryPrivate *priv;
-} EphySearchEntry;
+};
-typedef struct
+struct _EphySearchEntryClass
{
GtkEntryClass parent;
void (*search) (EphySearchEntry *view, const char *text);
-} EphySearchEntryClass;
+};
GType ephy_search_entry_get_type (void);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4c614f358..03fc32bf8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -49,6 +49,7 @@ src/bookmarks/ephy-topics-selector.c
src/bookmarks/ephy-topic-action.c
src/ephy-encoding-dialog.c
src/ephy-encoding-menu.c
+src/ephy-fullscreen-popup.c
src/ephy-go-action.c
src/ephy-history-window.c
src/ephy-main.c
@@ -57,11 +58,11 @@ src/ephy-session.c
src/ephy-shell.c
src/ephy-tab.c
src/ephy-toolbars-model.c
+src/ephy-toolbar.c
src/ephy-toolbar-editor.c
src/ephy-window.c
src/pdm-dialog.c
src/popup-commands.c
src/ppview-toolbar.c
src/prefs-dialog.c
-src/toolbar.c
src/window-commands.c
diff --git a/src/Makefile.am b/src/Makefile.am
index b78060cc7..ed3cd35e2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,6 +29,7 @@ NOINST_H_FILES = \
ephy-automation.h \
ephy-encoding-dialog.h \
ephy-encoding-menu.h \
+ ephy-fullscreen-popup.h \
ephy-go-action.h \
ephy-history-window.h \
ephy-home-action.h \
@@ -38,12 +39,12 @@ NOINST_H_FILES = \
ephy-navigation-action.h \
ephy-tabs-menu.h \
ephy-toolbars-model.h \
+ ephy-toolbar.h \
ephy-toolbar-editor.h \
pdm-dialog.h \
popup-commands.h \
prefs-dialog.h \
ppview-toolbar.h \
- toolbar.h \
window-commands.h
INST_H_FILES = \
@@ -65,6 +66,7 @@ libephymain_la_SOURCES = \
ephy-encoding-menu.c \
ephy-extension.c \
ephy-extensions-manager.c \
+ ephy-fullscreen-popup.c \
ephy-go-action.c \
ephy-home-action.c \
ephy-history-window.c \
@@ -80,13 +82,13 @@ libephymain_la_SOURCES = \
ephy-tab.h \
ephy-tabs-menu.c \
ephy-toolbars-model.c \
+ ephy-toolbar.c \
ephy-toolbar-editor.c \
ephy-window.c \
pdm-dialog.c \
popup-commands.c \
prefs-dialog.c \
ppview-toolbar.c \
- toolbar.c \
window-commands.c \
$(INST_H_FILES) \
$(NOINST_H_FILES)
diff --git a/src/ephy-fullscreen-popup.c b/src/ephy-fullscreen-popup.c
new file mode 100644
index 000000000..ece03ba71
--- /dev/null
+++ b/src/ephy-fullscreen-popup.c
@@ -0,0 +1,466 @@
+/*
+ * Copyright (C) 2000-2004 Marco Pesenti Gritti
+ * Copyright (C) 2003-2005 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#include "config.h"
+
+#include "ephy-fullscreen-popup.h"
+#include "ephy-spinner.h"
+#include "ephy-debug.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtkstock.h>
+#include <gtk/gtkimage.h>
+#include <gtk/gtkhseparator.h>
+#include <gtk/gtkeventbox.h>
+#include <gtk/gtktooltips.h>
+#include <gtk/gtkenums.h>
+#include <gtk/gtkbox.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkframe.h>
+#include <string.h>
+
+#define EPHY_FULLSCREEN_POPUP_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_FULLSCREEN_POPUP, EphyFullscreenPopupPrivate))
+
+struct _EphyFullscreenPopupPrivate
+{
+ EphyWindow *window;
+ GtkTooltips *tooltips;
+ GtkWidget *sep;
+ GtkWidget *frame;
+ EphySpinner *spinner;
+ GtkWidget *lock;
+ GtkWidget *lock_ebox;
+ GtkWidget *button;
+ gboolean spinning;
+ gboolean show_lock;
+};
+
+enum
+{
+ PROP_0,
+ PROP_WINDOW,
+};
+
+enum
+{
+ EXIT_CLICKED,
+ LOCK_CLICKED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static GObjectClass *parent_class = NULL;
+
+static void
+exit_button_clicked_cb (GtkWidget *button,
+ EphyFullscreenPopup *popup)
+{
+ g_signal_emit (popup, signals[EXIT_CLICKED], 0);
+}
+
+static gboolean
+lock_button_press_cb (GtkWidget *ebox,
+ GdkEventButton *event,
+ EphyFullscreenPopup *popup)
+{
+ if (event->type == GDK_BUTTON_PRESS && event->button == 1)
+ {
+ g_signal_emit (popup, signals[LOCK_CLICKED], 0);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+ephy_fullscreen_popup_update_visibility (EphyFullscreenPopup *popup)
+{
+ EphyFullscreenPopupPrivate *priv = popup->priv;
+ gboolean show_frame;
+
+ show_frame = priv->spinning || priv->show_lock;
+
+ g_object_set (priv->sep, "visible", show_frame, NULL);
+ g_object_set (priv->frame, "visible", show_frame, NULL);
+ g_object_set (priv->spinner, "visible", priv->spinning, NULL);
+ g_object_set (priv->lock_ebox, "visible", priv->show_lock, NULL);
+}
+
+static void
+ephy_fullscreen_popup_update_spinner (EphyFullscreenPopup *popup)
+{
+ EphyFullscreenPopupPrivate *priv = popup->priv;
+
+ if (priv->spinning && GTK_WIDGET_VISIBLE (popup))
+ {
+ ephy_spinner_start (priv->spinner);
+ }
+ else
+ {
+ ephy_spinner_stop (priv->spinner);
+ }
+}
+
+static void
+ephy_fullscreen_popup_update_position (EphyFullscreenPopup *popup)
+{
+ GtkWidget *widget = GTK_WIDGET (popup);
+ GdkScreen *screen;
+ GdkRectangle screen_rect;
+ int popup_width;
+
+ popup_width = widget->requisition.width;
+
+ screen = gtk_widget_get_screen (widget);
+ gdk_screen_get_monitor_geometry
+ (screen,
+ gdk_screen_get_monitor_at_window (screen, widget->window),
+ &screen_rect);
+
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ {
+ gtk_window_move (GTK_WINDOW (widget),
+ screen_rect.x, screen_rect.y);
+ }
+ else
+ {
+ gtk_window_move (GTK_WINDOW (widget),
+ screen_rect.x + screen_rect.width - popup_width,
+ screen_rect.y);
+ }
+}
+
+static void
+ephy_fullscreen_popup_set_window (EphyFullscreenPopup *popup,
+ EphyWindow *window)
+{
+ EphyFullscreenPopupPrivate *priv = popup->priv;
+ GdkScreen *screen;
+
+ priv->window = window;
+
+ /* FIXME multihead: screen change? */
+ screen = gtk_widget_get_screen (GTK_WIDGET (priv->window));
+ g_signal_connect_swapped (screen, "size-changed",
+ G_CALLBACK (ephy_fullscreen_popup_update_position), popup);
+}
+
+/* public functions */
+
+void
+ephy_fullscreen_popup_set_spinning (EphyFullscreenPopup *popup,
+ gboolean spinning)
+{
+ EphyFullscreenPopupPrivate *priv = popup->priv;
+
+ priv->spinning = spinning;
+ ephy_fullscreen_popup_update_visibility (popup);
+ ephy_fullscreen_popup_update_spinner (popup);
+}
+
+void
+ephy_fullscreen_popup_set_security_state (EphyFullscreenPopup *popup,
+ gboolean show_lock,
+ const char *stock,
+ const char *tooltip)
+{
+ EphyFullscreenPopupPrivate *priv = popup->priv;
+
+ priv->show_lock = show_lock;
+ gtk_image_set_from_stock (GTK_IMAGE (priv->lock), stock, GTK_ICON_SIZE_BUTTON);
+ gtk_tooltips_set_tip (priv->tooltips, priv->lock_ebox, tooltip, NULL);
+
+ ephy_fullscreen_popup_update_visibility (popup);
+}
+
+/* Class implementation */
+
+static void
+ephy_fullscreen_popup_init (EphyFullscreenPopup *popup)
+{
+ popup->priv = EPHY_FULLSCREEN_POPUP_GET_PRIVATE (popup);
+}
+
+static GObject *
+ephy_fullscreen_popup_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_params)
+
+{
+ GObject *object;
+ EphyFullscreenPopup *popup;
+ EphyFullscreenPopupPrivate *priv;
+ GtkWindow *window;
+ GtkWidget *hbox, *frame_hbox, *button_hbox, *icon, *label;
+
+ object = parent_class->constructor (type, n_construct_properties,
+ construct_params);
+
+ window = GTK_WINDOW (object);
+ popup = EPHY_FULLSCREEN_POPUP (window);
+ priv = popup->priv;
+
+ gtk_window_set_resizable (window, FALSE);
+
+ priv->tooltips = gtk_tooltips_new ();
+ g_object_ref (G_OBJECT (priv->tooltips));
+ gtk_object_sink (GTK_OBJECT (priv->tooltips));
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (window), hbox);
+ gtk_widget_show (hbox);
+
+ /* frame */
+ priv->frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (priv->frame), GTK_SHADOW_OUT);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->frame, FALSE, FALSE, 0);
+
+ frame_hbox = gtk_hbox_new (FALSE, 2);
+ gtk_container_add (GTK_CONTAINER (priv->frame), frame_hbox);
+ gtk_widget_show (frame_hbox);
+
+ /* add spinner */
+ priv->spinner = EPHY_SPINNER (ephy_spinner_new ());
+ ephy_spinner_set_size (EPHY_SPINNER (priv->spinner), GTK_ICON_SIZE_BUTTON);
+ gtk_box_pack_start (GTK_BOX (frame_hbox), GTK_WIDGET (priv->spinner), FALSE, FALSE, 0);
+
+ /* lock */
+ priv->lock = gtk_image_new ();
+ gtk_widget_show (priv->lock);
+
+ priv->lock_ebox = gtk_event_box_new ();
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->lock_ebox), FALSE);
+ gtk_widget_add_events (priv->lock_ebox, GDK_BUTTON_PRESS_MASK);
+ g_signal_connect (priv->lock_ebox, "button-press-event",
+ G_CALLBACK (lock_button_press_cb), popup);
+ gtk_container_add (GTK_CONTAINER (priv->lock_ebox), priv->lock);
+ gtk_box_pack_start (GTK_BOX (frame_hbox), priv->lock_ebox, FALSE, FALSE, 0);
+ gtk_widget_show (priv->lock_ebox);
+
+ /* separator */
+ priv->sep = gtk_hseparator_new ();
+ gtk_box_pack_start (GTK_BOX (hbox), priv->sep, FALSE, FALSE, 0);
+ gtk_widget_show (priv->sep);
+
+ /* exit button */
+ priv->button = gtk_button_new ();
+ g_signal_connect (priv->button, "clicked",
+ G_CALLBACK (exit_button_clicked_cb), popup);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->button, FALSE, FALSE, 0);
+ gtk_widget_show (priv->button);
+
+ button_hbox = gtk_hbox_new (FALSE, 2);
+ gtk_container_add (GTK_CONTAINER (priv->button), button_hbox);
+ gtk_widget_show (button_hbox);
+
+ icon = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
+ gtk_box_pack_start (GTK_BOX (button_hbox), icon, FALSE, FALSE, 0);
+ gtk_widget_show (icon);
+
+ label = gtk_label_new (_("Exit Fullscreen"));
+ gtk_box_pack_start (GTK_BOX (button_hbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ ephy_fullscreen_popup_update_visibility (popup);
+
+ return object;
+}
+
+static void
+ephy_fullscreen_popup_finalize (GObject *object)
+{
+ EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (object);
+ EphyFullscreenPopupPrivate *priv = popup->priv;
+ GdkScreen *screen;
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (priv->window));
+ g_signal_handlers_disconnect_matched (screen, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, popup);
+
+ g_signal_handlers_disconnect_matched (priv->window, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, popup);
+
+ g_object_unref (priv->tooltips);
+
+ parent_class->finalize (object);
+}
+
+static void
+ephy_fullscreen_popup_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ /* no readable properties */
+ g_assert_not_reached ();
+}
+
+static void
+ephy_fullscreen_popup_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (object);
+
+ switch (prop_id)
+ {
+ case PROP_WINDOW:
+ ephy_fullscreen_popup_set_window (popup, g_value_get_object (value));
+ break;
+ }
+}
+
+static void
+ephy_fullscreen_popup_show (GtkWidget *widget)
+{
+ EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
+
+ GTK_WIDGET_CLASS (parent_class)->show (widget);
+
+ ephy_fullscreen_popup_update_spinner (popup);
+}
+
+static void
+ephy_fullscreen_popup_hide (GtkWidget *widget)
+{
+ EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
+
+ GTK_WIDGET_CLASS (parent_class)->hide (widget);
+
+ ephy_fullscreen_popup_update_spinner (popup);
+}
+
+static void
+ephy_fullscreen_popup_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
+
+ GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+
+ if (GTK_WIDGET_REALIZED (widget))
+ {
+ ephy_fullscreen_popup_update_position (popup);
+ }
+}
+
+static void
+ephy_fullscreen_popup_realize (GtkWidget *widget)
+{
+ EphyFullscreenPopup *popup = EPHY_FULLSCREEN_POPUP (widget);
+
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
+
+ ephy_fullscreen_popup_update_position (popup);
+}
+
+static void
+ephy_fullscreen_popup_class_init (EphyFullscreenPopupClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->constructor = ephy_fullscreen_popup_constructor;
+ object_class->finalize = ephy_fullscreen_popup_finalize;
+ object_class->get_property = ephy_fullscreen_popup_get_property;
+ object_class->set_property = ephy_fullscreen_popup_set_property;
+
+ widget_class->show = ephy_fullscreen_popup_show;
+ widget_class->hide = ephy_fullscreen_popup_hide;
+ widget_class->size_request = ephy_fullscreen_popup_size_request;
+ widget_class->realize = ephy_fullscreen_popup_realize;
+
+ signals[EXIT_CLICKED] =
+ g_signal_new
+ ("exit-clicked",
+ EPHY_TYPE_FULLSCREEN_POPUP,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyFullscreenPopupClass, exit_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+ signals[LOCK_CLICKED] =
+ g_signal_new
+ ("lock-clicked",
+ EPHY_TYPE_FULLSCREEN_POPUP,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyFullscreenPopupClass, lock_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_object_class_install_property (object_class,
+ PROP_WINDOW,
+ g_param_spec_object ("window",
+ "Window",
+ "Parent window",
+ EPHY_TYPE_WINDOW,
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_type_class_add_private (object_class, sizeof (EphyFullscreenPopupPrivate));
+}
+
+GType
+ephy_fullscreen_popup_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0))
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyFullscreenPopupClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) ephy_fullscreen_popup_class_init,
+ NULL,
+ NULL,
+ sizeof (EphyFullscreenPopup),
+ 0,
+ (GInstanceInitFunc) ephy_fullscreen_popup_init
+ };
+
+ type = g_type_register_static (GTK_TYPE_WINDOW,
+ "EphyFullscreenPopup",
+ &our_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+ephy_fullscreen_popup_new (EphyWindow *window)
+{
+ return g_object_new (EPHY_TYPE_FULLSCREEN_POPUP,
+ "type", GTK_WINDOW_POPUP,
+ "window", window,
+ NULL);
+}
diff --git a/src/ephy-fullscreen-popup.h b/src/ephy-fullscreen-popup.h
new file mode 100644
index 000000000..393d31efb
--- /dev/null
+++ b/src/ephy-fullscreen-popup.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2000-2004 Marco Pesenti Gritti
+ * Copyright (C) 2003-2005 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef EPHY_FULLSCREEN_POPUP_H
+#define EPHY_FULLSCREEN_POPUP_H
+
+#include <gtk/gtkwindow.h>
+#include "ephy-window.h"
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_FULLSCREEN_POPUP (ephy_fullscreen_popup_get_type ())
+#define EPHY_FULLSCREEN_POPUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_FULLSCREEN_POPUP, EphyFullscreenPopup))
+#define EPHY_FULLSCREEN_POPUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_FULLSCREEN_POPUP, EphyFullscreenPopupClass))
+#define EPHY_IS_FULLSCREEN_POPUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_FULLSCREEN_POPUP))
+#define EPHY_IS_FULLSCREEN_POPUP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_FULLSCREEN_POPUP))
+#define EPHY_FULLSCREEN_POPUP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_FULLSCREEN_POPUP, EphyFullscreenPopupClass))
+
+typedef struct _EphyFullscreenPopup EphyFullscreenPopup;
+typedef struct _EphyFullscreenPopupPrivate EphyFullscreenPopupPrivate;
+typedef struct _EphyFullscreenPopupClass EphyFullscreenPopupClass;
+
+struct _EphyFullscreenPopup
+{
+ GtkWindow parent_instance;
+
+ /*< private >*/
+ EphyFullscreenPopupPrivate *priv;
+};
+
+struct _EphyFullscreenPopupClass
+{
+ GtkWindowClass parent_class;
+
+ void (* exit_clicked) (EphyFullscreenPopup *popup);
+ void (* lock_clicked) (EphyFullscreenPopup *popup);
+};
+
+GType ephy_fullscreen_popup_get_type (void);
+
+GtkWidget *ephy_fullscreen_popup_new (EphyWindow *window);
+
+void ephy_fullscreen_popup_set_spinning (EphyFullscreenPopup *popup,
+ gboolean spinning);
+
+void ephy_fullscreen_popup_set_security_state (EphyFullscreenPopup *popup,
+ gboolean show_lock,
+ const char *stock,
+ const char *tooltip);
+
+G_END_DECLS
+
+#endif /* !EPHY_FULLSCREEN_POPUP_H */
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index f3b1ba696..1420a880c 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -59,7 +59,6 @@
#include "ephy-new-bookmark.h"
#include "ephy-stock-icons.h"
#include "ephy-gui.h"
-#include "toolbar.h"
#include "ephy-stock-icons.h"
#include "ephy-search-entry.h"
#include "ephy-session.h"
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 806e49776..235cdc3f5 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -36,12 +36,12 @@
#include "prefs-dialog.h"
#include "ephy-debug.h"
#include "ephy-extensions-manager.h"
-#include "toolbar.h"
#include "ephy-session.h"
#include "downloader-view.h"
#include "egg-toolbars-model.h"
#include "eggtypebuiltins.h"
#include "ephy-toolbars-model.h"
+#include "ephy-toolbar.h"
#include "ephy-automation.h"
#include "print-dialog.h"
@@ -551,7 +551,7 @@ ephy_shell_new_tab (EphyShell *shell,
EphyEmbed *previous_embed = NULL;
GtkWidget *nb;
int position = -1;
- Toolbar *toolbar;
+ EphyToolbar *toolbar;
if (flags & EPHY_NEW_TAB_IN_NEW_WINDOW) in_new_window = TRUE;
if (flags & EPHY_NEW_TAB_IN_EXISTING_WINDOW) in_new_window = FALSE;
@@ -597,7 +597,7 @@ ephy_shell_new_tab (EphyShell *shell,
flags & EPHY_NEW_TAB_NEW_PAGE)
{
ephy_tab_set_location (tab, "", EPHY_TAB_ADDRESS_EXPIRE_NEXT);
- toolbar_activate_location (toolbar);
+ ephy_toolbar_activate_location (toolbar);
load_homepage (embed);
}
else if (flags & EPHY_NEW_TAB_OPEN_PAGE)
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
new file mode 100755
index 000000000..e375a4edd
--- /dev/null
+++ b/src/ephy-toolbar.c
@@ -0,0 +1,807 @@
+/*
+ * Copyright (C) 2000-2004 Marco Pesenti Gritti
+ * Copyright (C) 2001, 2002 Jorn Baayen
+ * Copyright (C) 2003, 2004, 2005 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#include "config.h"
+
+#include "ephy-toolbar.h"
+#include "ephy-link.h"
+#include "ephy-go-action.h"
+#include "ephy-home-action.h"
+#include "ephy-location-entry.h"
+#include "ephy-location-action.h"
+#include "ephy-navigation-action.h"
+#include "ephy-topic-action.h"
+#include "ephy-zoom-action.h"
+#include "ephy-spinner.h"
+#include "ephy-dnd.h"
+#include "ephy-shell.h"
+#include "ephy-stock-icons.h"
+#include "window-commands.h"
+#include "eel-gconf-extensions.h"
+#include "ephy-debug.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtkstock.h>
+#include <gtk/gtkuimanager.h>
+#include <gtk/gtktoolitem.h>
+#include <gtk/gtktoolbutton.h>
+#include <gtk/gtkseparatortoolitem.h>
+#include <gtk/gtktoolbar.h>
+#include <string.h>
+
+enum
+{
+ BACK_ACTION,
+ FORWARD_ACTION,
+ UP_ACTION,
+ LOCATION_ACTION,
+ ZOOM_ACTION,
+ LAST_ACTION
+};
+
+#define EPHY_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBAR, EphyToolbarPrivate))
+
+struct _EphyToolbarPrivate
+{
+ EphyWindow *window;
+ GtkActionGroup *action_group;
+ GtkAction *actions[LAST_ACTION];
+ gboolean updating_address;
+ GtkWidget *fixed_toolbar;
+ GtkWidget *spinner;
+ GtkToolItem *spinner_item;
+ GtkToolItem *sep_item;
+ GtkToolItem *exit_button;
+ guint disable_arbitrary_url_notifier_id;
+ gulong set_focus_handler;
+ gboolean fullscreen;
+ gboolean spinning;
+};
+
+static GtkTargetEntry drag_targets[] =
+{
+ { EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0 },
+ { EPHY_DND_TOPIC_TYPE, 0, 1 },
+ { EPHY_DND_URL_TYPE, 0, 2 }
+};
+
+#define CONF_LOCKDOWN_DISABLE_ARBITRARY_URL "/apps/epiphany/lockdown/disable_arbitrary_url"
+
+enum
+{
+ PROP_0,
+ PROP_WINDOW
+};
+
+enum
+{
+ ACTIVATION_FINISHED,
+ EXIT_CLICKED,
+ LOCK_CLICKED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static GObjectClass *parent_class = NULL;
+
+/* helper functions */
+
+static void
+exit_button_clicked_cb (GtkWidget *button,
+ EphyToolbar *toolbar)
+{
+ g_signal_emit (toolbar, signals[EXIT_CLICKED], 0);
+}
+
+static void
+ephy_toolbar_update_fixed_visibility (EphyToolbar *toolbar)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ g_object_set (priv->sep_item, "visible", priv->fullscreen, NULL);
+ g_object_set (priv->exit_button, "visible", priv->fullscreen,
+ "sensitive", priv->fullscreen, NULL);
+}
+
+static void
+ephy_toolbar_update_spinner (EphyToolbar *toolbar)
+{
+ GtkWidget *widget = GTK_WIDGET (toolbar);
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ if (priv->spinning && GTK_WIDGET_VISIBLE (widget))
+ {
+ ephy_spinner_start (EPHY_SPINNER (priv->spinner));
+ }
+ else
+ {
+ ephy_spinner_stop (EPHY_SPINNER (priv->spinner));
+ }
+}
+
+static void
+fixed_toolbar_reconfigured_cb (GtkToolItem *item,
+ EphySpinner *spinner)
+{
+ GtkToolbarStyle style;
+ GtkIconSize size;
+
+ style = gtk_tool_item_get_toolbar_style (item);
+
+ if (style == GTK_TOOLBAR_BOTH)
+ {
+ size = GTK_ICON_SIZE_INVALID;
+ }
+ else
+ {
+ size = GTK_ICON_SIZE_LARGE_TOOLBAR;
+ }
+
+ ephy_spinner_set_size (spinner, size);
+}
+
+static void
+toolbar_added_cb (EggToolbarsModel *model,
+ int position,
+ EggEditableToolbar *toolbar)
+{
+ const char *t_name;
+
+ t_name = egg_toolbars_model_toolbar_nth (model, position);
+ g_return_if_fail (t_name != NULL);
+
+ egg_editable_toolbar_set_drag_dest
+ (toolbar, drag_targets, G_N_ELEMENTS (drag_targets), t_name);
+}
+
+static void
+maybe_finish_activation_cb (EphyWindow *window,
+ GtkWidget *widget,
+ EphyToolbar *toolbar)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+ GtkWidget *wtoolbar = GTK_WIDGET (toolbar);
+
+ while (widget != NULL && widget != wtoolbar)
+ {
+ widget = widget->parent;
+ }
+
+ /* if widget == toolbar, the new focus widget is in the toolbar, so we
+ * don't deactivate.
+ */
+ if (widget != wtoolbar)
+ {
+ g_signal_handler_disconnect (window, priv->set_focus_handler);
+ toolbar->priv->set_focus_handler = 0;
+
+ g_signal_emit (toolbar, signals[ACTIVATION_FINISHED], 0);
+ }
+}
+
+static void
+update_location_editable (EphyToolbar *toolbar)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+ EphyEmbed *embed;
+ char *address;
+ gboolean editable;
+
+ editable = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL);
+
+ g_object_set (priv->actions[LOCATION_ACTION], "editable", editable, NULL);
+
+ /* Restore the real web page address when disabling entry */
+ if (editable == FALSE)
+ {
+ embed = ephy_window_get_active_embed (priv->window);
+ /* embed is NULL on startup */
+ if (EPHY_IS_EMBED (embed))
+ {
+ address = ephy_embed_get_location (embed, TRUE);
+ ephy_toolbar_set_location (toolbar, address);
+ g_free (address);
+ }
+ }
+}
+
+static void
+sync_user_input_cb (EphyLocationAction *action,
+ GParamSpec *pspec,
+ EphyToolbar *toolbar)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+ EphyTab *tab;
+ const char *address;
+
+ LOG ("sync_user_input_cb")
+
+ if (priv->updating_address) return;
+
+ tab = ephy_window_get_active_tab (priv->window);
+ g_return_if_fail (EPHY_IS_TAB (tab));
+
+ address = ephy_location_action_get_address (action);
+
+ priv->updating_address = TRUE;
+ ephy_tab_set_location (tab, address, EPHY_TAB_ADDRESS_EXPIRE_CURRENT);
+ priv->updating_address = FALSE;
+}
+
+static void
+zoom_to_level_cb (GtkAction *action,
+ float zoom,
+ EphyToolbar *toolbar)
+{
+ ephy_window_set_zoom (toolbar->priv->window, zoom);
+}
+
+static void
+arbitrary_url_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyToolbar *toolbar)
+{
+ update_location_editable (toolbar);
+}
+
+static void
+ephy_toolbar_set_window (EphyToolbar *toolbar,
+ EphyWindow *window)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+ GtkUIManager *manager;
+ GtkAction *action;
+
+ priv->window = window;
+ manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));
+
+ priv->action_group = gtk_action_group_new ("SpecialToolbarActions");
+ gtk_ui_manager_insert_action_group (manager, priv->action_group, -1);
+ g_object_unref (priv->action_group);
+
+ action = priv->actions[BACK_ACTION] =
+ g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
+ "name", "NavigationBack",
+ "label", _("Back"),
+ "stock_id", GTK_STOCK_GO_BACK,
+ "tooltip", _("Go back"),
+ /* this is the tooltip on the Back button's drop-down arrow, which will show
+ * a menu with all sites you can go 'back' to
+ */
+ "arrow-tooltip", _("Back history"),
+ "window", priv->window,
+ "direction", EPHY_NAVIGATION_DIRECTION_BACK,
+ "is_important", TRUE,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (window_cmd_go_back), priv->window);
+ gtk_action_group_add_action (priv->action_group, action);
+ g_object_unref (action);
+
+ action = priv->actions[FORWARD_ACTION] =
+ g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
+ "name", "NavigationForward",
+ "label", _("Forward"),
+ "stock_id", GTK_STOCK_GO_FORWARD,
+ "tooltip", _("Go forward"),
+ /* this is the tooltip on the Forward button's drop-down arrow, which will show
+ * a menu with all sites you can go 'forward' to
+ */
+ "arrow-tooltip", _("Forward history"),
+ "window", priv->window,
+ "direction", EPHY_NAVIGATION_DIRECTION_FORWARD,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (window_cmd_go_forward), priv->window);
+ gtk_action_group_add_action (priv->action_group, action);
+ g_object_unref (action);
+
+ action = priv->actions[UP_ACTION] =
+ g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
+ "name", "NavigationUp",
+ "label", _("Up"),
+ "stock_id", GTK_STOCK_GO_UP,
+ "tooltip", _("Go up one level"),
+ /* this is the tooltip on the Up button's drop-down arrow, which will show
+ * a menu with al sites you can go 'up' to
+ */
+ "arrow-tooltip", _("List of upper levels"),
+ "window", priv->window,
+ "direction", EPHY_NAVIGATION_DIRECTION_UP,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (window_cmd_go_up), priv->window);
+ g_signal_connect_swapped (action, "open-link",
+ G_CALLBACK (ephy_link_open), toolbar);
+ gtk_action_group_add_action (priv->action_group, action);
+ g_object_unref (action);
+
+ /* FIXME: I'm still waiting for the exact term to
+ * user here from the docs team.
+ */
+ action = priv->actions[LOCATION_ACTION] =
+ g_object_new (EPHY_TYPE_LOCATION_ACTION,
+ "name", "Location",
+ "label", _("Address Entry"),
+ "stock_id", EPHY_STOCK_ENTRY,
+ "tooltip", _("Enter a web address to open, or a phrase to search for on the web"),
+ "visible-overflown", FALSE,
+ "window", priv->window,
+ NULL);
+ g_signal_connect_swapped (action, "open-link",
+ G_CALLBACK (ephy_link_open), toolbar);
+ g_signal_connect (action, "notify::address",
+ G_CALLBACK (sync_user_input_cb), toolbar);
+ gtk_action_group_add_action (priv->action_group, action);
+ update_location_editable (toolbar);
+ g_object_unref (action);
+
+ action = priv->actions[ZOOM_ACTION] =
+ g_object_new (EPHY_TYPE_ZOOM_ACTION,
+ "name", "Zoom",
+ "label", _("Zoom"),
+ "stock_id", GTK_STOCK_ZOOM_IN,
+ "tooltip", _("Adjust the text size"),
+ "zoom", 1.0,
+ NULL);
+ g_signal_connect (action, "zoom_to_level",
+ G_CALLBACK (zoom_to_level_cb), toolbar);
+ gtk_action_group_add_action (priv->action_group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_GO_ACTION,
+ "name", "ToolbarGo",
+ "label", _("Go"),
+ "stock_id", GTK_STOCK_JUMP_TO,
+ "tooltip", _("Go to the address entered in the address entry"),
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (window_cmd_load_location), priv->window);
+ gtk_action_group_add_action (priv->action_group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_HOME_ACTION,
+ "name", "GoHome",
+ "label", _("_Home"),
+ "stock_id", GTK_STOCK_HOME,
+ "tooltip", _("Go to the home page"),
+ "is_important", TRUE,
+ NULL);
+ g_signal_connect_swapped (action, "open-link",
+ G_CALLBACK (ephy_link_open), toolbar);
+ gtk_action_group_add_action_with_accel (priv->action_group, action, "<alt>Home");
+ g_object_unref (action);
+
+ priv->disable_arbitrary_url_notifier_id = eel_gconf_notification_add
+ (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL,
+ (GConfClientNotifyFunc) arbitrary_url_notifier, toolbar);
+}
+
+/* public functions */
+
+void
+ephy_toolbar_set_favicon (EphyToolbar *toolbar,
+ const char *icon)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ g_object_set (priv->actions[LOCATION_ACTION], "icon", icon, NULL);
+}
+
+void
+ephy_toolbar_set_fullscreen_mode (EphyToolbar *toolbar,
+ gboolean fullscreen)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ priv->fullscreen = fullscreen;
+
+ ephy_toolbar_update_fixed_visibility (toolbar);
+}
+
+void
+ephy_toolbar_activate_location (EphyToolbar *toolbar)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+ GSList *proxies;
+ GtkWidget *entry = NULL;
+ gboolean visible;
+
+ proxies = gtk_action_get_proxies (priv->actions[LOCATION_ACTION]);
+
+ if (proxies != NULL && EPHY_IS_LOCATION_ENTRY (proxies->data))
+ {
+ entry = GTK_WIDGET (proxies->data);
+ }
+
+ if (entry == NULL)
+ {
+ /* happens when the user has removed the location entry from
+ * the toolbars.
+ */
+ return;
+ }
+
+ g_object_get (G_OBJECT (toolbar), "visible", &visible, NULL);
+ if (visible == FALSE)
+ {
+ gtk_widget_show (GTK_WIDGET (toolbar));
+ toolbar->priv->set_focus_handler =
+ g_signal_connect (toolbar->priv->window, "set-focus",
+ G_CALLBACK (maybe_finish_activation_cb),
+ toolbar);
+ }
+
+ ephy_location_entry_activate (EPHY_LOCATION_ENTRY (entry));
+}
+
+const char *
+ephy_toolbar_get_location (EphyToolbar *toolbar)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+ EphyLocationAction *action = EPHY_LOCATION_ACTION (priv->actions[LOCATION_ACTION]);
+
+ return ephy_location_action_get_address (action);
+}
+
+void
+ephy_toolbar_set_location (EphyToolbar *toolbar,
+ const char *address)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+ EphyLocationAction *action = EPHY_LOCATION_ACTION (priv->actions[LOCATION_ACTION]);
+
+ if (priv->updating_address) return;
+
+ priv->updating_address = TRUE;
+ ephy_location_action_set_address (action, address);
+ priv->updating_address = FALSE;
+}
+
+void
+ephy_toolbar_set_navigation_actions (EphyToolbar *toolbar,
+ gboolean back,
+ gboolean forward,
+ gboolean up)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ g_object_set (priv->actions[BACK_ACTION], "sensitive", back, NULL);
+ g_object_set (priv->actions[FORWARD_ACTION], "sensitive", forward, NULL);
+ g_object_set (priv->actions[UP_ACTION], "sensitive", up, NULL);
+}
+
+void
+ephy_toolbar_set_security_state (EphyToolbar *toolbar,
+ gboolean show_lock,
+ const char *stock_id,
+ const char *tooltip)
+{
+#if 0
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ g_object_set (priv->actions[LOCATION_ACTION],
+ "lock-show", show_lock,
+ "lock-stock-id", stock_id,
+ "lock-tooltip", tooltip,
+ NULL);
+#endif
+}
+
+void
+ephy_toolbar_set_spinning (EphyToolbar *toolbar,
+ gboolean spinning)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ priv->spinning = spinning;
+
+ ephy_toolbar_update_spinner (toolbar);
+}
+
+void
+ephy_toolbar_set_zoom (EphyToolbar *toolbar,
+ gboolean can_zoom,
+ float zoom)
+{
+ EphyToolbarPrivate *priv = toolbar->priv;
+
+ g_object_set (priv->actions[ZOOM_ACTION],
+ "zoom", can_zoom ? zoom : 1.0,
+ "sensitive", can_zoom,
+ NULL);
+}
+
+/* Class implementation */
+
+static void
+ephy_toolbar_realize (GtkWidget *widget)
+{
+ EggEditableToolbar *etoolbar = EGG_EDITABLE_TOOLBAR (widget);
+ EphyToolbar *toolbar = EPHY_TOOLBAR (widget);
+ EggToolbarsModel *model = egg_editable_toolbar_get_model (etoolbar);
+ int i, n_toolbars;
+
+ GTK_WIDGET_CLASS (parent_class)->realize (widget);
+
+ g_signal_connect_after (model, "toolbar_added",
+ G_CALLBACK (toolbar_added_cb), toolbar);
+
+ /* now that the toolbar has been constructed, set drag dests */
+ n_toolbars = egg_toolbars_model_n_toolbars (model);
+ for (i = 0; i < n_toolbars; i++)
+ {
+ const char *t_name;
+
+ t_name = egg_toolbars_model_toolbar_nth (model, i);
+ g_return_if_fail (t_name != NULL);
+
+ egg_editable_toolbar_set_drag_dest
+ (etoolbar, drag_targets, G_N_ELEMENTS (drag_targets), t_name);
+ }
+}
+
+static void
+ephy_toolbar_unrealize (GtkWidget *widget)
+{
+ EggEditableToolbar *eggtoolbar = EGG_EDITABLE_TOOLBAR (widget);
+ EphyToolbar *toolbar = EPHY_TOOLBAR (widget);
+ EggToolbarsModel *model;
+
+ model = egg_editable_toolbar_get_model (eggtoolbar);
+
+ g_signal_handlers_disconnect_by_func
+ (model, G_CALLBACK (toolbar_added_cb), toolbar);
+
+ GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
+}
+
+static void
+ephy_toolbar_show (GtkWidget *widget)
+{
+ EphyToolbar *toolbar = EPHY_TOOLBAR (widget);
+
+ GTK_WIDGET_CLASS (parent_class)->show (widget);
+
+ ephy_toolbar_update_spinner (toolbar);
+}
+
+static void
+ephy_toolbar_hide (GtkWidget *widget)
+{
+ EphyToolbar *toolbar = EPHY_TOOLBAR (widget);
+
+ GTK_WIDGET_CLASS (parent_class)->hide (widget);
+
+ ephy_toolbar_update_spinner (toolbar);
+}
+
+static void
+ephy_toolbar_init (EphyToolbar *toolbar)
+{
+ toolbar->priv = EPHY_TOOLBAR_GET_PRIVATE (toolbar);
+}
+
+static GObject *
+ephy_toolbar_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_params)
+{
+ GObject *object;
+ EphyToolbar *toolbar;
+ EphyToolbarPrivate *priv;
+ GtkToolbar *gtoolbar;
+
+ object = parent_class->constructor (type, n_construct_properties,
+ construct_params);
+
+ toolbar = EPHY_TOOLBAR (object);
+ priv = toolbar->priv;
+
+ priv->fixed_toolbar = gtk_toolbar_new ();
+ gtoolbar = GTK_TOOLBAR (priv->fixed_toolbar);
+ gtk_toolbar_set_show_arrow (gtoolbar, FALSE);
+
+ priv->spinner = ephy_spinner_new ();
+ gtk_widget_show (priv->spinner);
+
+ priv->spinner_item = gtk_tool_item_new ();
+ g_signal_connect (priv->spinner_item, "toolbar-reconfigured",
+ G_CALLBACK (fixed_toolbar_reconfigured_cb), priv->spinner);
+ gtk_container_add (GTK_CONTAINER (priv->spinner_item), priv->spinner);
+ gtk_toolbar_insert (gtoolbar, priv->spinner_item, -1);
+ gtk_widget_show (GTK_WIDGET (priv->spinner_item));
+
+ priv->sep_item = gtk_separator_tool_item_new ();
+ gtk_toolbar_insert (gtoolbar, priv->sep_item, -1);
+
+ priv->exit_button = gtk_tool_button_new_from_stock (GTK_STOCK_QUIT);
+ gtk_tool_button_set_label (GTK_TOOL_BUTTON (priv->exit_button), _("Exit Fullscreen"));
+ gtk_tool_item_set_is_important (priv->exit_button, TRUE);
+ g_signal_connect (priv->exit_button, "clicked",
+ G_CALLBACK (exit_button_clicked_cb), toolbar);
+ gtk_toolbar_insert (gtoolbar, priv->exit_button, -1);
+
+ egg_editable_toolbar_set_fixed (EGG_EDITABLE_TOOLBAR (toolbar), gtoolbar);
+
+ ephy_toolbar_update_fixed_visibility (toolbar);
+
+ return object;
+}
+
+static void
+ephy_toolbar_finalize (GObject *object)
+{
+ EphyToolbar *toolbar = EPHY_TOOLBAR (object);
+ EphyToolbarPrivate *priv = toolbar->priv;
+ EggEditableToolbar *etoolbar = EGG_EDITABLE_TOOLBAR (object);
+
+ if (priv->set_focus_handler != 0)
+ {
+ g_signal_handler_disconnect (priv->window,
+ priv->set_focus_handler);
+ }
+
+ eel_gconf_notification_remove (priv->disable_arbitrary_url_notifier_id);
+
+ g_signal_handlers_disconnect_by_func
+ (egg_editable_toolbar_get_model (etoolbar),
+ G_CALLBACK (toolbar_added_cb), toolbar);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+ephy_toolbar_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ /* no readable properties */
+ g_assert_not_reached ();
+}
+
+static void
+ephy_toolbar_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EphyToolbar *toolbar = EPHY_TOOLBAR (object);
+
+ switch (prop_id)
+ {
+ case PROP_WINDOW:
+ ephy_toolbar_set_window (toolbar, g_value_get_object (value));
+ break;
+ }
+}
+
+static void
+ephy_toolbar_class_init (EphyToolbarClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->constructor = ephy_toolbar_constructor;
+ object_class->finalize = ephy_toolbar_finalize;
+ object_class->set_property = ephy_toolbar_set_property;
+ object_class->get_property = ephy_toolbar_get_property;
+
+ widget_class->realize = ephy_toolbar_realize;
+ widget_class->unrealize = ephy_toolbar_unrealize;
+ widget_class->show = ephy_toolbar_show;
+ widget_class->hide = ephy_toolbar_hide;
+
+ signals[ACTIVATION_FINISHED] =
+ g_signal_new ("activation-finished",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyToolbarClass, activation_finished),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ signals[EXIT_CLICKED] =
+ g_signal_new
+ ("exit-clicked",
+ EPHY_TYPE_TOOLBAR,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyToolbarClass, exit_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ signals[LOCK_CLICKED] =
+ g_signal_new
+ ("lock-clicked",
+ EPHY_TYPE_TOOLBAR,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyToolbarClass, lock_clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_object_class_install_property (object_class,
+ PROP_WINDOW,
+ g_param_spec_object ("window",
+ "Window",
+ "Parent window",
+ EPHY_TYPE_WINDOW,
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_type_class_add_private (object_class, sizeof(EphyToolbarPrivate));
+}
+
+GType
+ephy_toolbar_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0))
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyToolbarClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_toolbar_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (EphyToolbar),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_toolbar_init
+ };
+ static const GInterfaceInfo link_info =
+ {
+ NULL,
+ NULL,
+ NULL
+ };
+
+ type = g_type_register_static (EGG_TYPE_EDITABLE_TOOLBAR,
+ "EphyToolbar",
+ &our_info, 0);
+ g_type_add_interface_static (type,
+ EPHY_TYPE_LINK,
+ &link_info);
+ }
+
+ return type;
+}
+
+EphyToolbar *
+ephy_toolbar_new (EphyWindow *window)
+{
+ return EPHY_TOOLBAR (g_object_new (EPHY_TYPE_TOOLBAR,
+ "window", window,
+ "ui-manager", ephy_window_get_ui_manager (window),
+ NULL));
+}
diff --git a/src/ephy-toolbar.h b/src/ephy-toolbar.h
new file mode 100644
index 000000000..26338dbfd
--- /dev/null
+++ b/src/ephy-toolbar.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2002 Jorn Baayen
+ * Copyright (C) 2003-2004 Marco Pesenti Gritti
+ * Copyright (C) 2003, 2004, 2005 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef EPHY_TOOLBAR_H
+#define EPHY_TOOLBAR_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "egg-editable-toolbar.h"
+#include "ephy-window.h"
+
+G_BEGIN_DECLS
+
+#define EPHY_TYPE_TOOLBAR (ephy_toolbar_get_type ())
+#define EPHY_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TOOLBAR, EphyToolbar))
+#define EPHY_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TOOLBAR, EphyToolbarClass))
+#define EPHY_IS_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TOOLBAR))
+#define EPHY_IS_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TOOLBAR))
+#define EPHY_TOOLBAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TOOLBAR, EphyToolbarClass))
+
+typedef struct _EphyToolbar EphyToolbar;
+typedef struct _EphyToolbarClass EphyToolbarClass;
+typedef struct _EphyToolbarPrivate EphyToolbarPrivate;
+
+struct _EphyToolbar
+{
+ EggEditableToolbar parent_object;
+
+ /*< private >*/
+ EphyToolbarPrivate *priv;
+};
+
+struct _EphyToolbarClass
+{
+ EggEditableToolbarClass parent_class;
+
+ /* Signals */
+ void (* activation_finished) (EphyToolbar *toolbar);
+ void (* exit_clicked) (EphyToolbar *toolbar);
+ void (* lock_clicked) (EphyToolbar *toolbar);
+};
+
+GType ephy_toolbar_get_type (void);
+
+EphyToolbar *ephy_toolbar_new (EphyWindow *window);
+
+void ephy_toolbar_set_favicon (EphyToolbar *toolbar,
+ const char *icon);
+
+void ephy_toolbar_set_fullscreen_mode (EphyToolbar *toolbar,
+ gboolean fullscreen);
+
+void ephy_toolbar_activate_location (EphyToolbar *t);
+
+const char *ephy_toolbar_get_location (EphyToolbar *t);
+
+void ephy_toolbar_set_location (EphyToolbar *toolbar,
+ const char *location);
+
+
+void ephy_toolbar_set_navigation_actions (EphyToolbar *toolbar,
+ gboolean back,
+ gboolean forward,
+ gboolean up);
+
+void ephy_toolbar_set_security_state (EphyToolbar *toolbar,
+ gboolean show_lock,
+ const char *stock_id,
+ const char *tooltip);
+
+void ephy_toolbar_set_spinning (EphyToolbar *toolbar,
+ gboolean spinning);
+
+void ephy_toolbar_set_zoom (EphyToolbar *toolbar,
+ gboolean can_zoom,
+ float zoom);
+
+G_END_DECLS
+
+#endif /* !EPHY_TOOLBAR_H */
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 68b99eabc..79be6fba2 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -44,7 +44,7 @@
#include "ephy-file-helpers.h"
#include "ephy-statusbar.h"
#include "egg-editable-toolbar.h"
-#include "toolbar.h"
+#include "ephy-toolbar.h"
#include "ephy-bookmarksbar.h"
#include "popup-commands.h"
#include "ephy-encoding-menu.h"
@@ -55,6 +55,7 @@
#include "ephy-link.h"
#include "ephy-gui.h"
#include "ephy-notebook.h"
+#include "ephy-fullscreen-popup.h"
#include <string.h>
#include <glib/gi18n.h>
@@ -86,6 +87,12 @@ static void ephy_window_view_bookmarksbar_cb (GtkAction *action,
EphyWindow *window);
static void ephy_window_view_popup_windows_cb (GtkAction *action,
EphyWindow *window);
+static void sync_tab_load_status (EphyTab *tab,
+ GParamSpec *pspec,
+ EphyWindow *window);
+static void sync_tab_security (EphyTab *tab,
+ GParamSpec *pspec,
+ EphyWindow *window);
static void sync_tab_zoom (EphyTab *tab,
GParamSpec *pspec,
EphyWindow *window);
@@ -356,8 +363,8 @@ struct _EphyWindowPrivate
{
GtkWidget *main_vbox;
GtkWidget *menu_dock;
- GtkWidget *exit_fullscreen_popup;
- Toolbar *toolbar;
+ GtkWidget *fullscreen_popup;
+ EphyToolbar *toolbar;
GtkWidget *bookmarksbar;
GtkWidget *statusbar;
GtkUIManager *manager;
@@ -433,56 +440,12 @@ ephy_window_get_type (void)
}
static void
-update_fullscreen_popup (EphyWindow *window)
+destroy_fullscreen_popup (EphyWindow *window)
{
- GtkWidget *popup = window->priv->exit_fullscreen_popup;
- int popup_width, popup_height;
- GdkRectangle screen_rect;
-
- g_return_if_fail (popup != NULL);
-
- popup_width = popup->requisition.width;
- popup_height = popup->requisition.height;
-
- /* FIXME multihead */
- gdk_screen_get_monitor_geometry (gdk_screen_get_default (),
- gdk_screen_get_monitor_at_window
- (gdk_screen_get_default (),
- GTK_WIDGET (window)->window),
- &screen_rect);
-
- if (gtk_widget_get_direction (popup) == GTK_TEXT_DIR_RTL)
+ if (window->priv->fullscreen_popup != NULL)
{
- gtk_window_move (GTK_WINDOW (popup),
- screen_rect.x + screen_rect.width - popup_width,
- screen_rect.height - popup_height);
- }
- else
- {
- gtk_window_move (GTK_WINDOW (popup),
- screen_rect.x, screen_rect.height - popup_height);
- }
-}
-
-static void
-screen_size_changed_cb (GdkScreen *screen,
- EphyWindow *window)
-{
- update_fullscreen_popup (window);
-}
-
-static void
-destroy_exit_fullscreen_popup (EphyWindow *window)
-{
- if (window->priv->exit_fullscreen_popup != NULL)
- {
- /* FIXME multihead */
- g_signal_handlers_disconnect_by_func
- (gdk_screen_get_default (),
- G_CALLBACK (screen_size_changed_cb), window);
-
- gtk_widget_destroy (window->priv->exit_fullscreen_popup);
- window->priv->exit_fullscreen_popup = NULL;
+ gtk_widget_destroy (window->priv->fullscreen_popup);
+ window->priv->fullscreen_popup = NULL;
}
}
@@ -505,7 +468,7 @@ ephy_window_destroy (GtkObject *gtkobject)
ephy_extension_detach_window (manager, window);
}
- destroy_exit_fullscreen_popup (window);
+ destroy_fullscreen_popup (window);
popups = gtk_ui_manager_get_toplevels (window->priv->manager, GTK_UI_MANAGER_POPUP);
g_slist_foreach (popups, (GFunc) gtk_menu_shell_deactivate, NULL);
@@ -524,7 +487,7 @@ add_widget (GtkUIManager *manager,
}
static void
-exit_fullscreen_button_clicked_cb (GtkWidget *button, EphyWindow *window)
+exit_fullscreen_clicked_cb (EphyWindow *window)
{
GtkAction *action;
@@ -534,6 +497,13 @@ exit_fullscreen_button_clicked_cb (GtkWidget *button, EphyWindow *window)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), FALSE);
}
+static gboolean
+get_toolbar_visibility (EphyWindow *window)
+{
+ return ((window->priv->chrome & EPHY_EMBED_CHROME_TOOLBAR) != 0) &&
+ !window->priv->ppv_mode;
+}
+
static void
get_chromes_visibility (EphyWindow *window, gboolean *show_menubar,
gboolean *show_statusbar, gboolean *show_toolbar,
@@ -562,6 +532,7 @@ get_chromes_visibility (EphyWindow *window, gboolean *show_menubar,
static void
sync_chromes_visibility (EphyWindow *window)
{
+ EphyWindowPrivate *priv = window->priv;
GtkWidget *menubar;
gboolean show_statusbar, show_menubar, show_toolbar, show_bookmarksbar;
@@ -572,22 +543,22 @@ sync_chromes_visibility (EphyWindow *window)
menubar = gtk_ui_manager_get_widget (window->priv->manager, "/menubar");
g_assert (menubar != NULL);
- g_object_set (G_OBJECT (menubar), "visible", show_menubar, NULL);
- g_object_set (G_OBJECT (window->priv->toolbar), "visible", show_toolbar, NULL);
- g_object_set (G_OBJECT (window->priv->bookmarksbar), "visible", show_bookmarksbar, NULL);
- g_object_set (G_OBJECT (window->priv->statusbar), "visible", show_statusbar, NULL);
-}
+ g_object_set (menubar, "visible", show_menubar, NULL);
+ g_object_set (priv->toolbar, "visible", show_toolbar, NULL);
+ g_object_set (priv->bookmarksbar, "visible", show_bookmarksbar, NULL);
+ g_object_set (priv->statusbar, "visible", show_statusbar, NULL);
-static void
-fullscreen_popup_size_request_cb (GtkWidget *popup, GtkRequisition *req, EphyWindow *window)
-{
- update_fullscreen_popup (window);
+ if (priv->fullscreen_popup != NULL)
+ {
+ g_object_set (priv->fullscreen_popup, "visible", !show_toolbar, NULL);
+ }
}
static void
ephy_window_fullscreen (EphyWindow *window)
{
- GtkWidget *popup, *button, *icon, *label, *hbox;
+ GtkWidget *popup;
+ EphyTab *tab;
window->priv->fullscreen_mode = TRUE;
@@ -599,44 +570,27 @@ ephy_window_fullscreen (EphyWindow *window)
return;
}
- popup = gtk_window_new (GTK_WINDOW_POPUP);
- window->priv->exit_fullscreen_popup = popup;
-
- button = gtk_button_new ();
- g_signal_connect (button, "clicked",
- G_CALLBACK (exit_fullscreen_button_clicked_cb),
- window);
- gtk_widget_show (button);
- gtk_container_add (GTK_CONTAINER (popup), button);
-
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_widget_show (hbox);
- gtk_container_add (GTK_CONTAINER (button), hbox);
-
- icon = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
- gtk_widget_show (icon);
- gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
-
- label = gtk_label_new (_("Exit Fullscreen"));
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
- gtk_window_set_resizable (GTK_WINDOW (popup), FALSE);
+ popup = ephy_fullscreen_popup_new (window);
+ window->priv->fullscreen_popup = popup;
+ g_signal_connect_swapped (popup, "exit-clicked",
+ G_CALLBACK (exit_fullscreen_clicked_cb), window);
- /* FIXME multihead */
- g_signal_connect (gdk_screen_get_default (), "size-changed",
- G_CALLBACK (screen_size_changed_cb), window);
- g_signal_connect (popup, "size_request",
- G_CALLBACK (fullscreen_popup_size_request_cb), window);
-
- update_fullscreen_popup (window);
+ /* sync status */
+ tab = ephy_window_get_active_tab (window);
+ sync_tab_load_status (tab, NULL, window);
+ sync_tab_security (tab, NULL, window);
- gtk_widget_show (popup);
+ if (get_toolbar_visibility (window) == FALSE)
+ {
+ gtk_widget_show (popup);
+ }
egg_editable_toolbar_set_model
(EGG_EDITABLE_TOOLBAR (window->priv->toolbar),
EGG_TOOLBARS_MODEL (
ephy_shell_get_toolbars_model (ephy_shell, TRUE)));
+
+ ephy_toolbar_set_fullscreen_mode (window->priv->toolbar, TRUE);
}
static void
@@ -644,7 +598,9 @@ ephy_window_unfullscreen (EphyWindow *window)
{
window->priv->fullscreen_mode = FALSE;
- destroy_exit_fullscreen_popup (window);
+ destroy_fullscreen_popup (window);
+
+ ephy_toolbar_set_fullscreen_mode (window->priv->toolbar, FALSE);
egg_editable_toolbar_set_model
(EGG_EDITABLE_TOOLBAR (window->priv->toolbar),
@@ -1208,7 +1164,7 @@ sync_tab_address (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
address = "";
}
- toolbar_set_location (window->priv->toolbar, address);
+ ephy_toolbar_set_location (window->priv->toolbar, address);
}
static void
@@ -1263,7 +1219,7 @@ sync_tab_icon (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
- toolbar_update_favicon (window->priv->toolbar, address);
+ ephy_toolbar_set_favicon (window->priv->toolbar, address);
if (pixbuf)
{
@@ -1340,8 +1296,8 @@ sync_tab_navigation (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
action = gtk_action_group_get_action (action_group, "GoForward");
g_object_set (action, "sensitive", forward, NULL);
- toolbar_update_navigation_actions (window->priv->toolbar,
- back, forward, up);
+ ephy_toolbar_set_navigation_actions (window->priv->toolbar,
+ back, forward, up);
}
static void
@@ -1353,6 +1309,7 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
char *state = NULL;
char *tooltip;
const char *stock_id = STOCK_LOCK_INSECURE;
+ gboolean show_lock = FALSE;
if (window->priv->closing) return;
@@ -1373,6 +1330,7 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
case EPHY_EMBED_STATE_IS_BROKEN:
state = _("Broken");
stock_id = STOCK_LOCK_BROKEN;
+ show_lock = TRUE;
g_free (description);
description = NULL;
break;
@@ -1387,6 +1345,7 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
case EPHY_EMBED_STATE_IS_SECURE_HIGH:
state = _("High");
stock_id = STOCK_LOCK_SECURE;
+ show_lock = TRUE;
break;
default:
g_assert_not_reached ();
@@ -1405,8 +1364,18 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
ephy_statusbar_set_security_state (EPHY_STATUSBAR (window->priv->statusbar),
stock_id, tooltip);
- g_free (tooltip);
+ ephy_toolbar_set_security_state (window->priv->toolbar,
+ show_lock, stock_id, tooltip);
+
+ if (window->priv->fullscreen_popup != NULL)
+ {
+ ephy_fullscreen_popup_set_security_state
+ (EPHY_FULLSCREEN_POPUP (window->priv->fullscreen_popup),
+ show_lock, stock_id, tooltip);
+ }
+
+ g_free (tooltip);
}
static void
@@ -1483,13 +1452,13 @@ sync_tab_load_status (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
/* disable print while loading, see bug #116344 */
update_print_actions (window, !status);
- if (status)
- {
- toolbar_spinner_start (window->priv->toolbar);
- }
- else
+ ephy_toolbar_set_spinning (window->priv->toolbar, status);
+
+ if (window->priv->fullscreen_popup)
{
- toolbar_spinner_stop (window->priv->toolbar);
+ ephy_fullscreen_popup_set_spinning
+ (EPHY_FULLSCREEN_POPUP (window->priv->fullscreen_popup),
+ status);
}
}
@@ -1569,7 +1538,7 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
can_zoom_normal = TRUE;
}
- toolbar_update_zoom (window->priv->toolbar, can_zoom, zoom);
+ ephy_toolbar_set_zoom (window->priv->toolbar, can_zoom, zoom);
action_group = window->priv->action_group;
action = gtk_action_group_get_action (action_group, "ViewZoomIn");
@@ -1791,6 +1760,12 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event)
popup = "/EphyInputPopup";
update_edit_actions_sensitivity (window, FALSE);
}
+ else if (window->priv->fullscreen_mode)
+ {
+ popup = framed ? "/EphyFullscreenFramedDocumentPopup" :
+ "/EphyFullscreenDocumentPopup";
+ update_edit_actions_sensitivity (window, TRUE);
+ }
else
{
popup = framed ? "/EphyFramedDocumentPopup" :
@@ -2045,7 +2020,7 @@ modal_alert_cb (EphyEmbed *embed,
/* make sure the location entry shows the real URL of the tab's page */
address = ephy_embed_get_location (embed, TRUE);
- toolbar_set_location (window->priv->toolbar, address);
+ ephy_toolbar_set_location (window->priv->toolbar, address);
g_free (address);
/* don't suppress alert */
@@ -2334,26 +2309,30 @@ ephy_window_get_property (GObject *object,
}
static gboolean
-ephy_window_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
+ephy_window_focus_in_event (GtkWidget *widget,
+ GdkEventFocus *event)
{
EphyWindow *window = EPHY_WINDOW (widget);
+ EphyWindowPrivate *priv = window->priv;
- if (window->priv->exit_fullscreen_popup)
+ if (priv->fullscreen_popup && !get_toolbar_visibility (window))
{
- gtk_widget_show (window->priv->exit_fullscreen_popup);
+ gtk_widget_show (priv->fullscreen_popup);
}
return GTK_WIDGET_CLASS (parent_class)->focus_in_event (widget, event);
}
static gboolean
-ephy_window_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
+ephy_window_focus_out_event (GtkWidget *widget,
+ GdkEventFocus *event)
{
EphyWindow *window = EPHY_WINDOW (widget);
+ EphyWindowPrivate *priv = window->priv;
- if (window->priv->exit_fullscreen_popup)
+ if (priv->fullscreen_popup)
{
- gtk_widget_hide (window->priv->exit_fullscreen_popup);
+ gtk_widget_hide (priv->fullscreen_popup);
}
return GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, event);
@@ -2579,9 +2558,11 @@ ephy_window_init (EphyWindow *window)
model= EGG_TOOLBARS_MODEL (ephy_shell_get_toolbars_model (ephy_shell, FALSE));
/* create the toolbars */
- window->priv->toolbar = toolbar_new (window);
+ window->priv->toolbar = ephy_toolbar_new (window);
g_signal_connect (window->priv->toolbar, "open-link",
G_CALLBACK (open_link_cb), window);
+ g_signal_connect_swapped (window->priv->toolbar, "exit-clicked",
+ G_CALLBACK (exit_fullscreen_clicked_cb), window);
window->priv->bookmarksbar = ephy_bookmarksbar_new (window);
g_signal_connect (window->priv->bookmarksbar, "open-link",
G_CALLBACK (open_link_cb), window);
@@ -3028,7 +3009,12 @@ ephy_window_load_url (EphyWindow *window,
void
ephy_window_activate_location (EphyWindow *window)
{
- toolbar_activate_location (window->priv->toolbar);
+ if (window->priv->fullscreen_popup)
+ {
+ gtk_widget_hide (window->priv->fullscreen_popup);
+ }
+
+ ephy_toolbar_activate_location (window->priv->toolbar);
}
static void
diff --git a/src/toolbar.c b/src/toolbar.c
deleted file mode 100755
index 0c9857c01..000000000
--- a/src/toolbar.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/*
- * Copyright (C) 2000-2004 Marco Pesenti Gritti
- * Copyright (C) 2001, 2002 Jorn Baayen
- * Copyright (C) 2003, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- */
-
-#include "config.h"
-
-#include "toolbar.h"
-#include "ephy-link.h"
-#include "ephy-go-action.h"
-#include "ephy-home-action.h"
-#include "ephy-location-entry.h"
-#include "ephy-location-action.h"
-#include "ephy-navigation-action.h"
-#include "ephy-spinner.h"
-#include "ephy-dnd.h"
-#include "ephy-topic-action.h"
-#include "ephy-zoom-action.h"
-#include "ephy-shell.h"
-#include "ephy-stock-icons.h"
-#include "window-commands.h"
-#include "eel-gconf-extensions.h"
-#include "ephy-debug.h"
-
-#include <glib/gi18n.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkuimanager.h>
-#include <string.h>
-
-static void toolbar_class_init (ToolbarClass *klass);
-static void toolbar_init (Toolbar *t);
-static void toolbar_finalize (GObject *object);
-static void toolbar_set_window (Toolbar *t, EphyWindow *window);
-
-static GtkTargetEntry drag_targets[] =
-{
- { EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0 },
- { EPHY_DND_TOPIC_TYPE, 0, 1 },
- { EPHY_DND_URL_TYPE, 0, 2 }
-};
-static int n_drag_targets = G_N_ELEMENTS (drag_targets);
-
-enum
-{
- PROP_0,
- PROP_WINDOW
-};
-
-enum
-{
- ACTIVATION_FINISHED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static GObjectClass *parent_class = NULL;
-
-#define CONF_LOCKDOWN_DISABLE_ARBITRARY_URL "/apps/epiphany/lockdown/disable_arbitrary_url"
-
-#define EPHY_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBAR, ToolbarPrivate))
-
-struct ToolbarPrivate
-{
- EphyWindow *window;
- GtkActionGroup *action_group;
- gboolean updating_address;
- GtkWidget *spinner;
- guint disable_arbitrary_url_notifier_id;
- gulong set_focus_handler;
-};
-
-GType
-toolbar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- static const GTypeInfo our_info =
- {
- sizeof (ToolbarClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) toolbar_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (Toolbar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) toolbar_init
- };
-
- static const GInterfaceInfo link_info =
- {
- NULL,
- NULL,
- NULL
- };
-
- type = g_type_register_static (EGG_TYPE_EDITABLE_TOOLBAR,
- "Toolbar",
- &our_info, 0);
- g_type_add_interface_static (type,
- EPHY_TYPE_LINK,
- &link_info);
- }
-
- return type;
-}
-
-static void
-update_location_editable (Toolbar *t)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
- gboolean editable;
-
- editable = !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL);
-
- /* Restore the real web page address when disabling entry */
- if (!editable)
- {
- EphyEmbed *embed;
- char *address;
-
- embed = ephy_window_get_active_embed (t->priv->window);
- if (EPHY_IS_EMBED (embed))
- {
- address = ephy_embed_get_location (embed, TRUE);
- toolbar_set_location (t, address);
- g_free (address);
- }
- }
-
- action_group = t->priv->action_group;
- action = gtk_action_group_get_action (action_group, "Location");
- g_object_set (G_OBJECT (action), "editable", editable, NULL);
-}
-
-static void
-arbitrary_url_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- Toolbar *t)
-{
- update_location_editable (t);
-}
-
-static void
-zoom_to_level_cb (GtkAction *action, float zoom, EphyWindow *window)
-{
- ephy_window_set_zoom (window, zoom);
-}
-
-static void
-toolbar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- Toolbar *t = EPHY_TOOLBAR (object);
-
- switch (prop_id)
- {
- case PROP_WINDOW:
- toolbar_set_window (t, g_value_get_object (value));
- break;
- }
-}
-
-static void
-toolbar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- /* no readable properties */
- g_assert_not_reached ();
-}
-
-static void
-toolbar_added_cb (EggToolbarsModel *model,
- int position,
- EggEditableToolbar *toolbar)
-{
- const char *t_name;
-
- t_name = egg_toolbars_model_toolbar_nth (model, position);
- g_return_if_fail (t_name != NULL);
-
- egg_editable_toolbar_set_drag_dest
- (toolbar, drag_targets, n_drag_targets, t_name);
-}
-
-static void
-toolbar_realize (GtkWidget *widget)
-{
- EggEditableToolbar *eggtoolbar = EGG_EDITABLE_TOOLBAR (widget);
- Toolbar *toolbar = EPHY_TOOLBAR (widget);
- EggToolbarsModel *model = egg_editable_toolbar_get_model (eggtoolbar);
- int i, n_toolbars;
-
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
-
- g_signal_connect_after (model, "toolbar_added",
- G_CALLBACK (toolbar_added_cb), toolbar);
-
- /* now that the toolbar has been constructed, set drag dests */
- n_toolbars = egg_toolbars_model_n_toolbars (model);
- for (i = 0; i < n_toolbars; i++)
- {
- const char *t_name;
-
- t_name = egg_toolbars_model_toolbar_nth (model, i);
- g_return_if_fail (t_name != NULL);
-
- egg_editable_toolbar_set_drag_dest
- (eggtoolbar, drag_targets, n_drag_targets, t_name);
- }
-}
-
-static void
-toolbar_unrealize (GtkWidget *widget)
-{
- EggEditableToolbar *eggtoolbar = EGG_EDITABLE_TOOLBAR (widget);
- Toolbar *toolbar = EPHY_TOOLBAR (widget);
- EggToolbarsModel *model = egg_editable_toolbar_get_model (eggtoolbar);
-
- g_signal_handlers_disconnect_by_func
- (model, G_CALLBACK (toolbar_added_cb), toolbar);
-
- GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
-}
-
-static void
-toolbar_class_init (ToolbarClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = toolbar_finalize;
- object_class->set_property = toolbar_set_property;
- object_class->get_property = toolbar_get_property;
- widget_class->realize = toolbar_realize;
- widget_class->unrealize = toolbar_unrealize;
-
- signals[ACTIVATION_FINISHED] =
- g_signal_new ("activation-finished",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ToolbarClass, activation_finished),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_object_class_install_property (object_class,
- PROP_WINDOW,
- g_param_spec_object ("window",
- "Window",
- "Parent window",
- EPHY_TYPE_WINDOW,
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_type_class_add_private (object_class, sizeof(ToolbarPrivate));
-}
-
-static void
-sync_user_input_cb (EphyLocationAction *action, GParamSpec *pspec, Toolbar *t)
-{
- EphyTab *tab;
- const char *address;
-
- LOG ("sync_user_input_cb")
-
- if (t->priv->updating_address) return;
-
- tab = ephy_window_get_active_tab (t->priv->window);
- g_return_if_fail (EPHY_IS_TAB (tab));
-
- address = ephy_location_action_get_address (action);
-
- t->priv->updating_address = TRUE;
- ephy_tab_set_location (tab, address, EPHY_TAB_ADDRESS_EXPIRE_CURRENT);
- t->priv->updating_address = FALSE;
-}
-
-static void
-toolbar_setup_actions (Toolbar *t)
-{
- GtkAction *action;
-
- t->priv->action_group = gtk_action_group_new ("SpecialToolbarActions");
-
- action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
- "name", "NavigationBack",
- "label", _("Back"),
- "stock_id", GTK_STOCK_GO_BACK,
- "tooltip", _("Go back"),
- /* this is the tooltip on the Back button's drop-down arrow, which will show
- * a menu with all sites you can go 'back' to
- */
- "arrow-tooltip", _("Back history"),
- "window", t->priv->window,
- "direction", EPHY_NAVIGATION_DIRECTION_BACK,
- "is_important", TRUE,
- NULL);
- g_signal_connect (action, "activate",
- G_CALLBACK (window_cmd_go_back), t->priv->window);
- gtk_action_group_add_action (t->priv->action_group, action);
- g_object_unref (action);
-
- action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
- "name", "NavigationForward",
- "label", _("Forward"),
- "stock_id", GTK_STOCK_GO_FORWARD,
- "tooltip", _("Go forward"),
- /* this is the tooltip on the Forward button's drop-down arrow, which will show
- * a menu with all sites you can go 'forward' to
- */
- "arrow-tooltip", _("Forward history"),
- "window", t->priv->window,
- "direction", EPHY_NAVIGATION_DIRECTION_FORWARD,
- NULL);
- g_signal_connect (action, "activate",
- G_CALLBACK (window_cmd_go_forward), t->priv->window);
- gtk_action_group_add_action (t->priv->action_group, action);
- g_object_unref (action);
-
- action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
- "name", "NavigationUp",
- "label", _("Up"),
- "stock_id", GTK_STOCK_GO_UP,
- "tooltip", _("Go up one level"),
- /* this is the tooltip on the Up button's drop-down arrow, which will show
- * a menu with al sites you can go 'up' to
- */
- "arrow-tooltip", _("List of upper levels"),
- "window", t->priv->window,
- "direction", EPHY_NAVIGATION_DIRECTION_UP,
- NULL);
- g_signal_connect (action, "activate",
- G_CALLBACK (window_cmd_go_up), t->priv->window);
- g_signal_connect_swapped (action, "open-link",
- G_CALLBACK (ephy_link_open), t);
- gtk_action_group_add_action (t->priv->action_group, action);
- g_object_unref (action);
-
- /* FIXME: I'm still waiting for the exact term to
- * user here from the docs team.
- */
- action = g_object_new (EPHY_TYPE_LOCATION_ACTION,
- "name", "Location",
- "label", _("Address Entry"),
- "stock_id", EPHY_STOCK_ENTRY,
- "tooltip", _("Enter a web address to open, or a phrase to search for on the web"),
- "visible-overflown", FALSE,
- "window", t->priv->window,
- NULL);
- g_signal_connect_swapped (action, "open-link",
- G_CALLBACK (ephy_link_open), t);
- g_signal_connect (action, "notify::address",
- G_CALLBACK (sync_user_input_cb), t);
- gtk_action_group_add_action (t->priv->action_group, action);
- update_location_editable (t);
- g_object_unref (action);
-
- action = g_object_new (EPHY_TYPE_ZOOM_ACTION,
- "name", "Zoom",
- "label", _("Zoom"),
- "stock_id", GTK_STOCK_ZOOM_IN,
- "tooltip", _("Adjust the text size"),
- "zoom", 1.0,
- NULL);
- g_signal_connect (action, "zoom_to_level",
- G_CALLBACK (zoom_to_level_cb), t->priv->window);
- gtk_action_group_add_action (t->priv->action_group, action);
- g_object_unref (action);
-
- action = g_object_new (EPHY_TYPE_GO_ACTION,
- "name", "ToolbarGo",
- "label", _("Go"),
- "stock_id", GTK_STOCK_JUMP_TO,
- "tooltip", _("Go to the address entered in the address entry"),
- NULL);
- g_signal_connect (action, "activate",
- G_CALLBACK (window_cmd_load_location), t->priv->window);
- gtk_action_group_add_action (t->priv->action_group, action);
- g_object_unref (action);
-
- action = g_object_new (EPHY_TYPE_HOME_ACTION,
- "name", "GoHome",
- "label", _("_Home"),
- "stock_id", GTK_STOCK_HOME,
- "tooltip", _("Go to the home page"),
- "is_important", TRUE,
- NULL);
- g_signal_connect_swapped (action, "open-link",
- G_CALLBACK (ephy_link_open), t);
- gtk_action_group_add_action_with_accel (t->priv->action_group, action, "<alt>Home");
- g_object_unref (action);
-}
-
-static void
-toolbar_set_window (Toolbar *t, EphyWindow *window)
-{
- GtkUIManager *manager;
-
- g_return_if_fail (t->priv->window == NULL);
-
- t->priv->window = window;
- manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));
-
- toolbar_setup_actions (t);
- gtk_ui_manager_insert_action_group (manager,
- t->priv->action_group, 1);
-
- t->priv->disable_arbitrary_url_notifier_id = eel_gconf_notification_add
- (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL,
- (GConfClientNotifyFunc)arbitrary_url_notifier, t);
-}
-
-static void
-fixed_toolbar_reconfigured_cb (GtkToolItem *fixed_item,
- EphySpinner *spinner)
-{
- GtkToolbarStyle style;
- GtkIconSize size;
-
- style = gtk_tool_item_get_toolbar_style (fixed_item);
-
- if (style == GTK_TOOLBAR_BOTH)
- {
- size = GTK_ICON_SIZE_INVALID;
- }
- else
- {
- size = GTK_ICON_SIZE_LARGE_TOOLBAR;
- }
-
- ephy_spinner_set_size (spinner, size);
-}
-
-static void
-toolbar_init (Toolbar *t)
-{
- GtkWidget *spinner;
- GtkToolItem *item;
-
- t->priv = EPHY_TOOLBAR_GET_PRIVATE (t);
-
- spinner = ephy_spinner_new ();
- t->priv->spinner = spinner;
- g_object_ref (spinner);
- gtk_object_sink (GTK_OBJECT (spinner));
- gtk_widget_show (spinner);
-
- item = gtk_tool_item_new ();
- gtk_container_add (GTK_CONTAINER (item), spinner);
- gtk_widget_show (GTK_WIDGET (item));
-
- egg_editable_toolbar_set_fixed (EGG_EDITABLE_TOOLBAR (t), item);
-
- g_signal_connect (item, "toolbar-reconfigured",
- G_CALLBACK (fixed_toolbar_reconfigured_cb), spinner);
-}
-
-static void
-toolbar_finalize (GObject *object)
-{
- Toolbar *t = EPHY_TOOLBAR (object);
- EggEditableToolbar *eggtoolbar = EGG_EDITABLE_TOOLBAR (object);
-
- if (t->priv->set_focus_handler != 0)
- {
- g_signal_handler_disconnect (t->priv->window,
- t->priv->set_focus_handler);
- }
-
- eel_gconf_notification_remove
- (t->priv->disable_arbitrary_url_notifier_id);
-
- g_signal_handlers_disconnect_by_func
- (egg_editable_toolbar_get_model (eggtoolbar),
- G_CALLBACK (toolbar_added_cb), t);
-
- g_object_unref (t->priv->spinner);
-
- g_object_unref (t->priv->action_group);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-
- LOG ("Toolbar finalized")
-}
-
-static void
-maybe_finish_activation_cb (EphyWindow *window,
- GtkWidget *widget,
- Toolbar *toolbar)
-{
- GtkWidget *wtoolbar = GTK_WIDGET (toolbar);
-
- while (widget != NULL && widget != wtoolbar)
- {
- widget = widget->parent;
- }
-
- /* if widget == toolbar, the new focus widget is in the toolbar, so we
- * don't deactivate.
- */
- if (widget != wtoolbar)
- {
- g_signal_handler_disconnect (window,
- toolbar->priv->set_focus_handler);
- toolbar->priv->set_focus_handler = 0;
-
- g_signal_emit (toolbar, signals[ACTIVATION_FINISHED], 0);
- }
-}
-
-void
-toolbar_activate_location (Toolbar *toolbar)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
- GSList *proxies;
- GtkWidget *entry = NULL;
- gboolean visible;
-
- action_group = toolbar->priv->action_group;
- action = gtk_action_group_get_action (action_group, "Location");
-
- proxies = gtk_action_get_proxies (action);
-
- if (proxies != NULL && EPHY_IS_LOCATION_ENTRY (proxies->data))
- {
- entry = GTK_WIDGET (proxies->data);
- }
-
- if (entry == NULL)
- {
- /* happens when the user has removed the location entry from
- * the toolbars.
- */
- return;
- }
-
- ephy_location_entry_activate (EPHY_LOCATION_ENTRY (entry));
-
- g_object_get (G_OBJECT (toolbar), "visible", &visible, NULL);
- if (visible == FALSE)
- {
- gtk_widget_show (GTK_WIDGET (toolbar));
- toolbar->priv->set_focus_handler =
- g_signal_connect (toolbar->priv->window, "set-focus",
- G_CALLBACK (maybe_finish_activation_cb),
- toolbar);
- }
-}
-
-void
-toolbar_spinner_start (Toolbar *t)
-{
- ephy_spinner_start (EPHY_SPINNER (t->priv->spinner));
-}
-
-void
-toolbar_spinner_stop (Toolbar *t)
-{
- ephy_spinner_stop (EPHY_SPINNER (t->priv->spinner));
-}
-
-void
-toolbar_set_location (Toolbar *t,
- const char *address)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
-
- if (t->priv->updating_address) return;
-
- action_group = t->priv->action_group;
- action = gtk_action_group_get_action (action_group, "Location");
-
- t->priv->updating_address = TRUE;
- ephy_location_action_set_address (EPHY_LOCATION_ACTION (action), address);
- t->priv->updating_address = FALSE;
-}
-
-void
-toolbar_update_favicon (Toolbar *t,
- const char *icon)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
-
- action_group = t->priv->action_group;
- action = gtk_action_group_get_action (action_group, "Location");
- g_object_set (action, "icon", icon, NULL);
-}
-
-const char *
-toolbar_get_location (Toolbar *t)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
-
- action_group = t->priv->action_group;
- action = gtk_action_group_get_action (action_group, "Location");
-
- return ephy_location_action_get_address (EPHY_LOCATION_ACTION (action));
-}
-
-void
-toolbar_update_navigation_actions (Toolbar *t, gboolean back, gboolean forward, gboolean up)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
-
- action_group = t->priv->action_group;
- action = gtk_action_group_get_action (action_group, "NavigationBack");
- g_object_set (action, "sensitive", back, NULL);
- action = gtk_action_group_get_action (action_group, "NavigationForward");
- g_object_set (action, "sensitive", forward, NULL);
- action = gtk_action_group_get_action (action_group, "NavigationUp");
- g_object_set (action, "sensitive", up, NULL);
-}
-
-void
-toolbar_update_zoom (Toolbar *t,
- gboolean can_zoom,
- float zoom)
-{
- GtkActionGroup *action_group;
- GtkAction *action;
-
- action_group = t->priv->action_group;
- action = gtk_action_group_get_action (action_group, "Zoom");
- g_object_set (action, "zoom", can_zoom ? zoom : 1.0,
- "sensitive", can_zoom,
- NULL);
-}
-
-Toolbar *
-toolbar_new (EphyWindow *window)
-{
- return EPHY_TOOLBAR (g_object_new (EPHY_TYPE_TOOLBAR,
- "window", window,
- "ui-manager", ephy_window_get_ui_manager (window),
- NULL));
-}
diff --git a/src/toolbar.h b/src/toolbar.h
deleted file mode 100644
index 38d51ae2b..000000000
--- a/src/toolbar.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2002 Jorn Baayen
- * Copyright (C) 2003-2004 Marco Pesenti Gritti
- * Copyright (C) 2003-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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- */
-
-#ifndef TOOLBAR_H
-#define TOOLBAR_H
-
-#include "egg-editable-toolbar.h"
-#include "ephy-window.h"
-
-#include <glib-object.h>
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-#define EPHY_TYPE_TOOLBAR (toolbar_get_type ())
-#define EPHY_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_TOOLBAR, Toolbar))
-#define EPHY_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_TOOLBAR, ToolbarClass))
-#define EPHY_IS_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_TOOLBAR))
-#define EPHY_IS_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_TOOLBAR))
-#define EPHY_TOOLBAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_TOOLBAR, ToolbarClass))
-
-typedef struct Toolbar Toolbar;
-typedef struct ToolbarClass ToolbarClass;
-typedef struct ToolbarPrivate ToolbarPrivate;
-
-struct Toolbar
-{
- EggEditableToolbar parent_object;
-
- /*< private >*/
- ToolbarPrivate *priv;
-};
-
-struct ToolbarClass
-{
- EggEditableToolbarClass parent_class;
-
- /* Signals */
- void (* activation_finished) (Toolbar *toolbar);
-};
-
-GType toolbar_get_type (void);
-
-Toolbar *toolbar_new (EphyWindow *window);
-
-void toolbar_spinner_start (Toolbar *t);
-
-void toolbar_spinner_stop (Toolbar *t);
-
-const char *toolbar_get_location (Toolbar *t);
-
-void toolbar_set_location (Toolbar *t,
- const char *location);
-
-void toolbar_activate_location (Toolbar *t);
-
-void toolbar_update_favicon (Toolbar *t,
- const char *icon);
-
-void toolbar_update_navigation_actions (Toolbar *t,
- gboolean back,
- gboolean forward,
- gboolean up);
-
-void toolbar_update_zoom (Toolbar *t,
- gboolean can_zoom,
- float zoom);
-
-G_END_DECLS
-
-#endif
diff --git a/src/window-commands.c b/src/window-commands.c
index c38ccde97..48479061e 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -38,7 +38,7 @@
#include "ephy-new-bookmark.h"
#include "ephy-file-chooser.h"
#include "ephy-file-helpers.h"
-#include "toolbar.h"
+#include "ephy-toolbar.h"
#include "ephy-state.h"
#include "ephy-gui.h"
#include "ephy-zoom.h"
@@ -916,11 +916,11 @@ void
window_cmd_load_location (GtkAction *action,
EphyWindow *window)
{
- Toolbar *toolbar;
+ EphyToolbar *toolbar;
const char *location;
toolbar = EPHY_TOOLBAR (ephy_window_get_toolbar (window));
- location = toolbar_get_location (toolbar);
+ location = ephy_toolbar_get_location (toolbar);
if (location)
{