Fix #8099 - convert left tree to use get_data<> methods
[roobuilder] / src / Application.vala
index cfe0fe0..340a70d 100644 (file)
@@ -1,5 +1,5 @@
 
+ /*
        public class AppSettings : Object
        {
 
@@ -46,7 +46,7 @@
 
                
        }
-       
+       */
        
        public static BuilderApplication application = null;
        
                    { "application/x-rootwindow-drop", 0, Target.ROOTWIN }
                };
                */
-               public AppSettings settings = null;
+               //public AppSettings settings = null;
 
 
 
                                flags: ApplicationFlags.FLAGS_NONE
                        );
                        BuilderApplication.windows = new        Gee.ArrayList<Xcls_MainWindow>();
+                       BuilderApplication.windowlist = new GLib.ListStore(typeof(WindowState));
                        //BuilderApplication.valacompilequeue = new Palete.ValaCompileQueue();
                        
                        
                        configDirectory();
-                       this.settings = AppSettings.factory();  
+               //      this.settings = AppSettings.factory();  
                        var opt_context = new OptionContext ("Application Builder");
                        
                        try {
 
                }
 
+               public static Settings settings;
 
+               protected override void activate () 
+               {
+                       var css = new Gtk.CssProvider();
+                       css.load_from_resource("/css/roobuilder.css");
+                       
+                       Gtk.StyleContext.add_provider_for_display(
+                               Gdk.Display.get_default(),
+                               css     ,
+                               Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+                       );
+                       BuilderApplication.settings = new Settings();
+               
+                       var w = new Xcls_MainWindow();
+                   w.initChildren();
+                       BuilderApplication.addWindow(w);
+                       
+                       // it looks like showall after children causes segfault on ubuntu 14.4
+                       w.windowstate.init();
+               //      w.windowstate.showPopoverFiles(w.open_projects_btn.el, null, false);
+                       w.show();
+               
+               }
                
                public static BuilderApplication  singleton(  string[]? args)
                {
@@ -627,12 +651,14 @@ flutter-project  -  was try and read flutter data (but desnt work.)
                
                // move to 'window colletction?
                public static Gee.ArrayList<Xcls_MainWindow> windows;
+               public static GLib.ListStore windowlist;
                
                public static void addWindow(Xcls_MainWindow w)
                {
                         
+               windowlist.append(w.windowstate);
                        BuilderApplication.windows.add(w);
-                       BuilderApplication.updateWindows();
+
   
                        
                }
@@ -641,7 +667,15 @@ flutter-project  -  was try and read flutter data (but desnt work.)
                {
                        //GLib.debug("remove window before = %d", BuilderApplication.windows.size);
                        BuilderApplication.windows.remove(w);
-                       BuilderApplication.updateWindows();
+                       for(var i = 0 ; i < windowlist.get_n_items(); i++) {
+                               var ws = windowlist.get_item(i) as WindowState;
+                               if (ws.file.path == w.windowstate.file.path && ws.project.path == w.windowstate.project.path) {
+                                       windowlist.remove(i);
+                                       break;
+                               }
+                       }
+                       
+
                                
                        w.el.hide();
                        w.el.close();
@@ -650,12 +684,7 @@ flutter-project  -  was try and read flutter data (but desnt work.)
                        
                        
                }
-               public static void updateWindows()
-               {
-                       foreach(var ww in BuilderApplication.windows) {
-                               ww.windowbtn.updateMenu();
-                       }
-               }
+        
                public static Xcls_MainWindow? getWindow(JsRender.JsRender file)
                {
                        foreach(var ww in BuilderApplication.windows) {
@@ -671,8 +700,9 @@ flutter-project  -  was try and read flutter data (but desnt work.)
                {
                    var w = new Xcls_MainWindow();
                        w.ref();
-                       BuilderApplication.addWindow(w);
                        w.initChildren();
+                       BuilderApplication.addWindow(w);
+                       w.windowstate.init();
                        w.windowstate.fileViewOpen(file, false, line);
                        w.el.present();
                         
@@ -710,12 +740,14 @@ flutter-project  -  was try and read flutter data (but desnt work.)
                                if (ww == null || ww.windowstate == null || ww.windowstate.project ==null) {
                                        continue;
                                }
+                               
 
                                ww.windowstate.updateErrorMarksAll();
                                 
-                               GLib.debug("calling udate Errors of window %s", ww.windowstate.file.targetName());
+                               //GLib.debug("calling udate Errors of window %s", ww.windowstate.file.targetName());
                                ww.updateErrors();
-                               
+                               ww.windowstate.left_tree.updateErrors();
+                               ww.windowstate.left_props.updateErrors();
                                
                        }
                
@@ -736,6 +768,10 @@ flutter-project  -  was try and read flutter data (but desnt work.)
                                                BuilderApplication.showSpinner( "format-justify-fill", msg);                                    
                                                return;
 
+                                       case Palete.LanguageClientAction.DIAG_END:
+                                               BuilderApplication.showSpinner( "", "");
+                                               return;
+
                                        case Palete.LanguageClientAction.OPEN:
                                                BuilderApplication.showSpinner( "document-open", msg);                                  
                                                return;
@@ -803,4 +839,4 @@ flutter-project  -  was try and read flutter data (but desnt work.)
                
 
  
\ No newline at end of file