sync
[gitlive] / StatusIcon.vala
index 027ecf9..42bccd7 100644 (file)
@@ -47,16 +47,18 @@ public class StatusIconA : StatusIcon {
          //title : 'gitlive',
         this.stock = Gtk.Stock.REFRESH;
         this.tooltip_text = "GitLive";
-        this.title = "vgitlive";
+        this.title = "gitlive";
         
-        this.set_name("vgitlive");
+        this.set_name("gitlive");
         this.set_visible(true);      
         
         var menu = new MenuA();
         menu.ref();       
-         
-        this.popup_menu.connect( () =>{
-            
+
+           
+       this.popup_menu.connect( (  button,   time) =>{
+       //this.button_press_event.connect( (  ) =>{
+               
             //print(Array.prototype.slice.call(arguments).join(','));
             print("menu activiate called\n");
             //var menu = this.get('menu');
@@ -70,17 +72,18 @@ public class StatusIconA : StatusIcon {
                 menu.resume.hide();
                 menu.pause.show();
             }
-              
+              //               public void popup (Gtk.Widget? parent_menu_shell, Gtk.Widget? parent_menu_item,
+                    // [CCode (scope = "async")] Gtk.MenuPositionFunc? func, uint button, uint32 activate_time);
             //Gtk.get_current_event_device ()
             menu.popup(
-                    
+
                         null, null,
-                        this.position_menu, 0,
-                         Gtk.get_current_event_time()
+                       this.position_menu,
+                       
+                    button,  time //   time
             );
                         
             
-            
             //var g = { };
             //var a = new Gdk.Rectangle();
             //  needs direction=inout setting in gir to work (in bugzilla @present)
@@ -89,11 +92,46 @@ public class StatusIconA : StatusIcon {
             // should check to see if @ top or bottom I guess..
             //menu.el.get_toplevel().move(a.x, a.y +a.height);
             //menu.el.get_toplevel().move(10,10);
+            //return false;
               
         }); 
         
     }
     
+    public void pause()
+    {
+               this.set_from_stock( Gtk.Stock.MEDIA_PAUSE );
+               this.paused = true;
+    }
+    
+    public void resume()
+    {
+               this.set_from_stock( Gtk.Stock.MEDIA_PLAY );
+               this.paused = false;
+    }
+    
+    public void refreshing()
+    {
+               this.set_from_stock( Gtk.Stock.REFRESH );
+    }
+    
+    public void pauseError()
+    {
+                this.paused = true;
+                var flag = true;
+                Timeout.add_full(Priority.LOW, 500, () => {
+                
+                       if (!this.paused) {
+                               return false;
+                       }
+                       this.set_from_stock( flag == true ? Gtk.Stock.MEDIA_RECORD  
+                                       : Gtk.Stock.MEDIA_PAUSE);
+                       flag = !flag;
+                       return true;
+               });
+                
+    }
+    
     class MenuA : Gtk.Menu
     {
         public ImageMenuItem pause;
@@ -188,7 +226,8 @@ public class StatusIconA : StatusIcon {
                     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 );
+                        statusicon.set_from_stock( 
+                               i%2 == 0 ?  Gtk.Stock.FULLSCREEN : Gtk.Stock.LEAVE_FULLSCREEN );
                                 
                         var repo = tr.index(i);
                         //if (!repo.autocommit()) {
@@ -328,4 +367,4 @@ public class StatusIconA : StatusIcon {
 }
       
                 
-                  
+                  
\ No newline at end of file