details: Only enable fullscreen option when it makes sense

This commit is contained in:
Cole Robinson 2011-06-01 12:22:05 -04:00
parent 3ce01b0f18
commit 0bc059d7db
3 changed files with 29 additions and 2 deletions

View File

@ -553,7 +553,7 @@ class vmmConsolePages(vmmGObjectUI):
self.tunnels = None
self.viewerRetriesScheduled = 0
self.viewerRetryDelay = 125
self.viewer_connected = False
self._viewer_connected = False
self.viewer_connecting = False
self.scale_type = self.vm.get_console_scaling()
@ -584,6 +584,8 @@ class vmmConsolePages(vmmGObjectUI):
self.add_gconf_handle(
self.config.on_console_accels_changed(self.set_enable_accel))
self.page_changed()
def is_visible(self):
if self.topwin.flags() & gtk.VISIBLE:
return 1
@ -924,6 +926,21 @@ class vmmConsolePages(vmmGObjectUI):
if self.viewer and self.viewer.get_widget():
self.viewer.get_widget().grab_focus()
def page_changed(self, ignore1=None, ignore2=None, ignore3=None):
self.set_allow_fullscreen()
def set_allow_fullscreen(self):
cpage = self.window.get_widget("console-pages").get_current_page()
dpage = self.window.get_widget("details-pages").get_current_page()
allow_fullscreen = (dpage == 0 and
cpage == PAGE_VIEWER and
self.viewer_connected)
print "ALLOW FULLSCREEN", dpage, cpage, self.viewer_connected, allow_fullscreen
self.window.get_widget("control-fullscreen").set_sensitive(allow_fullscreen)
self.window.get_widget("details-menu-view-fullscreen").set_sensitive(allow_fullscreen)
def disconnected(self):
errout = ""
if self.tunnels is not None:
@ -951,6 +968,13 @@ class vmmConsolePages(vmmGObjectUI):
self.activate_unavailable_page(error)
def _set_viewer_connected(self, val):
self._viewer_connected = val
self.set_allow_fullscreen()
def _get_viewer_connected(self):
return self._viewer_connected
viewer_connected = property(_get_viewer_connected, _set_viewer_connected)
def connected(self):
self.viewer_connected = True
logging.debug("Viewer connected")

View File

@ -386,6 +386,7 @@ class vmmDetails(vmmGObjectUI):
"on_details_menu_view_scale_fullscreen_toggled": self.console.set_scale_type,
"on_details_menu_view_scale_never_toggled": self.console.set_scale_type,
"on_console_pages_switch_page": self.console.page_changed,
"on_console_auth_password_activate": self.console.auth_login,
"on_console_auth_login_clicked": self.console.auth_login,
})
@ -1073,6 +1074,7 @@ class vmmDetails(vmmGObjectUI):
self.page_refresh(newpage)
self.sync_details_console_view(newpage == PAGE_DETAILS)
self.console.set_allow_fullscreen()
if newpage == PAGE_CONSOLE or newpage >= PAGE_DYNAMIC_OFFSET:
self.last_console_page = newpage

View File

@ -515,7 +515,7 @@
<property name="tab_border">0</property>
<property name="tab_hborder">0</property>
<property name="tab_vborder">0</property>
<signal name="switch_page" handler="on_details_pages_switch_page"/>
<signal name="switch_page" handler="on_details_pages_switch_page" after="yes"/>
<child>
<widget class="GtkNotebook" id="console-pages">
<property name="visible">True</property>
@ -524,6 +524,7 @@
<property name="tab_border">0</property>
<property name="tab_hborder">0</property>
<property name="tab_vborder">0</property>
<signal name="switch_page" handler="on_console_pages_switch_page" after="yes"/>
<child>
<widget class="GtkLabel" id="console-unavailable">
<property name="visible">True</property>