Skip to content

Commit

Permalink
feat: Gtk.Spinner => Adw.Spinner (#1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr authored Sep 23, 2024
1 parent 1f46223 commit 1aa4cf0
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 25 deletions.
2 changes: 1 addition & 1 deletion data/ui/views/base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<object class="GtkStackPage">
<property name="name">spinner</property>
<property name="child">
<object class="GtkSpinner" id="status_spinner">
<object class="AdwSpinner" id="status_spinner">
<property name="height_request">32</property>
<property name="valign">center</property>
</object>
Expand Down
6 changes: 2 additions & 4 deletions src/Dialogs/Composer/AttachmentsPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Tuba.AttachmentsPage : ComposerPage {
"video/x-ms-asf"
};

private Gtk.Spinner spinner;
private Adw.Spinner spinner;
public GLib.ListStore attachments;
public Adw.ToastOverlay toast_overlay;
public bool media_sensitive { get; set; default = false; }
Expand Down Expand Up @@ -267,8 +267,7 @@ public class Tuba.AttachmentsPage : ComposerPage {
stack.add_named (list, "list");
stack.add_named (empty_state, "empty");

spinner = new Gtk.Spinner () {
spinning = false,
spinner = new Adw.Spinner () {
halign = Gtk.Align.CENTER,
valign = Gtk.Align.CENTER,
vexpand = true,
Expand Down Expand Up @@ -336,7 +335,6 @@ public class Tuba.AttachmentsPage : ComposerPage {
var is_empty = attachments_size < 1;
if (is_empty || uploading) {
stack.visible_child_name = uploading ? "spinner" : "empty";
spinner.spinning = uploading;
bottom_bar.hide ();
can_publish = false;
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/Dialogs/Report.vala
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ public class Tuba.Dialogs.Report : Adw.Dialog {
hexpand = true,
valign = Gtk.Align.CENTER
};
page_3_stack.add_named (new Gtk.Spinner () {
spinning = true,
page_3_stack.add_named (new Adw.Spinner () {
halign = Gtk.Align.CENTER,
valign = Gtk.Align.CENTER,
vexpand = true,
Expand Down
5 changes: 2 additions & 3 deletions src/Views/Admin/Pages/Base.vala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
public class Tuba.Views.Admin.Page.Base : Adw.NavigationPage {
protected Gtk.Widget page { get; set; }
private Gtk.ScrolledWindow scroller;
private Gtk.Spinner spinner;
private Adw.Spinner spinner;
private Adw.ToastOverlay toast_overlay;
protected Adw.HeaderBar headerbar;
protected Adw.ToolbarView toolbar_view;
Expand Down Expand Up @@ -29,11 +29,10 @@ public class Tuba.Views.Admin.Page.Base : Adw.NavigationPage {

construct {
headerbar = new Adw.HeaderBar ();
spinner = new Gtk.Spinner () {
spinner = new Adw.Spinner () {
valign = Gtk.Align.CENTER,
hexpand = true,
vexpand = true,
spinning = true,
height_request = 32
};

Expand Down
4 changes: 0 additions & 4 deletions src/Views/Base.vala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public class Tuba.Views.Base : Adw.BreakpointBin {
[GtkChild] unowned Gtk.Stack status_stack;
[GtkChild] unowned Gtk.Label status_title_label;
[GtkChild] unowned Gtk.Label status_message_label;
[GtkChild] unowned Gtk.Spinner status_spinner;

public class StatusMessage : Object {
public string? title = null;
Expand All @@ -87,16 +86,13 @@ public class Tuba.Views.Base : Adw.BreakpointBin {

if (value == null) {
states.visible_child_name = "content";
status_spinner.spinning = false;
} else {
states.visible_child_name = "status";
if (value.loading) {
status_stack.visible_child_name = "spinner";
status_spinner.spinning = true;
this.update_state (Gtk.AccessibleState.BUSY, true, -1);
} else {
status_stack.visible_child_name = "message";
status_spinner.spinning = false;

if (value.title == null) {
status_title_label.label = empty_state_title;
Expand Down
6 changes: 2 additions & 4 deletions src/Views/MediaViewer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
public class Item : Adw.Bin {
private Gtk.Stack stack;
private Gtk.Overlay overlay;
private Gtk.Spinner spinner;
private Adw.Spinner spinner;
private Gtk.ScrolledWindow scroller;
public signal void zoom_changed ();

Expand Down Expand Up @@ -212,8 +212,7 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
vexpand = true,
hexpand = true
};
spinner = new Gtk.Spinner () {
spinning = true,
spinner = new Adw.Spinner () {
halign = Gtk.Align.CENTER,
valign = Gtk.Align.CENTER,
vexpand = true,
Expand Down Expand Up @@ -284,7 +283,6 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
public void done () {
if (is_done) return;

spinner.spinning = false;
stack.visible_child_name = "child";

if (is_video) {
Expand Down
4 changes: 1 addition & 3 deletions src/Views/Profile.vala
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,7 @@ public class Tuba.Views.Profile : Views.Accounts {
}

public Adw.Dialog create_ar_list_dialog () {
var spinner = new Gtk.Spinner () {
spinning = true,
var spinner = new Adw.Spinner () {
halign = Gtk.Align.CENTER,
valign = Gtk.Align.CENTER,
vexpand = true,
Expand All @@ -393,7 +392,6 @@ public class Tuba.Views.Profile : Views.Accounts {
content_width = 600,
content_height = 550
};
spinner.start ();

var preferences_page = new Adw.PreferencesPage ();
var preferences_group = new Adw.PreferencesGroup () {
Expand Down
6 changes: 2 additions & 4 deletions src/Views/Timeline.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Tuba.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
protected int entity_queue_size { get; set; default=0; }
#endif

private Gtk.Spinner pull_to_refresh_spinner;
private Adw.Spinner pull_to_refresh_spinner;
private bool _is_pulling = false;
private bool is_pulling {
get {
Expand All @@ -26,11 +26,9 @@ public class Tuba.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
set {
if (_is_pulling != value) {
if (value) {
pull_to_refresh_spinner.spinning = true;
scrolled_overlay.add_overlay (pull_to_refresh_spinner);
scrolled.sensitive = false;
} else {
pull_to_refresh_spinner.spinning = false;
scrolled_overlay.remove_overlay (pull_to_refresh_spinner);
scrolled.sensitive = true;
pull_to_refresh_spinner.margin_top = 32;
Expand Down Expand Up @@ -74,7 +72,7 @@ public class Tuba.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
construct {
empty_state_title = _("No Posts");

pull_to_refresh_spinner = new Gtk.Spinner () {
pull_to_refresh_spinner = new Adw.Spinner () {
height_request = 32,
width_request = 32,
margin_top = 32,
Expand Down

0 comments on commit 1aa4cf0

Please sign in to comment.