diff options
-rw-r--r-- | shell/ev-window.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c index 8e679ea9..0b0ffc7c 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -635,26 +635,34 @@ ev_window_update_actions (EvWindow *ev_window) } } +static const gchar *view_accels[] = { + "PageDown", + "PageUp", + "Plus", + "Minus", + "KpPlus", + "KpMinus", + "Equal", + "p", + "n", + "FitPage", + "FitWidth" +}; + static void ev_window_set_view_accels_sensitivity (EvWindow *window, gboolean sensitive) { gboolean can_find; + gint i; - can_find = window->priv->document && - EV_IS_DOCUMENT_FIND (window->priv->document); - - if (window->priv->action_group) { - ev_window_set_action_sensitive (window, "PageDown", sensitive); - ev_window_set_action_sensitive (window, "PageUp", sensitive); - ev_window_set_action_sensitive (window, "Plus", sensitive); - ev_window_set_action_sensitive (window, "Minus", sensitive); - ev_window_set_action_sensitive (window, "KpPlus", sensitive); - ev_window_set_action_sensitive (window, "KpMinus", sensitive); - ev_window_set_action_sensitive (window, "Equal", sensitive); - ev_window_set_action_sensitive (window, "p", sensitive); - ev_window_set_action_sensitive (window, "n", sensitive); - ev_window_set_action_sensitive (window, "Slash", sensitive && can_find); - } + if (!window->priv->action_group) + return; + + for (i = 0; i < G_N_ELEMENTS (view_accels); i++) + ev_window_set_action_sensitive (window, view_accels[i], sensitive); + + can_find = window->priv->document && EV_IS_DOCUMENT_FIND (window->priv->document); + ev_window_set_action_sensitive (window, "Slash", sensitive && can_find); } static void |