#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;
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,
ev_document_model_set_page(ev_dscwindow->priv->notes_model, page);
}
}
+
static void
ev_dscwindow_presentation_page_changed_cb (EvViewPresentation *pview,
GParamSpec *pspec,
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)
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;
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),
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 ();
- GtkToolItem* b_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);
- GtkToolItem* b_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);
}