[gnome-text-editor] page: remove top-margin hacks
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] page: remove top-margin hacks
- Date: Wed, 30 Jun 2021 20:40:19 +0000 (UTC)
commit 2f3a92dbca470fc46c5742326b51e6bf43a7eb78
Author: Christian Hergert <chergert redhat com>
Date: Wed Jun 30 13:39:27 2021 -0700
page: remove top-margin hacks
This causes lots of issues with active scrolling, so we need to drop it
so that we can actually move to the proper scroll offsets when leaving
the search box.
src/editor-page.c | 84 -------------------------------------------------------
1 file changed, 84 deletions(-)
---
diff --git a/src/editor-page.c b/src/editor-page.c
index 066c63b..8d87ca4 100644
--- a/src/editor-page.c
+++ b/src/editor-page.c
@@ -333,78 +333,6 @@ editor_page_drop_target_drop (EditorPage *self,
return FALSE;
}
-static void
-editor_page_update_top_margin (EditorPage *self)
-{
- GtkAdjustment *adj;
- gint top_margin;
- gint new_top_margin;
- gint diff;
- gint min, nat;
-
- g_assert (EDITOR_IS_PAGE (self));
-
- adj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (self->view));
- gtk_widget_measure (GTK_WIDGET (self->search_bar),
- GTK_ORIENTATION_VERTICAL,
- -1,
- &min, &nat, NULL, NULL);
-
- top_margin = gtk_text_view_get_top_margin (GTK_TEXT_VIEW (self->view));
- if (gtk_revealer_get_reveal_child (self->search_revealer))
- new_top_margin = 16 + min;
- else
- new_top_margin = 16;
- diff = new_top_margin - top_margin;
-
- if (new_top_margin != top_margin)
- {
- guint duration = gtk_revealer_get_transition_duration (self->search_revealer);
-
- if (gtk_adjustment_get_value (adj) > 0.0)
- duration = 0;
-
- editor_object_animate (self->view,
- EDITOR_ANIMATION_EASE_OUT_CUBIC,
- duration,
- NULL,
- "top-margin", new_top_margin,
- NULL);
- }
-
- if (gtk_adjustment_get_value (adj) > new_top_margin)
- gtk_adjustment_set_value (adj, gtk_adjustment_get_value (adj) + diff);
-}
-
-static void
-editor_page_search_revealer_notify_reveal_child_cb (EditorPage *self,
- GParamSpec *pspec,
- GtkRevealer *revealer)
-{
- g_assert (EDITOR_IS_PAGE (self));
- g_assert (GTK_IS_REVEALER (revealer));
-
- editor_page_update_top_margin (self);
-}
-
-static void
-top_margin_changed_cb (EditorPage *self,
- GParamSpec *pspec,
- GtkSourceView *view)
-{
- GtkSourceGutter *gutter;
-
- g_assert (EDITOR_IS_PAGE (self));
- g_assert (GTK_SOURCE_IS_VIEW (view));
-
- gutter = gtk_source_view_get_gutter (view, GTK_TEXT_WINDOW_LEFT);
-
- for (GtkWidget *child = gtk_widget_get_first_child (GTK_WIDGET (gutter));
- child != NULL;
- child = gtk_widget_get_next_sibling (child))
- gtk_widget_queue_allocate (child);
-}
-
static void
editor_page_dispose (GObject *object)
{
@@ -588,12 +516,6 @@ editor_page_init (EditorPage *self)
g_object_bind_property (self, "document", self->infobar, "document", 0);
- g_signal_connect_object (self->view,
- "notify::top-margin",
- G_CALLBACK (top_margin_changed_cb),
- self,
- G_CONNECT_SWAPPED);
-
dest = gtk_drop_target_new (G_TYPE_FILE, GDK_ACTION_COPY);
g_signal_connect_object (dest,
"drop",
@@ -602,12 +524,6 @@ editor_page_init (EditorPage *self)
G_CONNECT_SWAPPED);
gtk_widget_add_controller (GTK_WIDGET (self->view), GTK_EVENT_CONTROLLER (dest));
- g_signal_connect_object (self->search_revealer,
- "notify::reveal-child",
- G_CALLBACK (editor_page_search_revealer_notify_reveal_child_cb),
- self,
- G_CONNECT_SWAPPED);
-
_editor_page_actions_init (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]