summaryrefslogtreecommitdiff
path: root/src/book-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/book-view.c')
-rw-r--r--src/book-view.c235
1 files changed, 151 insertions, 84 deletions
diff --git a/src/book-view.c b/src/book-view.c
index f418d37..53e2ad8 100644
--- a/src/book-view.c
+++ b/src/book-view.c
@@ -1,4 +1,4 @@
-/* book-view.c generated by valac 0.16.1, the Vala compiler
+/* book-view.c generated by valac 0.17.7, the Vala compiler
* generated from book-view.vala, do not modify */
/*
@@ -120,12 +120,7 @@ GType page_view_get_type (void) G_GNUC_CONST;
enum {
BOOK_VIEW_DUMMY_PROPERTY
};
-BookView* book_view_new (Book* book);
-BookView* book_view_construct (GType object_type, Book* book);
-guint book_get_n_pages (Book* self);
-Page* book_get_page (Book* self, gint page_number);
static void book_view_add_cb (BookView* self, Book* book, Page* page);
-void book_view_select_page (BookView* self, Page* page);
static void _book_view_add_cb_book_page_added (Book* _sender, Page* page, gpointer self);
static void book_view_remove_cb (BookView* self, Book* book, Page* page);
static void _book_view_remove_cb_book_page_removed (Book* _sender, Page* page, gpointer self);
@@ -133,8 +128,6 @@ static void book_view_reorder_cb (BookView* self, Book* book);
static void _book_view_reorder_cb_book_reordered (Book* _sender, gpointer self);
static void book_view_clear_cb (BookView* self, Book* book);
static void _book_view_clear_cb_book_cleared (Book* _sender, gpointer self);
-static void _page_unref0_ (gpointer var);
-static void _page_view_unref0_ (gpointer var);
static gboolean book_view_configure_cb (BookView* self, GtkWidget* widget, GdkEventConfigure* event);
static gboolean _book_view_configure_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self);
static gboolean book_view_draw_cb (BookView* self, GtkWidget* widget, cairo_t* context);
@@ -151,6 +144,13 @@ static gboolean _book_view_focus_cb_gtk_widget_focus_in_event (GtkWidget* _sende
static gboolean _book_view_focus_cb_gtk_widget_focus_out_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self);
static void book_view_scroll_cb (BookView* self, GtkAdjustment* adjustment);
static void _book_view_scroll_cb_gtk_adjustment_value_changed (GtkAdjustment* _sender, gpointer self);
+BookView* book_view_new (Book* book);
+BookView* book_view_construct (GType object_type, Book* book);
+guint book_get_n_pages (Book* self);
+Page* book_get_page (Book* self, gint page_number);
+void book_view_select_page (BookView* self, Page* page);
+static void _page_unref0_ (gpointer var);
+static void _page_view_unref0_ (gpointer var);
static PageView* book_view_get_nth_page (BookView* self, gint n);
static PageView* book_view_get_next_page (BookView* self, PageView* page);
Page* page_view_get_page (PageView* self);
@@ -193,16 +193,10 @@ void page_view_motion (PageView* self, gint x, gint y);
GdkCursorType page_view_get_cursor (PageView* self);
void book_view_select_next_page (BookView* self);
void book_view_select_prev_page (BookView* self);
-GtkWidget* book_view_get_event_source (BookView* self);
static void g_cclosure_user_marshal_VOID__PAGE (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void book_view_finalize (GObject* obj);
-static gpointer _book_ref0 (gpointer self) {
- return self ? book_ref (self) : NULL;
-}
-
-
static void _book_view_add_cb_book_page_added (Book* _sender, Page* page, gpointer self) {
book_view_add_cb (self, _sender, page);
}
@@ -223,21 +217,6 @@ static void _book_view_clear_cb_book_cleared (Book* _sender, gpointer self) {
}
-static void _page_unref0_ (gpointer var) {
- (var == NULL) ? NULL : (var = (page_unref (var), NULL));
-}
-
-
-static void _page_view_unref0_ (gpointer var) {
- (var == NULL) ? NULL : (var = (page_view_unref (var), NULL));
-}
-
-
-static gpointer _g_object_ref0 (gpointer self) {
- return self ? g_object_ref (self) : NULL;
-}
-
-
static gboolean _book_view_configure_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self) {
gboolean result;
result = book_view_configure_cb (self, _sender, event);
@@ -299,6 +278,26 @@ static void _book_view_scroll_cb_gtk_adjustment_value_changed (GtkAdjustment* _s
}
+static gpointer _book_ref0 (gpointer self) {
+ return self ? book_ref (self) : NULL;
+}
+
+
+static void _page_unref0_ (gpointer var) {
+ (var == NULL) ? NULL : (var = (page_unref (var), NULL));
+}
+
+
+static void _page_view_unref0_ (gpointer var) {
+ (var == NULL) ? NULL : (var = (page_view_unref (var), NULL));
+}
+
+
+static gpointer _g_object_ref0 (gpointer self) {
+ return self ? g_object_ref (self) : NULL;
+}
+
+
BookView* book_view_construct (GType object_type, Book* book) {
BookView * self = NULL;
Book* _tmp0_;
@@ -318,23 +317,21 @@ BookView* book_view_construct (GType object_type, Book* book) {
GtkWidget* _tmp25_;
GtkWidget* _tmp26_;
GtkWidget* _tmp27_;
- GtkWidget* _tmp28_;
+ GtkScrollbar* _tmp28_;
GtkScrollbar* _tmp29_;
- GtkScrollbar* _tmp30_;
- GtkScrollbar* _tmp31_;
- GtkAdjustment* _tmp32_ = NULL;
- GtkAdjustment* _tmp33_;
- GtkScrollbar* _tmp34_;
+ GtkAdjustment* _tmp30_ = NULL;
+ GtkAdjustment* _tmp31_;
+ GtkScrollbar* _tmp32_;
+ GtkWidget* _tmp33_;
+ GtkWidget* _tmp34_;
GtkWidget* _tmp35_;
GtkWidget* _tmp36_;
GtkWidget* _tmp37_;
GtkWidget* _tmp38_;
GtkWidget* _tmp39_;
GtkWidget* _tmp40_;
- GtkWidget* _tmp41_;
+ GtkAdjustment* _tmp41_;
GtkWidget* _tmp42_;
- GtkAdjustment* _tmp43_;
- GtkWidget* _tmp44_;
g_return_val_if_fail (book != NULL, NULL);
self = (BookView*) g_object_new (object_type, NULL);
_tmp0_ = book;
@@ -403,48 +400,48 @@ BookView* book_view_construct (GType object_type, Book* book) {
self->priv->page_data = _tmp22_;
self->priv->cursor = GDK_ARROW;
_tmp23_ = (GtkDrawingArea*) gtk_drawing_area_new ();
- _tmp24_ = (GtkWidget*) g_object_ref_sink (_tmp23_);
+ g_object_ref_sink (_tmp23_);
_g_object_unref0 (self->priv->drawing_area);
- self->priv->drawing_area = _tmp24_;
+ self->priv->drawing_area = (GtkWidget*) _tmp23_;
+ _tmp24_ = self->priv->drawing_area;
+ gtk_widget_set_size_request (_tmp24_, 200, 100);
_tmp25_ = self->priv->drawing_area;
- gtk_widget_set_size_request (_tmp25_, 200, 100);
+ gtk_widget_set_can_focus (_tmp25_, TRUE);
_tmp26_ = self->priv->drawing_area;
- gtk_widget_set_can_focus (_tmp26_, TRUE);
+ gtk_widget_set_events (_tmp26_, (gint) (((((GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK) | GDK_BUTTON_RELEASE_MASK) | GDK_FOCUS_CHANGE_MASK) | GDK_STRUCTURE_MASK) | GDK_SCROLL_MASK));
_tmp27_ = self->priv->drawing_area;
- gtk_widget_set_events (_tmp27_, (gint) (((((GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK) | GDK_BUTTON_RELEASE_MASK) | GDK_FOCUS_CHANGE_MASK) | GDK_STRUCTURE_MASK) | GDK_SCROLL_MASK));
- _tmp28_ = self->priv->drawing_area;
- gtk_box_pack_start ((GtkBox*) self, _tmp28_, TRUE, TRUE, (guint) 0);
- _tmp29_ = (GtkScrollbar*) gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, NULL);
- _tmp30_ = g_object_ref_sink (_tmp29_);
+ gtk_box_pack_start ((GtkBox*) self, _tmp27_, TRUE, TRUE, (guint) 0);
+ _tmp28_ = (GtkScrollbar*) gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, NULL);
+ g_object_ref_sink (_tmp28_);
_g_object_unref0 (self->priv->scroll);
- self->priv->scroll = _tmp30_;
- _tmp31_ = self->priv->scroll;
- _tmp32_ = gtk_range_get_adjustment ((GtkRange*) _tmp31_);
- _tmp33_ = _g_object_ref0 (_tmp32_);
+ self->priv->scroll = _tmp28_;
+ _tmp29_ = self->priv->scroll;
+ _tmp30_ = gtk_range_get_adjustment ((GtkRange*) _tmp29_);
+ _tmp31_ = _g_object_ref0 (_tmp30_);
_g_object_unref0 (self->priv->adjustment);
- self->priv->adjustment = _tmp33_;
- _tmp34_ = self->priv->scroll;
- gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp34_, FALSE, TRUE, (guint) 0);
+ self->priv->adjustment = _tmp31_;
+ _tmp32_ = self->priv->scroll;
+ gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp32_, FALSE, TRUE, (guint) 0);
+ _tmp33_ = self->priv->drawing_area;
+ g_signal_connect_object (_tmp33_, "configure-event", (GCallback) _book_view_configure_cb_gtk_widget_configure_event, self, 0);
+ _tmp34_ = self->priv->drawing_area;
+ g_signal_connect_object (_tmp34_, "draw", (GCallback) _book_view_draw_cb_gtk_widget_draw, self, 0);
_tmp35_ = self->priv->drawing_area;
- g_signal_connect_object (_tmp35_, "configure-event", (GCallback) _book_view_configure_cb_gtk_widget_configure_event, self, 0);
+ g_signal_connect_object (_tmp35_, "motion-notify-event", (GCallback) _book_view_motion_cb_gtk_widget_motion_notify_event, self, 0);
_tmp36_ = self->priv->drawing_area;
- g_signal_connect_object (_tmp36_, "draw", (GCallback) _book_view_draw_cb_gtk_widget_draw, self, 0);
+ g_signal_connect_object (_tmp36_, "key-press-event", (GCallback) _book_view_key_cb_gtk_widget_key_press_event, self, 0);
_tmp37_ = self->priv->drawing_area;
- g_signal_connect_object (_tmp37_, "motion-notify-event", (GCallback) _book_view_motion_cb_gtk_widget_motion_notify_event, self, 0);
+ g_signal_connect_object (_tmp37_, "button-press-event", (GCallback) _book_view_button_cb_gtk_widget_button_press_event, self, 0);
_tmp38_ = self->priv->drawing_area;
- g_signal_connect_object (_tmp38_, "key-press-event", (GCallback) _book_view_key_cb_gtk_widget_key_press_event, self, 0);
+ g_signal_connect_object (_tmp38_, "button-release-event", (GCallback) _book_view_button_cb_gtk_widget_button_release_event, self, 0);
_tmp39_ = self->priv->drawing_area;
- g_signal_connect_object (_tmp39_, "button-press-event", (GCallback) _book_view_button_cb_gtk_widget_button_press_event, self, 0);
+ g_signal_connect_object (_tmp39_, "focus-in-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_in_event, self, G_CONNECT_AFTER);
_tmp40_ = self->priv->drawing_area;
- g_signal_connect_object (_tmp40_, "button-release-event", (GCallback) _book_view_button_cb_gtk_widget_button_release_event, self, 0);
- _tmp41_ = self->priv->drawing_area;
- g_signal_connect_object (_tmp41_, "focus-in-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_in_event, self, G_CONNECT_AFTER);
+ g_signal_connect_object (_tmp40_, "focus-out-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_out_event, self, G_CONNECT_AFTER);
+ _tmp41_ = self->priv->adjustment;
+ g_signal_connect_object (_tmp41_, "value-changed", (GCallback) _book_view_scroll_cb_gtk_adjustment_value_changed, self, 0);
_tmp42_ = self->priv->drawing_area;
- g_signal_connect_object (_tmp42_, "focus-out-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_out_event, self, G_CONNECT_AFTER);
- _tmp43_ = self->priv->adjustment;
- g_signal_connect_object (_tmp43_, "value-changed", (GCallback) _book_view_scroll_cb_gtk_adjustment_value_changed, self, 0);
- _tmp44_ = self->priv->drawing_area;
- gtk_widget_show (_tmp44_);
+ gtk_widget_show (_tmp42_);
return self;
}
@@ -894,7 +891,14 @@ static void book_view_remove_cb (BookView* self, Book* book, Page* page) {
gboolean _tmp5_;
GHashTable* _tmp12_;
Page* _tmp13_;
- PageView* _tmp14_;
+ gconstpointer _tmp14_ = NULL;
+ PageView* _tmp15_;
+ PageView* page_view;
+ guint _tmp16_ = 0U;
+ guint _tmp17_ = 0U;
+ GHashTable* _tmp18_;
+ Page* _tmp19_;
+ PageView* _tmp20_;
g_return_if_fail (self != NULL);
g_return_if_fail (book != NULL);
g_return_if_fail (page != NULL);
@@ -930,11 +934,21 @@ static void book_view_remove_cb (BookView* self, Book* book, Page* page) {
}
_tmp12_ = self->priv->page_data;
_tmp13_ = page;
- g_hash_table_remove (_tmp12_, _tmp13_);
- _tmp14_ = new_selection;
- book_view_select_page_view (self, _tmp14_);
+ _tmp14_ = g_hash_table_lookup (_tmp12_, _tmp13_);
+ _tmp15_ = _page_view_ref0 ((PageView*) _tmp14_);
+ page_view = _tmp15_;
+ g_signal_parse_name ("changed", TYPE_PAGE_VIEW, &_tmp16_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (page_view, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp16_, 0, NULL, (GCallback) _book_view_page_view_changed_cb_page_view_changed, self);
+ g_signal_parse_name ("size-changed", TYPE_PAGE_VIEW, &_tmp17_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (page_view, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp17_, 0, NULL, (GCallback) _book_view_page_view_size_changed_cb_page_view_size_changed, self);
+ _tmp18_ = self->priv->page_data;
+ _tmp19_ = page;
+ g_hash_table_remove (_tmp18_, _tmp19_);
+ _tmp20_ = new_selection;
+ book_view_select_page_view (self, _tmp20_);
self->priv->need_layout = TRUE;
book_view_redraw (self);
+ _page_view_unref0 (page_view);
_page_view_unref0 (new_selection);
}
@@ -2216,18 +2230,6 @@ Page* book_view_get_selected (BookView* self) {
}
-GtkWidget* book_view_get_event_source (BookView* self) {
- GtkWidget* result = NULL;
- GtkWidget* _tmp0_;
- GtkWidget* _tmp1_;
- g_return_val_if_fail (self != NULL, NULL);
- _tmp0_ = self->priv->drawing_area;
- _tmp1_ = _g_object_ref0 (_tmp0_);
- result = _tmp1_;
- return result;
-}
-
-
static void g_cclosure_user_marshal_VOID__PAGE (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
typedef void (*GMarshalFunc_VOID__PAGE) (gpointer data1, gpointer arg_1, gpointer data2);
register GMarshalFunc_VOID__PAGE callback;
@@ -2266,7 +2268,72 @@ static void book_view_instance_init (BookView * self) {
static void book_view_finalize (GObject* obj) {
BookView * self;
- self = BOOK_VIEW (obj);
+ Book* _tmp0_;
+ guint _tmp1_ = 0U;
+ Book* _tmp2_;
+ guint _tmp3_ = 0U;
+ Book* _tmp4_;
+ guint _tmp5_ = 0U;
+ Book* _tmp6_;
+ guint _tmp7_ = 0U;
+ GtkWidget* _tmp8_;
+ guint _tmp9_ = 0U;
+ GtkWidget* _tmp10_;
+ guint _tmp11_ = 0U;
+ GtkWidget* _tmp12_;
+ guint _tmp13_ = 0U;
+ GtkWidget* _tmp14_;
+ guint _tmp15_ = 0U;
+ GtkWidget* _tmp16_;
+ guint _tmp17_ = 0U;
+ GtkWidget* _tmp18_;
+ guint _tmp19_ = 0U;
+ GtkWidget* _tmp20_;
+ guint _tmp21_ = 0U;
+ GtkWidget* _tmp22_;
+ guint _tmp23_ = 0U;
+ GtkAdjustment* _tmp24_;
+ guint _tmp25_ = 0U;
+ self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BOOK_VIEW, BookView);
+ _tmp0_ = self->priv->book;
+ g_signal_parse_name ("page-added", TYPE_BOOK, &_tmp1_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _book_view_add_cb_book_page_added, self);
+ _tmp2_ = self->priv->book;
+ g_signal_parse_name ("page-removed", TYPE_BOOK, &_tmp3_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _book_view_remove_cb_book_page_removed, self);
+ _tmp4_ = self->priv->book;
+ g_signal_parse_name ("reordered", TYPE_BOOK, &_tmp5_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _book_view_reorder_cb_book_reordered, self);
+ _tmp6_ = self->priv->book;
+ g_signal_parse_name ("cleared", TYPE_BOOK, &_tmp7_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _book_view_clear_cb_book_cleared, self);
+ _tmp8_ = self->priv->drawing_area;
+ g_signal_parse_name ("configure-event", GTK_TYPE_WIDGET, &_tmp9_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _book_view_configure_cb_gtk_widget_configure_event, self);
+ _tmp10_ = self->priv->drawing_area;
+ g_signal_parse_name ("draw", GTK_TYPE_WIDGET, &_tmp11_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, 0, NULL, (GCallback) _book_view_draw_cb_gtk_widget_draw, self);
+ _tmp12_ = self->priv->drawing_area;
+ g_signal_parse_name ("motion-notify-event", GTK_TYPE_WIDGET, &_tmp13_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp12_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp13_, 0, NULL, (GCallback) _book_view_motion_cb_gtk_widget_motion_notify_event, self);
+ _tmp14_ = self->priv->drawing_area;
+ g_signal_parse_name ("key-press-event", GTK_TYPE_WIDGET, &_tmp15_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp14_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp15_, 0, NULL, (GCallback) _book_view_key_cb_gtk_widget_key_press_event, self);
+ _tmp16_ = self->priv->drawing_area;
+ g_signal_parse_name ("button-press-event", GTK_TYPE_WIDGET, &_tmp17_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp16_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp17_, 0, NULL, (GCallback) _book_view_button_cb_gtk_widget_button_press_event, self);
+ _tmp18_ = self->priv->drawing_area;
+ g_signal_parse_name ("button-release-event", GTK_TYPE_WIDGET, &_tmp19_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp18_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp19_, 0, NULL, (GCallback) _book_view_button_cb_gtk_widget_button_release_event, self);
+ _tmp20_ = self->priv->drawing_area;
+ g_signal_parse_name ("focus-in-event", GTK_TYPE_WIDGET, &_tmp21_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp20_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp21_, 0, NULL, (GCallback) _book_view_focus_cb_gtk_widget_focus_in_event, self);
+ _tmp22_ = self->priv->drawing_area;
+ g_signal_parse_name ("focus-out-event", GTK_TYPE_WIDGET, &_tmp23_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp22_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp23_, 0, NULL, (GCallback) _book_view_focus_cb_gtk_widget_focus_out_event, self);
+ _tmp24_ = self->priv->adjustment;
+ g_signal_parse_name ("value-changed", GTK_TYPE_ADJUSTMENT, &_tmp25_, NULL, FALSE);
+ g_signal_handlers_disconnect_matched (_tmp24_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp25_, 0, NULL, (GCallback) _book_view_scroll_cb_gtk_adjustment_value_changed, self);
_book_unref0 (self->priv->book);
_g_hash_table_unref0 (self->priv->page_data);
_page_view_unref0 (self->priv->selected_page);