[GTKUI] Add MainWindow.get_window() and replace window attr usage
* In GTK3 the use of `window` attribute is no longer valid so need to use get_window(). This updates MainWindow to follow the same convention.
This commit is contained in:
parent
86549eb3ee
commit
ccfe6b3c80
|
@ -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').window)
|
self.dialog.set_transient_for(component.get('MainWindow').get_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').window)
|
self.dialog.set_transient_for(component.get('MainWindow').get_window())
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def update_core_config(self, show=False, focus=False):
|
def update_core_config(self, show=False, focus=False):
|
||||||
|
|
|
@ -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').window)
|
self.connection_manager.set_transient_for(component.get('MainWindow').get_window())
|
||||||
|
|
||||||
self.connection_manager.set_icon(get_deluge_icon())
|
self.connection_manager.set_icon(get_deluge_icon())
|
||||||
|
|
||||||
|
|
|
@ -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').window)
|
self.dialog.set_transient_for(component.get('MainWindow').get_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').window)
|
self.builder.get_object('progress_dialog').set_transient_for(component.get('MainWindow').get_window())
|
||||||
self.builder.get_object('progress_dialog').show_all()
|
self.builder.get_object('progress_dialog').show_all()
|
||||||
|
|
||||||
self.dialog.destroy()
|
self.dialog.destroy()
|
||||||
|
|
|
@ -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').window,
|
parent=parent if parent else component.get('MainWindow').get_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)
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,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').window.get_style()
|
style = component.get('MainWindow').get_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]
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,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.window.destroy()
|
self.mainwindow.get_window().destroy()
|
||||||
|
|
||||||
reactor.stop()
|
reactor.stop()
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,9 @@ 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.
|
||||||
|
|
||||||
|
@ -326,7 +329,7 @@ class MainWindow(component.Component):
|
||||||
"""
|
"""
|
||||||
if wnck:
|
if wnck:
|
||||||
self.screen.force_update()
|
self.screen.force_update()
|
||||||
win = wnck.window_get(self.window.window.xid)
|
win = wnck.window_get(self.get_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:
|
||||||
|
|
|
@ -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.window)
|
self.mainwindow.get_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.window)
|
self.move_storage_dialog.set_transient_for(self.mainwindow.get_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.window, details=failure.value.logable()
|
self.mainwindow.get_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)
|
||||||
|
|
|
@ -24,7 +24,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 = gtk.accel_groups_from_object(gtkui.mainwindow.window)[0]
|
group = gtk.accel_groups_from_object(gtkui.mainwindow.get_window())[0]
|
||||||
|
|
||||||
config = ConfigManager('gtkui.conf')
|
config = ConfigManager('gtkui.conf')
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,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').window)
|
self.pref_dialog.set_transient_for(component.get('MainWindow').get_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')
|
||||||
|
|
|
@ -53,7 +53,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').window)
|
self.dialog.set_transient_for(component.get('MainWindow').get_window())
|
||||||
self.dialog.show()
|
self.dialog.show()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
|
|
@ -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').window)
|
self.__dialog.set_transient_for(component.get('MainWindow').get_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
|
||||||
|
|
|
@ -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.window.connect('hide', self._on_window_hide)
|
self._sig_win_hide = self.mainwindow.get_window().connect('hide', self._on_window_hide)
|
||||||
self._sig_win_show = self.mainwindow.window.connect('show', self._on_window_show)
|
self._sig_win_show = self.mainwindow.get_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:
|
||||||
|
@ -264,8 +264,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.window.disconnect(self._sig_win_hide)
|
self.mainwindow.get_window().disconnect(self._sig_win_hide)
|
||||||
self.mainwindow.window.disconnect(self._sig_win_show)
|
self.mainwindow.get_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)
|
||||||
|
|
|
@ -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').window)
|
dialog = EditTrackersDialog(torrent_id, component.get('MainWindow').get_window())
|
||||||
dialog.run()
|
dialog.run()
|
||||||
|
|
Loading…
Reference in New Issue