Skip to content

Commit

Permalink
Make pages subclass Adw.NavigationPage (#2118)
Browse files Browse the repository at this point in the history
* Make pages subclass Adw.NavigationView

* Add mininum adwaita version

---------

Co-authored-by: Leonhard <[email protected]>
  • Loading branch information
danirabbit and leolost2605 authored Feb 22, 2024
1 parent 569048d commit 71811e4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ An open, pay-what-you-want app store for indie developers.

You'll need the following dependencies:
* gettext
* libadwaita-1-dev
* libadwaita-1-dev (>= 1.4)
* libappstream-dev (>= 0.15.2)
* libflatpak-dev (>= 1.0.7)
* libgee-0.8-dev
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gio = dependency ('gio-2.0')
gee = dependency ('gee-0.8')
gtk = dependency ('gtk4', version: '>=4.10')
granite = dependency ('granite-7', version: '>=7.3.0')
adwaita = dependency('libadwaita-1')
adwaita = dependency('libadwaita-1', version: '>=1.4')
appstream = dependency ('appstream', version: '>=0.15.2')
libsoup = dependency ('libsoup-3.0')
json = dependency ('json-glib-1.0')
Expand Down
11 changes: 2 additions & 9 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,10 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow {

if (previous_child == null) {
set_return_name (null);
} else if (previous_child is Homepage) {
set_return_name (_("Home"));
} else if (previous_child == search_view) {
/// TRANSLATORS: the name of the Search view
set_return_name (C_("view", "Search"));
} else if (previous_child is Adw.NavigationPage) {
set_return_name (previous_child.title);
} else if (previous_child is Views.AppInfoView) {
set_return_name (((Views.AppInfoView) previous_child).package.get_name ());
} else if (previous_child is CategoryView) {
set_return_name (((CategoryView) previous_child).category.name);
} else if (previous_child is Views.AppListUpdateView) {
set_return_name (C_("view", "Installed"));
}

while (leaflet.get_adjacent_child (FORWARD) != null) {
Expand Down
6 changes: 4 additions & 2 deletions src/Views/AppListUpdateView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace AppCenter.Views {
/** AppList for the Updates View. Sorts update_available first and shows headers.
* Does not show Uninstall Button **/
public class AppListUpdateView : Gtk.Box {
public class AppListUpdateView : Adw.NavigationPage {
public signal void show_app (AppCenterCore.Package package);

private Granite.HeaderLabel header_label;
Expand Down Expand Up @@ -136,7 +136,9 @@ namespace AppCenter.Views {
stack.add_child (main_box);
stack.add_child (loading_view);

append (stack);
child = stack;
/// TRANSLATORS: the name of the Installed Apps view
title = C_("view", "Installed");

get_apps.begin ((obj, res) => {
get_apps.end (res);
Expand Down
5 changes: 3 additions & 2 deletions src/Views/CategoryView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

public class AppCenter.CategoryView : Gtk.Box {
public class AppCenter.CategoryView : Adw.NavigationPage {
public signal void show_app (AppCenterCore.Package package);

public AppStream.Category category { get; construct; }
Expand Down Expand Up @@ -60,7 +60,8 @@ public class AppCenter.CategoryView : Gtk.Box {
stack.add_child (spinner);
stack.add_child (scrolled);

append (stack);
child = stack;
title = category.name;

populate ();

Expand Down
5 changes: 3 additions & 2 deletions src/Views/Homepage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Dane Henson <[email protected]>
*/

public class AppCenter.Homepage : Gtk.Box {
public class AppCenter.Homepage : Adw.NavigationPage {
public signal void show_package (AppCenterCore.Package package);
public signal void show_category (AppStream.Category category);

Expand Down Expand Up @@ -209,7 +209,8 @@ public class AppCenter.Homepage : Gtk.Box {
hscrollbar_policy = Gtk.PolicyType.NEVER
};

append (scrolled_window);
child = scrolled_window;
title = _("Home");

var local_package = App.local_package;
if (local_package != null) {
Expand Down
6 changes: 4 additions & 2 deletions src/Views/SearchView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Atheesh Thirumalairajan <[email protected]>
*/

public class AppCenter.SearchView : Gtk.Box {
public class AppCenter.SearchView : Adw.NavigationPage {
public signal void show_app (AppCenterCore.Package package);

public string? current_search_term { get; set; default = null; }
Expand Down Expand Up @@ -48,7 +48,9 @@ public class AppCenter.SearchView : Gtk.Box {
hscrollbar_policy = Gtk.PolicyType.NEVER
};

append (scrolled);
child = scrolled;
/// TRANSLATORS: the name of the Search view
title = C_("view", "Search");

notify["current-search-term"].connect (() => {
if (current_search_term == null) {
Expand Down

0 comments on commit 71811e4

Please sign in to comment.