From 2d5f858d2e9b3fd288efff11a753656953b72f4c Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 29 Nov 2010 13:15:06 -0500 Subject: [PATCH] console: Remove mouse grab notification The window title informs the user about the key combo, so this is kind of redundant. virt-viewer has never had it and no one has complained, so I doubt people will stuggle with it. --- src/virtManager/config.py | 7 ----- src/virtManager/console.py | 53 -------------------------------------- 2 files changed, 60 deletions(-) diff --git a/src/virtManager/config.py b/src/virtManager/config.py index fbbb07bbe..6803b2d25 100644 --- a/src/virtManager/config.py +++ b/src/virtManager/config.py @@ -445,13 +445,6 @@ class vmmConfig: def set_console_scaling(self, pref): self.conf.set_int(self.conf_dir + "/console/scaling", pref) - # VNC console pointer grab notification - def show_console_grab_notify(self): - return self.conf.get_bool(self.conf_dir + "/console/grab-notify") - def set_console_grab_notify(self, state): - self.conf.set_bool(self.conf_dir + "/console/grab-notify", state) - - # Show VM details toolbar def get_details_show_toolbar(self): res = self.conf.get_bool(self.conf_dir + "/details/show-toolbar") diff --git a/src/virtManager/console.py b/src/virtManager/console.py index b7719e0cf..0caa76a67 100644 --- a/src/virtManager/console.py +++ b/src/virtManager/console.py @@ -105,10 +105,6 @@ class vmmConsolePages(gobject.GObject): gtk.ICON_SIZE_BUTTON) self.window.get_widget("console-auth-login").set_image(finish_img) - self.notifyID = None - self.notifyInterface = None - self.init_dbus() - # Make VNC widget background always be black black = gtk.gdk.Color(0, 0, 0) self.window.get_widget("console-vnc-viewport").modify_bg( @@ -128,21 +124,6 @@ class vmmConsolePages(gobject.GObject): # Initialization helpers # ########################## - def init_dbus(self): - try: - bus = dbus.SessionBus() - notifyObject = bus.get_object("org.freedesktop.Notifications", - "/org/freedesktop/Notifications") - self.notifyInterface = dbus.Interface(notifyObject, - "org.freedesktop.Notifications") - self.notifyInterface.connect_to_signal("ActionInvoked", - self.notify_action) - self.notifyInterface.connect_to_signal("NotificationClosed", - self.notify_closed) - except Exception, e: - logging.error("Cannot initialize notification system" + str(e)) - - def init_vnc(self): self.vncViewer.realize() @@ -200,43 +181,9 @@ class vmmConsolePages(gobject.GObject): self.topwin.set_title(_("Press %s to release pointer.") % keystr + " " + self.title) - if (not self.config.show_console_grab_notify() or - not self.notifyInterface): - return - - try: - if self.notifyID is not None: - self.notifyInterface.CloseNotification(self.notifyID) - self.notifyID = None - - (x, y) = self.topwin.window.get_origin() - self.notifyID = self.notifyInterface.Notify(self.topwin.get_title(), - 0, - '', - _("Pointer grabbed"), - _("The mouse pointer has been restricted to the virtual console window. To release the pointer, press the key pair") + " " + keystr, - ["dismiss", _("Do not show this notification in the future.")], - {"desktop-entry": "virt-manager", - "x": x+200, "y": y}, - 8 * 1000) - except Exception, e: - logging.error("Cannot popup notification " + str(e)) - def notify_ungrabbed(self, src): self.topwin.set_title(self.title) - def notify_closed(self, i, reason=None): - if self.notifyID is not None and self.notifyID == i: - self.notifyID = None - - def notify_action(self, i, action): - if self.notifyID is None or self.notifyID != i: - return - - if action == "dismiss": - self.config.set_console_grab_notify(False) - - def _disable_modifiers(self): if self.gtk_settings_accel is not None: return