From 8199928160941359faaeb63c85ebe55c171df1e3 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 17 Sep 2018 15:47:22 +0100 Subject: [PATCH] [GTK3] Use a non-CSD filechooser dialog for PathChooser My personal feeling is that GTK client-side decoration (CSD) putting main dialog buttons in the titlebar is wrong so create a non-CSD dialog. There was no simple way of changing GtkFileChooserDialog to play nice with non-CSD buttons and resulting in these GTK warnings: Gtk-WARNING : Content added to the action area of a dialog using header bars There is an unwanted dialog border with this custom filechooser dialog with no apparent way to remove them. Would require switching to a GtkWindow implementation. --- deluge/ui/gtk3/glade/path_combo_chooser.ui | 287 +++++++++++---------- deluge/ui/gtk3/path_combo_chooser.py | 8 +- 2 files changed, 149 insertions(+), 146 deletions(-) diff --git a/deluge/ui/gtk3/glade/path_combo_chooser.ui b/deluge/ui/gtk3/glade/path_combo_chooser.ui index dac61f6ba..0fbac03e3 100644 --- a/deluge/ui/gtk3/glade/path_combo_chooser.ui +++ b/deluge/ui/gtk3/glade/path_combo_chooser.ui @@ -498,6 +498,134 @@ config_dialog_button_close + + False + + + + + + True + False + 3 + + + + 160 + False + True + select-folder + False + False + Select a Directory + + + False + False + 0 + + + + + True + True + True + + + + True + False + + + True + False + gtk-open + + + False + False + 0 + + + + + True + False + + + False + False + 1 + + + + + + + False + False + 1 + + + + + True + True + + + + + + + + + + True + True + 2 + + + + + True + True + False + True + Saved paths + + + + + + 15 + True + False + vertical + True + + + True + False + down + + + True + False + 0 + + + + + + + False + False + 3 + + + + + @@ -577,26 +705,22 @@ - + False - 5 - GtkFileChooserDialog + Choose a folder + True + center True dialog - select-folder - False - - True + False vertical - 2 - - True + False end @@ -628,13 +752,21 @@ False - True - end + False 0 - + + True + False + select-folder + + + False + True + 1 + @@ -867,133 +999,4 @@ - - False - - - - - - True - False - 3 - - - - 160 - False - True - select-folder - False - False - Select a Directory - - - False - False - 0 - - - - - True - True - True - - - - True - False - - - True - False - gtk-open - - - False - False - 0 - - - - - True - False - - - False - False - 1 - - - - - - - False - False - 1 - - - - - True - True - - - - - - - - - - - True - True - 2 - - - - - True - True - False - True - Saved paths - - - - - - 15 - True - False - vertical - True - - - True - False - down - - - True - False - 0 - - - - - - - False - False - 3 - - - - - diff --git a/deluge/ui/gtk3/path_combo_chooser.py b/deluge/ui/gtk3/path_combo_chooser.py index c27cb1684..a2c374353 100755 --- a/deluge/ui/gtk3/path_combo_chooser.py +++ b/deluge/ui/gtk3/path_combo_chooser.py @@ -1157,6 +1157,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.filechooser_widget = self.builder.get_object('filechooser_widget') self.folder_name_label = self.builder.get_object('folder_name_label') self.default_text = None self.button_properties = self.builder.get_object('button_properties') @@ -1417,14 +1418,13 @@ class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject): self.set_path_entry_visible(self.path_entry_visible) def _on_button_open_dialog_clicked(self, widget): - dialog = self.filechooserdialog - dialog.set_current_folder(self.get_text()) - response_id = dialog.run() + self.filechooser_widget.set_current_folder(self.get_text()) + response_id = self.filechooserdialog.run() if response_id == 0: text = self.filechooserdialog.get_filename() self.set_text(text, trigger_event=True) - dialog.hide() + self.filechooserdialog.hide() def _on_entry_text_key_press_event(self, widget, event): """