[gnome-builder/gnome-builder-43] plugins/buildui: clear bound model when pipeline changes



commit e52504cb6828ff87e3bba50a90683960ecdeb53d
Author: Christian Hergert <chergert redhat com>
Date:   Wed Sep 21 12:41:39 2022 -0700

    plugins/buildui: clear bound model when pipeline changes
    
    We need to be sure that the GtkListBox has access to it's references so
    that they can be removed in-case the model changes. Additionally, we don't
    want it to continue to react to changes, so just clear the model. Odd that
    it wasn't done this way to begin with.
    
    Fixes #956

 src/plugins/buildui/gbp-buildui-pane.c      | 6 +-----
 src/plugins/buildui/gbp-buildui-stage-row.h | 3 ++-
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/buildui/gbp-buildui-pane.c b/src/plugins/buildui/gbp-buildui-pane.c
index 1daec0197..63fccc524 100644
--- a/src/plugins/buildui/gbp-buildui-pane.c
+++ b/src/plugins/buildui/gbp-buildui-pane.c
@@ -128,11 +128,7 @@ gbp_buildui_pane_unbind_pipeline (GbpBuilduiPane *self,
 
   if (!gtk_widget_in_destruction (GTK_WIDGET (self)))
     {
-      GtkWidget *child;
-
-      while ((child = gtk_widget_get_first_child (GTK_WIDGET (self->stages_list_box))) != NULL)
-        gtk_list_box_remove (self->stages_list_box, child);
-
+      gtk_list_box_bind_model (self->stages_list_box, NULL, NULL, NULL, NULL);
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_PIPELINE]);
     }
 }
diff --git a/src/plugins/buildui/gbp-buildui-stage-row.h b/src/plugins/buildui/gbp-buildui-stage-row.h
index 4fb16cd1c..9cc669f3b 100644
--- a/src/plugins/buildui/gbp-buildui-stage-row.h
+++ b/src/plugins/buildui/gbp-buildui-stage-row.h
@@ -21,6 +21,7 @@
 #pragma once
 
 #include <gtk/gtk.h>
+
 #include <libide-foundry.h>
 
 G_BEGIN_DECLS
@@ -29,7 +30,7 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GbpBuilduiStageRow, gbp_buildui_stage_row, GBP, BUILDUI_STAGE_ROW, GtkListBoxRow)
 
-GtkWidget     *gbp_buildui_stage_row_new       (IdePipelineStage    *stage);
+GtkWidget        *gbp_buildui_stage_row_new       (IdePipelineStage   *stage);
 IdePipelineStage *gbp_buildui_stage_row_get_stage (GbpBuilduiStageRow *self);
 
 G_END_DECLS


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