-/*
-+ if (!EV_IS_DSCWINDOW (self))
-+ return FALSE;
-+
-+ EvDSCWindowPrivate *priv = EV_DSCWINDOW_GET_PRIVATE (self);
-+
-+ gint num_monitors = get_num_monitors (GTK_WINDOW (self));
-+
-+ if (num_monitors == 2) {
-+ GtkWindow * presentation_window = GTK_WINDOW (priv->presentation_window);
-+ GdkScreen * screen = gtk_window_get_screen (presentation_window);
-+
-+ gint monitor_1 = gdk_screen_get_monitor_at_window (screen,
-+ GTK_WIDGET (presentation_window)->window);
-+
-+ gint monitor_2 = (monitor_1 + 1) % 2;
-+
-+ GdkRectangle coords;
-+ gdk_screen_get_monitor_geometry (screen, monitor_2, &coords);
-+ ev_window_stop_presentation (priv->presentation_window);
-+ gtk_window_move (presentation_window, coords.x, coords.y);
-+ ev_window_run_presentation (priv->presentation_window);
-+ priv->moveback_monitor = monitor_1;
-+
-+ gdk_screen_get_monitor_geometry (screen, monitor_1, &coords);
-+ gtk_window_unmaximize (GTK_WINDOW (self));
-+ gtk_window_move (GTK_WINDOW (self), coords.x, coords.y);
-+ gtk_window_maximize (GTK_WINDOW (self));
-+ }*/
- return TRUE;
+ if (!EV_IS_DSCWINDOW (ev_dscwindow))
+ return FALSE;
+
+ gint num_monitors = get_num_monitors (GTK_WINDOW (ev_dscwindow));
+ if (num_monitors == 2) {
+ GdkRectangle coords;
+ GdkScreen *screen = gtk_window_get_screen (GTK_WINDOW (ev_dscwindow));
+ gint presentation_monitor = ev_dscwindow->priv->presentation_monitor;
+ gint control_monitor = (presentation_monitor + 1) % 2;
+
+ gdk_screen_get_monitor_geometry (screen, control_monitor, &coords);
+ gtk_window_unmaximize (GTK_WINDOW (ev_dscwindow));
+ gtk_window_move (GTK_WINDOW (ev_dscwindow), coords.x, coords.y);
+ gtk_window_maximize (GTK_WINDOW (ev_dscwindow));
+
+ gdk_screen_get_monitor_geometry (screen, presentation_monitor,&coords);
+ gtk_window_move (GTK_WINDOW (ev_dscwindow->priv->presentation_window), coords.x, coords.y);
+
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+static void
+ev_dscwindow_switch_monitors (EvDSCWindow *ev_dscwindow)
+{
+ gint num_monitors = get_num_monitors (GTK_WINDOW (ev_dscwindow));
+ if (num_monitors == 2) {
+ ev_dscwindow->priv->presentation_monitor = (ev_dscwindow->priv->presentation_monitor + 1) % 2;
+ if (ev_dscwindow->priv->metadata)
+ ev_metadata_set_int (ev_dscwindow->priv->metadata,
+ "presentation-monitor", ev_dscwindow->priv->presentation_monitor);
+ }
+ ev_dscwindow_windows_placement (ev_dscwindow);
+}
+
+static void
+ev_dscwindow_sidebar_visibility_cb (GtkWidget *sidebar)
+{
+ gtk_widget_set_visible (sidebar, !(gtk_widget_get_visible(sidebar)));
+}
+
+static void
+ev_dscwindow_set_page (EvDSCWindow *ev_dscwindow, gint page)
+{
+ if((ev_dscwindow->priv->page == 0) && (page == 1))
+ ev_presentation_timer_start (EV_PRESENTATION_TIMER (ev_dscwindow->priv->timer));
+ if(!(ev_dscwindow->priv->page == page)) {
+ ev_dscwindow->priv->page = page;
+ if(ev_document_model_get_page (ev_dscwindow->priv->model) != page)
+ ev_document_model_set_page(ev_dscwindow->priv->model, page);
+ if(ev_document_model_get_page (ev_dscwindow->priv->notes_model) != page)
+ ev_document_model_set_page(ev_dscwindow->priv->notes_model, page);
+ if(ev_view_presentation_get_current_page (EV_VIEW_PRESENTATION(ev_dscwindow->priv->presentation_view)) != page);
+ ev_view_presentation_set_page (EV_VIEW_PRESENTATION(ev_dscwindow->priv->presentation_view), page);
+ ev_presentation_timer_set_page (EV_PRESENTATION_TIMER(ev_dscwindow->priv->timer), page);
+ }
+}
+
+static void
+ev_dscwindow_presentation_time_cb (EvDSCWindow *ev_dscwindow)
+{
+ gint time = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ev_dscwindow->priv->spinner));
+ ev_presentation_timer_set_time (EV_PRESENTATION_TIMER (ev_dscwindow->priv->timer),time);
+ if (ev_dscwindow->priv->metadata)
+ ev_metadata_set_double (ev_dscwindow->priv->metadata, "presentation-time", time);
+}
+
+static void
+ev_dscwindow_page_changed_cb (EvDocumentModel *model,
+ GParamSpec *pspec,
+ EvDSCWindow *ev_dscwindow)
+{
+ ev_dscwindow_set_page (ev_dscwindow, ev_document_model_get_page (model));
+}
+
+static void
+ev_dscwindow_presentation_page_changed_cb (EvViewPresentation *pview,
+ GParamSpec *pspec,
+ EvDSCWindow *ev_dscwindow)
+{
+ ev_dscwindow_set_page (ev_dscwindow, ev_view_presentation_get_current_page (pview));