storagelist: Reset list position after deleting volume (bz 1279861)

This commit is contained in:
Cole Robinson 2015-11-10 17:27:49 -05:00
parent 07e22c926a
commit ba8080db3f
2 changed files with 9 additions and 2 deletions

View File

@ -217,7 +217,7 @@
<property name="border_width">3</property>
<property name="position">200</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow6">
<object class="GtkScrolledWindow" id="pool-scroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
@ -525,7 +525,7 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow5">
<object class="GtkScrolledWindow" id="vol-scroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>

View File

@ -415,6 +415,9 @@ class vmmStorageList(vmmGObjectUI):
list_widget.get_selection().unselect_all()
model.clear()
vadj = self.widget("vol-scroll").get_vadjustment()
vscroll_percent = vadj.get_value() / max(vadj.get_upper(), 1)
for vol in vols:
key = vol.get_connkey()
@ -455,6 +458,10 @@ class vmmStorageList(vmmGObjectUI):
row[VOL_COLUMN_SENSITIVE] = sensitive
model.append(row)
def _reset_vscroll_position():
vadj.set_value(vadj.get_upper() * vscroll_percent)
self.idle_add(_reset_vscroll_position)
def _confirm_changes(self):
if not self._active_edits:
return True