Commit 9367d646 authored by Abdo Roig-Maranges's avatar Abdo Roig-Maranges
Browse files

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.
parent 860c7488
...@@ -218,36 +218,6 @@ cb_refresh_view(GtkWidget* GIRARA_UNUSED(view), gpointer data) ...@@ -218,36 +218,6 @@ cb_refresh_view(GtkWidget* GIRARA_UNUSED(view), gpointer data)
statusbar_page_number_update(zathura); 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 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)) cb_page_layout_value_changed(girara_session_t* session, const char* UNUSED(name), girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
{ {
......
...@@ -49,9 +49,7 @@ void cb_view_vadjustment_value_changed(GtkAdjustment *adjustment, gpointer data) ...@@ -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 * This function gets called when the bounds or the page_size of the horizontal
* scrollbar change (e.g. when the zoom level is changed). * scrollbar change (e.g. when the zoom level is changed).
* *
* It adjusts the value of the horizontal scrollbar, possibly based on its * It adjusts the value of the horizontal scrollbar
* previous adjustment, stored in the tracking adjustment
* zathura->ui.hadjustment.
* *
* @param adjustment The horizontal adjustment of a gtkScrolledWindow * @param adjustment The horizontal adjustment of a gtkScrolledWindow
* @param data The zathura instance * @param data The zathura instance
...@@ -81,27 +79,6 @@ void cb_view_vadjustment_changed(GtkAdjustment *adjustment, gpointer data); ...@@ -81,27 +79,6 @@ void cb_view_vadjustment_changed(GtkAdjustment *adjustment, gpointer data);
*/ */
void cb_refresh_view(GtkWidget* view, 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" * This function gets called when the value of the "pages-per-row"
* variable changes * variable changes
......
...@@ -160,37 +160,23 @@ zathura_init(zathura_t* zathura) ...@@ -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); 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( GtkAdjustment* hadjustment = gtk_scrolled_window_get_hadjustment(
GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
zathura->ui.hadjustment = zathura_adjustment_clone(hadjustment);
g_object_ref_sink(zathura->ui.hadjustment);
/* Connect hadjustment signals */ /* Connect hadjustment signals */
g_signal_connect(G_OBJECT(hadjustment), "value-changed", g_signal_connect(G_OBJECT(hadjustment), "value-changed",
G_CALLBACK(cb_view_hadjustment_value_changed), zathura); 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_signal_connect(G_OBJECT(hadjustment), "changed",
G_CALLBACK(cb_view_hadjustment_changed), zathura); 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( GtkAdjustment* vadjustment = gtk_scrolled_window_get_vadjustment(
GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view)); GTK_SCROLLED_WINDOW(zathura->ui.session->gtk.view));
zathura->ui.vadjustment = zathura_adjustment_clone(vadjustment);
g_object_ref_sink(zathura->ui.vadjustment);
/* Connect vadjustment signals */ /* Connect vadjustment signals */
g_signal_connect(G_OBJECT(vadjustment), "value-changed", g_signal_connect(G_OBJECT(vadjustment), "value-changed",
G_CALLBACK(cb_view_vadjustment_value_changed), zathura); 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_signal_connect(G_OBJECT(vadjustment), "changed",
G_CALLBACK(cb_view_vadjustment_changed), zathura); 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 */ /* page view alignment */
zathura->ui.page_widget_alignment = gtk_alignment_new(0.5, 0.5, 0, 0); zathura->ui.page_widget_alignment = gtk_alignment_new(0.5, 0.5, 0, 0);
...@@ -297,13 +283,6 @@ zathura_free(zathura_t* zathura) ...@@ -297,13 +283,6 @@ zathura_free(zathura_t* zathura)
girara_session_destroy(zathura->ui.session); 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 */ /* stdin support */
if (zathura->stdin_support.file != NULL) { if (zathura->stdin_support.file != NULL) {
g_unlink(zathura->stdin_support.file); g_unlink(zathura->stdin_support.file);
......
...@@ -69,9 +69,6 @@ struct zathura_s ...@@ -69,9 +69,6 @@ struct zathura_s
GtkWidget *page_widget_alignment; GtkWidget *page_widget_alignment;
GtkWidget *page_widget; /**< Widget that contains all rendered pages */ GtkWidget *page_widget; /**< Widget that contains all rendered pages */
GtkWidget *index; /**< Widget to show the index of the document */ GtkWidget *index; /**< Widget to show the index of the document */
GtkAdjustment *hadjustment; /**< Tracking hadjustment */
GtkAdjustment *vadjustment; /**< Tracking vadjustment */
} ui; } ui;
struct struct
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment