]> www.fi.muni.cz Git - evince.git/commitdiff
[sualscreen] [presentation] work in progress
authorLukáš Bezdička <255993@mail.muni.cz>
Thu, 21 Apr 2011 17:02:09 +0000 (19:02 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 Jun 2011 11:09:21 +0000 (13:09 +0200)
shell/ev-dualscreen.c
shell/ev-window.c

index ee4cb7c1af8a8dbbed3de33d1f21e887b0bb4aaa..bdf695ff598127a923ec7a749be8392a61da0e73 100644 (file)
@@ -58,21 +58,12 @@ struct _EvDSCWindowPrivate {
 #define EV_DSCWINDOW_GET_PRIVATE(object) \
        (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_DSCWINDOW, EvDSCWindowPrivate))
 #define PAGE_CACHE_SIZE 52428800 /* 50MB */
-#define SIDEBAR_DEFAULT_SIZE    132
-
 
 G_DEFINE_TYPE (EvDSCWindow, ev_dscwindow, GTK_TYPE_WINDOW)
 
-/**
- * ev_dscwindow_switch_monitors: Bring the presentation window and the control window each on the other monitor.
- *
- * @widget: Callback widget
- * @self: EvDSCWindow
- **/
 static gboolean
 ev_dscwindow_switch_monitors (GtkWidget *widget, EvDSCWindow *ev_dscwindow)
 {
-
        if (!EV_IS_DSCWINDOW (ev_dscwindow))
                return FALSE;
 
@@ -100,10 +91,12 @@ ev_dscwindow_switch_monitors (GtkWidget *widget, EvDSCWindow *ev_dscwindow)
        return TRUE;
 }
 
-/**
- * ev_dscwindow_page_changed_cb: Callback to change page on all views
- *
- **/
+static void
+ev_dscwindow_sidebar_visibility(GtkWidget *sidebar)
+{
+       gtk_widget_set_visible (sidebar, !(gtk_widget_get_visible(sidebar)));
+}
+
 static void
 ev_dscwindow_page_changed_cb (EvDocumentModel *model,
                           GParamSpec      *pspec,
@@ -118,6 +111,7 @@ ev_dscwindow_page_changed_cb (EvDocumentModel *model,
                ev_document_model_set_page(ev_dscwindow->priv->notes_model, page);
        }
 }
+
 static void
 ev_dscwindow_presentation_page_changed_cb (EvViewPresentation *pview,
                           GParamSpec      *pspec,
@@ -241,10 +235,6 @@ ev_dscwindow_notes_clicked (GtkWidget *widget, GdkEvent *event,
        return FALSE;
 }
 
-/**
- * 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)
@@ -292,7 +282,6 @@ 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;
@@ -304,6 +293,9 @@ ev_dscwindow_init (EvDSCWindow *ev_dscwindow)
        GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
 
        ev_dscwindow->priv->model = ev_document_model_new ();
+       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);
 
        ev_dscwindow->priv->sidebar = ev_sidebar_new ();
        ev_sidebar_set_model (EV_SIDEBAR (ev_dscwindow->priv->sidebar),
@@ -313,63 +305,65 @@ ev_dscwindow_init (EvDSCWindow *ev_dscwindow)
        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);
+       gtk_paned_add1(GTK_PANED(hpaned), 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);
+       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 (hpaned), ev_dscwindow->priv->notesview_scrolled_window);
+
+       ev_dscwindow->priv->notesview = ev_view_new ();
+       g_object_ref (ev_dscwindow->priv->notesview);
+       gtk_container_add (GTK_CONTAINER (ev_dscwindow->priv->notesview_scrolled_window),
+               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 (hpaned);
+       gtk_box_pack_start(GTK_BOX(vbox),hpaned,TRUE,TRUE,0);
 
        GtkWidget *expander = gtk_expander_new (_("Expensive features"));
        gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
-
        GtkWidget *toolbar = gtk_toolbar_new ();
 
-       GtkToolItemb_switch = gtk_tool_button_new (NULL, _("Switch monitors"));
+       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 (toolbar), b_switch, -1);
        g_signal_connect (b_switch, "clicked",
                G_CALLBACK (ev_dscwindow_switch_monitors), ev_dscwindow);
 
-       GtkToolItemb_notes = gtk_tool_button_new_from_stock (GTK_STOCK_OPEN);
+       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");
+       GtkToolItem *b_close = gtk_tool_button_new_from_stock (GTK_STOCK_CLOSE);
+       gtk_tool_button_set_label (GTK_TOOL_BUTTON(b_close), _("End presentation"));
        gtk_toolbar_insert (GTK_TOOLBAR (toolbar), b_close, -1);
-
        g_signal_connect (b_close, "clicked",
                G_CALLBACK (ev_dscwindow_end), NULL);
 
+       GtkToolItem *b_sidebar = gtk_tool_button_new_from_stock (GTK_STOCK_PAGE_SETUP);
+       gtk_tool_button_set_label (GTK_TOOL_BUTTON(b_sidebar), _("Show sidebar"));
+       gtk_toolbar_insert (GTK_TOOLBAR (toolbar), b_sidebar, -1);
+       g_signal_connect_swapped (b_sidebar, "clicked",
+               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_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 (hpaned), ev_dscwindow->priv->notesview_scrolled_window);
+//     gtk_drag_dest_unset (GTK_WIDGET (ev_dscwindow->priv->notesview));
+//      gtk_drag_dest_unset (GTK_WIDGET (ev_dscwindow->priv->sidebar));
 
-       ev_dscwindow->priv->notesview = ev_view_new ();
-       g_object_ref (ev_dscwindow->priv->notesview);
-       gtk_container_add (GTK_CONTAINER (ev_dscwindow->priv->notesview_scrolled_window),
-               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 (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);
+//     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);*/
+
+       gtk_widget_show_all(vbox);
+       gtk_container_add (GTK_CONTAINER (ev_dscwindow), vbox);
 }
 
 
index a9e03e6ebd1382aaf9cc75828edcf9ae85c1438c..da4c58ff56f12204bbc3cadeda75d4e850d577b9 100644 (file)
@@ -4053,14 +4053,14 @@ ev_window_run_presentation (EvWindow *window)
        if (window->priv->metadata && !ev_window_is_empty (window))
                ev_metadata_set_boolean (window->priv->metadata, "presentation", TRUE);
 
-       if ( get_num_monitors(GTK_WINDOW(window)) > 1) {
+//     if ( get_num_monitors(GTK_WINDOW(window)) > 1) {
                EvDSCWindow *control = ev_dscwindow_get_control();
 
                ev_dscwindow_set_presentation   (control, window,
                                         window->priv->document,
                                         EV_VIEW_PRESENTATION(window->priv->presentation_view));
                gtk_window_present (GTK_WINDOW (control));
-       }
+//     }
 }
 
 void