Skip to content

Commit

Permalink
fix: исправить невозможность закрытия окна во время загрузки и измене…
Browse files Browse the repository at this point in the history
…ние алгоритма проверки подписки Плюс
  • Loading branch information
Rirusha committed May 15, 2024
1 parent 3a7849a commit 5792c3c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
7 changes: 7 additions & 0 deletions data/ui/header-bar.blp
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,35 @@ template $CassetteHeaderBar: $CassetteShrinkableBin {
icon-name: "go-previous-symbolic";
visible: false;
tooltip-text: _("Go back");
sensitive: bind template.interactive;
}

[start]
Button refresh_button {
icon-name: "view-refresh-symbolic";
visible: false;
tooltip-text: _("Refresh");
sensitive: bind template.interactive;
}

[start]
ToggleButton search_button {
icon-name: "edit-find-symbolic";
visible: false;
tooltip-text: _("Yandex.Music search");
sensitive: bind template.interactive;
}

title-widget: Adw.ViewSwitcher switcher_title {
policy: wide;
hexpand: false;
sensitive: bind template.interactive;
};

[end]
$CassettePrimaryMenuButton menu_button {
visible: bind template.sidebar-shown inverted;
sensitive: bind template.interactive;
}

[end]
Expand All @@ -43,6 +48,7 @@ template $CassetteHeaderBar: $CassetteShrinkableBin {
]

visible: false;
sensitive: bind template.interactive;

Adw.Avatar avatar {
size: 22;
Expand All @@ -52,6 +58,7 @@ template $CassetteHeaderBar: $CassetteShrinkableBin {
[end]
$CassetteCacheIndicator {
visible: bind template.sidebar-shown inverted;
sensitive: bind template.interactive;
}
}
}
2 changes: 1 addition & 1 deletion data/ui/window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ template $CassetteWindow: $CassetteApplicationWindow {

[top]
$CassetteHeaderBar header_bar {
sensitive: false;
interactive: false;
title-stack: main_stack;
sidebar-shown: bind sidebar.is-shown;
switcher-visible: bind switcher_toolbar.reveal-bottom-bars inverted;
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/header-bar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class Cassette.HeaderBar : ShrinkableBin {

public bool sidebar_shown { get; set; }

public bool interactive { get; set; }

public bool can_backward {
set {
backward_button.visible = value;
Expand Down
13 changes: 7 additions & 6 deletions src/window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,19 @@ public class Cassette.Window : ApplicationWindow {
}

public void load_default_views () {
if (!yam_talker.me.has_plus) {
show_no_plus_dialog ();
return;
}

if (loading_stack.visible_child_name == "loading") {
pager.load_pages (PagesType.ONLINE);

header_bar.load_avatar.begin ();
yam_talker.update_all.begin ();
header_bar.can_search = true;

header_bar.sensitive = true;
header_bar.interactive = true;

cachier.check_all_cache.begin ();

Expand All @@ -262,11 +267,7 @@ public class Cassette.Window : ApplicationWindow {
}
});

if (yam_talker.me.has_plus) {
loading_stack.visible_child_name = "done";
} else {
show_no_plus_dialog ();
}
loading_stack.visible_child_name = "done";
}
}

Expand Down

0 comments on commit 5792c3c

Please sign in to comment.