Menu categories should now display in alphabetical order.

This commit is contained in:
Storm Dragon 2024-06-29 19:00:36 -04:00
parent f5b34aa89c
commit c0b5c2ee29

View File

@ -10,7 +10,6 @@
# You should have received a copy of the GNU General Public License along with I38. If not, see <https://www.gnu.org/licenses/>.
import os
import configparser
from pathlib import Path
@ -99,7 +98,7 @@ for entry in desktop_entries:
except configparser.NoOptionError:
continue
class XdgMenuWindow(Gtk.Window):
class Xdg_Menu_Window(Gtk.Window):
def __init__(self):
super().__init__(title="I38 Menu")
self.set_default_size(400, 300)
@ -107,7 +106,9 @@ class XdgMenuWindow(Gtk.Window):
self.store = Gtk.TreeStore(str, str) # Columns: Category/Application Name, Exec Command
for category, entries in categories.items():
sorted_categories = sorted(categories.items()) # Sort categories alphabetically
for category, entries in sorted_categories:
if category == "":
continue
category_iter = self.store.append(parent=None, row=[category, None])
@ -160,7 +161,7 @@ class XdgMenuWindow(Gtk.Window):
else:
self.treeview.collapse_row(path)
win = XdgMenuWindow()
win = Xdg_Menu_Window()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()