EvDocument *notes_document;
GtkWidget *presentation_window;
- GtkWidget *overview_scrolled_window;
- GtkWidget *notesview_scrolled_window;
+ GtkWidget *overview_scrolled_window;
+ GtkWidget *notesview_scrolled_window;
EvViewPresentation *presentation_view;
gint moveback_monitor;
return TRUE;
}
+/**
+ * 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);
+ 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);
+ }
+}
+static void
+ev_dscwindow_presentation_page_changed_cb (EvViewPresentation *pview,
+ GParamSpec *pspec,
+ EvDSCWindow *ev_dscwindow)
+{
+ gint page = ev_view_presentation_get_current_page (pview);
+ 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);
+}
+
/**
* ev_dscwindow_notes_interaction: User wants to load a different file as notes.
**/
static gboolean
-ev_dscwindow_notes_interaction (GtkContainer *container, EvDSCWindow *self)
+ev_dscwindow_notes_interaction (GtkContainer *container, EvDSCWindow *ev_dscwindow)
{
-/*
-+ EvDSCWindowPrivate *priv = EV_DSCWINDOW_GET_PRIVATE (self);
-+ GtkWidget *dialog;
-+
-+ dialog = gtk_file_chooser_dialog_new (
-+ _("Open Document"),
-+ GTK_WINDOW (self),
-+ GTK_FILE_CHOOSER_ACTION_OPEN,
-+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
-+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-+ NULL);
-+
-+ ev_document_factory_add_filters (dialog, NULL);
-+ gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), FALSE);
-+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
-+
-+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
-+ {
-+ char * uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
-+ GError * error = NULL;
-+ ev_view_set_loading (EV_VIEW (priv->notesview), TRUE);
-+
-+ if (priv->notesdocument) {
-+ ev_document_load (priv->notesdocument, uri, &error);
-+ } else {
-+ priv->notesdocument = ev_document_factory_get_document (uri,
-+ &error);
-+ }
-+ g_free (uri);
-+ if (error == NULL){
-+ ev_view_set_document (EV_VIEW (priv->notesview),
-+ priv->notesdocument);
-+ /* TODO: go to the same page that is open at the moment, or
-+ * move the presentation to the beginning. *//*
-+ }
-+ }
-+ gtk_widget_destroy (dialog);
-*/
+ GtkWidget *dialog;
+
+ dialog = gtk_file_chooser_dialog_new (
+ _("Open Document"),
+ GTK_WINDOW (ev_dscwindow),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ ev_document_factory_add_filters (dialog, NULL);
+ gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), FALSE);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ char * uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
+ GError * error = NULL;
+ ev_view_set_loading (EV_VIEW (ev_dscwindow->priv->notesview), TRUE);
+
+ if (ev_dscwindow->priv->notes_document) {
+ ev_document_load (ev_dscwindow->priv->notes_document, uri, &error);
+ } else {
+ ev_dscwindow->priv->notes_document = ev_document_factory_get_document (uri,
+ &error);
+ }
+ g_free (uri);
+ if (error == NULL){
+ ev_dscwindow->priv->notes_model = ev_document_model_new_with_document (ev_dscwindow->priv->notes_document);
+ ev_view_set_model(EV_VIEW(ev_dscwindow->priv->notesview),
+ ev_dscwindow->priv->notes_model);
+ g_signal_connect (G_OBJECT(ev_dscwindow->priv->notes_model),
+ "notify::page",
+ G_CALLBACK (ev_dscwindow_page_changed_cb),
+ ev_dscwindow);
+ }
+ }
+ gtk_widget_destroy (dialog);
+
return TRUE;
}
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) {
+ 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,
&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);
+ }
}
static gboolean
GtkToolItem* b_close = gtk_tool_button_new (NULL, _("End presentation"));
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (b_close), "view-restore");
gtk_toolbar_insert (GTK_TOOLBAR (t), b_close, -1);
- /*TODO: rework close*/
+
g_signal_connect (b_close, "clicked",
G_CALLBACK (ev_dscwindow_end), NULL);
g_object_ref (ev_dscwindow->priv->notesview);
gtk_container_add (GTK_CONTAINER (ev_dscwindow->priv->notesview_scrolled_window),
ev_dscwindow->priv->notesview);
- ev_view_set_model (EV_VIEW (ev_dscwindow->priv->notesview), ev_dscwindow->priv->model);
+ ev_dscwindow->priv->notes_model = ev_dscwindow->priv->model;
+ ev_view_set_model (EV_VIEW (ev_dscwindow->priv->notesview), ev_dscwindow->priv->notes_model);
gtk_widget_show_all (h);
gtk_container_add (GTK_CONTAINER (ev_dscwindow), h);