mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 05:25:59 +01:00
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.
This commit is contained in:
parent
860c748889
commit
9367d646d9
4 changed files with 3 additions and 80 deletions
30
callbacks.c
30
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))
|
||||
{
|
||||
|
|
25
callbacks.h
25
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
|
||||
|
|
25
zathura.c
25
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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue