]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-dualscreen.c
[dualscreen] in short "Disziplin ist Macht."
[evince.git] / shell / ev-dualscreen.c
index 98e9322cd71c98aaa983ec6a72a6e7615a306777..208fe349fc1084ccae9d0c39b3b7b56a96083547 100644 (file)
 #include "ev-utils.h"
 #include "ev-sidebar.h"
 #include "ev-sidebar-thumbnails.h"
+#include "ev-presentation-timer.h"
 
 struct _EvDSCWindowPrivate {
        GtkWidget       *main_box;
        GtkWidget       *menubar;
        GtkWidget       *sidebar;
        GtkWidget       *notesview;
+       GtkWidget       *timer;
        EvDocumentModel *model;
        EvDocumentModel *notes_model;
        EvDocument      *presentation_document;
@@ -190,39 +192,18 @@ ev_dscwindow_get_control (void)
 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_dscwindow->priv->moveback_monitor = work_monitor;
-               gtk_window_maximize (GTK_WINDOW (ev_dscwindow));
-       }
-}
-
-static gboolean
-ev_dscwindow_notes_clicked (GtkWidget *widget, GdkEvent *event,
-       EvDSCWindow *self)
-{
-       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);
-       }
-       return FALSE;
+       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_dscwindow->priv->moveback_monitor = work_monitor;
+       gtk_window_maximize (GTK_WINDOW (ev_dscwindow));
 }
 
 void
@@ -235,8 +216,10 @@ 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_page(ev_dscwindow->priv->model, ev_view_presentation_get_current_page (pview));
+       /*signals*/
        g_signal_connect_swapped (ev_dscwindow->priv->presentation_view,
                                  "destroy",
                                  G_CALLBACK (gtk_widget_destroy),
@@ -249,6 +232,7 @@ ev_dscwindow_set_presentation (EvDSCWindow *ev_dscwindow,
                          "notify::page",
                          G_CALLBACK (ev_dscwindow_presentation_page_changed_cb),
                          ev_dscwindow);
+
        ev_dscwindow_window_placement (ev_dscwindow);
 }
 
@@ -331,22 +315,16 @@ ev_dscwindow_init (EvDSCWindow *ev_dscwindow)
                G_CALLBACK (ev_dscwindow_sidebar_visibility), ev_dscwindow->priv->sidebar);
 
        gtk_container_add (GTK_CONTAINER (expander), toolbar);
-       gtk_box_pack_end (GTK_BOX (vbox), expander, FALSE, TRUE, 0);
-
-//     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, this part is broken...*/
-       /*g_signal_connect (ev_dscwindow->priv->notesview, "button-press-event",
-                         G_CALLBACK (ev_dscwindow_notes_clicked), ev_dscwindow);*/
 
+       GtkWidget *hbox = gtk_hbox_new (FALSE,0);
+       gtk_box_pack_start (GTK_BOX (hbox), expander, FALSE, TRUE, 0);
+       ev_dscwindow->priv->timer = ev_presentation_timer_new ();
+       gtk_box_pack_end (GTK_BOX (hbox), ev_dscwindow->priv->timer, TRUE, TRUE, 0);
+       gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
        gtk_widget_show_all(vbox);
        gtk_container_add (GTK_CONTAINER (ev_dscwindow), vbox);
 }
 
-
 static void
 ev_dscwindow_dispose (GObject *obj)
 {
@@ -369,7 +347,6 @@ ev_dscwindow_dispose (GObject *obj)
                priv->overview = NULL;
        }*/
 
-
        G_OBJECT_CLASS (ev_dscwindow_parent_class)->dispose (obj);
 }