[GTK3] Fix the transient parent for PathChooser
The filechooser dialog was wrongly transient to the main window causing weird behaviour, namely the main window moving but dialog remaining in place when attempting to move the child dialog. The solution is to pass the parent dialog to PathChooser so it can be properly set the filechooser dialog transient property. Fixed the Preferences dialog not being set to be modal to main window.
This commit is contained in:
parent
8199928160
commit
92a048625a
|
@ -420,7 +420,9 @@ class AddTorrentDialog(component.Component):
|
|||
self.move_completed_hbox = self.builder.get_object(
|
||||
'hbox_move_completed_chooser'
|
||||
)
|
||||
self.move_completed_path_chooser = PathChooser('move_completed_paths_list')
|
||||
self.move_completed_path_chooser = PathChooser(
|
||||
'move_completed_paths_list', parent=self.dialog
|
||||
)
|
||||
self.move_completed_hbox.add(self.move_completed_path_chooser)
|
||||
self.move_completed_hbox.show_all()
|
||||
|
||||
|
@ -429,7 +431,7 @@ class AddTorrentDialog(component.Component):
|
|||
'hbox_download_location_chooser'
|
||||
)
|
||||
self.download_location_path_chooser = PathChooser(
|
||||
'download_location_paths_list'
|
||||
'download_location_paths_list', parent=self.dialog
|
||||
)
|
||||
self.download_location_hbox.add(self.download_location_path_chooser)
|
||||
self.download_location_hbox.show_all()
|
||||
|
|
|
@ -237,6 +237,7 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Preferences</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="default_width">450</property>
|
||||
<property name="default_height">500</property>
|
||||
|
|
|
@ -343,7 +343,9 @@ class MenuBar(component.Component):
|
|||
self.move_storage_dialog = builder.get_object('move_storage_dialog')
|
||||
self.move_storage_dialog.set_transient_for(self.mainwindow.window)
|
||||
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
|
||||
)
|
||||
self.move_storage_dialog_hbox.add(self.move_storage_path_chooser)
|
||||
self.move_storage_dialog_hbox.show_all()
|
||||
self.move_storage_path_chooser.set_text(status['download_location'])
|
||||
|
|
|
@ -58,7 +58,9 @@ class OptionsTab(Tab):
|
|||
|
||||
self.button_apply = self.main_builder.get_object('button_apply')
|
||||
|
||||
self.move_completed_path_chooser = PathChooser('move_completed_paths_list')
|
||||
self.move_completed_path_chooser = PathChooser(
|
||||
'move_completed_paths_list', parent=component.get('MainWindow').window
|
||||
)
|
||||
self.move_completed_path_chooser.set_sensitive(
|
||||
self.tab_widgets['chk_move_completed'].obj.get_active()
|
||||
)
|
||||
|
|
|
@ -123,9 +123,9 @@ class PathChoosersHandler(component.Component):
|
|||
|
||||
|
||||
class PathChooser(PathChooserComboBox):
|
||||
def __init__(self, paths_config_key=None):
|
||||
def __init__(self, paths_config_key=None, parent=None):
|
||||
self.paths_config_key = paths_config_key
|
||||
super(PathChooser, self).__init__()
|
||||
super(PathChooser, self).__init__(parent=parent)
|
||||
self.chooser_handler = PathChoosersHandler()
|
||||
self.chooser_handler.register_chooser(self)
|
||||
self.set_auto_completer_func(self.on_completion)
|
||||
|
|
|
@ -18,7 +18,6 @@ from gi.module import get_introspection_module
|
|||
from gi.repository import Gdk, GObject, Gtk
|
||||
from gi.repository.GObject import SignalFlags
|
||||
|
||||
import deluge.component as component
|
||||
from deluge.common import PY2, resource_filename
|
||||
from deluge.path_chooser_common import get_completion_paths
|
||||
|
||||
|
@ -1130,7 +1129,11 @@ class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject):
|
|||
}
|
||||
|
||||
def __init__(
|
||||
self, max_visible_rows=20, auto_complete=True, use_completer_popup=True
|
||||
self,
|
||||
max_visible_rows=20,
|
||||
auto_complete=True,
|
||||
use_completer_popup=True,
|
||||
parent=None,
|
||||
):
|
||||
GtkGI.Box.__init__(self)
|
||||
GObject.GObject.__init__(self)
|
||||
|
@ -1143,6 +1146,7 @@ class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject):
|
|||
self.show_folder_name_on_button = False
|
||||
self.setting_accelerator_key = False
|
||||
self.builder = Gtk.Builder()
|
||||
self.parent = parent
|
||||
self.popup_buttonbox = self.builder.get_object('buttonbox')
|
||||
self.builder.add_from_file(
|
||||
resource_filename(
|
||||
|
@ -1156,7 +1160,7 @@ class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject):
|
|||
)
|
||||
self.filechooser_button = self.open_filechooser_dialog_button
|
||||
self.filechooserdialog = self.builder.get_object('filechooserdialog')
|
||||
self.filechooserdialog.set_transient_for(component.get('MainWindow').window)
|
||||
self.filechooserdialog.set_transient_for(self.parent)
|
||||
self.filechooser_widget = self.builder.get_object('filechooser_widget')
|
||||
self.folder_name_label = self.builder.get_object('folder_name_label')
|
||||
self.default_text = None
|
||||
|
@ -1550,7 +1554,7 @@ class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject):
|
|||
self.show_folder_name_on_button_checkbutton = self.builder.get_object(
|
||||
'show_folder_name_on_button_checkbutton'
|
||||
)
|
||||
self.config_dialog.set_transient_for(component.get('MainWindow').window)
|
||||
self.config_dialog.set_transient_for(self.parent)
|
||||
|
||||
def on_close(widget, event=None):
|
||||
if not self.setting_accelerator_key:
|
||||
|
|
|
@ -189,7 +189,7 @@ class Preferences(component.Component):
|
|||
'hbox_download_to_path_chooser'
|
||||
)
|
||||
self.download_location_path_chooser = PathChooser(
|
||||
'download_location_paths_list'
|
||||
'download_location_paths_list', parent=self.pref_dialog
|
||||
)
|
||||
self.download_location_hbox.add(self.download_location_path_chooser)
|
||||
self.download_location_hbox.show_all()
|
||||
|
@ -197,7 +197,9 @@ class Preferences(component.Component):
|
|||
self.move_completed_hbox = self.builder.get_object(
|
||||
'hbox_move_completed_to_path_chooser'
|
||||
)
|
||||
self.move_completed_path_chooser = PathChooser('move_completed_paths_list')
|
||||
self.move_completed_path_chooser = PathChooser(
|
||||
'move_completed_paths_list', parent=self.pref_dialog
|
||||
)
|
||||
self.move_completed_hbox.add(self.move_completed_path_chooser)
|
||||
self.move_completed_hbox.show_all()
|
||||
|
||||
|
@ -205,7 +207,7 @@ class Preferences(component.Component):
|
|||
'hbox_copy_torrent_files_path_chooser'
|
||||
)
|
||||
self.copy_torrent_files_path_chooser = PathChooser(
|
||||
'copy_torrent_files_to_paths_list'
|
||||
'copy_torrent_files_to_paths_list', parent=self.pref_dialog
|
||||
)
|
||||
self.copy_torrents_to_hbox.add(self.copy_torrent_files_path_chooser)
|
||||
self.copy_torrents_to_hbox.show_all()
|
||||
|
|
Loading…
Reference in New Issue