Ignore:
Timestamp:
06/19/12 14:52:44 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Implemented option to control whether to quit or hide when the window close button is pressed

Location:
src/mlx/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/gui.py

    r246 r249  
    8383        window.set_icon_from_file(os.path.join(iconDirectory, "logo.ico"))
    8484        window.set_resizable(False)
    85         window.connect("delete-event",
    86                        lambda a, b: self.hideMainWindow())
     85        window.connect("delete-event", self.deleteMainWindow)
    8786        window.connect("window-state-event", self._handleMainWindowState)
    8887        accelGroup = gtk.AccelGroup()
     
    568567            self.showMainWindow()
    569568        self._mainWindow.present()
     569
     570    def deleteMainWindow(self, window, event):
     571        """Handle the delete event for the main window."""
     572        if self.config.quitOnClose:
     573            self._quit()
     574        else:
     575            self.hideMainWindow()
     576        return True
    570577
    571578    def hideMainWindow(self, savePosition = True):
  • src/mlx/gui/prefs.py

    r233 r249  
    225225        self._setLanguage(config.language)
    226226        self._hideMinimizedWindow.set_active(config.hideMinimizedWindow)
     227        self._quitOnClose.set_active(config.quitOnClose)
    227228        self._onlineGateSystem.set_active(config.onlineGateSystem)
    228229        self._onlineACARS.set_active(config.onlineACARS)
     
    270271        config.language = self._getLanguage()
    271272        config.hideMinimizedWindow = self._hideMinimizedWindow.get_active()
     273        config.quitOnClose = self._quitOnClose.get_active()
    272274        config.onlineGateSystem = self._onlineGateSystem.get_active()
    273275        config.onlineACARS = self._onlineACARS.get_active()
     
    347349        self._hideMinimizedWindow.set_tooltip_text(xstr("prefs_hideMinimizedWindow_tooltip"))
    348350        guiBox.pack_start(self._hideMinimizedWindow, False, False, 4)
     351
     352        self._quitOnClose = gtk.CheckButton(xstr("prefs_quitOnClose"))
     353        self._quitOnClose.set_use_underline(True)
     354        self._quitOnClose.set_tooltip_text(xstr("prefs_quitOnClose_tooltip"))
     355        guiBox.pack_start(self._quitOnClose, False, False, 4)
    349356
    350357        onlineBox = self._createFrame(mainBox, xstr("prefs_frame_online"))       
Note: See TracChangeset for help on using the changeset viewer.