Fix #8063 - see if we can improve glade dump
[roobuilder] / src / Builder4 / DialogFiles.vala
index 346b64f..7e51469 100644 (file)
@@ -67,10 +67,48 @@ public class DialogFiles : Object
                this.el.default_height = 550;
                this.el.default_width = 1000;
                this.el.modal = true;
-               var child_1 = new Xcls_Box2( _this );
+               var child_1 = new Xcls_Box1( _this );
+               child_1.ref();
                this.el.child = child_1.el;
                var child_2 = new Xcls_HeaderBar44( _this );
+               child_2.ref();
                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?
+                       ((Gtk.Widget)this.el).add_controller(ev);
+               }
        }
 
        // user defined functions
@@ -195,7 +233,7 @@ public class DialogFiles : Object
         
          
        }
-       public class Xcls_Box2 : Object
+       public class Xcls_Box1 : Object
        {
                public Gtk.Box el;
                private DialogFiles  _this;
@@ -205,7 +243,7 @@ public class DialogFiles : Object
                public bool expand;
 
                // ctor
-               public Xcls_Box2(DialogFiles _owner )
+               public Xcls_Box1(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -219,7 +257,7 @@ public class DialogFiles : Object
                        this.el.margin_start = 10;
                        this.el.margin_bottom = 10;
                        this.el.margin_top = 10;
-                       var child_1 = new Xcls_Box3( _this );
+                       var child_1 = new Xcls_Box2( _this );
                        child_1.ref();
                        this.el.append( child_1.el );
                        new Xcls_mainpane( _this );
@@ -228,7 +266,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_Box3 : Object
+       public class Xcls_Box2 : Object
        {
                public Gtk.Box el;
                private DialogFiles  _this;
@@ -237,7 +275,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box3(DialogFiles _owner )
+               public Xcls_Box2(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -280,6 +318,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_EventControllerKey43( _this );
+                       child_3.ref();
+                       this.el.add_controller(  child_3.el );
                }
 
                // user defined functions
@@ -339,28 +380,9 @@ public class DialogFiles : Object
 
                        // set gobject values
                        this.el.name = "project-list";
-                       var child_2 = new Xcls_ColumnViewColumn12( _this );
+                       var child_2 = new Xcls_ColumnViewColumn11( _this );
                        child_2.ref();
                        this.el.append_column ( child_2.el  );
-
-                       // init method
-
-                       {
-                        
-                               this.css = new Gtk.CssProvider();
-                        
-                               this.css.load_from_string("
-                                       #project-list { font-size: 12px;}
-                               ");
-                       
-                               Gtk.StyleContext.add_provider_for_display(
-                                       this.el.get_display(),
-                                       this.css,
-                                       Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
-                               );
-                                       
-                          
-                       }
                }
 
                // user defined functions
@@ -439,7 +461,7 @@ public class DialogFiles : Object
                        _this = _owner;
                        _this.projectsort = this;
                        new Xcls_projectmodel( _this );
-                       var child_2 = new Xcls_StringSorter10( _this );
+                       var child_2 = new Xcls_StringSorter9( _this );
                        child_2.ref();
                        this.el = new Gtk.SortListModel( _this.projectmodel.el, child_2.el );
 
@@ -486,7 +508,7 @@ public class DialogFiles : Object
                }
        }
 
-       public class Xcls_StringSorter10 : Object
+       public class Xcls_StringSorter9 : Object
        {
                public Gtk.StringSorter el;
                private DialogFiles  _this;
@@ -495,10 +517,10 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_StringSorter10(DialogFiles _owner )
+               public Xcls_StringSorter9(DialogFiles _owner )
                {
                        _this = _owner;
-                       var child_1 = new Xcls_PropertyExpression11( _this );
+                       var child_1 = new Xcls_PropertyExpression10( _this );
                        child_1.ref();
                        this.el = new Gtk.StringSorter( child_1.el );
 
@@ -509,7 +531,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_PropertyExpression11 : Object
+       public class Xcls_PropertyExpression10 : Object
        {
                public Gtk.PropertyExpression el;
                private DialogFiles  _this;
@@ -518,7 +540,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_PropertyExpression11(DialogFiles _owner )
+               public Xcls_PropertyExpression10(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.PropertyExpression( typeof(Project.Project), null, "name" );
@@ -534,7 +556,7 @@ public class DialogFiles : Object
 
 
 
-       public class Xcls_ColumnViewColumn12 : Object
+       public class Xcls_ColumnViewColumn11 : Object
        {
                public Gtk.ColumnViewColumn el;
                private DialogFiles  _this;
@@ -543,10 +565,10 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_ColumnViewColumn12(DialogFiles _owner )
+               public Xcls_ColumnViewColumn11(DialogFiles _owner )
                {
                        _this = _owner;
-                       var child_1 = new Xcls_SignalListItemFactory13( _this );
+                       var child_1 = new Xcls_SignalListItemFactory12( _this );
                        child_1.ref();
                        this.el = new Gtk.ColumnViewColumn( "Project", child_1.el );
 
@@ -558,7 +580,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_SignalListItemFactory13 : Object
+       public class Xcls_SignalListItemFactory12 : Object
        {
                public Gtk.SignalListItemFactory el;
                private DialogFiles  _this;
@@ -567,7 +589,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_SignalListItemFactory13(DialogFiles _owner )
+               public Xcls_SignalListItemFactory12(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.SignalListItemFactory();
@@ -628,7 +650,8 @@ public class DialogFiles : Object
                        // set gobject values
                        this.el.position = 200;
                        this.el.visible = false;
-                       var child_1 = new Xcls_Box15( _this );
+                       var child_1 = new Xcls_Box14( _this );
+                       child_1.ref();
                        this.el.end_child = child_1.el;
                        new Xcls_treescroll( _this );
                        this.el.start_child = _this.treescroll.el;
@@ -636,7 +659,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_Box15 : Object
+       public class Xcls_Box14 : Object
        {
                public Gtk.Box el;
                private DialogFiles  _this;
@@ -645,7 +668,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box15(DialogFiles _owner )
+               public Xcls_Box14(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -655,7 +678,7 @@ public class DialogFiles : Object
                        // set gobject values
                        this.el.hexpand = true;
                        this.el.vexpand = true;
-                       var child_1 = new Xcls_Box16( _this );
+                       var child_1 = new Xcls_Box15( _this );
                        child_1.ref();
                        this.el.append( child_1.el );
                        new Xcls_iconscroll( _this );
@@ -664,7 +687,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_Box16 : Object
+       public class Xcls_Box15 : Object
        {
                public Gtk.Box el;
                private DialogFiles  _this;
@@ -673,7 +696,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box16(DialogFiles _owner )
+               public Xcls_Box15(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -781,21 +804,21 @@ public class DialogFiles : Object
                        _this = _owner;
                        _this.gridview = this;
                        new Xcls_iconsel( _this );
-                       var child_2 = new Xcls_SignalListItemFactory29( _this );
+                       var child_2 = new Xcls_SignalListItemFactory28( _this );
                        child_2.ref();
                        this.el = new Gtk.GridView( _this.iconsel.el, child_2.el );
 
                        // my vars (dec)
 
                        // set gobject values
-                       var child_3 = new Xcls_GestureClick20( _this );
+                       var child_3 = new Xcls_GestureClick19( _this );
                        child_3.ref();
                        this.el.add_controller(  child_3.el );
                }
 
                // user defined functions
        }
-       public class Xcls_GestureClick20 : Object
+       public class Xcls_GestureClick19 : Object
        {
                public Gtk.GestureClick el;
                private DialogFiles  _this;
@@ -804,7 +827,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_GestureClick20(DialogFiles _owner )
+               public Xcls_GestureClick19(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.GestureClick();
@@ -853,7 +876,7 @@ public class DialogFiles : Object
                {
                        _this = _owner;
                        _this.iconsel = this;
-                       var child_1 = new Xcls_FilterListModel22( _this );
+                       var child_1 = new Xcls_FilterListModel21( _this );
                        child_1.ref();
                        this.el = new Gtk.SingleSelection( child_1.el );
 
@@ -889,7 +912,7 @@ public class DialogFiles : Object
                 
                }
        }
-       public class Xcls_FilterListModel22 : Object
+       public class Xcls_FilterListModel21 : Object
        {
                public Gtk.FilterListModel el;
                private DialogFiles  _this;
@@ -898,7 +921,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_FilterListModel22(DialogFiles _owner )
+               public Xcls_FilterListModel21(DialogFiles _owner )
                {
                        _this = _owner;
                        new Xcls_gridsort( _this );
@@ -926,7 +949,7 @@ public class DialogFiles : Object
                        _this = _owner;
                        _this.gridsort = this;
                        new Xcls_gridmodel( _this );
-                       var child_2 = new Xcls_StringSorter25( _this );
+                       var child_2 = new Xcls_StringSorter24( _this );
                        child_2.ref();
                        this.el = new Gtk.SortListModel( _this.gridmodel.el, child_2.el );
 
@@ -971,7 +994,7 @@ public class DialogFiles : Object
                }
        }
 
-       public class Xcls_StringSorter25 : Object
+       public class Xcls_StringSorter24 : Object
        {
                public Gtk.StringSorter el;
                private DialogFiles  _this;
@@ -980,10 +1003,10 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_StringSorter25(DialogFiles _owner )
+               public Xcls_StringSorter24(DialogFiles _owner )
                {
                        _this = _owner;
-                       var child_1 = new Xcls_PropertyExpression26( _this );
+                       var child_1 = new Xcls_PropertyExpression25( _this );
                        child_1.ref();
                        this.el = new Gtk.StringSorter( child_1.el );
 
@@ -995,7 +1018,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_PropertyExpression26 : Object
+       public class Xcls_PropertyExpression25 : Object
        {
                public Gtk.PropertyExpression el;
                private DialogFiles  _this;
@@ -1004,7 +1027,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_PropertyExpression26(DialogFiles _owner )
+               public Xcls_PropertyExpression25(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
@@ -1032,7 +1055,7 @@ public class DialogFiles : Object
                {
                        _this = _owner;
                        _this.iconsearch = this;
-                       var child_1 = new Xcls_PropertyExpression28( _this );
+                       var child_1 = new Xcls_PropertyExpression27( _this );
                        child_1.ref();
                        this.el = new Gtk.StringFilter( child_1.el );
 
@@ -1045,7 +1068,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_PropertyExpression28 : Object
+       public class Xcls_PropertyExpression27 : Object
        {
                public Gtk.PropertyExpression el;
                private DialogFiles  _this;
@@ -1054,7 +1077,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_PropertyExpression28(DialogFiles _owner )
+               public Xcls_PropertyExpression27(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender), null, "name" );
@@ -1070,7 +1093,7 @@ public class DialogFiles : Object
 
 
 
-       public class Xcls_SignalListItemFactory29 : Object
+       public class Xcls_SignalListItemFactory28 : Object
        {
                public Gtk.SignalListItemFactory el;
                private DialogFiles  _this;
@@ -1079,7 +1102,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_SignalListItemFactory29(DialogFiles _owner )
+               public Xcls_SignalListItemFactory28(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.SignalListItemFactory();
@@ -1203,7 +1226,7 @@ public class DialogFiles : Object
 
                        // set gobject values
                        this.el.name = "file-list";
-                       var child_2 = new Xcls_GestureClick32( _this );
+                       var child_2 = new Xcls_GestureClick31( _this );
                        child_2.ref();
                        this.el.add_controller(  child_2.el );
                        new Xcls_name( _this );
@@ -1236,7 +1259,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_GestureClick32 : Object
+       public class Xcls_GestureClick31 : Object
        {
                public Gtk.GestureClick el;
                private DialogFiles  _this;
@@ -1245,7 +1268,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_GestureClick32(DialogFiles _owner )
+               public Xcls_GestureClick31(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.GestureClick();
@@ -1295,7 +1318,7 @@ public class DialogFiles : Object
                {
                        _this = _owner;
                        _this.treeselmodel = this;
-                       var child_1 = new Xcls_FilterListModel34( _this );
+                       var child_1 = new Xcls_FilterListModel33( _this );
                        child_1.ref();
                        this.el = new Gtk.SingleSelection( child_1.el );
 
@@ -1339,7 +1362,7 @@ public class DialogFiles : Object
                        return  (JsRender.JsRender) tr.item;
                }
        }
-       public class Xcls_FilterListModel34 : Object
+       public class Xcls_FilterListModel33 : Object
        {
                public Gtk.FilterListModel el;
                private DialogFiles  _this;
@@ -1348,7 +1371,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_FilterListModel34(DialogFiles _owner )
+               public Xcls_FilterListModel33(DialogFiles _owner )
                {
                        _this = _owner;
                        new Xcls_treelistsort( _this );
@@ -1376,7 +1399,7 @@ public class DialogFiles : Object
                        _this = _owner;
                        _this.treelistsort = this;
                        new Xcls_treelistmodel( _this );
-                       var child_2 = new Xcls_TreeListRowSorter38( _this );
+                       var child_2 = new Xcls_TreeListRowSorter37( _this );
                        child_2.ref();
                        this.el = new Gtk.SortListModel( _this.treelistmodel.el, child_2.el );
 
@@ -1438,7 +1461,7 @@ public class DialogFiles : Object
        }
 
 
-       public class Xcls_TreeListRowSorter38 : Object
+       public class Xcls_TreeListRowSorter37 : Object
        {
                public Gtk.TreeListRowSorter el;
                private DialogFiles  _this;
@@ -1447,10 +1470,10 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_TreeListRowSorter38(DialogFiles _owner )
+               public Xcls_TreeListRowSorter37(DialogFiles _owner )
                {
                        _this = _owner;
-                       var child_1 = new Xcls_StringSorter39( _this );
+                       var child_1 = new Xcls_StringSorter38( _this );
                        child_1.ref();
                        this.el = new Gtk.TreeListRowSorter( child_1.el );
 
@@ -1461,7 +1484,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_StringSorter39 : Object
+       public class Xcls_StringSorter38 : Object
        {
                public Gtk.StringSorter el;
                private DialogFiles  _this;
@@ -1470,10 +1493,10 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_StringSorter39(DialogFiles _owner )
+               public Xcls_StringSorter38(DialogFiles _owner )
                {
                        _this = _owner;
-                       var child_1 = new Xcls_PropertyExpression40( _this );
+                       var child_1 = new Xcls_PropertyExpression39( _this );
                        child_1.ref();
                        this.el = new Gtk.StringSorter( child_1.el );
 
@@ -1485,7 +1508,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_PropertyExpression40 : Object
+       public class Xcls_PropertyExpression39 : Object
        {
                public Gtk.PropertyExpression el;
                private DialogFiles  _this;
@@ -1494,7 +1517,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_PropertyExpression40(DialogFiles _owner )
+               public Xcls_PropertyExpression39(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.PropertyExpression( typeof(JsRender.JsRender) , null, "name" );
@@ -1533,25 +1556,34 @@ public class DialogFiles : Object
        var str = _this.searchbox.el.text.down();       
        if (j.xtype == "Dir") {
        
-               if (str.length < 1) {
-                       return true;
-               }
+               
                for (var i =0 ; i < j.childfiles.n_items; i++) {
                        var f = (JsRender.JsRender) j.childfiles.get_item(i);
                        if (f.xtype != "PlainFile") {
                                continue;
                        }
+                       if (f.content_type.contains("image")) {
+                               continue;
+                       }
+                       if (str.length < 1) {
+                               return true;
+                       }
                        if (f.name.down().contains(str)) {
                                return true;
                        }
+                       
                }
+                
                return false;
        }
        if (j.xtype != "PlainFile") {
                return false;
        }
-
-       if (str.length < 1) {
+       if (j.content_type.contains("image")) {
+               return false;
+       }
+                        
+       if (str.length < 1) { // no search.
                return true;
        }
        if (j.name.down().contains(str)) {
@@ -1584,7 +1616,7 @@ public class DialogFiles : Object
                {
                        _this = _owner;
                        _this.name = this;
-                       var child_1 = new Xcls_SignalListItemFactory43( _this );
+                       var child_1 = new Xcls_SignalListItemFactory42( _this );
                        child_1.ref();
                        this.el = new Gtk.ColumnViewColumn( "General Files", child_1.el );
 
@@ -1607,7 +1639,7 @@ public class DialogFiles : Object
 
                // user defined functions
        }
-       public class Xcls_SignalListItemFactory43 : Object
+       public class Xcls_SignalListItemFactory42 : Object
        {
                public Gtk.SignalListItemFactory el;
                private DialogFiles  _this;
@@ -1616,7 +1648,7 @@ public class DialogFiles : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_SignalListItemFactory43(DialogFiles _owner )
+               public Xcls_SignalListItemFactory42(DialogFiles _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.SignalListItemFactory();
@@ -1703,6 +1735,51 @@ public class DialogFiles : Object
 
 
 
+       public class Xcls_EventControllerKey43 : Object
+       {
+               public Gtk.EventControllerKey el;
+               private DialogFiles  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_EventControllerKey43(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_HeaderBar44 : Object
@@ -1802,6 +1879,7 @@ public class DialogFiles : Object
 
                        // set gobject values
                        var child_1 = new Xcls_Box47( _this );
+                       child_1.ref();
                        this.el.child = child_1.el;
 
                        //listeners
@@ -1929,6 +2007,7 @@ public class DialogFiles : Object
 
                        // set gobject values
                        var child_1 = new Xcls_Box51( _this );
+                       child_1.ref();
                        this.el.child = child_1.el;
 
                        //listeners
@@ -2039,6 +2118,7 @@ public class DialogFiles : Object
 
                        // set gobject values
                        var child_1 = new Xcls_Box55( _this );
+                       child_1.ref();
                        this.el.child = child_1.el;
 
                        //listeners
@@ -2166,6 +2246,7 @@ public class DialogFiles : Object
 
                        // set gobject values
                        var child_1 = new Xcls_Box59( _this );
+                       child_1.ref();
                        this.el.child = child_1.el;
 
                        //listeners
@@ -2282,6 +2363,7 @@ public class DialogFiles : Object
 
                        // set gobject values
                        var child_1 = new Xcls_Box63( _this );
+                       child_1.ref();
                        this.el.child = child_1.el;
 
                        //listeners