diff options
author | Alessio Treglia <alessio@debian.org> | 2010-08-31 01:00:12 +0200 |
---|---|---|
committer | Alessio Treglia <alessio@debian.org> | 2010-08-31 01:00:12 +0200 |
commit | 4ac5f08a40731e4ac9331116748e2e5740cc3805 (patch) | |
tree | 698bea0d09e82ff8277163e5631e9bf70e6d24ed /src/book.c | |
parent | 213b74fec6f0f9be688d4e860db8d8339248a293 (diff) | |
parent | 6cd216d78dc05e818ce8e9a244be16a7d523d7d3 (diff) |
Merge commit 'upstream/2.31.91'
Diffstat (limited to 'src/book.c')
-rw-r--r-- | src/book.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -29,6 +29,7 @@ enum { enum { PAGE_ADDED, PAGE_REMOVED, + REORDERED, CLEARED, LAST_SIGNAL }; @@ -92,6 +93,18 @@ book_append_page (Book *book, gint width, gint height, gint dpi, ScanDirection s void +book_move_page (Book *book, Page *page, gint location) +{ + book->priv->pages = g_list_remove (book->priv->pages, page); + book->priv->pages = g_list_insert (book->priv->pages, page, location); + + g_signal_emit (book, signals[REORDERED], 0, page); + + book_set_needs_saving (book, TRUE); +} + + +void book_delete_page (Book *book, Page *page) { g_signal_handlers_disconnect_by_func (page, page_changed_cb, book); @@ -121,6 +134,13 @@ book_get_page (Book *book, gint page_number) } +gint +book_get_page_index (Book *book, Page *page) +{ + return g_list_index (book->priv->pages, page); +} + + static GFile * make_indexed_file (const gchar *uri, gint i) { @@ -805,6 +825,14 @@ book_class_init (BookClass *klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, page_get_type ()); + signals[REORDERED] = + g_signal_new ("reordered", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (BookClass, reordered), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[CLEARED] = g_signal_new ("cleared", G_TYPE_FROM_CLASS (klass), |