]> www.fi.muni.cz Git - evince.git/commitdiff
A data/evince.schemas.in:
authorChristian Persch <chpe@cvs.gnome.org>
Mon, 7 Feb 2005 14:02:30 +0000 (14:02 +0000)
committerChristian Persch <chpe@src.gnome.org>
Mon, 7 Feb 2005 14:02:30 +0000 (14:02 +0000)
2005-02-07  Christian Persch  <chpe@cvs.gnome.org>

* Makefile.am:
* configure.ac:
* data/.cvsignore:
* data/Makefile.am:
* data/evince-ui.xml:
A data/evince.schemas.in:
* po/POTFILES.in:
* shell/ev-stock-icons.c: (ev_stock_icons_init):
* shell/ev-stock-icons.h:
* shell/ev-window.c: (update_chrome_visibility),
(update_chrome_flag), (ev_window_cmd_edit_find),
(ev_window_update_fullscreen_popup), (ev_window_fullscreen),
(ev_window_unfullscreen), (ev_window_focus_in_event),
(ev_window_focus_out_event), (ev_window_cmd_leave_fullscreen),
(ev_window_view_toolbar_cb), (ev_window_view_statusbar_cb),
(ev_window_view_sidebar_cb), (find_bar_close_cb),
(ev_window_dispose), (ev_window_class_init),
(set_action_properties), (set_chrome_actions), (load_chrome),
(ev_window_init):

Implement fullscreen mode changes from bug #164776.
Also implement persistent chrome toggles.

ChangeLog
Makefile.am
configure.ac
data/.cvsignore
data/Makefile.am
data/evince-ui.xml
data/evince.schemas.in [new file with mode: 0644]
po/POTFILES.in
shell/ev-stock-icons.c
shell/ev-stock-icons.h
shell/ev-window.c

index 8ea65e02fee9c6978c23696e8a0a6ba06fad0501..a6f1fe2be6b384b4804ba9b48581d953b423bf44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2005-02-07  Christian Persch  <chpe@cvs.gnome.org>
+
+       * Makefile.am:
+       * configure.ac:
+       * data/.cvsignore:
+       * data/Makefile.am:
+       * data/evince-ui.xml:
+       A data/evince.schemas.in:
+       * po/POTFILES.in:
+       * shell/ev-stock-icons.c: (ev_stock_icons_init):
+       * shell/ev-stock-icons.h:
+       * shell/ev-window.c: (update_chrome_visibility),
+       (update_chrome_flag), (ev_window_cmd_edit_find),
+       (ev_window_update_fullscreen_popup), (ev_window_fullscreen),
+       (ev_window_unfullscreen), (ev_window_focus_in_event),
+       (ev_window_focus_out_event), (ev_window_cmd_leave_fullscreen),
+       (ev_window_view_toolbar_cb), (ev_window_view_statusbar_cb),
+       (ev_window_view_sidebar_cb), (find_bar_close_cb),
+       (ev_window_dispose), (ev_window_class_init),
+       (set_action_properties), (set_chrome_actions), (load_chrome),
+       (ev_window_init):
+
+       Implement fullscreen mode changes from bug #164776.
+       Also implement persistent chrome toggles.
+
 2005-02-07  Jordi Mallach  <jordi@sindominio.net>
 
        * configure.ac (ALL_LINGUAS): Added "ca" (Catalan).
index e9c225c9f74102b7e9298fc4557e476116496c7c..65d886d90c2f095ae6a5c9db7bb8ccb68ba54f40 100644 (file)
@@ -8,3 +8,5 @@ DISTCLEANFILES =                \
        intltool-extract        \
        intltool-merge          \
        intltool-update
+
+DISTCHECK_CONFIGURE_FLAGS = --disable-schemas-install
index ed15758577c29d4186a135628cc6a943bd7d2b5a..5df83b975aaafebbc895540986061a7d829ec568 100644 (file)
@@ -31,7 +31,7 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
 
 PKG_CHECK_MODULES(LIBEVPRIVATE, gtk+-2.0 >= 2.4.0)
 PKG_CHECK_MODULES(RECENT_FILES, gtk+-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.4.0)
-PKG_CHECK_MODULES(SHELL, gtk+-2.0 >= 2.5.0 libgnomeui-2.0 gnome-vfs-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libglade-2.0)
+PKG_CHECK_MODULES(SHELL, gtk+-2.0 >= 2.6.0 libgnomeui-2.0 gnome-vfs-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libglade-2.0 gconf-2.0)
 PKG_CHECK_MODULES(DVI, gtk+-2.0 >= 2.6.0)
 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
 PKG_CHECK_MODULES(PS, gtk+-2.0 >= 2.6.0 gnome-vfs-2.0 libgnomeui-2.0)
@@ -62,6 +62,13 @@ else
 fi
 AC_SUBST(EVINCE_DISABLE_DEPRECATED)
 
+AM_GCONF_SOURCE_2
+
+AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
+if test "x$GCONFTOOL" = "xno"; then
+       AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+fi
+
 dnl ================== Xpdf aconf.h.in checks ==================================
 
 AH_TEMPLATE([HAVE_LIBSM], [Define to 1 if you have session management.])
index 80e5ad65eeeeddf70eae31ab698304da19a6fc4a..781a35cf26e5c1161bf30b44433c73af66387ff0 100644 (file)
@@ -1,3 +1,4 @@
 Makefile
 Makefile.in
 evince.desktop
+evince.schemas
index 2ff2f59caa575f30282433989149d6f8c2108fbc..60f14f9c6f68c239c70a639b2a2160e73f6dd228 100644 (file)
@@ -1,4 +1,5 @@
 @INTLTOOL_DESKTOP_RULE@
+@INTLTOOL_SCHEMAS_RULE@
 
 NULL =
 
@@ -23,12 +24,27 @@ DESKTOP_FILES= $(DESKTOP_IN_FILES:.desktop.in=.desktop)
 desktopdir = $(datadir)/applications
 desktop_DATA = $(DESKTOP_FILES)
 
+schema_in_files = evince.schemas.in
+schemadir = $(GCONF_SCHEMA_FILE_DIR)
+schema_DATA = $(schema_in_files:.schemas.in=.schemas)
+
+install-data-local:
+if GCONF_SCHEMAS_INSTALL
+       if test -z "$(DESTDIR)" ; then \
+       for p in $(schema_DATA) ; do \
+       GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/data/$$p >&1 > /dev/null; \
+       done \
+       fi
+endif
+
 EXTRA_DIST =                           \
        $(stock_DATA)                   \
        $(glade_DATA)                   \
        $(ui_DATA)                      \
        $(DESKTOP_IN_FILES)             \
+       $(schema_in_files)              \
        $(NULL)
 
 DISTCLEANFILES = \
-       $(DESKTOP_FILES)
+       $(DESKTOP_FILES)        \
+       $(schema_DATA)
index b1467c0339b078f47d83f235f413c6cae90e3e40..88d18a2e91869dfd2e40fd24fd42f599c51357e6 100644 (file)
     <toolitem action="ContinuousPage"/>
 -->
   </toolbar>
+
+  <toolbar name="LeaveFullscreenToolbar">
+    <toolitem action="LeaveFullscreen"/>
+  </toolbar>
+
+  <accelerator name="LeaveFullscreenAccel" action="LeaveFullscreen"/>
 </ui>
diff --git a/data/evince.schemas.in b/data/evince.schemas.in
new file mode 100644 (file)
index 0000000..e02f543
--- /dev/null
@@ -0,0 +1,37 @@
+<gconfschemafile>
+  <schemalist>
+    <schema>
+      <key>/schemas/apps/evince/show_toolbar</key>
+      <applyto>/apps/evince/show_toolbar/applyto>
+      <owner>evince</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Show toolbar by default</short>
+        <long>Show toolbar by default.</long>
+      </locale>
+    </schema>
+    <schema>
+      <key>/schemas/apps/evince/show_sidebar</key>
+      <applyto>/apps/evince/show_sidebar/applyto>
+      <owner>evince</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Show sidebar by default</short>
+        <long>Show sidebar by default.</long>
+      </locale>
+    </schema>
+    <schema>
+      <key>/schemas/apps/evince/show_statusbar</key>
+      <applyto>/apps/evince/show_statusbar/applyto>
+      <owner>evince</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Show statusbar by default</short>
+        <long>Show statusbar by default.</long>
+      </locale>
+    </schema>
+  </schemalist>
+</gconfschemafile>
index 9597971ca0e3e24d77dfa74c68715294c3796854..441127f4b23fdd1d5029e12ae01b14a3d74d1fab 100644 (file)
@@ -3,6 +3,7 @@
 [encoding: UTF-8]
 data/evince-password.glade
 data/evince.desktop.in
+data/evince.schemas.in
 pdf/xpdf/pdf-document.cc
 ps/gsdefaults.c
 ps/ps-document.c
index 17793f37e3a9fb87aaded5b5c6024550bace3fb3..a9f533caeeb30c377541a5f844a8a2de4bf09223 100644 (file)
 void
 ev_stock_icons_init (void)
 {
+       static const char *icon_theme_items[] = {
+               EV_STOCK_LEAVE_FULLSCREEN
+       };
         GtkIconFactory *factory;
+       guint i;
 
         factory = gtk_icon_factory_new ();
         gtk_icon_factory_add_default (factory);
 
        /* fitwidth stock icon */
        EV_ADD_STOCK_ICON (EV_STOCK_ZOOM_FIT_WIDTH, STOCK_ZOOM_FIT_WIDTH_FILE, GTK_STOCK_ZOOM_FIT);
-       
+
+       for (i = 0; i < G_N_ELEMENTS (icon_theme_items); i++) {
+               GtkIconSet *icon_set;
+               GtkIconSource *icon_source;
+
+               icon_set = gtk_icon_set_new ();
+               icon_source = gtk_icon_source_new ();
+               gtk_icon_source_set_icon_name (icon_source, icon_theme_items[i]);
+               gtk_icon_set_add_source (icon_set, icon_source);
+               gtk_icon_factory_add (factory, icon_theme_items[i], icon_set);
+               gtk_icon_set_unref (icon_set);
+               gtk_icon_source_free (icon_source);
+       }
+
        g_object_unref (G_OBJECT (factory));
 }
index b29ddbc24183285d1af453516eb726bd082693d2..52c54cf381d52d153e38bc0f04d57a4060e39c05 100644 (file)
@@ -30,6 +30,7 @@ G_BEGIN_DECLS
 
 /* Toolbar icons */
 #define EV_STOCK_ZOOM_FIT_WIDTH "ev-zoom-fit-width"
+#define EV_STOCK_LEAVE_FULLSCREEN "stock_leave-fullscreen"
 
 void ev_stock_icons_init (void);
 
index e5c6bace054f7391cdccb78d2220c2d292300cd5..875e271dd97e07cbf646ada5920607ad65cfc9fe 100644 (file)
@@ -4,7 +4,7 @@
  *  Copyright (C) 2004 Martin Kretzschmar
  *  Copyright (C) 2004 Red Hat, Inc.
  *  Copyright (C) 2000, 2001, 2002, 2003, 2004 Marco Pesenti Gritti
- *  Copyright (C) 2003, 2004 Christian Persch
+ *  Copyright (C) 2003, 2004, 2005 Christian Persch
  *
  *  Author:
  *    Martin Kretzschmar <martink@gnome.org>
@@ -52,6 +52,8 @@
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
 #include <libgnomeprintui/gnome-print-dialog.h>
 
+#include <gconf/gconf-client.h>
+
 #include <string.h>
 
 #include "ev-application.h"
@@ -63,8 +65,20 @@ typedef enum {
        PAGE_MODE_PASSWORD,
 } EvWindowPageMode;
 
+typedef enum {
+       EV_CHROME_MENUBAR       = 1 << 0,
+       EV_CHROME_TOOLBAR       = 1 << 1,
+       EV_CHROME_SIDEBAR       = 1 << 2,
+       EV_CHROME_FINDBAR       = 1 << 3,
+       EV_CHROME_STATUSBAR     = 1 << 4,
+       EV_CHROME_NORMAL        = EV_CHROME_MENUBAR | EV_CHROME_TOOLBAR | EV_CHROME_SIDEBAR | EV_CHROME_STATUSBAR
+} EvChrome;
+
 struct _EvWindowPrivate {
        GtkWidget *main_box;
+       GtkWidget *menubar;
+       GtkWidget *toolbar_dock;
+       GtkWidget *toolbar;
        GtkWidget *hpaned;
        GtkWidget *sidebar;
        GtkWidget *thumbs_sidebar;
@@ -79,6 +93,7 @@ struct _EvWindowPrivate {
        guint help_message_cid;
        guint view_message_cid;
        GtkWidget *exit_fullscreen_popup;
+       GtkWidget *exit_fullscreen_toolbar;
        char *uri;
 
        EvDocument *document;
@@ -89,14 +104,17 @@ struct _EvWindowPrivate {
        GtkWidget *password_dialog;
        char *password_uri;
 
+       EvChrome chrome;
        gboolean fullscreen_mode;
 };
 #define EV_WINDOW_GET_PRIVATE(object) \
        (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_WINDOW, EvWindowPrivate))
 
+#define PAGE_SELECTOR_ACTION   "PageSelector"
 
-#define PAGE_SELECTOR_ACTION "PageSelector"
-
+#define GCONF_CHROME_TOOLBAR   "/apps/evince/show_toolbar"
+#define GCONF_CHROME_SIDEBAR   "/apps/evince/show_sidebar"
+#define GCONF_CHROME_STATUSBAR "/apps/evince/show_statusbar"
 
 static void     ev_window_update_fullscreen_popup (EvWindow         *window);
 static void     ev_window_set_page_mode           (EvWindow         *window,
@@ -187,6 +205,52 @@ update_action_sensitivity (EvWindow *ev_window)
        set_action_sensitive (ev_window, PAGE_SELECTOR_ACTION, document!=NULL);
 }
 
+static void
+update_chrome_visibility (EvWindow *window)
+{
+       EvWindowPrivate *priv = window->priv;
+       gboolean menubar, toolbar, sidebar, findbar, statusbar;
+
+       menubar = (priv->chrome & EV_CHROME_MENUBAR) != 0 && !priv->fullscreen_mode;
+       toolbar = (priv->chrome & EV_CHROME_TOOLBAR) != 0;
+       sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0;
+       findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0;
+       statusbar = (priv->chrome & EV_CHROME_STATUSBAR) != 0 && !priv->fullscreen_mode;
+
+       g_object_set (priv->menubar, "visible", menubar, NULL);
+       g_object_set (priv->toolbar_dock, "visible", toolbar, NULL);
+       g_object_set (priv->sidebar, "visible", sidebar, NULL);
+       g_object_set (priv->find_bar, "visible", findbar, NULL);
+       g_object_set (priv->statusbar, "visible", statusbar, NULL);
+
+       g_object_set (priv->exit_fullscreen_toolbar, "visible", priv->fullscreen_mode, NULL);
+       if (priv->exit_fullscreen_popup != NULL) {
+               g_object_set (priv->exit_fullscreen_popup, "visible", !toolbar, NULL);
+       }
+}
+
+static void
+update_chrome_flag (EvWindow *window, EvChrome flag, const char *pref, gboolean active)
+{
+       EvWindowPrivate *priv = window->priv;
+       GConfClient *client;
+       
+       if (active) {
+               priv->chrome |= flag;
+       }
+       else {
+               priv->chrome &= ~flag;
+       }
+
+       if (pref != NULL) {
+               client = gconf_client_get_default ();
+               gconf_client_set_bool (client, pref, active, NULL);
+               g_object_unref (client);
+       }
+
+       update_chrome_visibility (window);
+}
+
 void
 ev_window_open_page (EvWindow *ev_window, int page)
 {
@@ -783,10 +847,7 @@ ev_window_cmd_edit_find (GtkAction *action, EvWindow *ev_window)
        } else if (!EV_IS_DOCUMENT_FIND (ev_window->priv->document)) {
                find_not_supported_dialog (ev_window);
        } else {
-               gtk_widget_show (ev_window->priv->find_bar);
-
-               if (ev_window->priv->exit_fullscreen_popup)
-                       ev_window_update_fullscreen_popup (ev_window);
+               update_chrome_flag (ev_window, EV_CHROME_FINDBAR, NULL, TRUE);
 
                egg_find_bar_grab_focus (EGG_FIND_BAR (ev_window->priv->find_bar));
        }
@@ -809,9 +870,6 @@ ev_window_update_fullscreen_popup (EvWindow *window)
 
        g_return_if_fail (popup != NULL);
 
-       if (!popup)
-               return;
-
        popup_width = popup->requisition.width;
        popup_height = popup->requisition.height;
 
@@ -822,24 +880,17 @@ ev_window_update_fullscreen_popup (EvWindow *window)
                          GTK_WIDGET (window)->window),
                          &screen_rect);
 
-       if (GTK_WIDGET_VISIBLE (window->priv->find_bar)) {
-               GtkRequisition req;
-
-               gtk_widget_size_request (window->priv->find_bar, &req);
-
-               screen_rect.height -= req.height;
-       }
-
        if (gtk_widget_get_direction (popup) == GTK_TEXT_DIR_RTL)
        {
                gtk_window_move (GTK_WINDOW (popup),
-                                screen_rect.x + screen_rect.width - popup_width,
-                                screen_rect.height - popup_height);
+                                screen_rect.x,
+                                screen_rect.y);
        }
        else
        {
                gtk_window_move (GTK_WINDOW (popup),
-                               screen_rect.x, screen_rect.height - popup_height);
+                                screen_rect.x + screen_rect.width - popup_width,
+                                screen_rect.y);
        }
 }
 
@@ -885,10 +936,12 @@ fullscreen_popup_size_request_cb (GtkWidget *popup, GtkRequisition *req, EvWindo
 static void
 ev_window_fullscreen (EvWindow *window)
 {
-       GtkWidget *popup, *button, *icon, *label, *hbox, *main_menu;
+       GtkWidget *popup, *button, *icon, *label, *hbox;
 
        window->priv->fullscreen_mode = TRUE;
 
+       g_return_if_fail (window->priv->exit_fullscreen_popup == NULL);
+
        popup = gtk_window_new (GTK_WINDOW_POPUP);
        window->priv->exit_fullscreen_popup = popup;
 
@@ -903,11 +956,11 @@ ev_window_fullscreen (EvWindow *window)
        gtk_widget_show (hbox);
        gtk_container_add (GTK_CONTAINER (button), hbox);
 
-       icon = gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON);
+       icon = gtk_image_new_from_stock (EV_STOCK_LEAVE_FULLSCREEN, 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"));
+       label = gtk_label_new (_("Leave Fullscreen"));
        gtk_widget_show (label);
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
 
@@ -919,27 +972,19 @@ ev_window_fullscreen (EvWindow *window)
        g_signal_connect (popup, "size_request",
                          G_CALLBACK (fullscreen_popup_size_request_cb), window);
 
-       main_menu = gtk_ui_manager_get_widget (window->priv->ui_manager, "/MainMenu");
-       gtk_widget_hide (main_menu);
-       gtk_widget_hide (window->priv->statusbar);
+       update_chrome_visibility (window);
 
        ev_window_update_fullscreen_popup (window);
-
-       gtk_widget_show (popup);
 }
 
 static void
 ev_window_unfullscreen (EvWindow *window)
 {
-       GtkWidget *main_menu;
-
        window->priv->fullscreen_mode = FALSE;
 
-       main_menu = gtk_ui_manager_get_widget (window->priv->ui_manager, "/MainMenu");
-       gtk_widget_show (main_menu);
-       gtk_widget_show (window->priv->statusbar);
-
        destroy_exit_fullscreen_popup (window);
+
+       update_chrome_visibility (window);
 }
 
 static void
@@ -993,11 +1038,33 @@ ev_window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event, EvWindo
 }
 
 static gboolean
-ev_window_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, EvWindow *ev_window)
+ev_window_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
 {
-       gtk_window_unfullscreen (GTK_WINDOW (ev_window));
+       EvWindow *window = EV_WINDOW (widget);
+       EvWindowPrivate *priv = window->priv;
 
-       return FALSE;
+       if (priv->exit_fullscreen_popup != NULL &&
+           (priv->chrome & EV_CHROME_TOOLBAR) == 0)
+       {
+               gtk_widget_show (priv->exit_fullscreen_popup);
+       }
+
+       return GTK_WIDGET_CLASS (ev_window_parent_class)->focus_in_event (widget, event);
+}
+
+static gboolean
+ev_window_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
+{
+       EvWindow *window = EV_WINDOW (widget);
+       EvWindowPrivate *priv = window->priv;
+
+       if (priv->exit_fullscreen_popup != NULL &&
+           (priv->chrome & EV_CHROME_TOOLBAR) == 0)
+       {
+               gtk_widget_hide (priv->exit_fullscreen_popup);
+       }
+
+       return GTK_WIDGET_CLASS (ev_window_parent_class)->focus_out_event (widget, event);
 }
 
 static void
@@ -1118,6 +1185,12 @@ ev_window_cmd_help_contents (GtkAction *action, EvWindow *ev_window)
         /* FIXME */
 }
 
+static void
+ev_window_cmd_leave_fullscreen (GtkAction *action, EvWindow *window)
+{
+       gtk_window_unfullscreen (GTK_WINDOW (window));
+}
+
 static void
 ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
 {
@@ -1180,33 +1253,25 @@ ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
 static void
 ev_window_view_toolbar_cb (GtkAction *action, EvWindow *ev_window)
 {
-       g_object_set (
-               G_OBJECT (gtk_ui_manager_get_widget (
-                                 ev_window->priv->ui_manager,
-                                 "/ToolBar")),
-               "visible",
-               gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)),
-               NULL);
+       update_chrome_flag (ev_window, EV_CHROME_TOOLBAR,
+                           GCONF_CHROME_TOOLBAR,
+                           gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
 static void
 ev_window_view_statusbar_cb (GtkAction *action, EvWindow *ev_window)
 {
-       g_object_set (
-               ev_window->priv->statusbar,
-               "visible",
-               gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)),
-               NULL);
+       update_chrome_flag (ev_window, EV_CHROME_STATUSBAR,
+                           GCONF_CHROME_STATUSBAR,
+                           gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
 static void
 ev_window_view_sidebar_cb (GtkAction *action, EvWindow *ev_window)
 {
-       g_object_set (
-               ev_window->priv->sidebar,
-               "visible",
-               gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)),
-               NULL);
+       update_chrome_flag (ev_window, EV_CHROME_SIDEBAR,
+                           GCONF_CHROME_SIDEBAR,
+                           gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
 }
 
 static void
@@ -1331,10 +1396,7 @@ static void
 find_bar_close_cb (EggFindBar *find_bar,
                   EvWindow   *ev_window)
 {
-       gtk_widget_hide (ev_window->priv->find_bar);
-
-       if (ev_window->priv->exit_fullscreen_popup)
-               ev_window_update_fullscreen_popup (ev_window);
+       update_chrome_flag (ev_window, EV_CHROME_FINDBAR, NULL, FALSE);
 }
 
 static void
@@ -1393,11 +1455,8 @@ find_bar_search_changed_cb (EggFindBar *find_bar,
 static void
 ev_window_dispose (GObject *object)
 {
-       EvWindowPrivate *priv;
-
-       g_return_if_fail (object != NULL && EV_IS_WINDOW (object));
-
-       priv = EV_WINDOW (object)->priv;
+       EvWindow *window = EV_WINDOW (object);
+       EvWindowPrivate *priv = window->priv;
 
        if (priv->ui_manager) {
                g_object_unref (priv->ui_manager);
@@ -1423,20 +1482,24 @@ ev_window_dispose (GObject *object)
                g_free (priv->password_uri);
                priv->password_uri = NULL;
        }
-       
+
+       destroy_exit_fullscreen_popup (window);
+
        G_OBJECT_CLASS (ev_window_parent_class)->dispose (object);
 }
 
 static void
 ev_window_class_init (EvWindowClass *ev_window_class)
 {
-       GObjectClass *g_object_class;
+       GObjectClass *g_object_class = G_OBJECT_CLASS (ev_window_class);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (ev_window_class);
 
-       g_object_class = G_OBJECT_CLASS (ev_window_class);
        g_object_class->dispose = ev_window_dispose;
 
-       g_type_class_add_private (g_object_class, sizeof (EvWindowPrivate));
+       widget_class->focus_in_event = ev_window_focus_in_event;
+       widget_class->focus_out_event = ev_window_focus_out_event;
 
+       g_type_class_add_private (g_object_class, sizeof (EvWindowPrivate));
 }
 
 /* Normal items */
@@ -1511,6 +1574,11 @@ static GtkActionEntry entries[] = {
        { "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL,
          N_("Display credits for the document viewer creators"),
          G_CALLBACK (ev_window_cmd_help_about) },
+
+       /* Toolbar-only */
+       { "LeaveFullscreen", EV_STOCK_LEAVE_FULLSCREEN, N_("Leave Fullscreen"), "Escape",
+         N_("Leave fullscreen mode"),
+         G_CALLBACK (ev_window_cmd_leave_fullscreen) }
 };
 
 /* Toggle items */
@@ -1566,7 +1634,7 @@ register_custom_actions (EvWindow *window, GtkActionGroup *group)
 }
 
 static void
-set_short_labels (GtkActionGroup *action_group)
+set_action_properties (GtkActionGroup *action_group)
 {
        GtkAction *action;
 
@@ -1576,6 +1644,79 @@ set_short_labels (GtkActionGroup *action_group)
        g_object_set (action, "short_label", _("Down"), NULL);
        action = gtk_action_group_get_action (action_group, "ViewPageWidth");
        g_object_set (action, "short_label", _("Fit Width"), NULL);
+
+       action = gtk_action_group_get_action (action_group, "LeaveFullscreen");
+       g_object_set (action, "is-important", TRUE, NULL);
+}
+
+static void
+set_chrome_actions (EvWindow *window)
+{
+       EvWindowPrivate *priv = window->priv;
+       GtkActionGroup *action_group = priv->action_group;
+       GtkAction *action;
+
+       action= gtk_action_group_get_action (action_group, "ViewToolbar");
+       g_signal_handlers_block_by_func
+               (action, G_CALLBACK (ev_window_view_toolbar_cb), window);
+       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+                                     (priv->chrome & EV_CHROME_TOOLBAR) != 0);
+       g_signal_handlers_unblock_by_func
+               (action, G_CALLBACK (ev_window_view_toolbar_cb), window);
+
+       action= gtk_action_group_get_action (action_group, "ViewSidebar");
+       g_signal_handlers_block_by_func
+               (action, G_CALLBACK (ev_window_view_sidebar_cb), window);
+       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+                                     (priv->chrome & EV_CHROME_SIDEBAR) != 0);
+       g_signal_handlers_unblock_by_func
+               (action, G_CALLBACK (ev_window_view_sidebar_cb), window);
+
+       action= gtk_action_group_get_action (action_group, "ViewStatusbar");
+       g_signal_handlers_block_by_func
+               (action, G_CALLBACK (ev_window_view_statusbar_cb), window);
+       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+                                     (priv->chrome & EV_CHROME_STATUSBAR) != 0);
+       g_signal_handlers_unblock_by_func
+               (action, G_CALLBACK (ev_window_view_statusbar_cb), window);
+}
+
+static EvChrome
+load_chrome (void)
+{
+       GConfClient *client;
+       GConfValue *value;      
+       EvChrome chrome = EV_CHROME_NORMAL;
+
+       client = gconf_client_get_default ();
+
+       value = gconf_client_get (client, GCONF_CHROME_TOOLBAR, NULL);
+       if (value != NULL) {
+               if (value->type == GCONF_VALUE_BOOL && !gconf_value_get_bool (value)) {
+                       chrome &= ~EV_CHROME_TOOLBAR;
+               }
+               gconf_value_free (value);
+       }
+
+       value = gconf_client_get (client, GCONF_CHROME_SIDEBAR, NULL);
+       if (value != NULL) {
+               if (value->type == GCONF_VALUE_BOOL && !gconf_value_get_bool (value)) {
+                       chrome &= ~EV_CHROME_SIDEBAR;
+               }
+               gconf_value_free (value);
+       }
+
+       value = gconf_client_get (client, GCONF_CHROME_STATUSBAR, NULL);
+       if (value != NULL) {
+               if (value->type == GCONF_VALUE_BOOL && !gconf_value_get_bool (value)) {
+                       chrome &= ~EV_CHROME_STATUSBAR;
+               }
+               gconf_value_free (value);
+       }
+
+       g_object_unref (client);
+
+       return chrome;
 }
 
 static void
@@ -1584,9 +1725,7 @@ ev_window_init (EvWindow *ev_window)
        GtkActionGroup *action_group;
        GtkAccelGroup *accel_group;
        GError *error = NULL;
-       GtkWidget *menubar;
-       GtkWidget *toolbar;
-       GtkWidget *sidebar_widget;
+       GtkWidget *sidebar_widget, *toolbar_dock;
 
        ev_window->priv = EV_WINDOW_GET_PRIVATE (ev_window);
 
@@ -1610,7 +1749,7 @@ ev_window_init (EvWindow *ev_window)
                                            ev_window->priv->page_mode,
                                            G_CALLBACK (ev_window_page_mode_cb),
                                            ev_window);
-       set_short_labels (action_group);
+       set_action_properties (action_group);
        register_custom_actions (ev_window, action_group);
 
        ev_window->priv->ui_manager = gtk_ui_manager_new ();
@@ -1633,15 +1772,39 @@ ev_window_init (EvWindow *ev_window)
                g_error_free (error);
        }
 
-       menubar = gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
-                                            "/MainMenu");
-       gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box), menubar,
+       ev_window->priv->menubar =
+                gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
+                                           "/MainMenu");
+       gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box),
+                           ev_window->priv->menubar,
                            FALSE, FALSE, 0);
 
-       toolbar = gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
-                                            "/ToolBar");
-       gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box), toolbar,
+       /* This sucks, but there is no way to have a draw=no, expand=true separator
+        * in a GtkUIManager-built toolbar. So, just add another toolbar.
+        * See gtk+ bug 166489.
+        */
+       toolbar_dock = ev_window->priv->toolbar_dock = gtk_hbox_new (FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box), toolbar_dock,
                            FALSE, FALSE, 0);
+       gtk_widget_show (toolbar_dock);
+
+       ev_window->priv->toolbar =
+               gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
+                                          "/ToolBar");
+       gtk_box_pack_start (GTK_BOX (toolbar_dock), ev_window->priv->toolbar,
+                           TRUE, TRUE, 0);
+       gtk_widget_show (ev_window->priv->toolbar);
+
+       ev_window->priv->exit_fullscreen_toolbar =
+               gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
+                                          "/LeaveFullscreenToolbar");
+       gtk_box_pack_start (GTK_BOX (toolbar_dock),
+                           ev_window->priv->exit_fullscreen_toolbar,
+                           FALSE, FALSE, 0);
+       gtk_toolbar_set_show_arrow (GTK_TOOLBAR (ev_window->priv->exit_fullscreen_toolbar),
+                                   FALSE);
+       gtk_toolbar_set_style (GTK_TOOLBAR (ev_window->priv->exit_fullscreen_toolbar),
+                              GTK_TOOLBAR_BOTH_HORIZ);
 
        /* Add the main area */
        ev_window->priv->hpaned = gtk_hpaned_new ();
@@ -1650,7 +1813,6 @@ ev_window_init (EvWindow *ev_window)
                            TRUE, TRUE, 0);
 
        ev_window->priv->sidebar = ev_sidebar_new ();
-       gtk_widget_show (ev_window->priv->sidebar);
        gtk_paned_add1 (GTK_PANED (ev_window->priv->hpaned),
                        ev_window->priv->sidebar);
 
@@ -1712,7 +1874,6 @@ ev_window_init (EvWindow *ev_window)
                          ev_window);
 
        ev_window->priv->statusbar = gtk_statusbar_new ();
-       gtk_widget_show (ev_window->priv->statusbar);
        gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
                          ev_window->priv->statusbar,
                          FALSE, TRUE, 0);
@@ -1726,6 +1887,10 @@ ev_window_init (EvWindow *ev_window)
                          ev_window->priv->find_bar,
                          FALSE, TRUE, 0);
 
+       ev_window->priv->chrome = load_chrome ();
+       set_chrome_actions (ev_window);
+       update_chrome_visibility (ev_window);
+
        /* Connect to find bar signals */
        g_signal_connect (ev_window->priv->find_bar,
                          "previous",
@@ -1755,9 +1920,6 @@ ev_window_init (EvWindow *ev_window)
        g_signal_connect (ev_window, "window-state-event",
                          G_CALLBACK (ev_window_state_event_cb),
                          ev_window);
-       g_signal_connect (ev_window, "focus_out_event",
-                         G_CALLBACK (ev_window_focus_out_cb),
-                         ev_window);
 
        /* Give focus to the scrolled window */
        gtk_widget_grab_focus (ev_window->priv->scrolled_window);