]> www.fi.muni.cz Git - evince.git/commitdiff
[dualscreen] bugfixes(set_presentation), cleanup
authorxbezdick <255993@mail.muni.cz>
Tue, 12 Apr 2011 14:01:29 +0000 (16:01 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 Jun 2011 11:09:21 +0000 (13:09 +0200)
shell/ev-dualscreen.c

index ad6590707bf9eb5fd4fc520fa865d5c855722724..ee4cb7c1af8a8dbbed3de33d1f21e887b0bb4aaa 100644 (file)
@@ -164,7 +164,13 @@ ev_dscwindow_notes_interaction (GtkContainer *container, EvDSCWindow *ev_dscwind
                }
                g_free (uri);
                if (error == NULL){
-                       ev_dscwindow->priv->notes_model = ev_document_model_new_with_document (ev_dscwindow->priv->notes_document);
+                       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),
@@ -249,12 +255,16 @@ ev_dscwindow_set_presentation (EvDSCWindow *ev_dscwindow,
        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);
+       ev_document_model_set_document(ev_dscwindow->priv->model, document);
+       ev_document_model_set_page(ev_dscwindow->priv->model, ev_view_presentation_get_current_page (pview));
        g_signal_connect_swapped (ev_dscwindow->priv->presentation_view,
                                  "destroy",
                                  G_CALLBACK (gtk_widget_destroy),
                                  ev_dscwindow);
+       g_signal_connect (G_OBJECT(ev_dscwindow->priv->model),
+                         "notify::page",
+                         G_CALLBACK (ev_dscwindow_page_changed_cb),
+                         ev_dscwindow);
        g_signal_connect (G_OBJECT(ev_dscwindow->priv->presentation_view),
                          "notify::page",
                          G_CALLBACK (ev_dscwindow_presentation_page_changed_cb),
@@ -282,68 +292,66 @@ ev_dscwindow_end (GtkWidget *widget, GdkEvent *event)
 static void
 ev_dscwindow_init (EvDSCWindow *ev_dscwindow)
 {
+       /*TODO - cleanup!!*/
+
        ev_dscwindow->priv = EV_DSCWINDOW_GET_PRIVATE (ev_dscwindow);
        ev_dscwindow->priv->moveback_monitor = -1;
        ev_dscwindow->priv->notes_document = NULL;
 
        gtk_window_set_title (GTK_WINDOW (ev_dscwindow), _("Presentation Control"));
 
-       GtkWidget *h = gtk_hpaned_new ();
-       GtkWidget *v = gtk_vbox_new (FALSE, 0);
+       GtkWidget *hpaned = gtk_hpaned_new ();
+       GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
 
        ev_dscwindow->priv->model = ev_document_model_new ();
-       g_signal_connect (G_OBJECT(ev_dscwindow->priv->model),
-                         "notify::page",
-                         G_CALLBACK (ev_dscwindow_page_changed_cb),
-                         ev_dscwindow);
+
        ev_dscwindow->priv->sidebar = ev_sidebar_new ();
        ev_sidebar_set_model (EV_SIDEBAR (ev_dscwindow->priv->sidebar),
                              ev_dscwindow->priv->model);
-       gtk_box_pack_start (GTK_BOX (v), ev_dscwindow->priv->sidebar, TRUE , TRUE, 0);
-       gtk_widget_show (ev_dscwindow->priv->sidebar);
-
        GtkWidget *sidebar_widget;
        sidebar_widget = ev_sidebar_thumbnails_new ();
-
        gtk_widget_show (sidebar_widget);
        ev_sidebar_add_page (EV_SIDEBAR (ev_dscwindow->priv->sidebar),
                             sidebar_widget);
 
+       gtk_box_pack_start (GTK_BOX (vbox), ev_dscwindow->priv->sidebar, TRUE, TRUE, 0);
+       gtk_widget_show (ev_dscwindow->priv->sidebar);
+
        ev_document_model_set_continuous (ev_dscwindow->priv->model, FALSE);
        ev_document_model_set_dual_page (ev_dscwindow->priv->model, FALSE);
        ev_document_model_set_sizing_mode (ev_dscwindow->priv->model, EV_SIZING_BEST_FIT);
 
-       GtkWidget *e = gtk_expander_new (_("Expensive features"));
-       gtk_expander_set_expanded (GTK_EXPANDER (e), TRUE);
+       GtkWidget *expander = gtk_expander_new (_("Expensive features"));
+       gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
 
-       GtkWidget *t = gtk_toolbar_new ();
+       GtkWidget *toolbar = gtk_toolbar_new ();
 
        GtkToolItem* b_switch = gtk_tool_button_new (NULL, _("Switch monitors"));
        gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (b_switch), "object-flip-horizontal");
-       gtk_toolbar_insert (GTK_TOOLBAR (t), b_switch, -1);
+       gtk_toolbar_insert (GTK_TOOLBAR (toolbar), b_switch, -1);
        g_signal_connect (b_switch, "clicked",
                G_CALLBACK (ev_dscwindow_switch_monitors), ev_dscwindow);
 
-       GtkToolItem* b_notes = gtk_tool_button_new (NULL, _("Load notes ..."));
-       gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (b_notes), "object-flip-horizontal");
-       gtk_toolbar_insert (GTK_TOOLBAR (t), b_notes, -1);
+       GtkToolItem* b_notes = gtk_tool_button_new_from_stock (GTK_STOCK_OPEN);
+       gtk_tool_button_set_label (GTK_TOOL_BUTTON(b_notes), _("Load notes..."));
+       gtk_toolbar_insert (GTK_TOOLBAR (toolbar), b_notes, -1);
        g_signal_connect (b_notes, "clicked",
                G_CALLBACK (ev_dscwindow_notes_interaction), ev_dscwindow);
 
        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);
+       gtk_toolbar_insert (GTK_TOOLBAR (toolbar), b_close, -1);
 
        g_signal_connect (b_close, "clicked",
                G_CALLBACK (ev_dscwindow_end), NULL);
 
-       gtk_container_add (GTK_CONTAINER (e), t);
-       gtk_box_pack_end (GTK_BOX (v), e, FALSE, TRUE, 0);
-       gtk_paned_add1 (GTK_PANED (h), v);
+       gtk_container_add (GTK_CONTAINER (expander), toolbar);
+       gtk_box_pack_end (GTK_BOX (vbox), expander, FALSE, TRUE, 0);
+       gtk_paned_add1 (GTK_PANED (hpaned), vbox);
 
        ev_dscwindow->priv->notesview_scrolled_window = GTK_WIDGET (g_object_new (
                GTK_TYPE_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, NULL));
-       gtk_paned_add2 (GTK_PANED (h), ev_dscwindow->priv->notesview_scrolled_window);
+       gtk_paned_add2 (GTK_PANED (hpaned), ev_dscwindow->priv->notesview_scrolled_window);
 
        ev_dscwindow->priv->notesview = ev_view_new ();
        g_object_ref (ev_dscwindow->priv->notesview);
@@ -351,17 +359,17 @@ ev_dscwindow_init (EvDSCWindow *ev_dscwindow)
                ev_dscwindow->priv->notesview);
        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);
+       gtk_widget_show_all (hpaned);
+       gtk_container_add (GTK_CONTAINER (ev_dscwindow), hpaned);
 
        gtk_drag_dest_unset (GTK_WIDGET (ev_dscwindow->priv->notesview));
        gtk_drag_dest_unset (GTK_WIDGET (ev_dscwindow->priv->sidebar));
 
        gint click = GDK_BUTTON1_MOTION_MASK | GDK_KEY_PRESS_MASK;
        gtk_widget_add_events (GTK_WIDGET (ev_dscwindow->priv->sidebar), click);
-       /* TODO: actions*/
-       g_signal_connect (ev_dscwindow->priv->notesview, "button-press-event",
-                         G_CALLBACK (ev_dscwindow_notes_clicked), ev_dscwindow);
+       /* TODO: actions, this part is broken...*/
+       /*g_signal_connect (ev_dscwindow->priv->notesview, "button-press-event",
+                         G_CALLBACK (ev_dscwindow_notes_clicked), ev_dscwindow);*/
 }