Skip to content

Commit cead5fb

Browse files
authored
Explicitly start and stop gtk spinnersThis cuts down on CPU usage when the application is idle. (#328)
Perfect, thank you so much!
1 parent 4e6e7be commit cead5fb

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/Layouts/DataBaseSchema.vala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ public class Sequeler.Layouts.DataBaseSchema : Gtk.Grid {
131131
spinner.vexpand = true;
132132
spinner.halign = Gtk.Align.CENTER;
133133
spinner.valign = Gtk.Align.CENTER;
134-
spinner.start ();
135134

136135
toolbar.attach (add_table_btn, 0, 0, 1, 1);
137136
toolbar.attach (new Gtk.Separator (Gtk.Orientation.VERTICAL), 1, 0, 1, 1);
@@ -147,15 +146,15 @@ public class Sequeler.Layouts.DataBaseSchema : Gtk.Grid {
147146
attach (revealer, 0, 1, 1, 1);
148147
attach (stack, 0, 2, 1, 2);
149148
attach (toolbar, 0, 4, 1, 1);
150-
151-
start_spinner ();
152149
}
153150

154151
public void start_spinner () {
152+
spinner.start ();
155153
stack.visible_child_name = "spinner";
156154
}
157155

158156
public void stop_spinner () {
157+
spinner.stop ();
159158
stack.visible_child_name = "list";
160159
}
161160

src/Layouts/Views/Content.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public class Sequeler.Layouts.Views.Content : Gtk.Grid {
8585
spinner.vexpand = true;
8686
spinner.halign = Gtk.Align.CENTER;
8787
spinner.valign = Gtk.Align.CENTER;
88-
spinner.start ();
8988

9089
var welcome = new Granite.Widgets.Welcome (_("Select Table"), _("Select a table from the left sidebar to activate this view."));
9190

@@ -107,10 +106,12 @@ public class Sequeler.Layouts.Views.Content : Gtk.Grid {
107106
}
108107

109108
public void start_spinner () {
109+
spinner.start ();
110110
stack.visible_child_name = "spinner";
111111
}
112112

113113
public void stop_spinner () {
114+
spinner.stop ();
114115
stack.visible_child_name = "list";
115116
}
116117

src/Layouts/Views/Relations.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public class Sequeler.Layouts.Views.Relations : Gtk.Grid {
7373
spinner.vexpand = true;
7474
spinner.halign = Gtk.Align.CENTER;
7575
spinner.valign = Gtk.Align.CENTER;
76-
spinner.start ();
7776

7877
var welcome = new Granite.Widgets.Welcome (_("Select Table"), _("Select a table from the left sidebar to activate this view."));
7978

@@ -95,10 +94,12 @@ public class Sequeler.Layouts.Views.Relations : Gtk.Grid {
9594
}
9695

9796
public void start_spinner () {
97+
spinner.start ();
9898
stack.visible_child_name = "spinner";
9999
}
100100

101101
public void stop_spinner () {
102+
spinner.stop ();
102103
stack.visible_child_name = "list";
103104
}
104105

src/Layouts/Views/Structure.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public class Sequeler.Layouts.Views.Structure : Gtk.Grid {
7474
spinner.vexpand = true;
7575
spinner.halign = Gtk.Align.CENTER;
7676
spinner.valign = Gtk.Align.CENTER;
77-
spinner.start ();
7877

7978
var welcome = new Granite.Widgets.Welcome (_("Select Table"), _("Select a table from the left sidebar to activate this view."));
8079

@@ -96,10 +95,12 @@ public class Sequeler.Layouts.Views.Structure : Gtk.Grid {
9695
}
9796

9897
public void start_spinner () {
98+
spinner.start ();
9999
stack.visible_child_name = "spinner";
100100
}
101101

102102
public void stop_spinner () {
103+
spinner.stop ();
103104
stack.visible_child_name = "list";
104105
}
105106

0 commit comments

Comments
 (0)