X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=src%2FBuilder4%2FDialogFiles.vala;h=11e80aa05eedf7b0a6920894f7a29c53718b1e64;hb=173617f1a97bfc9af24e73f7da986fd192fd0747;hp=728d4c63720d007cdf7cfcfe901c84da6c276fa5;hpb=a5beb2b68764286c695911023901d50e8ddb4b4d;p=roobuilder diff --git a/src/Builder4/DialogFiles.vala b/src/Builder4/DialogFiles.vala index 728d4c637..11e80aa05 100644 --- a/src/Builder4/DialogFiles.vala +++ b/src/Builder4/DialogFiles.vala @@ -71,6 +71,42 @@ public class DialogFiles : Object this.el.child = child_1.el; var child_2 = new Xcls_HeaderBar43( _this ); this.el.titlebar = child_2.el; + + // init method + + { + var ev = new Gtk.EventControllerKey(); + ev.propagation_phase = Gtk.PropagationPhase.CAPTURE; + // my vars (dec) + + // set gobject values + + //listeners + ev.key_released.connect( (keyval, keycode, state) => { + + // GLib.debug("key pressed %d", (int)keycode); + if (keycode != 9) { + return ; + } + if (BuilderApplication.windows.size < 2 && + _this.win.windowstate.file == null + ) { + BuilderApplication.singleton(null).quit(); + return ; + } + + _this.el.hide(); + + if (_this.win.windowstate.file == null) { + BuilderApplication.removeWindow(_this.win); + + } + + return ; + }); + ev.ref(); //?? needed? + (this.el as Gtk.Widget).add_controller(ev); + } } // user defined functions @@ -280,6 +316,9 @@ public class DialogFiles : Object this.el.start_child = _this.projectscroll.el; new Xcls_filepane( _this ); this.el.end_child = _this.filepane.el; + var child_3 = new Xcls_EventControllerKey411( _this ); + child_3.ref(); + this.el.add_controller( child_3.el ); } // user defined functions @@ -1693,6 +1732,51 @@ public class DialogFiles : Object + public class Xcls_EventControllerKey411 : Object + { + public Gtk.EventControllerKey el; + private DialogFiles _this; + + + // my vars (def) + + // ctor + public Xcls_EventControllerKey411(DialogFiles _owner ) + { + _this = _owner; + this.el = new Gtk.EventControllerKey(); + + // my vars (dec) + + // set gobject values + + //listeners + this.el.key_pressed.connect( (keyval, keycode, state) => { + + if (keycode != Gdk.Key.Escape) { + return true; + } + if (BuilderApplication.windows.size < 2 && + _this.win.windowstate.file == null + ) { + BuilderApplication.singleton(null).quit(); + return true; + } + + _this.el.hide(); + + if (_this.win.windowstate.file == null) { + BuilderApplication.removeWindow(_this.win); + + } + + return true; + }); + } + + // user defined functions + } + public class Xcls_HeaderBar43 : Object