+/**
+ * ev_dscwindow_get_control: Get the control instance.
+ *
+ * If there is none, create one.
+ *
+ * Returns: control instance
+ **/
+EvDSCWindow *
+ev_dscwindow_get_control (void)
+{
+ static EvDSCWindow * control = NULL;
+
+ if (!control || !EV_IS_DSCWINDOW (control)) {
+ control = EV_DSCWINDOW (g_object_new (EV_TYPE_DSCWINDOW, NULL));
+ }
+
+ return control;
+}
+
+/*TODO: Fix me!*/
+static void
+ev_dscwindow_window_placement (EvDSCWindow *ev_dscwindow)
+{
+ gint num_monitors = get_num_monitors (GTK_WINDOW (ev_dscwindow));
+ //if (num_monitors == 2) {
+ GtkWindow * presentation_window = GTK_WINDOW (ev_dscwindow->priv->presentation_window);
+ GdkScreen * screen = gtk_window_get_screen (presentation_window);
+ gint work_monitor = gdk_screen_get_monitor_at_window (screen,
+ gtk_widget_get_window (GTK_WIDGET (presentation_window)));
+ gint presentation_monitor = (work_monitor + 1) % 2;
+ GdkRectangle coords;
+ gdk_screen_get_monitor_geometry (screen, presentation_monitor,
+ &coords);
+
+ gtk_window_move (presentation_window, coords.x, coords.y);
+ //ev_window_run_presentation (ev_dscwindow->priv->presentation_window);
+ ev_dscwindow->priv->moveback_monitor = work_monitor;
+ gtk_window_maximize (GTK_WINDOW (ev_dscwindow));
+ //}
+}
+/**
+ * ev_dscwindow_page_changed_cb: Callback to change page on all views
+ *
+ **/
+static void
+ev_dscwindow_page_changed_cb (EvDocumentModel *model,
+ GParamSpec *pspec,
+ EvDSCWindow *ev_dscwindow)
+{
+ gint page = ev_document_model_get_page (model);
+ if(page != ev_view_presentation_get_current_page (ev_dscwindow->priv->presentation_view))
+ ev_view_presentation_set_page (EV_VIEW_PRESENTATION(ev_dscwindow->priv->presentation_view), page);
+}
+static void
+ev_dscwindow_presentation_page_changed_cb (EvViewPresentation *pview,
+ GParamSpec *pspec,
+ EvDSCWindow *ev_dscwindow)
+{
+ gint page = ev_view_presentation_get_current_page (pview);
+ ev_document_model_set_page (ev_dscwindow->priv->model, page);
+}
+
+/**
+ * ev_dscwindow_set_presentation: Set presentation document
+ * @presentation_window: Main window we can reuse for presentation
+ **/
+void
+ev_dscwindow_set_presentation (EvDSCWindow *ev_dscwindow,
+ EvWindow *presentation_window, EvDocument *document, EvViewPresentation *pview)
+{
+ if (!EV_IS_WINDOW (presentation_window))
+ return;
+
+ ev_dscwindow->priv->presentation_window = GTK_WIDGET(presentation_window);
+ ev_dscwindow->priv->presentation_document = document;
+ ev_dscwindow->priv->presentation_view = EV_VIEW_PRESENTATION(pview);
+ ev_document_model_set_document(ev_dscwindow->priv->model,
+ document);
+ g_signal_connect (G_OBJECT(ev_dscwindow->priv->presentation_view),
+ "notify::page",
+ G_CALLBACK (ev_dscwindow_presentation_page_changed_cb),
+ ev_dscwindow);
+ ev_dscwindow_window_placement (ev_dscwindow);
+}
+