+static void
+set_action_properties (GtkActionGroup *action_group)
+{
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (action_group, "GoPreviousPage");
+ /*translators: this is the label for toolbar button*/
+ g_object_set (action, "short_label", _("Previous"), NULL);
+ g_object_set (action, "is-important", TRUE, NULL);
+
+ action = gtk_action_group_get_action (action_group, "GoNextPage");
+ g_object_set (action, "is-important", TRUE, NULL);
+ /*translators: this is the label for toolbar button*/
+ g_object_set (action, "short_label", _("Next"), NULL);
+
+ action = gtk_action_group_get_action (action_group, "ViewZoomIn");
+ /*translators: this is the label for toolbar button*/
+ g_object_set (action, "short_label", _("Zoom In"), NULL);
+ action = gtk_action_group_get_action (action_group, "ViewZoomIn");
+
+ action = gtk_action_group_get_action (action_group, "ViewZoomOut");
+ /*translators: this is the label for toolbar button*/
+ g_object_set (action, "short_label", _("Zoom Out"), NULL);
+ action = gtk_action_group_get_action (action_group, "ViewZoomIn");
+
+ action = gtk_action_group_get_action (action_group, "ViewBestFit");
+ /*translators: this is the label for toolbar button*/
+ g_object_set (action, "short_label", _("Best Fit"), NULL);
+ action = gtk_action_group_get_action (action_group, "ViewZoomIn");
+
+ action = gtk_action_group_get_action (action_group, "ViewPageWidth");
+ /*translators: this is the label for toolbar button*/
+ g_object_set (action, "short_label", _("Fit Width"), NULL);
+ action = gtk_action_group_get_action (action_group, "ViewZoomIn");
+
+ 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)
+{
+ EvChrome chrome = EV_CHROME_NORMAL;
+ GConfClient *client;
+ GConfValue *value;
+
+ 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
+sidebar_widget_model_set (EvSidebarLinks *ev_sidebar_links,
+ GParamSpec *pspec,
+ EvWindow *ev_window)
+{
+ GtkTreeModel *model;
+ GtkAction *action;
+
+ g_object_get (G_OBJECT (ev_sidebar_links),
+ "model", &model,
+ NULL);
+
+ action = gtk_action_group_get_action (ev_window->priv->action_group, PAGE_SELECTOR_ACTION);
+ ev_page_action_set_model (EV_PAGE_ACTION (action), model);
+ g_object_unref (model);
+}
+
+
+static void
+set_view_actions_sensitivity (EvWindow *window, gboolean sensitive)
+{
+ if (window->priv->action_group) {
+ set_action_sensitive (window, "PageDown", sensitive);
+ set_action_sensitive (window, "PageUp", sensitive);
+ set_action_sensitive (window, "Space", sensitive);
+ set_action_sensitive (window, "ShiftSpace", sensitive);
+ set_action_sensitive (window, "BackSpace", sensitive);
+ set_action_sensitive (window, "ShiftBackSpace", sensitive);
+ set_action_sensitive (window, "Slash", sensitive);
+ set_action_sensitive (window, "Plus", sensitive);
+ set_action_sensitive (window, "Minus", sensitive);
+ }
+}
+
+static void
+view_actions_focus_in_cb (GtkWidget *widget, GdkEventFocus *event, EvWindow *window)
+{
+ update_chrome_flag (window, EV_CHROME_RAISE_TOOLBAR, NULL, FALSE);
+ set_action_sensitive (window, "ViewToolbar", TRUE);
+
+ set_view_actions_sensitivity (window, TRUE);
+}
+
+static void
+view_actions_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, EvWindow *window)
+{
+ set_view_actions_sensitivity (window, FALSE);
+}
+
+static void
+sidebar_page_main_widget_update_cb (GObject *ev_sidebar_page,
+ GParamSpec *pspec,
+ EvWindow *ev_window)
+{
+ GtkWidget *widget;
+
+ g_object_get (ev_sidebar_page, "main_widget", &widget, NULL);
+
+ if (widget != NULL) {
+ g_signal_connect_object (widget, "focus_in_event",
+ G_CALLBACK (view_actions_focus_in_cb),
+ ev_window, 0);
+ g_signal_connect_object (widget, "focus_out_event",
+ G_CALLBACK (view_actions_focus_out_cb),
+ ev_window, 0);
+ g_object_unref (widget);
+ }