- if (!self || !EV_IS_DSCWINDOW (self) || !event)
- return FALSE;
- gint page = ev_document_model_get_page (self->priv->model);
-
- if (event->type == GDK_2BUTTON_PRESS && ((GdkEventButton *)event)->button == 1) {
- ev_dscwindow_notes_interaction (NULL, self);
- } else if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 1) {
- ev_document_model_set_page (self->priv->model, page+1);
- } else if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 3) {
- ev_document_model_set_page (self->priv->model, page-1);
+ 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 ();
+ ev_document_model_set_document (ev_dscwindow->priv->notes_model, ev_dscwindow->priv->notes_document);
+ ev_document_model_set_continuous (ev_dscwindow->priv->notes_model, FALSE);
+ ev_document_model_set_dual_page (ev_dscwindow->priv->notes_model, FALSE);
+ ev_document_model_set_sizing_mode (ev_dscwindow->priv->notes_model, EV_SIZING_BEST_FIT);
+ ev_document_model_set_page (ev_dscwindow->priv->notes_model,
+ ev_document_model_get_page (ev_dscwindow->priv->model));
+ 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;
+}
+
+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));