summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlessio Treglia <quadrispro@ubuntu.com>2010-05-13 20:16:51 +0200
committerAlessio Treglia <quadrispro@ubuntu.com>2010-05-13 20:16:51 +0200
commit37e8ad6c00349fd62f09c8cfe3e22acf545db2ac (patch)
tree4b663edb122b77e9c8f1b48c0f1c68f69fcf5655 /src
parentdc950f77d2a9f9aa23f6bd0ea59648c34fff491b (diff)
Imported Upstream version 2.31.1upstream/2.31.1
Diffstat (limited to 'src')
-rw-r--r--src/book-view.c224
-rw-r--r--src/book-view.h16
-rw-r--r--src/book.c10
-rw-r--r--src/scanner.c8
-rw-r--r--src/ui.c41
5 files changed, 181 insertions, 118 deletions
diff --git a/src/book-view.c b/src/book-view.c
index e45e22c..377a156 100644
--- a/src/book-view.c
+++ b/src/book-view.c
@@ -18,8 +18,14 @@
// FIXME: Only render pages that change and only the part that changed
enum {
+ PROP_0,
+ PROP_BOOK
+};
+
+enum {
PAGE_SELECTED,
SHOW_PAGE,
+ SHOW_MENU,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0, };
@@ -37,25 +43,22 @@ struct BookViewPrivate
PageView *selected_page;
/* Widget being rendered to */
- GtkWidget *widget;
+ GtkWidget *drawing_area;
- /* Horizontal adjustment */
+ /* Horizontal scrollbar */
+ GtkWidget *scroll;
GtkAdjustment *adjustment;
- GtkWidget *box, *scroll;
-
- GtkWidget *page_menu;
-
gint cursor;
};
-G_DEFINE_TYPE (BookView, book_view, G_TYPE_OBJECT);
+G_DEFINE_TYPE (BookView, book_view, GTK_TYPE_VBOX);
BookView *
-book_view_new ()
+book_view_new (Book *book)
{
- return g_object_new (BOOK_VIEW_TYPE, NULL);
+ return g_object_new (BOOK_VIEW_TYPE, "book", book, NULL);
}
@@ -148,7 +151,7 @@ set_selected_page (BookView *view, PageView *page)
return;
/* Select new page if widget has focus */
- if (!gtk_widget_has_focus (view->priv->widget))
+ if (!gtk_widget_has_focus (view->priv->drawing_area))
page_view_set_selected (view->priv->selected_page, FALSE);
else
page_view_set_selected (view->priv->selected_page, TRUE);
@@ -173,17 +176,19 @@ static void
show_page (BookView *view, PageView *page)
{
gint left_edge, right_edge;
+ GtkAllocation allocation;
if (!page || !gtk_widget_get_visible (view->priv->scroll))
return;
+ gtk_widget_get_allocation(view->priv->drawing_area, &allocation);
left_edge = page_view_get_x_offset (page);
right_edge = page_view_get_x_offset (page) + page_view_get_width (page);
if (left_edge - get_x_offset (view) < 0)
set_x_offset(view, left_edge);
- else if (right_edge - get_x_offset (view) > view->priv->widget->allocation.width)
- set_x_offset(view, right_edge - view->priv->widget->allocation.width);
+ else if (right_edge - get_x_offset (view) > allocation.width)
+ set_x_offset(view, right_edge - allocation.width);
}
@@ -241,32 +246,6 @@ clear_cb (Book *book, BookView *view)
}
-void
-book_view_set_book (BookView *view, Book *book)
-{
- gint i, n_pages;
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (book != NULL);
-
- view->priv->book = g_object_ref (book);
-
- /* Load existing pages */
- n_pages = book_get_n_pages (view->priv->book);
- for (i = 0; i < n_pages; i++) {
- Page *page = book_get_page (book, i);
- add_cb (book, page, view);
- }
-
- book_view_select_page (view, book_get_page (book, 0));
-
- /* Watch for new pages */
- g_signal_connect (book, "page-added", G_CALLBACK (add_cb), view);
- g_signal_connect (book, "page-removed", G_CALLBACK (remove_cb), view);
- g_signal_connect (book, "cleared", G_CALLBACK (clear_cb), view);
-}
-
-
Book *
book_view_get_book (BookView *view)
{
@@ -370,36 +349,40 @@ layout (BookView *view)
{
gint width, height, book_width, book_height;
gboolean right_aligned = TRUE;
+ GtkAllocation allocation, box_allocation;
if (!view->priv->need_layout)
return;
-
+
view->priv->laying_out = TRUE;
+ gtk_widget_get_allocation(view->priv->drawing_area, &allocation);
+ gtk_widget_get_allocation(GTK_WIDGET(view), &box_allocation);
+
/* If scroll is right aligned then keep that after layout */
if (gtk_adjustment_get_value (view->priv->adjustment) < gtk_adjustment_get_upper (view->priv->adjustment) - gtk_adjustment_get_page_size (view->priv->adjustment))
right_aligned = FALSE;
-
+
/* Try and fit without scrollbar */
- width = view->priv->widget->allocation.width;
- height = view->priv->box->allocation.height;
+ width = allocation.width;
+ height = box_allocation.height - gtk_container_get_border_width (GTK_CONTAINER (view)) * 2;
layout_into (view, width, height, &book_width, &book_height);
/* Relayout with scrollbar */
- if (book_width > view->priv->widget->allocation.width) {
+ if (book_width > allocation.width) {
gint max_offset;
/* Re-layout leaving space for scrollbar */
- height = view->priv->widget->allocation.height;
+ height = allocation.height;
layout_into (view, width, height, &book_width, &book_height);
/* Set scrollbar limits */
gtk_adjustment_set_lower (view->priv->adjustment, 0);
gtk_adjustment_set_upper (view->priv->adjustment, book_width);
- gtk_adjustment_set_page_size (view->priv->adjustment, view->priv->widget->allocation.width);
+ gtk_adjustment_set_page_size (view->priv->adjustment, allocation.width);
/* Keep right-aligned */
- max_offset = book_width - view->priv->widget->allocation.width;
+ max_offset = book_width - allocation.width;
if (right_aligned || get_x_offset (view) > max_offset)
set_x_offset(view, max_offset);
@@ -407,7 +390,7 @@ layout (BookView *view)
} else {
gint offset;
gtk_widget_hide (view->priv->scroll);
- offset = (book_width - view->priv->widget->allocation.width) / 2;
+ offset = (book_width - allocation.width) / 2;
gtk_adjustment_set_lower (view->priv->adjustment, offset);
gtk_adjustment_set_upper (view->priv->adjustment, offset);
gtk_adjustment_set_page_size (view->priv->adjustment, 0);
@@ -435,7 +418,7 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, BookView *view)
layout (view);
- context = gdk_cairo_create (widget->window);
+ context = gdk_cairo_create (gtk_widget_get_window(widget));
/* Render each page */
for (i = 0; i < n_pages; i++) {
@@ -455,8 +438,8 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, BookView *view)
cairo_restore (context);
if (page_view_get_selected (page))
- gtk_paint_focus (gtk_widget_get_style (view->priv->widget),
- gtk_widget_get_window (view->priv->widget),
+ gtk_paint_focus (gtk_widget_get_style (view->priv->drawing_area),
+ gtk_widget_get_window (view->priv->drawing_area),
GTK_STATE_SELECTED,
&event->area,
NULL,
@@ -507,7 +490,7 @@ button_cb (GtkWidget *widget, GdkEventButton *event, BookView *view)
layout (view);
- gtk_widget_grab_focus (view->priv->widget);
+ gtk_widget_grab_focus (view->priv->drawing_area);
if (event->type == GDK_BUTTON_PRESS)
select_page (view, get_page_at (view, event->x + get_x_offset (view), event->y, &x, &y));
@@ -526,10 +509,8 @@ button_cb (GtkWidget *widget, GdkEventButton *event, BookView *view)
}
/* Show pop-up menu on right click */
- if (event->button == 3) {
- gtk_menu_popup (GTK_MENU (view->priv->page_menu), NULL, NULL, NULL, NULL,
- event->button, event->time);
- }
+ if (event->button == 3)
+ g_signal_emit (view, signals[SHOW_MENU], 0);
return FALSE;
}
@@ -545,7 +526,7 @@ set_cursor (BookView *view, gint cursor)
view->priv->cursor = cursor;
c = gdk_cursor_new (cursor);
- gdk_window_set_cursor (gtk_widget_get_window (view->priv->widget), c);
+ gdk_window_set_cursor (gtk_widget_get_window (view->priv->drawing_area), c);
gdk_cursor_destroy (c);
}
@@ -618,34 +599,10 @@ scroll_cb (GtkAdjustment *adjustment, BookView *view)
void
-book_view_set_widgets (BookView *view, GtkWidget *box, GtkWidget *area, GtkWidget *scroll, GtkWidget *page_menu)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (view->priv->widget == NULL);
-
- view->priv->widget = area;
- view->priv->box = box;
- view->priv->scroll = scroll;
- view->priv->adjustment = gtk_range_get_adjustment (GTK_RANGE (scroll));
- view->priv->page_menu = page_menu;
-
- g_signal_connect (area, "configure-event", G_CALLBACK (configure_cb), view);
- g_signal_connect (area, "expose-event", G_CALLBACK (expose_cb), view);
- g_signal_connect (area, "motion-notify-event", G_CALLBACK (motion_cb), view);
- g_signal_connect (area, "key-press-event", G_CALLBACK (key_cb), view);
- g_signal_connect (area, "button-press-event", G_CALLBACK (button_cb), view);
- g_signal_connect (area, "button-release-event", G_CALLBACK (button_cb), view);
- g_signal_connect_after (area, "focus-in-event", G_CALLBACK (focus_cb), view);
- g_signal_connect_after (area, "focus-out-event", G_CALLBACK (focus_cb), view);
- g_signal_connect (view->priv->adjustment, "value-changed", G_CALLBACK (scroll_cb), view);
-}
-
-
-void
book_view_redraw (BookView *view)
{
g_return_if_fail (view != NULL);
- gtk_widget_queue_draw (view->priv->widget);
+ gtk_widget_queue_draw (view->priv->drawing_area);
}
@@ -693,6 +650,63 @@ book_view_get_selected (BookView *view)
static void
+book_view_set_property(GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ BookView *self;
+ gint i, n_pages;
+
+ self = BOOK_VIEW (object);
+
+ switch (prop_id) {
+ case PROP_BOOK:
+ self->priv->book = g_object_ref (g_value_get_object (value));
+
+ /* Load existing pages */
+ n_pages = book_get_n_pages (self->priv->book);
+ for (i = 0; i < n_pages; i++) {
+ Page *page = book_get_page (self->priv->book, i);
+ add_cb (self->priv->book, page, self);
+ }
+
+ book_view_select_page (self, book_get_page (self->priv->book, 0));
+
+ /* Watch for new pages */
+ g_signal_connect (self->priv->book, "page-added", G_CALLBACK (add_cb), self);
+ g_signal_connect (self->priv->book, "page-removed", G_CALLBACK (remove_cb), self);
+ g_signal_connect (self->priv->book, "cleared", G_CALLBACK (clear_cb), self);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+static void
+book_view_get_property(GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ BookView *self;
+
+ self = BOOK_VIEW (object);
+
+ switch (prop_id) {
+ case PROP_BOOK:
+ g_value_set_object (value, self->priv->book);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+static void
book_view_finalize (GObject *object)
{
BookView *view = BOOK_VIEW (object);
@@ -710,6 +724,8 @@ book_view_class_init (BookViewClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = book_view_finalize;
+ object_class->set_property = book_view_set_property;
+ object_class->get_property = book_view_get_property;
signals[PAGE_SELECTED] =
g_signal_new ("page-selected",
@@ -717,16 +733,32 @@ book_view_class_init (BookViewClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (BookViewClass, page_selected),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, page_get_type ());
signals[SHOW_PAGE] =
g_signal_new ("show-page",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (BookViewClass, show_page),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, page_get_type ());
+ signals[SHOW_MENU] =
+ g_signal_new ("show-menu",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (BookViewClass, show_page),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ g_object_class_install_property(object_class,
+ PROP_BOOK,
+ g_param_spec_object("book",
+ "book",
+ "Book being shown",
+ book_get_type(),
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (klass, sizeof (BookViewPrivate));
}
@@ -740,4 +772,26 @@ book_view_init (BookView *view)
view->priv->page_data = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) g_object_unref);
view->priv->cursor = GDK_ARROW;
+
+ view->priv->drawing_area = gtk_drawing_area_new ();
+ gtk_widget_set_size_request (view->priv->drawing_area, 200, 100);
+ gtk_widget_set_can_focus (view->priv->drawing_area, TRUE);
+ gtk_widget_set_events (view->priv->drawing_area, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_SCROLL_MASK);
+ gtk_box_pack_start (GTK_BOX (view), view->priv->drawing_area, TRUE, TRUE, 0);
+
+ view->priv->scroll = gtk_hscrollbar_new (NULL);
+ view->priv->adjustment = gtk_range_get_adjustment (GTK_RANGE (view->priv->scroll));
+ gtk_box_pack_start (GTK_BOX (view), view->priv->scroll, FALSE, TRUE, 0);
+
+ g_signal_connect (view->priv->drawing_area, "configure-event", G_CALLBACK (configure_cb), view);
+ g_signal_connect (view->priv->drawing_area, "expose-event", G_CALLBACK (expose_cb), view);
+ g_signal_connect (view->priv->drawing_area, "motion-notify-event", G_CALLBACK (motion_cb), view);
+ g_signal_connect (view->priv->drawing_area, "key-press-event", G_CALLBACK (key_cb), view);
+ g_signal_connect (view->priv->drawing_area, "button-press-event", G_CALLBACK (button_cb), view);
+ g_signal_connect (view->priv->drawing_area, "button-release-event", G_CALLBACK (button_cb), view);
+ g_signal_connect_after (view->priv->drawing_area, "focus-in-event", G_CALLBACK (focus_cb), view);
+ g_signal_connect_after (view->priv->drawing_area, "focus-out-event", G_CALLBACK (focus_cb), view);
+ g_signal_connect (view->priv->adjustment, "value-changed", G_CALLBACK (scroll_cb), view);
+
+ gtk_widget_show (view->priv->drawing_area);
}
diff --git a/src/book-view.h b/src/book-view.h
index acc3899..5b5e2a6 100644
--- a/src/book-view.h
+++ b/src/book-view.h
@@ -12,7 +12,6 @@
#ifndef _BOOK_VIEW_H_
#define _BOOK_VIEW_H_
-#include <glib-object.h>
#include <gtk/gtk.h>
#include <cairo.h>
#include "book.h"
@@ -27,28 +26,23 @@ typedef struct BookViewPrivate BookViewPrivate;
typedef struct
{
- GObject parent_instance;
+ GtkVBox parent_instance;
BookViewPrivate *priv;
} BookView;
typedef struct
{
- GObjectClass parent_class;
-
+ GtkVBoxClass parent_class;
+
void (*page_selected) (BookView *view, Page *page);
void (*show_page) (BookView *view, Page *page);
+ void (*show_menu) (BookView *view, Page *page);
} BookViewClass;
GType book_view_get_type (void);
-BookView *book_view_new (void);
-
-// FIXME: Book view should extend GtkVBox
-void book_view_set_widgets (BookView *view, GtkWidget *box, GtkWidget *area, GtkWidget *scroll, GtkWidget *page_menu);
-
-// FIXME: Should be part of book_view_new
-void book_view_set_book (BookView *view, Book *book);
+BookView *book_view_new (Book *book);
void book_view_redraw (BookView *view);
diff --git a/src/book.c b/src/book.c
index 0dce5f0..1c1cc6e 100644
--- a/src/book.c
+++ b/src/book.c
@@ -304,6 +304,7 @@ book_save_pdf_with_imagemagick (Book *book, GFile *file, GError **error)
path = g_file_get_path (tiff_file);
resolution_command = g_strdup_printf ("convert %s -density %d %s", path, page_get_dpi (page), path);
+ g_debug ("Executing ImageMagick command: %s", resolution_command);
result = g_spawn_command_line_sync (resolution_command, &stdout_text, &stderr_text, &exit_status, error);
if (result && exit_status != 0) {
g_warning ("ImageMagick returned error code %d, command line was: %s", exit_status, resolution_command);
@@ -334,6 +335,7 @@ book_save_pdf_with_imagemagick (Book *book, GFile *file, GError **error)
g_string_append_printf (command_line, " %s", path);
g_free (path);
+ g_debug ("Executing ImageMagick command: %s", command_line->str);
result = g_spawn_command_line_sync (command_line->str, &stdout_text, &stderr_text, &exit_status, error);
if (result && exit_status != 0) {
g_warning ("ImageMagick returned error code %d, command line was: %s", exit_status, command_line->str);
@@ -459,16 +461,16 @@ book_class_init (BookClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (BookClass, page_added),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, page_get_type ());
signals[PAGE_REMOVED] =
g_signal_new ("page-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (BookClass, page_removed),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, page_get_type ());
signals[CLEARED] =
g_signal_new ("cleared",
G_TYPE_FROM_CLASS (klass),
diff --git a/src/scanner.c b/src/scanner.c
index b27ae2a..a8d09f9 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1054,6 +1054,14 @@ do_get_option (Scanner *scanner)
break;
}
}
+ else if (strcmp (option->name, "duplex") == 0) {
+ if (option->type == SANE_TYPE_BOOL)
+ set_bool_option (scanner->priv->handle, option, option_index, job->type == SCAN_ADF_BOTH, NULL);
+ }
+ else if (strcmp (option->name, "batch-scan") == 0) {
+ if (option->type == SANE_TYPE_BOOL)
+ set_bool_option (scanner->priv->handle, option, option_index, job->type != SCAN_SINGLE, NULL);
+ }
else if (strcmp (option->name, SANE_NAME_BIT_DEPTH) == 0) {
if (job->depth > 0)
set_int_option (scanner->priv->handle, option, option_index, job->depth, NULL);
diff --git a/src/ui.c b/src/ui.c
index 6fdd2e4..d67ee5e 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -42,8 +42,7 @@ struct SimpleScanPrivate
GtkBuilder *builder;
- GtkWidget *window;
- GtkWidget *preview_box, *preview_area, *preview_scroll;
+ GtkWidget *window, *main_vbox;
GtkWidget *page_delete_menuitem, *crop_rotate_menuitem;
GtkWidget *stop_menuitem, *stop_toolbutton;
@@ -644,6 +643,14 @@ show_page_cb (BookView *view, Page *page, SimpleScan *ui)
}
+static void
+show_page_menu_cb (BookView *view, SimpleScan *ui)
+{
+ gtk_menu_popup (GTK_MENU (gtk_builder_get_object (ui->priv->builder, "page_menu")), NULL, NULL, NULL, NULL,
+ 3, gtk_get_current_event_time());
+}
+
+
void rotate_left_button_clicked_cb (GtkWidget *widget, SimpleScan *ui);
G_MODULE_EXPORT
void
@@ -1310,9 +1317,7 @@ ui_load (SimpleScan *ui)
gtk_builder_connect_signals (builder, ui);
ui->priv->window = GTK_WIDGET (gtk_builder_get_object (builder, "simple_scan_window"));
- ui->priv->preview_box = GTK_WIDGET (gtk_builder_get_object (builder, "preview_vbox"));
- ui->priv->preview_area = GTK_WIDGET (gtk_builder_get_object (builder, "preview_area"));
- ui->priv->preview_scroll = GTK_WIDGET (gtk_builder_get_object (builder, "preview_scrollbar"));
+ ui->priv->main_vbox = GTK_WIDGET (gtk_builder_get_object (builder, "main_vbox"));
ui->priv->page_delete_menuitem = GTK_WIDGET (gtk_builder_get_object (builder, "page_delete_menuitem"));
ui->priv->crop_rotate_menuitem = GTK_WIDGET (gtk_builder_get_object (builder, "crop_rotate_menuitem"));
ui->priv->stop_menuitem = GTK_WIDGET (gtk_builder_get_object (builder, "stop_scan_menuitem"));
@@ -1342,7 +1347,9 @@ ui_load (SimpleScan *ui)
GtkTreeIter iter;
gtk_list_store_append (GTK_LIST_STORE (ui->priv->paper_size_model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (ui->priv->paper_size_model), &iter, 0, 0, 1, 0, 2, "Automatic", -1);
+ gtk_list_store_set (GTK_LIST_STORE (ui->priv->paper_size_model), &iter, 0, 0, 1, 0, 2,
+ /* Combo box value for automatic paper size */
+ _("Automatic"), -1);
gtk_list_store_append (GTK_LIST_STORE (ui->priv->paper_size_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (ui->priv->paper_size_model), &iter, 0, 1050, 1, 1480, 2, "A6", -1);
gtk_list_store_append (GTK_LIST_STORE (ui->priv->paper_size_model), &iter);
@@ -1399,14 +1406,13 @@ ui_load (SimpleScan *ui)
g_free (document_type);
}
- ui->priv->book_view = book_view_new ();
+ ui->priv->book_view = book_view_new (ui->priv->book);
+ gtk_container_set_border_width (GTK_CONTAINER (ui->priv->book_view), 18);
+ gtk_box_pack_end (GTK_BOX (ui->priv->main_vbox), GTK_WIDGET (ui->priv->book_view), TRUE, TRUE, 0);
g_signal_connect (ui->priv->book_view, "page-selected", G_CALLBACK (page_selected_cb), ui);
g_signal_connect (ui->priv->book_view, "show-page", G_CALLBACK (show_page_cb), ui);
- book_view_set_widgets (ui->priv->book_view,
- ui->priv->preview_box,
- ui->priv->preview_area,
- ui->priv->preview_scroll,
- GTK_WIDGET (gtk_builder_get_object (builder, "page_menu")));
+ g_signal_connect (ui->priv->book_view, "show-menu", G_CALLBACK (show_page_menu_cb), ui);
+ gtk_widget_show (GTK_WIDGET (ui->priv->book_view));
/* Find default page details */
scan_direction = gconf_client_get_string(ui->priv->client, GCONF_DIR "/scan_direction", NULL);
@@ -1445,7 +1451,6 @@ ui_load (SimpleScan *ui)
if (book_get_n_pages (ui->priv->book) == 0)
add_default_page (ui);
- book_view_set_book (ui->priv->book_view, ui->priv->book);
}
@@ -1571,9 +1576,9 @@ ui_finalize (GObject *object)
ui->priv->builder = NULL;
g_object_unref (ui->priv->book);
ui->priv->book = NULL;
- g_object_unref (ui->priv->book_view);
- ui->priv->book_view = NULL;
-
+ gtk_widget_destroy (GTK_WIDGET (ui->priv->book_view));
+ ui->priv->book_view = NULL;
+
G_OBJECT_CLASS (ui_parent_class)->finalize (object);
}
@@ -1607,8 +1612,8 @@ ui_class_init (SimpleScanClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (SimpleScanClass, save),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
signals[EMAIL] =
g_signal_new ("email",
G_TYPE_FROM_CLASS (klass),