set item padding of iconviews based on item size

This commit is contained in:
coderkun 2016-06-11 14:06:06 +02:00
parent be3037bc03
commit c8dd5f7a83
2 changed files with 7 additions and 4 deletions

View file

@ -560,13 +560,13 @@
<object class="GtkIconView" id="playlist-iconview"> <object class="GtkIconView" id="playlist-iconview">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="margin">6</property> <property name="margin">0</property>
<property name="item_orientation">horizontal</property> <property name="item_orientation">horizontal</property>
<property name="columns">3</property> <property name="columns">3</property>
<property name="row_spacing">0</property> <property name="row_spacing">0</property>
<property name="column_spacing">0</property> <property name="column_spacing">0</property>
<property name="tooltip_column">1</property> <property name="tooltip_column">1</property>
<property name="item_padding">5</property> <property name="item_padding">0</property>
<style> <style>
<class name="no-bg"/> <class name="no-bg"/>
</style> </style>
@ -643,13 +643,13 @@
<object class="GtkIconView" id="library-iconview"> <object class="GtkIconView" id="library-iconview">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="margin">6</property> <property name="margin">0</property>
<property name="selection_mode">none</property> <property name="selection_mode">none</property>
<property name="item_orientation">horizontal</property> <property name="item_orientation">horizontal</property>
<property name="row_spacing">0</property> <property name="row_spacing">0</property>
<property name="column_spacing">0</property> <property name="column_spacing">0</property>
<property name="tooltip_column">1</property> <property name="tooltip_column">1</property>
<property name="item_padding">5</property> <property name="item_padding">0</property>
<property name="activate_on_single_click">True</property> <property name="activate_on_single_click">True</property>
<signal name="item-activated" handler="on_library-iconview_item_activated" swapped="no"/> <signal name="item-activated" handler="on_library-iconview_item_activated" swapped="no"/>
<style> <style>

View file

@ -1020,6 +1020,7 @@ class PlaylistPanel(mcg.Base):
self._playlist_grid.set_model(None) self._playlist_grid.set_model(None)
self._playlist_grid.freeze_child_notify() self._playlist_grid.freeze_child_notify()
self._playlist_grid_model.clear() self._playlist_grid_model.clear()
GObject.idle_add(self._playlist_grid.set_item_padding, size / 100)
cache = mcg.MCGCache(host, size) cache = mcg.MCGCache(host, size)
for album in playlist: for album in playlist:
@ -1177,6 +1178,7 @@ class LibraryPanel(mcg.Base):
return return
self._item_size = size self._item_size = size
GObject.idle_add(self._set_widget_grid_size, self._library_grid, size, True) GObject.idle_add(self._set_widget_grid_size, self._library_grid, size, True)
GObject.idle_add(self._library_grid.set_item_padding, size / 100)
def on_grid_scale_changed(self, widget, event): def on_grid_scale_changed(self, widget, event):
@ -1331,6 +1333,7 @@ class LibraryPanel(mcg.Base):
self._albums = albums self._albums = albums
GObject.idle_add(self._progress_revealer.set_reveal_child, True) GObject.idle_add(self._progress_revealer.set_reveal_child, True)
GObject.idle_add(self._progress_bar.set_fraction, 0.0) GObject.idle_add(self._progress_bar.set_fraction, 0.0)
GObject.idle_add(self._library_grid.set_item_padding, size / 100)
self._library_grid.set_model(None) self._library_grid.set_model(None)
self._library_grid.freeze_child_notify() self._library_grid.freeze_child_notify()
self._library_grid_model.clear() self._library_grid_model.clear()