]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-window.c
Make rotate menu entries unsensitive if there is not a document open
[evince.git] / shell / ev-window.c
index 07aaa37dd8044cc0d9cccd7f32ab99934b2384a7..836bc918a4b4e100e77e392387d6b88a8be04df0 100644 (file)
@@ -213,13 +213,18 @@ update_action_sensitivity (EvWindow *ev_window)
        int n_pages = 0, page = -1;
        gboolean ok_to_print = TRUE;
        gboolean ok_to_copy = TRUE;
+       gboolean has_properties = TRUE;
 
        view = EV_VIEW (ev_window->priv->view);
+
        document = ev_window->priv->document;
+
        if (document)
                info = ev_page_cache_get_info (ev_window->priv->page_cache);
+
        page_mode = ev_window->priv->page_mode;
        has_document = document != NULL;
+
        if (has_document && ev_window->priv->page_cache) {
                page = ev_page_cache_get_current_page (ev_window->priv->page_cache);
                n_pages = ev_page_cache_get_n_pages (ev_window->priv->page_cache);
@@ -231,11 +236,15 @@ update_action_sensitivity (EvWindow *ev_window)
                ok_to_copy = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_COPY);
        }
 
+       if (!info || info->fields_mask == 0) {
+               has_properties = FALSE;
+       }
+
        /* File menu */
        /* "FileOpen": always sensitive */
        set_action_sensitive (ev_window, "FileSaveAs", has_document && ok_to_copy);
        set_action_sensitive (ev_window, "FilePrint", has_pages && ok_to_print);
-       set_action_sensitive (ev_window, "FileProperties", has_document);
+       set_action_sensitive (ev_window, "FileProperties", has_document && has_properties);
        /* "FileCloseWindow": always sensitive */
 
         /* Edit menu */
@@ -248,6 +257,8 @@ update_action_sensitivity (EvWindow *ev_window)
                              has_pages && EV_IS_DOCUMENT_FIND (document));
        set_action_sensitive (ev_window, "EditFindNext",
                              ev_view_can_find_next (view));
+       set_action_sensitive (ev_window, "EditRotateLeft", has_document);
+       set_action_sensitive (ev_window, "EditRotateRight", has_document);
 
         /* View menu */
        set_action_sensitive (ev_window, "ViewContinuous", has_pages);
@@ -2174,7 +2185,7 @@ ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
                "name", _("Evince"),
                "version", VERSION,
                "copyright",
-               _("\xc2\xa9 1996-2004 The Evince authors"),
+               _("\xc2\xa9 1996-2005 The Evince authors"),
                "license", license_trans,
                "website", "http://www.gnome.org/projects/evince",
                "comments", comments,
@@ -2216,17 +2227,18 @@ ev_window_sidebar_visibility_changed_cb (EvSidebar *ev_sidebar, GParamSpec *pspe
                                         EvWindow   *ev_window)
 {
        GtkAction *action;
-       gboolean visible, fullscreen;
+       gboolean visible, fullscreen_mode;
+
+
+       fullscreen_mode = ev_view_get_presentation (EV_VIEW (ev_window->priv->view)) ||
+                              ev_view_get_fullscreen (EV_VIEW (ev_window->priv->view));
 
-       g_object_get (ev_window->priv->view,
-                     "fullscreen", &fullscreen,
-                     NULL);
        visible = GTK_WIDGET_VISIBLE (ev_sidebar);
 
        /* In fullscreen mode the sidebar is not visible,
         * but we don't want to update the chrome
         */
-       if (fullscreen)
+       if (fullscreen_mode)
                return;
        
        action = gtk_action_group_get_action (ev_window->priv->action_group, "ViewSidebar");