Revert "[GTKUI] Add MainWindow.get_window() and replace window attr usage"

Made a mistake with types of window, get_window actually refers to GdkWindow
rather than GtkWindow... The use of self.window.window is confusing and is
still deprecated in Gtk3 so will fix that in following commit.

This reverts commit ccfe6b3c80e054893ae6a626c46be5e3024d8a45.
This commit is contained in:
Calum Lind 2016-11-19 10:16:09 +00:00
parent 6ac296118d
commit b8135617ae
14 changed files with 21 additions and 24 deletions

View File

@ -148,7 +148,7 @@ class AddTorrentDialog(component.Component):
def _show(self, focus=False): def _show(self, focus=False):
if component.get('MainWindow').is_on_active_workspace(): if component.get('MainWindow').is_on_active_workspace():
self.dialog.set_transient_for(component.get('MainWindow').get_window()) self.dialog.set_transient_for(component.get('MainWindow').window)
else: else:
self.dialog.set_transient_for(None) self.dialog.set_transient_for(None)
@ -166,7 +166,7 @@ class AddTorrentDialog(component.Component):
self.previous_selected_torrent = None self.previous_selected_torrent = None
self.torrent_liststore.clear() self.torrent_liststore.clear()
self.files_treestore.clear() self.files_treestore.clear()
self.dialog.set_transient_for(component.get('MainWindow').get_window()) self.dialog.set_transient_for(component.get('MainWindow').window)
return None return None
def update_core_config(self, show=False, focus=False): def update_core_config(self, show=False, focus=False):

View File

@ -129,7 +129,7 @@ class ConnectionManager(component.Component):
# Setup the ConnectionManager dialog # Setup the ConnectionManager dialog
self.connection_manager = self.builder.get_object('connection_manager') self.connection_manager = self.builder.get_object('connection_manager')
self.connection_manager.set_transient_for(component.get('MainWindow').get_window()) self.connection_manager.set_transient_for(component.get('MainWindow').window)
self.connection_manager.set_icon(get_deluge_icon()) self.connection_manager.set_icon(get_deluge_icon())

View File

@ -54,7 +54,7 @@ class CreateTorrentDialog(object):
self.config = ConfigManager('gtkui.conf') self.config = ConfigManager('gtkui.conf')
self.dialog = self.builder.get_object('create_torrent_dialog') self.dialog = self.builder.get_object('create_torrent_dialog')
self.dialog.set_transient_for(component.get('MainWindow').get_window()) self.dialog.set_transient_for(component.get('MainWindow').window)
self.builder.connect_signals({ self.builder.connect_signals({
'on_button_file_clicked': self._on_button_file_clicked, 'on_button_file_clicked': self._on_button_file_clicked,
@ -351,7 +351,7 @@ class CreateTorrentDialog(object):
add_to_session).addCallback(hide_progress) add_to_session).addCallback(hide_progress)
# Setup progress dialog # Setup progress dialog
self.builder.get_object('progress_dialog').set_transient_for(component.get('MainWindow').get_window()) self.builder.get_object('progress_dialog').set_transient_for(component.get('MainWindow').window)
self.builder.get_object('progress_dialog').show_all() self.builder.get_object('progress_dialog').show_all()
self.dialog.destroy() self.dialog.destroy()

View File

@ -32,7 +32,7 @@ class BaseDialog(gtk.Dialog):
""" """
super(BaseDialog, self).__init__( super(BaseDialog, self).__init__(
title=header, title=header,
parent=parent if parent else component.get('MainWindow').get_window(), parent=parent if parent else component.get('MainWindow').window,
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
buttons=buttons) buttons=buttons)

View File

@ -99,7 +99,7 @@ class FilterTreeView(component.Component):
self.treeview.connect('button-press-event', self.on_button_press_event) self.treeview.connect('button-press-event', self.on_button_press_event)
# colors using current theme. # colors using current theme.
style = component.get('MainWindow').get_window().get_style() style = component.get('MainWindow').window.get_style()
self.colour_background = style.bg[gtk.STATE_NORMAL] self.colour_background = style.bg[gtk.STATE_NORMAL]
self.colour_foreground = style.fg[gtk.STATE_NORMAL] self.colour_foreground = style.fg[gtk.STATE_NORMAL]

View File

@ -263,7 +263,7 @@ class GtkUI(object):
# The gtk modal dialogs (e.g. Preferences) can prevent the application # The gtk modal dialogs (e.g. Preferences) can prevent the application
# quitting, so force exiting by destroying MainWindow. Must be done here # quitting, so force exiting by destroying MainWindow. Must be done here
# to avoid hanging when quitting with SIGINT (CTRL-C). # to avoid hanging when quitting with SIGINT (CTRL-C).
self.mainwindow.get_window().destroy() self.mainwindow.window.destroy()
reactor.stop() reactor.stop()

View File

@ -191,9 +191,6 @@ class MainWindow(component.Component):
"""Returns a reference to the main window GTK builder object.""" """Returns a reference to the main window GTK builder object."""
return self.main_builder return self.main_builder
def get_window(self):
return self.window
def quit(self, shutdown=False, restart=False): def quit(self, shutdown=False, restart=False):
"""Quits the GtkUI application. """Quits the GtkUI application.
@ -324,7 +321,7 @@ class MainWindow(component.Component):
""" """
if wnck: if wnck:
self.screen.force_update() self.screen.force_update()
win = wnck.window_get(self.get_window().xid) win = wnck.window_get(self.window.window.xid)
if win: if win:
active_wksp = win.get_screen().get_active_workspace() active_wksp = win.get_screen().get_active_workspace()
if active_wksp: if active_wksp:

View File

@ -285,7 +285,7 @@ class MenuBar(component.Component):
from deluge.ui.gtkui.edittrackersdialog import EditTrackersDialog from deluge.ui.gtkui.edittrackersdialog import EditTrackersDialog
dialog = EditTrackersDialog( dialog = EditTrackersDialog(
component.get('TorrentView').get_selected_torrent(), component.get('TorrentView').get_selected_torrent(),
self.mainwindow.get_window()) self.mainwindow.window)
dialog.run() dialog.run()
def on_menuitem_remove_activate(self, data=None): def on_menuitem_remove_activate(self, data=None):
@ -326,7 +326,7 @@ class MenuBar(component.Component):
# Keep it referenced: # Keep it referenced:
# https://bugzilla.gnome.org/show_bug.cgi?id=546802 # https://bugzilla.gnome.org/show_bug.cgi?id=546802
self.move_storage_dialog = builder.get_object('move_storage_dialog') self.move_storage_dialog = builder.get_object('move_storage_dialog')
self.move_storage_dialog.set_transient_for(self.mainwindow.get_window()) self.move_storage_dialog.set_transient_for(self.mainwindow.window)
self.move_storage_dialog_hbox = builder.get_object('hbox_entry') self.move_storage_dialog_hbox = builder.get_object('hbox_entry')
self.move_storage_path_chooser = PathChooser('move_completed_paths_list') self.move_storage_path_chooser = PathChooser('move_completed_paths_list')
self.move_storage_dialog_hbox.add(self.move_storage_path_chooser) self.move_storage_dialog_hbox.add(self.move_storage_path_chooser)
@ -554,7 +554,7 @@ class MenuBar(component.Component):
ErrorDialog( ErrorDialog(
_('Ownership Change Error'), _('Ownership Change Error'),
_('There was an error while trying changing ownership.'), _('There was an error while trying changing ownership.'),
self.mainwindow.get_window(), details=failure.value.logable() self.mainwindow.window, details=failure.value.logable()
).run() ).run()
client.core.set_owner( client.core.set_owner(
update_torrents, username).addErrback(failed_change_owner) update_torrents, username).addErrback(failed_change_owner)

View File

@ -25,7 +25,7 @@ def accel_meta(item, group, key):
def menubar_osx(gtkui, osxapp): def menubar_osx(gtkui, osxapp):
main_builder = gtkui.mainwindow.get_builder() main_builder = gtkui.mainwindow.get_builder()
menubar = main_builder.get_object('menubar') menubar = main_builder.get_object('menubar')
group = accel_groups_from_object(gtkui.mainwindow.get_window())[0] group = accel_groups_from_object(gtkui.mainwindow.window)[0]
config = ConfigManager('gtkui.conf') config = ConfigManager('gtkui.conf')

View File

@ -50,7 +50,7 @@ class Preferences(component.Component):
self.builder.add_from_file(deluge.common.resource_filename( self.builder.add_from_file(deluge.common.resource_filename(
'deluge.ui.gtkui', os.path.join('glade', 'preferences_dialog.ui'))) 'deluge.ui.gtkui', os.path.join('glade', 'preferences_dialog.ui')))
self.pref_dialog = self.builder.get_object('pref_dialog') self.pref_dialog = self.builder.get_object('pref_dialog')
self.pref_dialog.set_transient_for(component.get('MainWindow').get_window()) self.pref_dialog.set_transient_for(component.get('MainWindow').window)
self.pref_dialog.set_icon(get_deluge_icon()) self.pref_dialog.set_icon(get_deluge_icon())
self.treeview = self.builder.get_object('treeview') self.treeview = self.builder.get_object('treeview')
self.notebook = self.builder.get_object('notebook') self.notebook = self.builder.get_object('notebook')

View File

@ -52,7 +52,7 @@ class QueuedTorrents(component.Component):
self.treeview.set_tooltip_column(1) self.treeview.set_tooltip_column(1)
def run(self): def run(self):
self.dialog.set_transient_for(component.get('MainWindow').get_window()) self.dialog.set_transient_for(component.get('MainWindow').window)
self.dialog.show() self.dialog.show()
def start(self): def start(self):

View File

@ -44,7 +44,7 @@ class RemoveTorrentDialog(object):
'deluge.ui.gtkui', os.path.join('glade', 'remove_torrent_dialog.ui'))) 'deluge.ui.gtkui', os.path.join('glade', 'remove_torrent_dialog.ui')))
self.__dialog = self.builder.get_object('remove_torrent_dialog') self.__dialog = self.builder.get_object('remove_torrent_dialog')
self.__dialog.set_transient_for(component.get('MainWindow').get_window()) self.__dialog.set_transient_for(component.get('MainWindow').window)
self.builder.connect_signals({ self.builder.connect_signals({
'on_delete_files_toggled': self.on_delete_files_toggled 'on_delete_files_toggled': self.on_delete_files_toggled

View File

@ -91,8 +91,8 @@ class SystemTray(component.Component):
self.indicator.set_menu(self.tray_menu) self.indicator.set_menu(self.tray_menu)
# Make sure the status of the Show Window MenuItem is correct # Make sure the status of the Show Window MenuItem is correct
self._sig_win_hide = self.mainwindow.get_window().connect('hide', self._on_window_hide) self._sig_win_hide = self.mainwindow.window.connect('hide', self._on_window_hide)
self._sig_win_show = self.mainwindow.get_window().connect('show', self._on_window_show) self._sig_win_show = self.mainwindow.window.connect('show', self._on_window_show)
if self.mainwindow.visible(): if self.mainwindow.visible():
self.builder.get_object('menuitem_show_deluge').set_active(True) self.builder.get_object('menuitem_show_deluge').set_active(True)
else: else:
@ -262,8 +262,8 @@ class SystemTray(component.Component):
app_ind_conf = self.config['enable_appindicator'] app_ind_conf = self.config['enable_appindicator']
if appindicator and app_ind_conf: if appindicator and app_ind_conf:
if hasattr(self, '_sig_win_hide'): if hasattr(self, '_sig_win_hide'):
self.mainwindow.get_window().disconnect(self._sig_win_hide) self.mainwindow.window.disconnect(self._sig_win_hide)
self.mainwindow.get_window().disconnect(self._sig_win_show) self.mainwindow.window.disconnect(self._sig_win_show)
log.debug('Disabling the application indicator..') log.debug('Disabling the application indicator..')
self.indicator.set_status(appindicator.STATUS_PASSIVE) self.indicator.set_status(appindicator.STATUS_PASSIVE)

View File

@ -75,5 +75,5 @@ class TrackersTab(Tab):
torrent_id = component.get('TorrentView').get_selected_torrent() torrent_id = component.get('TorrentView').get_selected_torrent()
if torrent_id: if torrent_id:
from deluge.ui.gtkui.edittrackersdialog import EditTrackersDialog from deluge.ui.gtkui.edittrackersdialog import EditTrackersDialog
dialog = EditTrackersDialog(torrent_id, component.get('MainWindow').get_window()) dialog = EditTrackersDialog(torrent_id, component.get('MainWindow').window)
dialog.run() dialog.run()