Change sidebat appearence

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