StatusIcon.vala
[gitlive] / StatusIcon.vala
index 8e90270..e728ff4 100644 (file)
@@ -72,14 +72,15 @@ 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, null,
                        this.position_menu,
-                       null,  
-                    0,  time //   time
+                       
+                    button,  time //   time
             );
                         
             
@@ -97,6 +98,37 @@ public class StatusIconA : StatusIcon {
         
     }
     
+    void pause()
+    {
+               this.set_from_stock( Gtk.Stock.MEDIA_PAUSE );
+    }
+    void resume()
+    {
+               this.set_from_stock( Gtk.Stock.MEDIA_PLAY );
+               this.error_animate= false;
+    }
+    
+    void refreshing()
+    {
+               this.set_from_stock( Gtk.Stock.REFRESH );
+    }
+    void pauseError()
+    {
+                this.error_animate = true;
+                var flag = true;
+                Timeout.add_full(Priority.LOW, 500, () => {
+                
+                       if (!this.error_animate) {
+                               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;
@@ -191,7 +223,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()) {