From 9367d646d9667a038fcedd8ffde47d385b9ef5eb Mon Sep 17 00:00:00 2001 From: Abdo Roig-Maranges Date: Sun, 20 Oct 2013 23:57:24 +0200 Subject: [PATCH] get rid of tracking adjustments They are not used anywere, and do not seem to become useful anymore in the light of the new separation of document and view. --- callbacks.c | 30 ------------------------------ callbacks.h | 25 +------------------------ zathura.c | 25 ++----------------------- zathura.h | 3 --- 4 files changed, 3 insertions(+), 80 deletions(-) diff --git a/callbacks.c b/callbacks.c index 9a5f816..cee7731 100644 --- a/callbacks.c +++ b/callbacks.c @@ -218,36 +218,6 @@ cb_refresh_view(GtkWidget* GIRARA_UNUSED(view), gpointer data) statusbar_page_number_update(zathura); } -void -cb_adjustment_track_value(GtkAdjustment* adjustment, gpointer data) -{ - GtkAdjustment* tracker = data; - - gdouble lower = gtk_adjustment_get_lower(adjustment); - gdouble upper = gtk_adjustment_get_upper(adjustment); - if (lower != gtk_adjustment_get_lower(tracker) || - upper != gtk_adjustment_get_upper(tracker)) { - return; - } - - gdouble value = gtk_adjustment_get_value(adjustment); - gtk_adjustment_set_value(tracker, value); -} - -void -cb_adjustment_track_bounds(GtkAdjustment* adjustment, gpointer data) -{ - GtkAdjustment* tracker = data; - gdouble value = gtk_adjustment_get_value(adjustment); - gdouble lower = gtk_adjustment_get_lower(adjustment); - gdouble upper = gtk_adjustment_get_upper(adjustment); - gdouble page_size = gtk_adjustment_get_page_size(adjustment); - gtk_adjustment_set_value(tracker, value); - gtk_adjustment_set_lower(tracker, lower); - gtk_adjustment_set_upper(tracker, upper); - gtk_adjustment_set_page_size(tracker, page_size); -} - void cb_page_layout_value_changed(girara_session_t* session, const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data)) { diff --git a/callbacks.h b/callbacks.h index 9683f81..48cbf90 100644 --- a/callbacks.h +++ b/callbacks.h @@ -49,9 +49,7 @@ void cb_view_vadjustment_value_changed(GtkAdjustment *adjustment, gpointer data) * This function gets called when the bounds or the page_size of the horizontal * scrollbar change (e.g. when the zoom level is changed). * - * It adjusts the value of the horizontal scrollbar, possibly based on its - * previous adjustment, stored in the tracking adjustment - * zathura->ui.hadjustment. + * It adjusts the value of the horizontal scrollbar * * @param adjustment The horizontal adjustment of a gtkScrolledWindow * @param data The zathura instance @@ -81,27 +79,6 @@ void cb_view_vadjustment_changed(GtkAdjustment *adjustment, gpointer data); */ void cb_refresh_view(GtkWidget* view, gpointer data); -/* This function gets called when the value of the adjustment changes. - * - * It updates the value of the tracking adjustment, only if the bounds of the - * adjustment have not changed (if they did change, - * cb_adjustment_track_bounds() will take care of updating everything). - * - * @param adjustment The adjustment instance - * @param data The tracking adjustment instance - */ -void cb_adjustment_track_value(GtkAdjustment* adjustment, gpointer data); - -/* This function gets called when the bounds or the page_size of the adjustment - * change. - * - * It updates the value, bounds and page_size of the tracking adjustment. - * - * @param adjustment The adjustment instance - * @param data The tracking adjustment instance - */ -void cb_adjustment_track_bounds(GtkAdjustment* adjustment, gpointer data); - /** * This function gets called when the value of the "pages-per-row" * variable changes diff --git a/zathura.c b/zathura.c index e74cc51..c4e6aa3 100644 --- a/zathura.c +++ b/zathura.c @@ -160,37 +160,23 @@ zathura_init(zathura_t* zathura) g_signal_connect(G_OBJECT(zathura->ui.session->gtk.window), "size-allocate", G_CALLBACK(cb_view_resized), zathura); - /* Setup hadjustment tracker */ GtkAdjustment* hadjustment = gtk_scrolled_window_get_hadjustment( - GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); - zathura->ui.hadjustment = zathura_adjustment_clone(hadjustment); - g_object_ref_sink(zathura->ui.hadjustment); + GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); /* Connect hadjustment signals */ g_signal_connect(G_OBJECT(hadjustment), "value-changed", G_CALLBACK(cb_view_hadjustment_value_changed), zathura); - g_signal_connect(G_OBJECT(hadjustment), "value-changed", - G_CALLBACK(cb_adjustment_track_value), zathura->ui.hadjustment); g_signal_connect(G_OBJECT(hadjustment), "changed", G_CALLBACK(cb_view_hadjustment_changed), zathura); - g_signal_connect(G_OBJECT(hadjustment), "changed", - G_CALLBACK(cb_adjustment_track_bounds), zathura->ui.hadjustment); - /* Setup vadjustment tracker */ GtkAdjustment* vadjustment = gtk_scrolled_window_get_vadjustment( - GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); - zathura->ui.vadjustment = zathura_adjustment_clone(vadjustment); - g_object_ref_sink(zathura->ui.vadjustment); + GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); /* Connect vadjustment signals */ g_signal_connect(G_OBJECT(vadjustment), "value-changed", G_CALLBACK(cb_view_vadjustment_value_changed), zathura); - g_signal_connect(G_OBJECT(vadjustment), "value-changed", - G_CALLBACK(cb_adjustment_track_value), zathura->ui.vadjustment); g_signal_connect(G_OBJECT(vadjustment), "changed", G_CALLBACK(cb_view_vadjustment_changed), zathura); - g_signal_connect(G_OBJECT(vadjustment), "changed", - G_CALLBACK(cb_adjustment_track_bounds), zathura->ui.vadjustment); /* page view alignment */ zathura->ui.page_widget_alignment = gtk_alignment_new(0.5, 0.5, 0, 0); @@ -297,13 +283,6 @@ zathura_free(zathura_t* zathura) girara_session_destroy(zathura->ui.session); } - if (zathura->ui.hadjustment != NULL) { - g_object_unref(G_OBJECT(zathura->ui.hadjustment)); - } - if (zathura->ui.vadjustment != NULL) { - g_object_unref(G_OBJECT(zathura->ui.vadjustment)); - } - /* stdin support */ if (zathura->stdin_support.file != NULL) { g_unlink(zathura->stdin_support.file); diff --git a/zathura.h b/zathura.h index 1a5dd0f..113585e 100644 --- a/zathura.h +++ b/zathura.h @@ -69,9 +69,6 @@ struct zathura_s GtkWidget *page_widget_alignment; GtkWidget *page_widget; /**< Widget that contains all rendered pages */ GtkWidget *index; /**< Widget to show the index of the document */ - - GtkAdjustment *hadjustment; /**< Tracking hadjustment */ - GtkAdjustment *vadjustment; /**< Tracking vadjustment */ } ui; struct