StatusIcon.vala
[gitlive] / StatusIcon.vala
index 181c2bf..d88ce96 100644 (file)
@@ -249,6 +249,11 @@ public class StatusIconA : StatusIcon {
                 this.activate.connect( () => {
                     GitMonitor.gitmonitor.stop();
                     var tr = GitRepo.list();
+                    
+                    
+                    
+                    
+                    
                     for (var i= 0; i< tr.length;i++) {
                         statusicon.set_from_stock( 
                                i%2 == 0 ?  Gtk.Stock.FULLSCREEN : Gtk.Stock.LEAVE_FULLSCREEN );
@@ -283,14 +288,70 @@ public class StatusIconA : StatusIcon {
                         }        
 
                     } 
-                    statusicon.set_tooltip_text("Gitlive");
-                             
-                            
-                    GitMonitor.gitmonitor.start();         
+                           
                            
                 });
             }
-            
+            void pullAll()
+            {
+                       var tr = GitRepo.list();
+                
+                
+                
+                var total = tr.length;
+                
+                for (var i= 0; i< tr.length;i++) {
+                    statusicon.set_from_stock( 
+                               i%2 == 0 ?  Gtk.Stock.FULLSCREEN : Gtk.Stock.LEAVE_FULLSCREEN );
+                            
+                    var repo = tr.index(i);
+                    //if (!repo.autocommit()) {
+                        //??? should we ignore ones not on autocommit..
+                    //    continue;
+                    //}
+                    //try {
+                        statusicon.set_tooltip_text("pull: " + repo.name);
+                        var str = "";
+                        repo.pull_async((out result) {
+                               total--;`
+                               if (!Regex.match_simple ("Already up-to-date", str) ) {
+                                        
+                               
+                                               str += str.length > 0 ? "\n" : "";
+                                               str += "Updated: " +repo.name + "\n" + res +"\n";
+                                       }
+                                       if (total < 1) {
+                                       var notification = new Notify.Notification( 
+                                            "Updated " + repo.name,
+                                            str,
+                                              "dialog-information"
+                                       );
+                               statusicon.set_tooltip_text("Gitlive");
+                             
+                            
+                                               GitMonitor.gitmonitor.start();
+                               }
+                        });
+                                // do not care if it's already in sycn..
+                        
+                    
+                        notification.set_timeout(20);
+                        notification.show();
+                                 
+                    //} catch(Error e) {
+                   //     print("notification or push errror- probably to many in queue..");
+                    //    statusicon.set_from_stock( Gtk.Stock.MEDIA_RECORD );
+                    //    print(e.message);
+                        
+                   // }        
+
+                } 
+                statusicon.set_tooltip_text("Gitlive");
+                  
+        
+        
+               }
+        
             
         }