+ if (priv->action_group) {
+ g_object_unref (priv->action_group);
+ priv->action_group = NULL;
+ }
+
+ if (priv->view_popup_action_group) {
+ g_object_unref (priv->view_popup_action_group);
+ priv->view_popup_action_group = NULL;
+ }
+
+ if (priv->attachment_popup_action_group) {
+ g_object_unref (priv->attachment_popup_action_group);
+ priv->attachment_popup_action_group = NULL;
+ }
+
+ if (priv->recent_action_group) {
+ g_object_unref (priv->recent_action_group);
+ priv->recent_action_group = NULL;
+ }
+
+ if (priv->recent_manager) {
+ g_signal_handlers_disconnect_by_func (priv->recent_manager,
+ ev_window_setup_recent,
+ window);
+ priv->recent_manager = NULL;
+ }
+
+ priv->recent_ui_id = 0;
+
+ if (priv->page_cache) {
+ g_signal_handlers_disconnect_by_func (priv->page_cache, page_changed_cb, window);
+ priv->page_cache = NULL;
+ }
+
+ if (priv->document) {
+ g_object_unref (priv->document);
+ priv->document = NULL;
+ }
+
+ if (priv->view) {
+ g_object_unref (priv->view);
+ priv->view = NULL;
+ }
+
+ if (priv->password_view) {
+ g_object_unref (priv->password_view);
+ priv->password_view = NULL;
+ }
+
+ if (priv->load_job) {
+ ev_window_clear_load_job (window);
+ }
+
+ if (priv->reload_job) {
+ ev_window_clear_reload_job (window);
+ }
+
+ if (priv->save_job) {
+ ev_window_clear_save_job (window);
+ }
+
+ if (priv->thumbnail_job) {
+ ev_window_clear_thumbnail_job (window);
+ }
+
+ if (priv->find_job) {
+ ev_window_clear_find_job (window);
+ }
+
+ if (priv->local_uri) {
+ ev_window_clear_local_uri (window);
+ priv->local_uri = NULL;
+ }
+
+ ev_window_close_dialogs (window);
+ ev_window_clear_print_job (window);
+
+ if (window->priv->gtk_print_job) {
+ g_object_unref (window->priv->gtk_print_job);
+ window->priv->gtk_print_job = NULL;
+ }
+
+ if (window->priv->printer) {
+ g_object_unref (window->priv->printer);
+ window->priv->printer = NULL;
+ }
+
+ if (window->priv->print_settings) {
+ g_object_unref (window->priv->print_settings);
+ window->priv->print_settings = NULL;
+ }
+
+ if (window->priv->print_page_setup) {
+ g_object_unref (window->priv->print_page_setup);
+ window->priv->print_page_setup = NULL;
+ }
+
+ if (priv->link) {
+ g_object_unref (priv->link);
+ priv->link = NULL;
+ }
+
+ if (priv->image) {
+ g_object_unref (priv->image);
+ priv->image = NULL;
+ }
+
+ if (priv->attach_list) {
+ g_list_foreach (priv->attach_list,
+ (GFunc) g_object_unref,
+ NULL);
+ g_list_free (priv->attach_list);
+ priv->attach_list = NULL;
+ }
+
+ if (priv->find_bar) {
+ g_signal_handlers_disconnect_by_func
+ (window->priv->find_bar,
+ G_CALLBACK (find_bar_close_cb),
+ window);
+ priv->find_bar = NULL;
+ }
+
+ if (priv->uri) {
+ if (priv->unlink_temp_file)
+ ev_window_clear_temp_file (window);
+ g_free (priv->uri);
+ priv->uri = NULL;
+ }
+
+ if (priv->dest) {
+ g_object_unref (priv->dest);
+ priv->dest = NULL;
+ }
+
+ if (priv->history) {
+ g_object_unref (priv->history);
+ priv->history = NULL;
+ }
+
+ if (priv->print_settings_file) {
+ ev_window_clear_print_settings_file (window);
+ priv->print_settings_file = NULL;
+ }
+
+ if (priv->presentation_timeout_id > 0) {
+ g_source_remove (priv->presentation_timeout_id);
+ priv->presentation_timeout_id = 0;
+ }
+
+ G_OBJECT_CLASS (ev_window_parent_class)->dispose (object);
+}
+
+static void
+ev_window_class_init (EvWindowClass *ev_window_class)
+{
+ GObjectClass *g_object_class = G_OBJECT_CLASS (ev_window_class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (ev_window_class);
+
+ g_object_class->dispose = ev_window_dispose;
+ g_object_class->finalize = ev_window_finalize;
+
+ widget_class->screen_changed = ev_window_screen_changed;
+ widget_class->window_state_event = ev_window_state_event;
+
+ g_type_class_add_private (g_object_class, sizeof (EvWindowPrivate));
+}
+
+/* Normal items */
+static const GtkActionEntry entries[] = {
+ { "File", NULL, N_("_File") },
+ { "Edit", NULL, N_("_Edit") },
+ { "View", NULL, N_("_View") },
+ { "Go", NULL, N_("_Go") },
+ { "Help", NULL, N_("_Help") },
+
+ /* File menu */
+ { "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "<control>O",
+ N_("Open an existing document"),
+ G_CALLBACK (ev_window_cmd_file_open) },
+ { "FileOpenCopy", NULL, N_("Op_en a Copy"), "<control>N",
+ N_("Open a copy of the current document in a new window"),
+ G_CALLBACK (ev_window_cmd_file_open_copy) },
+ { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("_Save a Copy..."), "<control>S",
+ N_("Save a copy of the current document"),
+ G_CALLBACK (ev_window_cmd_save_as) },
+ { "FilePrintSetup", NULL, N_("Print Set_up..."), NULL,
+ N_("Setup the page settings for printing"),
+ G_CALLBACK (ev_window_cmd_file_print_setup) },
+ { "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
+ N_("Print this document"),
+ G_CALLBACK (ev_window_cmd_file_print) },
+ { "FileProperties", GTK_STOCK_PROPERTIES, N_("P_roperties"), "<alt>Return", NULL,
+ G_CALLBACK (ev_window_cmd_file_properties) },
+ { "FileCloseWindow", GTK_STOCK_CLOSE, NULL, "<control>W", NULL,
+ G_CALLBACK (ev_window_cmd_file_close_window) },
+
+ /* Edit menu */
+ { "EditCopy", GTK_STOCK_COPY, NULL, "<control>C", NULL,
+ G_CALLBACK (ev_window_cmd_edit_copy) },
+ { "EditSelectAll", GTK_STOCK_SELECT_ALL, N_("Select _All"), "<control>A", NULL,
+ G_CALLBACK (ev_window_cmd_edit_select_all) },
+ { "EditFind", GTK_STOCK_FIND, N_("_Find..."), "<control>F",
+ N_("Find a word or phrase in the document"),
+ G_CALLBACK (ev_window_cmd_edit_find) },
+ { "EditFindNext", NULL, N_("Find Ne_xt"), "<control>G", NULL,
+ G_CALLBACK (ev_window_cmd_edit_find_next) },
+ { "EditFindPrevious", NULL, N_("Find Pre_vious"), "<shift><control>G", NULL,
+ G_CALLBACK (ev_window_cmd_edit_find_previous) },
+ { "EditToolbar", NULL, N_("T_oolbar"), NULL, NULL,
+ G_CALLBACK (ev_window_cmd_edit_toolbar) },
+ { "EditRotateLeft", EV_STOCK_ROTATE_LEFT, N_("Rotate _Left"), "<alt>Left", NULL,
+ G_CALLBACK (ev_window_cmd_edit_rotate_left) },
+ { "EditRotateRight", EV_STOCK_ROTATE_RIGHT, N_("Rotate _Right"), "<alt>Right", NULL,
+ G_CALLBACK (ev_window_cmd_edit_rotate_right) },
+
+ /* View menu */
+ { "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "<control>plus",
+ N_("Enlarge the document"),
+ G_CALLBACK (ev_window_cmd_view_zoom_in) },
+ { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL, "<control>minus",
+ N_("Shrink the document"),
+ G_CALLBACK (ev_window_cmd_view_zoom_out) },
+ { "ViewReload", GTK_STOCK_REFRESH, N_("_Reload"), "<control>R",
+ N_("Reload the document"),
+ G_CALLBACK (ev_window_cmd_view_reload) },
+
+ { "ViewAutoscroll", GTK_STOCK_MEDIA_PLAY, N_("Auto_scroll"), NULL, NULL,
+ G_CALLBACK (ev_window_cmd_view_autoscroll) },
+
+ /* Go menu */
+ { "GoPreviousPage", GTK_STOCK_GO_UP, N_("_Previous Page"), "<control>Page_Up",
+ N_("Go to the previous page"),
+ G_CALLBACK (ev_window_cmd_go_previous_page) },
+ { "GoNextPage", GTK_STOCK_GO_DOWN, N_("_Next Page"), "<control>Page_Down",
+ N_("Go to the next page"),
+ G_CALLBACK (ev_window_cmd_go_next_page) },
+ { "GoFirstPage", GTK_STOCK_GOTO_TOP, N_("_First Page"), "<control>Home",
+ N_("Go to the first page"),
+ G_CALLBACK (ev_window_cmd_go_first_page) },
+ { "GoLastPage", GTK_STOCK_GOTO_BOTTOM, N_("_Last Page"), "<control>End",
+ N_("Go to the last page"),
+ G_CALLBACK (ev_window_cmd_go_last_page) },
+
+ /* Help menu */
+ { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1", NULL,
+ G_CALLBACK (ev_window_cmd_help_contents) },
+
+ { "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL,
+ G_CALLBACK (ev_window_cmd_help_about) },
+
+ /* Toolbar-only */
+ { "LeaveFullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_("Leave Fullscreen"), NULL,
+ N_("Leave fullscreen mode"),
+ G_CALLBACK (ev_window_cmd_leave_fullscreen) },
+ { "StartPresentation", EV_STOCK_RUN_PRESENTATION, N_("Start Presentation"), NULL,
+ N_("Start a presentation"),
+ G_CALLBACK (ev_window_cmd_start_presentation) },
+ { "PreviewPrint", GTK_STOCK_PRINT, N_("Print"), NULL,
+ N_("Print this document"),
+ G_CALLBACK (ev_window_cmd_preview_print) },
+
+ /* Accellerators */
+ { "Escape", NULL, "", "Escape", "",
+ G_CALLBACK (ev_window_cmd_escape) },
+ { "Slash", GTK_STOCK_FIND, NULL, "slash", NULL,
+ G_CALLBACK (ev_window_cmd_edit_find) },
+ { "PageDown", NULL, "", "Page_Down", NULL,
+ G_CALLBACK (ev_window_cmd_scroll_forward) },
+ { "PageUp", NULL, "", "Page_Up", NULL,
+ G_CALLBACK (ev_window_cmd_scroll_backward) },
+ { "Space", NULL, "", "space", NULL,
+ G_CALLBACK (ev_window_cmd_scroll_forward) },
+ { "ShiftSpace", NULL, "", "<shift>space", NULL,
+ G_CALLBACK (ev_window_cmd_scroll_backward) },
+ { "BackSpace", NULL, "", "BackSpace", NULL,
+ G_CALLBACK (ev_window_cmd_scroll_backward) },
+ { "ShiftBackSpace", NULL, "", "<shift>BackSpace", NULL,
+ G_CALLBACK (ev_window_cmd_scroll_forward) },
+ { "Return", NULL, "", "Return", NULL,
+ G_CALLBACK (ev_window_cmd_scroll_forward) },
+ { "ShiftReturn", NULL, "", "<shift>Return", NULL,
+ G_CALLBACK (ev_window_cmd_scroll_backward) },
+ { "Plus", GTK_STOCK_ZOOM_IN, NULL, "plus", NULL,
+ G_CALLBACK (ev_window_cmd_view_zoom_in) },
+ { "CtrlEqual", GTK_STOCK_ZOOM_IN, NULL, "<control>equal", NULL,
+ G_CALLBACK (ev_window_cmd_view_zoom_in) },
+ { "Equal", GTK_STOCK_ZOOM_IN, NULL, "equal", NULL,
+ G_CALLBACK (ev_window_cmd_view_zoom_in) },
+ { "Minus", GTK_STOCK_ZOOM_OUT, NULL, "minus", NULL,
+ G_CALLBACK (ev_window_cmd_view_zoom_out) },
+ { "FocusPageSelector", NULL, "", "<control>l", NULL,
+ G_CALLBACK (ev_window_cmd_focus_page_selector) },
+ { "GoBackwardFast", NULL, "", "<shift>Page_Up", NULL,
+ G_CALLBACK (ev_window_cmd_go_backward) },
+ { "GoForwardFast", NULL, "", "<shift>Page_Down", NULL,
+ G_CALLBACK (ev_window_cmd_go_forward) },
+ { "KpPlus", GTK_STOCK_ZOOM_IN, NULL, "KP_Add", NULL,
+ G_CALLBACK (ev_window_cmd_view_zoom_in) },
+ { "KpMinus", GTK_STOCK_ZOOM_OUT, NULL, "KP_Subtract", NULL,
+ G_CALLBACK (ev_window_cmd_view_zoom_out) },
+ { "CtrlKpPlus", GTK_STOCK_ZOOM_IN, NULL, "<control>KP_Add", NULL,
+ G_CALLBACK (ev_window_cmd_view_zoom_in) },
+ { "CtrlKpMinus", GTK_STOCK_ZOOM_OUT, NULL, "<control>KP_Subtract", NULL,
+ G_CALLBACK (ev_window_cmd_view_zoom_out) },
+ { "CtrlInsert", GTK_STOCK_COPY, NULL, "<control>Insert", NULL,
+ G_CALLBACK (ev_window_cmd_edit_copy) },
+};
+
+/* Toggle items */
+static const GtkToggleActionEntry toggle_entries[] = {
+ /* View Menu */
+ { "ViewToolbar", NULL, N_("_Toolbar"), NULL,
+ N_("Show or hide the toolbar"),
+ G_CALLBACK (ev_window_view_toolbar_cb), TRUE },
+ { "ViewSidebar", GTK_STOCK_INDEX, N_("Side _Pane"), "F9",
+ N_("Show or hide the side pane"),
+ G_CALLBACK (ev_window_view_sidebar_cb), TRUE },
+ { "ViewContinuous", EV_STOCK_VIEW_CONTINUOUS, N_("_Continuous"), NULL,
+ N_("Show the entire document"),
+ G_CALLBACK (ev_window_cmd_continuous), TRUE },
+ { "ViewDual", EV_STOCK_VIEW_DUAL, N_("_Dual"), NULL,
+ N_("Show two pages at once"),
+ G_CALLBACK (ev_window_cmd_dual), FALSE },
+ { "ViewFullscreen", GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
+ N_("Expand the window to fill the screen"),
+ G_CALLBACK (ev_window_cmd_view_fullscreen) },
+ { "ViewPresentation", EV_STOCK_RUN_PRESENTATION, N_("Pre_sentation"), "F5",
+ N_("Run document as a presentation"),
+ G_CALLBACK (ev_window_cmd_view_presentation) },
+ { "ViewBestFit", EV_STOCK_ZOOM_PAGE, N_("_Best Fit"), NULL,
+ N_("Make the current document fill the window"),
+ G_CALLBACK (ev_window_cmd_view_best_fit) },
+ { "ViewPageWidth", EV_STOCK_ZOOM_WIDTH, N_("Fit Page _Width"), NULL,
+ N_("Make the current document fill the window width"),
+ G_CALLBACK (ev_window_cmd_view_page_width) },
+};
+
+/* Popups specific items */
+static const GtkActionEntry view_popup_entries [] = {
+ /* Links */
+ { "OpenLink", GTK_STOCK_OPEN, N_("_Open Link"), NULL,
+ NULL, G_CALLBACK (ev_view_popup_cmd_open_link) },
+ { "GoLink", GTK_STOCK_GO_FORWARD, N_("_Go To"), NULL,
+ NULL, G_CALLBACK (ev_view_popup_cmd_open_link) },
+ { "OpenLinkNewWindow", NULL, N_("Open in New _Window"), NULL,
+ NULL, G_CALLBACK (ev_view_popup_cmd_open_link_new_window) },
+ { "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
+ NULL, G_CALLBACK (ev_view_popup_cmd_copy_link_address) },
+ { "SaveImageAs", NULL, N_("_Save Image As..."), NULL,
+ NULL, G_CALLBACK (ev_view_popup_cmd_save_image_as) },
+ { "CopyImage", NULL, N_("Copy _Image"), NULL,
+ NULL, G_CALLBACK (ev_view_popup_cmd_copy_image) },
+};
+
+static const GtkActionEntry attachment_popup_entries [] = {
+ { "OpenAttachment", GTK_STOCK_OPEN, N_("_Open..."), NULL,
+ NULL, G_CALLBACK (ev_attachment_popup_cmd_open_attachment) },
+ { "SaveAttachmentAs", GTK_STOCK_SAVE_AS, N_("_Save a Copy..."), NULL,
+ NULL, G_CALLBACK (ev_attachment_popup_cmd_save_attachment_as) },
+};
+
+static void
+sidebar_links_link_activated_cb (EvSidebarLinks *sidebar_links, EvLink *link, EvWindow *window)
+{
+ ev_view_handle_link (EV_VIEW (window->priv->view), link);
+}
+
+static void
+activate_link_cb (EvPageAction *page_action, EvLink *link, EvWindow *window)
+{
+ ev_view_handle_link (EV_VIEW (window->priv->view), link);
+ gtk_widget_grab_focus (window->priv->view);
+}
+
+static void
+navigation_action_activate_link_cb (EvNavigationAction *action, EvLink *link, EvWindow *window)
+{
+
+ ev_view_handle_link (EV_VIEW (window->priv->view), link);
+ gtk_widget_grab_focus (window->priv->view);
+}
+
+static void
+register_custom_actions (EvWindow *window, GtkActionGroup *group)
+{
+ GtkAction *action;
+
+ action = g_object_new (EV_TYPE_PAGE_ACTION,
+ "name", PAGE_SELECTOR_ACTION,
+ "label", _("Page"),
+ "tooltip", _("Select Page"),
+ "icon_name", "text-x-generic",
+ "visible_overflown", FALSE,
+ NULL);
+ g_signal_connect (action, "activate_link",
+ G_CALLBACK (activate_link_cb), window);
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EPHY_TYPE_ZOOM_ACTION,
+ "name", ZOOM_CONTROL_ACTION,
+ "label", _("Zoom"),
+ "stock_id", EV_STOCK_ZOOM,
+ "tooltip", _("Adjust the zoom level"),
+ "zoom", 1.0,
+ NULL);
+ g_signal_connect (action, "zoom_to_level",
+ G_CALLBACK (zoom_control_changed_cb), window);
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EV_TYPE_NAVIGATION_ACTION,
+ "name", NAVIGATION_ACTION,
+ "label", _("Navigation"),
+ "is_important", TRUE,
+ "short_label", _("Back"),
+ "stock_id", GTK_STOCK_GO_DOWN,
+ /*translators: this is the history action*/
+ "tooltip", _("Move across visited pages"),
+ NULL);
+ g_signal_connect (action, "activate_link",
+ G_CALLBACK (navigation_action_activate_link_cb), window);
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
+
+ action = g_object_new (EV_TYPE_OPEN_RECENT_ACTION,
+ "name", "FileOpenRecent",
+ "label", _("_Open..."),
+ "tooltip", _("Open an existing document"),
+ "stock_id", GTK_STOCK_OPEN,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (ev_window_cmd_file_open), window);
+ g_signal_connect (action, "item_activated",
+ G_CALLBACK (ev_window_open_recent_action_item_activated),
+ window);
+ gtk_action_group_add_action (group, action);
+ g_object_unref (action);
+}
+
+static void
+set_action_properties (GtkActionGroup *action_group)
+{
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (action_group, "GoPreviousPage");
+ g_object_set (action, "is-important", TRUE, NULL);
+ /*translators: this is the label for toolbar button*/
+ g_object_set (action, "short_label", _("Previous"), 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, "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, "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, "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, "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);
+}
+
+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 gboolean
+view_actions_focus_in_cb (GtkWidget *widget, GdkEventFocus *event, EvWindow *window)
+{
+#ifdef ENABLE_DBUS
+ GObject *keys;
+
+ keys = ev_application_get_media_keys (EV_APP);
+ ev_media_player_keys_focused (EV_MEDIA_PLAYER_KEYS (keys));
+#endif /* ENABLE_DBUS */
+
+ update_chrome_flag (window, EV_CHROME_RAISE_TOOLBAR, FALSE);
+ ev_window_set_action_sensitive (window, "ViewToolbar", TRUE);
+
+ ev_window_set_view_accels_sensitivity (window, TRUE);
+
+ update_chrome_visibility (window);
+
+ return FALSE;
+}
+
+static gboolean
+view_actions_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, EvWindow *window)
+{
+ ev_window_set_view_accels_sensitivity (window, FALSE);
+
+ return 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);
+ }
+}
+
+static gboolean
+window_state_event_cb (EvWindow *window, GdkEventWindowState *event, gpointer dummy)
+{
+ if (!(event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
+ gboolean maximized;
+
+ maximized = event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED;
+ if (!ev_window_is_empty (window))
+ ev_metadata_manager_set_boolean (window->priv->uri, "window_maximized", maximized);