dialogs: Use response virtual function instead of signal

This commit is contained in:
Rafał Dzięgiel
2021-09-02 17:29:56 +02:00
parent 3aab01d35c
commit 2e0a455f92

View File

@@ -29,7 +29,6 @@ class ClapperFileChooser extends Gtk.FileChooserNative
} }
this.chooserPurpose = purpose; this.chooserPurpose = purpose;
this.responseSignal = this.connect('response', this._onResponse.bind(this));
/* File chooser closes itself when nobody is holding its ref */ /* File chooser closes itself when nobody is holding its ref */
this.ref(); this.ref();
@@ -62,14 +61,11 @@ class ClapperFileChooser extends Gtk.FileChooserNative
this.add_filter(filter); this.add_filter(filter);
} }
_onResponse(filechooser, response) vfunc_response(respId)
{ {
debug('closing file chooser dialog'); debug('closing file chooser dialog');
this.disconnect(this.responseSignal); if(respId === Gtk.ResponseType.ACCEPT) {
this.responseSignal = null;
if(response === Gtk.ResponseType.ACCEPT) {
switch(this.chooserPurpose) { switch(this.chooserPurpose) {
case 'open_local': case 'open_local':
this._handleOpenLocal(); this._handleOpenLocal();
@@ -209,14 +205,12 @@ class ClapperResumeDialog extends Gtk.MessageDialog
}); });
this.resumeInfo = resumeInfo; this.resumeInfo = resumeInfo;
this.set_default_response(Gtk.ResponseType.YES); this.set_default_response(Gtk.ResponseType.YES);
this.connect('response', this._onResponse.bind(this));
this.show(); this.show();
} }
_onResponse(dialog, respId) vfunc_response(respId)
{ {
const { player } = this.transient_for.child; const { player } = this.transient_for.child;