[evince/wip/gpoo/gtk4-rebase-port: 80/96] ev-view: implement and enable ev_remove_all




commit 4f48f9c2d8f89338905eb46f8c7c5d561c8ef07a
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date:   Fri Aug 27 14:52:35 2021 +0800

    ev-view: implement and enable ev_remove_all
    
    Signed-off-by: Qiu Wenbo <qiuwenbo kylinos com cn>

 libview/ev-view.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 4665062f6..ca93717e4 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -5772,6 +5772,20 @@ ev_view_remove_all_form_fields (EvView *view)
        }
 }
 
+static void
+ev_view_remove_all (EvView *view)
+{
+       GtkWidget *child = gtk_widget_get_first_child (GTK_WIDGET (view));
+
+       while (child != NULL) {
+               GtkWidget *next = gtk_widget_get_next_sibling (child);
+
+               gtk_widget_unparent (child);
+
+               child = next;
+       }
+}
+
 /*** Drag and Drop ***/
 static GdkContentProvider *
 on_drag_prepare (GtkDragSource *self,
@@ -8503,7 +8517,7 @@ ev_view_document_changed_cb (EvDocumentModel *model,
        if (document != view->document) {
                gint current_page;
 
-               // ev_view_remove_all (view);
+               ev_view_remove_all (view);
                clear_caches (view);
 
                if (view->document) {
@@ -8554,7 +8568,7 @@ ev_view_rotation_changed_cb (EvDocumentModel *model,
                gtk_widget_queue_resize (GTK_WIDGET (view));
        }
 
-       // ev_view_remove_all (view);
+       ev_view_remove_all (view);
        view_update_scale_limits (view);
 
        if (rotation != 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]