Skip to content

Commit

Permalink
Merge pull request #679 from mjakeman/accessibility-improvements
Browse files Browse the repository at this point in the history
Accessibility Improvements
  • Loading branch information
oscfdezdz committed Sep 16, 2024
2 parents 74f8bd9 + added27 commit ec54a77
Show file tree
Hide file tree
Showing 27 changed files with 925 additions and 1,076 deletions.
2 changes: 2 additions & 0 deletions data/icons/hicolor/scalable/actions/supported-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions data/icons/hicolor/scalable/actions/unknown-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions data/icons/hicolor/scalable/actions/unsupported-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
184 changes: 103 additions & 81 deletions src/exm-browse-page.blp
Original file line number Diff line number Diff line change
@@ -1,85 +1,107 @@
using Gtk 4.0;
using Adw 1;

template $ExmBrowsePage : Gtk.Widget {
notify::manager => $on_bind_manager();

Gtk.ScrolledWindow {
Adw.StatusPage {
title: _("Search for Extensions");
description: _("Enter a keyword to search 'extensions.gnome.org' for GNOME Shell Extensions");
valign: start;
vexpand: true;

child: Adw.Clamp {
Gtk.Box {
orientation: vertical;

Gtk.Box {
styles ["linked"]

Gtk.SearchEntry search_entry {
hexpand: true;
search-delay: 750;
realize => $on_search_entry_realize();
search-changed => $on_search_changed() swapped;
changed => $gtk_widget_grab_focus();
}

// Keep the same order as the ExmSearchSort enum
Gtk.DropDown search_dropdown {
model: StringList {
// Translators: dropdown items for sorting search results
strings [_("Relevance"), C_("Sort search results", "Downloads"), _("Recent"), _("Name")]
};
notify::selected => $on_search_changed() swapped;
}
}

Gtk.Stack search_stack {
Gtk.StackPage {
name: "page_spinner";
child: Gtk.Spinner {
valign: center;
halign: center;
spinning: true;
height-request: 32;
width-request: 32;
};
}

Gtk.StackPage {
name: "page_results";
child: Gtk.Box {
orientation: vertical;

Gtk.ListBox search_results {
styles ["boxed-list"]
valign: start;
selection-mode: none;
}

Gtk.Button more_results_btn {
label: _("_Load More Results");
halign: center;
margin-top: 24;
use-underline: true;
clicked => $on_load_more_results();
}
};
}

Gtk.StackPage {
name: "page_empty";
child: Gtk.Label {
label: _("No Results Found");
valign: start;
halign: center;
};
}
}
}
};
}
}
template $ExmBrowsePage: Gtk.Widget {
notify::manager => $on_bind_manager();

Gtk.ScrolledWindow {
Adw.StatusPage status_page {
title: _("Search for Extensions");
description: _("Enter a keyword to search 'extensions.gnome.org' for GNOME Shell Extensions");
valign: start;
vexpand: true;

child: Adw.Clamp {
Gtk.Box {
orientation: vertical;

Gtk.Box {
styles [
"linked"
]

Gtk.SearchEntry search_entry {
hexpand: true;
search-delay: 750;
realize => $on_search_entry_realize();
search-changed => $on_search_changed() swapped;
changed => $gtk_widget_grab_focus();

accessibility {
labelled-by: status_page;
}
}

// Keep the same order as the ExmSearchSort enum
Gtk.DropDown search_dropdown {
model: StringList {
// Translators: dropdown items for sorting search results
strings [
_("Relevance"),
C_("Sort search results", "Downloads"),
_("Recent"),
_("Name")
]
};

notify::selected => $on_search_changed() swapped;

accessibility {
description: _("Sort search results");
}
}
}

Gtk.Stack search_stack {
Gtk.StackPage {
name: "page_spinner";

child: Gtk.Spinner {
valign: center;
halign: center;
spinning: true;
height-request: 32;
width-request: 32;
};
}

Gtk.StackPage {
name: "page_results";

child: Gtk.Box {
orientation: vertical;

Gtk.ListBox search_results {
styles [
"boxed-list"
]

valign: start;
selection-mode: none;
}

Gtk.Button more_results_btn {
label: _("_Load More Results");
halign: center;
margin-top: 24;
use-underline: true;
clicked => $on_load_more_results();
}
};
}

Gtk.StackPage {
name: "page_empty";

child: Gtk.Label {
label: _("No Results Found");
valign: start;
halign: center;
};
}
}
}
};
}
}
}
7 changes: 3 additions & 4 deletions src/exm-browse-page.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,11 @@ on_first_page_result (GObject *source,
{
GError *error = NULL;
GListModel *to_append;
int n_items;
int i;

to_append = exm_search_provider_query_finish (EXM_SEARCH_PROVIDER (source), res, &self->max_pages, &error);

if (G_IS_LIST_MODEL (to_append))
{
n_items = g_list_model_get_n_items (G_LIST_MODEL (to_append));

// Populate list model
self->search_results_model = to_append;
}
Expand Down Expand Up @@ -221,6 +217,9 @@ on_next_page_result (GObject *source,

item = g_list_model_get_object (to_append, i);
g_list_store_append (G_LIST_STORE (self->search_results_model), item);

if (i == 0)
gtk_widget_grab_focus (gtk_widget_get_last_child (GTK_WIDGET (self->search_results)));
}

// Remove unnecessary model
Expand Down
Loading

0 comments on commit ec54a77

Please sign in to comment.