Commit cb9378c2 authored by Jean Felder's avatar Jean Felder Committed by Jean Felder

playlistdialog: Update listbox's style

This way the dialog style looks closer to the original mockups.

see: https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/music/wire-add-to-playlist-dialog.png
parent 72352024
......@@ -94,3 +94,17 @@ box#ArtistAlbumsWidget .artist-label {
.tooltip-title {
font-weight: bold;
}
/* PlaylistDialog */
.playlistdialog-row {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.playlistdialog-row:selected {
color: @theme_fg_color;
background-color: @theme_insensitive_bg_color;
}
.playlistdialog-row:selected label {
color: @theme_text_color;
}
......@@ -205,7 +205,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selection_mode">single</property>
<signal name="row-selected" handler="_on_row_selected" swapped="no"/>
<property name="valign">start</property>
<signal name="selected-rows-changed" handler="_on_selected_rows_changed" swapped="no"/>
</object>
</child>
</object>
......
......@@ -6,11 +6,22 @@
<class name="playlistdialog-row"/>
</style>
<child>
<object class="GtkLabel" id="_label">
<property name="ellipsize">end</property>
<property name="margin">8</property>
<object class="GtkBox" id="hbox">
<property name="visible">True</property>
<property name="xalign">0.0</property>
<child>
<object class="GtkLabel" id="_label">
<property name="ellipsize">end</property>
<property name="margin">8</property>
<property name="visible">True</property>
<property name="xalign">0.0</property>
</object>
</child>
<child>
<object class="GtkImage" id="_selection_icon">
<property name="icon-name">object-select-symbolic</property>
<property name="icon-size">2</property>
</object>
</child>
</object>
</child>
</template>
......
......@@ -128,10 +128,14 @@ class PlaylistDialog(Gtk.Dialog):
@Gtk.Template.Callback()
@log
def _on_row_selected(self, listbox, row):
def _on_selected_rows_changed(self, klass):
self._add_playlist_entry.props.text = ""
self._add_playlist_button.props.sensitive = False
self._select_button.props.sensitive = row is not None
selected_row = self._listbox.get_selected_row()
self._select_button.props.sensitive = selected_row is not None
for row in self._listbox:
row.props.selected = (row == selected_row)
@Gtk.Template.Callback()
@log
......
......@@ -33,8 +33,10 @@ class PlaylistDialogRow(Gtk.ListBoxRow):
__gtype_name__ = "PlaylistDialogRow"
playlist = GObject.Property(type=Grl.Media, default=None)
selected = GObject.Property(type=bool, default=False)
_label = Gtk.Template.Child()
_selection_icon = Gtk.Template.Child()
def __repr__(self):
return "PlaylistDialogRow"
......@@ -48,3 +50,7 @@ class PlaylistDialogRow(Gtk.ListBoxRow):
self.props.playlist = playlist
self._label.props.label = utils.get_media_title(playlist)
self.bind_property(
"selected", self._selection_icon, "visible",
GObject.BindingFlags.SYNC_CREATE)
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