Skip to content

Commit

Permalink
Destroy and recreate scrolled window when new content is fetched. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alecaddd authored Dec 2, 2018
1 parent 115641f commit 57936b4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/Layouts/DataBaseView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public class Sequeler.Layouts.DataBaseView : Gtk.Grid {

tabs.mode_changed.connect ((tab) => {
stack.set_visible_child_name (tab.name);

if (window.main.database_schema.source_list == null) {
return;
}

var item_selected = window.main.database_schema.source_list.selected;

if (item_selected == null) {
Expand Down
13 changes: 11 additions & 2 deletions src/Layouts/Views/Content.vala
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,18 @@ public class Sequeler.Layouts.Views.Content : Gtk.Grid {
}

public void clear () {
if (scroll.get_child () != null) {
scroll.remove (scroll.get_child ());
if (scroll == null) {
return;
}

scroll.destroy ();

scroll = new Gtk.ScrolledWindow (null, null);
scroll.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
scroll.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
scroll.expand = true;

attach (scroll, 0, 0, 1, 1);
}

public void reset () {
Expand Down
13 changes: 11 additions & 2 deletions src/Layouts/Views/Relations.vala
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,18 @@ public class Sequeler.Layouts.Views.Relations : Gtk.Grid {
}

public void clear () {
if (scroll.get_child () != null) {
scroll.remove (scroll.get_child ());
if (scroll == null) {
return;
}

scroll.destroy ();

scroll = new Gtk.ScrolledWindow (null, null);
scroll.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
scroll.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
scroll.expand = true;

attach (scroll, 0, 0, 1, 1);
}

public void reset () {
Expand Down
13 changes: 11 additions & 2 deletions src/Layouts/Views/Structure.vala
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,18 @@ public class Sequeler.Layouts.Views.Structure : Gtk.Grid {
}

public void clear () {
if (scroll.get_child () != null) {
scroll.remove (scroll.get_child ());
if (scroll == null) {
return;
}

scroll.destroy ();

scroll = new Gtk.ScrolledWindow (null, null);
scroll.hscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
scroll.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
scroll.expand = true;

attach (scroll, 0, 0, 1, 1);
}

public void reset () {
Expand Down

0 comments on commit 57936b4

Please sign in to comment.