#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 21 /* This seems like bug in gtk to me */
+#define SIDEBAR_DEFAULT_SIZE 25 /* This seems like bug in gtk to me */
#define MAX_PRESENTATION_TIME 1440 /*60*24 ONE DAY*/
G_DEFINE_TYPE (EvDSCWindow, ev_dscwindow, GTK_TYPE_WINDOW)
+static void
+ev_dscwindow_window_placement (EvDSCWindow *ev_dscwindow)
+{
+ 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_switch_monitors (GtkWidget *widget, EvDSCWindow *ev_dscwindow)
{
EvDSCWindow *
ev_dscwindow_get_control (void)
{
- static EvDSCWindow * control = NULL;
+ static EvDSCWindow *control = NULL;
if (!control || !EV_IS_DSCWINDOW (control)) {
control = EV_DSCWINDOW (g_object_new (EV_TYPE_DSCWINDOW, NULL));
return control;
}
-static void
-ev_dscwindow_window_placement (EvDSCWindow *ev_dscwindow)
-{
- 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
ev_dscwindow_set_presentation (EvDSCWindow *ev_dscwindow,
EvWindow *presentation_window, EvDocument *document, EvViewPresentation *pview)
g_signal_connect_swapped (ev_dscwindow->priv->presentation_view,
"destroy",
G_CALLBACK (gtk_widget_destroy),
- ev_dscwindow);
+ GTK_WIDGET (ev_dscwindow));
g_signal_connect (G_OBJECT(ev_dscwindow->priv->model),
"notify::page",
G_CALLBACK (ev_dscwindow_page_changed_cb),
static gboolean
ev_dscwindow_end (GtkWidget *widget, GdkEvent *event)
{
- gtk_widget_destroy (GTK_WIDGET (ev_dscwindow_get_control ()));
+ gtk_widget_destroy (widget);
return TRUE;
}
gtk_tool_button_set_label (GTK_TOOL_BUTTON(b_close), _("End presentation"));
gtk_tool_item_set_tooltip_text (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);
+ g_signal_connect_swapped (b_close, "clicked",
+ G_CALLBACK (ev_dscwindow_end), ev_dscwindow);
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"));
ev_dscwindow_dispose (GObject *obj)
{
EvDSCWindow *ev_dscwindow = EV_DSCWINDOW (obj);
- EvDSCWindowPrivate *priv = ev_dscwindow->priv;
+ EvDSCWindowPrivate *priv = EV_DSCWINDOW (ev_dscwindow)->priv;
if (priv->moveback_monitor >= 0) {
- GtkWindow * presentation_window = GTK_WINDOW (priv->presentation_window);
+ GtkWindow *presentation_window = GTK_WINDOW (priv->presentation_window);
GdkRectangle coords;
gdk_screen_get_monitor_geometry (
gtk_window_move (presentation_window, coords.x, coords.y);
}
- /*if (priv->timer) {
- g_object_unref (priv->timer);
- priv->timer = NULL;
- }*/
- ev_presentation_timer_stop(EV_PRESENTATION_TIMER (priv->timer));
ev_window_stop_presentation (EV_WINDOW(priv->presentation_window), TRUE);
G_OBJECT_CLASS (ev_dscwindow_parent_class)->dispose (obj);
}
gint remaining;
guint page;
guint pages;
+ guint timeout;
gboolean running;
};
ev_timer->priv->pages = 0;
ev_timer->priv->remaining = 0;
ev_timer->priv->time = 0;
+ ev_timer->priv->timeout = 0;
ev_timer->priv->running = FALSE;
}
{
ev_timer->priv->remaining = (ev_timer->priv->time)*60;
ev_timer->priv->running = TRUE;
- g_timeout_add_seconds (1, timeout_cb, ev_timer);
+ ev_timer->priv->timeout = g_timeout_add_seconds (1, timeout_cb, ev_timer);
}
}
ev_timer->priv->time = (time < -1)? -1:time;
}
+static void
+ev_presentation_timer_dispose (GObject *gobject)
+{
+ EvPresentationTimer *ev_timer = EV_PRESENTATION_TIMER (gobject);
+ EvPresentationTimerPrivate *priv = EV_PRESENTATION_TIMER (ev_timer)->priv;
+ if (priv->timeout > 0)
+ g_source_remove (priv->timeout);
+ G_OBJECT_CLASS (ev_presentation_timer_parent_class)->dispose (gobject);
+}
+
static void
ev_presentation_timer_class_init (EvPresentationTimerClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
g_type_class_add_private (object_class, sizeof (EvPresentationTimerPrivate));
widget_class->draw = ev_presentation_timer_draw;
- /*object_class->finalize = ev_presentation_timer_finalize;*/
+ object_class->dispose = ev_presentation_timer_dispose;
}
GtkWidget *