Commit e001f439 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui
Browse files

Sort Icons & Icons contexts

parent 0776f918
Pipeline #96911 passed with stages
in 14 minutes and 58 seconds
......@@ -68,6 +68,7 @@ configure_file(
ui_config = configuration_data()
ui_config.set('app-id', application_id)
ui_config.set('version', meson.project_version() + version_suffix)
ui_config.set('name-suffix', name_suffix)
ui_preconfigured_files = files(
'resources/ui/about_dialog.ui.in',
'resources/ui/window.ui.in',
......
......@@ -8,6 +8,7 @@
<property name="default_width">600</property>
<property name="default_height">400</property>
<property name="icon_name">@app-id@</property>
<property name="title">Icon Library@name-suffix@</property>
<child type="titlebar">
<object class="HdyHeaderBar" id="headerbar">
<property name="visible">True</property>
......@@ -21,7 +22,7 @@
<property name="maximum_width">400</property>
<property name="linear_growth_width">400</property>
<child>
<object class="GtkSearchEntry">
<object class="GtkSearchEntry" id="search_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
......
use gdk;
use gio::prelude::*;
use glib;
use gtk;
use gtk::prelude::*;
use std::fs;
......
......@@ -51,7 +51,8 @@ impl IconsView {
fn fill(&self, parent: &gtk::ApplicationWindow) {
let theme = IconTheme::get_default();
let icons = theme.unwrap().list_icons(Some(self.context.as_str()));
let mut icons = theme.unwrap().list_icons(Some(self.context.as_str()));
icons.sort_by(|a, b| a.as_str().cmp(&b.as_str()));
let icons_blacklist = vec![
"gesture-rotate-clockwise-symbolic",
......
......@@ -8,23 +8,22 @@ use crate::window_state;
pub struct Window {
pub widget: gtk::ApplicationWindow,
appmenu_button: gtk::MenuButton,
search_entry: gtk::SearchEntry,
}
impl Window {
pub fn new() -> Self {
let settings = gio::Settings::new(APP_ID);
let builder = gtk::Builder::new_from_resource("/com/bilelmoussaoui/IconLibrary/window.ui");
let window_widget: gtk::ApplicationWindow = builder.get_object("window").unwrap();
let appmenu_btn: gtk::MenuButton = builder.get_object("appmenu_button").unwrap();
let widget: gtk::ApplicationWindow = builder.get_object("window").unwrap();
let appmenu_button: gtk::MenuButton = builder.get_object("appmenu_button").unwrap();
let search_entry: gtk::SearchEntry = builder.get_object("search_entry").unwrap();
if PROFILE == "Devel" {
window_widget.get_style_context().add_class("devel");
widget.get_style_context().add_class("devel");
}
let window = Window {
widget: window_widget,
appmenu_button: appmenu_btn,
};
let window = Window { widget, appmenu_button, search_entry };
window.init(settings);
window
......@@ -49,8 +48,8 @@ impl Window {
let container = gtk::Box::new(gtk::Orientation::Vertical, 0);
let theme = gtk::IconTheme::get_default().unwrap();
let icon_contexts = theme.list_contexts();
let mut icon_contexts = theme.list_contexts();
icon_contexts.sort_by(|a, b| a.as_str().cmp(&b.as_str()));
for context in icon_contexts.iter() {
let context_str = context.as_str();
if legacy_contexts.contains(&context_str) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment