Change sidebat appearence

parent 72b72e46
......@@ -275,9 +275,9 @@ class Page:
stack_page.set_name(self.name)
row = TuneItPanelRow()
row.set_name(self.name)
row.set_title(self.name)
row.icon_name = self.icon
row.props.name = self.name
row.props.title = self.name
row.props.icon_name = self.icon
listbox.append(row)
else:
print(f"the page {self.name} is empty, ignored")
......@@ -335,7 +335,7 @@ def init_settings_stack(stack, listbox, split_view):
def on_row_selected(listbox, row):
if row:
page_id = row.get_name()
page_id = row.props.name
print(f"Selected page: {page_id}")
visible_child = stack.get_child_by_name(page_id)
......
using Gtk 4.0;
using Adw 1;
template $TuneItPanelRow: Adw.PreferencesRow {
child: Box {
template $TuneItPanelRow: ListBoxRow {
Box {
spacing: 12;
margin-start: 6;
margin-end: 6;
margin-top: 12;
margin-bottom: 12;
margin-top: 6;
margin-bottom: 6;
margin-start: 2;
margin-end: 2;
Image thumbnail_image {
icon-name: bind template.icon-name;
......@@ -15,17 +14,28 @@ template $TuneItPanelRow: Adw.PreferencesRow {
Box {
orientation: vertical;
valign: center;
spacing: 2;
Label label {
Label title_label {
label: bind template.title;
halign: start;
justify: left;
wrap: true;
}
// Label sub_label {
// label: bind template.subtitle;
// styles [
// "caption"
// ]
// }
Label subtitle_label {
styles [
"caption",
"dim-label",
]
label: bind template.subtitle;
visible: bind template.subtitle-visible;
halign: start;
justify: left;
wrap: true;
}
}
}
};
}
......@@ -2,24 +2,12 @@ from gi.repository import GObject, Adw, Gtk
@Gtk.Template(resource_path='/ru.ximperlinux.TuneIt/settings/widgets/panel_row.ui')
class TuneItPanelRow(Adw.PreferencesRow):
__gtype_name__ = "TuneItPanelRow"
def __init__(self, **kwargs):
super().__init__(**kwargs)
@GObject.Property(type=str, default="")
def icon_name(self):
return self._icon_name
class TuneItPanelRow(Gtk.ListBoxRow):
@icon_name.setter
def icon_name(self, icon_name):
self._icon_name = icon_name
@GObject.Property(type=str, default="")
def subtitle(self):
return self._subtitle
__gtype_name__ = "TuneItPanelRow"
@subtitle.setter
def subtitle(self, subtitle):
self._subtitle = subtitle
name = GObject.Property(type=str, default='')
title = GObject.Property(type=str, default='')
subtitle = GObject.Property(type=str, default='')
subtitle_visible = GObject.Property(type=bool, default=False)
icon_name = GObject.Property(type=str, default='')
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