Remove 'view active vs. inactive' choice in main manager window.

I really don't think anyone cares about this, and if they do, it certainly
doesn't need to be done as an entire separate row in the manager window.
This commit is contained in:
Cole Robinson 2009-07-26 16:12:39 -04:00
parent e33018602d
commit 8725f6ed59
2 changed files with 25 additions and 110 deletions

View File

@ -150,8 +150,6 @@ class vmmManager(gobject.GObject):
self.config.on_stats_enable_net_poll_changed(self.enable_polling, self.config.on_stats_enable_net_poll_changed(self.enable_polling,
VMLIST_SORT_NETWORK_USAGE) VMLIST_SORT_NETWORK_USAGE)
self.window.get_widget("vm-view").set_active(0)
self.vmmenu_icons = {} self.vmmenu_icons = {}
self.vmmenu_icons["run"] = gtk.Image() self.vmmenu_icons["run"] = gtk.Image()
self.vmmenu_icons["run"].set_from_stock(gtk.STOCK_MEDIA_PLAY, self.vmmenu_icons["run"].set_from_stock(gtk.STOCK_MEDIA_PLAY,
@ -305,7 +303,6 @@ class vmmManager(gobject.GObject):
"on_menu_edit_delete_activate": self.delete_vm, "on_menu_edit_delete_activate": self.delete_vm,
"on_menu_host_details_activate": self.show_host, "on_menu_host_details_activate": self.show_host,
"on_vm_view_changed": self.vm_view_changed,
"on_vm_list_row_activated": self.open_vm_console, "on_vm_list_row_activated": self.open_vm_console,
"on_vm_list_row_expanded": self.row_expanded, "on_vm_list_row_expanded": self.row_expanded,
"on_vm_list_row_collapsed": self.row_collapsed, "on_vm_list_row_collapsed": self.row_collapsed,
@ -377,18 +374,6 @@ class vmmManager(gobject.GObject):
def new_connection(self, src=None): def new_connection(self, src=None):
self.emit("action-show-connect") self.emit("action-show-connect")
def is_showing_active(self):
active = self.window.get_widget("vm-view").get_active()
if active in [0,1]:
return True
return False
def is_showing_inactive(self):
active = self.window.get_widget("vm-view").get_active()
if active in [0,2]:
return True
return False
def vm_row_key(self, vm): def vm_row_key(self, vm):
return vm.get_uuid() + ":" + vm.get_connection().get_uri() return vm.get_uuid() + ":" + vm.get_connection().get_uri()
@ -433,36 +418,6 @@ class vmmManager(gobject.GObject):
asyncjob.set_error(err, details) asyncjob.set_error(err, details)
def vm_view_changed(self, src):
vmlist = self.window.get_widget("vm-list")
model = vmlist.get_model()
_iter = model.get_iter_first()
while _iter is not None:
conn = model.get_value(_iter, ROW_HANDLE)
children = model.iter_children(_iter)
while children is not None:
vm = model.get_value(children, ROW_HANDLE)
del self.rows[self.vm_row_key(vm)]
model.remove(children)
children = model.iter_children(_iter)
if conn:
uuids = conn.list_vm_uuids()
for vmuuid in uuids:
vm = conn.get_vm(vmuuid)
if vm.is_active():
if not(self.is_showing_active()):
continue
else:
if not(self.is_showing_inactive()):
continue
self._append_vm(model, vm, conn)
_iter = model.iter_next(_iter)
def vm_added(self, connection, uri, vmuuid): def vm_added(self, connection, uri, vmuuid):
vm = connection.get_vm(vmuuid) vm = connection.get_vm(vmuuid)
vm.connect("status-changed", self.vm_status_changed) vm.connect("status-changed", self.vm_status_changed)
@ -471,13 +426,6 @@ class vmmManager(gobject.GObject):
vmlist = self.window.get_widget("vm-list") vmlist = self.window.get_widget("vm-list")
model = vmlist.get_model() model = vmlist.get_model()
if vm.is_active():
if not(self.is_showing_active()):
return
else:
if not(self.is_showing_inactive()):
return
self._append_vm(model, vm, connection) self._append_vm(model, vm, connection)
def vm_started(self, connection, uri, vmuuid): def vm_started(self, connection, uri, vmuuid):
@ -555,13 +503,6 @@ class vmmManager(gobject.GObject):
def vm_status_changed(self, vm, status): def vm_status_changed(self, vm, status):
parent = self.rows[vm.get_connection().get_uri()].iter parent = self.rows[vm.get_connection().get_uri()].iter
wanted = False
if vm.is_active():
if self.is_showing_active():
wanted = True
else:
if self.is_showing_inactive():
wanted = True
vmlist = self.window.get_widget("vm-list") vmlist = self.window.get_widget("vm-list")
model = vmlist.get_model() model = vmlist.get_model()
@ -570,14 +511,10 @@ class vmmManager(gobject.GObject):
for row in range(model.iter_n_children(parent)): for row in range(model.iter_n_children(parent)):
_iter = model.iter_nth_child(parent, row) _iter = model.iter_nth_child(parent, row)
if model.get_value(_iter, ROW_KEY) == vm.get_uuid(): if model.get_value(_iter, ROW_KEY) == vm.get_uuid():
if wanted: missing = False
missing = False
else:
model.remove(model.iter_nth_child(parent, row))
del self.rows[self.vm_row_key(vm)]
break break
if missing and wanted: if missing:
self._append_vm(model, vm, vm.get_connection()) self._append_vm(model, vm, vm.get_connection())

View File

@ -262,6 +262,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">False</property> <property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -269,110 +270,87 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="spacing">6</property> <property name="spacing">6</property>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">_View:</property>
<property name="use_underline">True</property>
<property name="justify">GTK_JUSTIFY_RIGHT</property>
<property name="ellipsize">PANGO_ELLIPSIZE_START</property>
</widget>
</child>
<child>
<widget class="GtkComboBox" id="vm-view">
<property name="visible">True</property>
<property name="items" translatable="yes">All virtual machines
Active virtual machines
Inactive virtual machines</property>
<signal name="changed" handler="on_vm_view_changed"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow1"> <widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">GTK_SHADOW_IN</property> <property name="shadow_type">in</property>
<child> <child>
<widget class="GtkTreeView" id="vm-list"> <widget class="GtkTreeView" id="vm-list">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="rules_hint">True</property> <property name="rules_hint">True</property>
<signal name="button_press_event" handler="on_vm_list_button_press_event"/> <signal name="button_press_event" handler="on_vm_list_button_press_event"/>
<signal name="row_collapsed" handler="on_vm_list_row_collapsed"/>
<signal name="row_expanded" handler="on_vm_list_row_expanded"/> <signal name="row_expanded" handler="on_vm_list_row_expanded"/>
<signal name="row_collapsed" handler="on_vm_list_row_collapsed"/>
<signal name="row_activated" handler="on_vm_list_row_activated"/> <signal name="row_activated" handler="on_vm_list_row_activated"/>
</widget> </widget>
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="position">1</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkHButtonBox" id="hbuttonbox2"> <widget class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">3</property> <property name="spacing">3</property>
<property name="layout_style">GTK_BUTTONBOX_END</property> <property name="layout_style">end</property>
<child> <child>
<widget class="GtkButton" id="vm-delete"> <widget class="GtkButton" id="vm-delete">
<property name="label">gtk-delete</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="label">gtk-delete</property> <property name="receives_default">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_vm_delete_clicked"/> <signal name="clicked" handler="on_vm_delete_clicked"/>
</widget> </widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkButton" id="vm-new"> <widget class="GtkButton" id="vm-new">
<property name="label">gtk-new</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="label">gtk-new</property> <property name="receives_default">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_vm_new_clicked"/> <signal name="clicked" handler="on_vm_new_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkButton" id="vm-open"> <widget class="GtkButton" id="vm-open">
<property name="label">gtk-open</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="label">gtk-open</property> <property name="receives_default">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_vm_open_clicked"/> <signal name="clicked" handler="on_vm_open_clicked"/>
</widget> </widget>
<packing> <packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">2</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
</widget> </widget>