var menu = new MenuA();
menu.ref();
+ this.button_press_event.connect( ( ev ) =>{
+ print("button press event called\n");
+
+ menu.show_all();
+
+ if (this.paused) {
+ menu.resume.show();
+ menu.pause.hide();
+ } else {
+ 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,
+
+ ev.button, ev.time // time
+ );
+
+ return true;
+ });
this.popup_menu.connect( ( button, time) =>{
//this.button_press_event.connect( ( ) =>{
}
+ 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;
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 );
+ statusicon.set_from_stock(
+ i%2 == 0 ? Gtk.Stock.FULLSCREEN : Gtk.Stock.LEAVE_FULLSCREEN );
var repo = tr.index(i);
//if (!repo.autocommit()) {
}
}
- statusicon.set_tooltip_text("Gitlive");
-
-
- GitMonitor.gitmonitor.start();
+
});
}
-
+ void pullAll()
+ {
+ var tr = GitRepo.list();
+
+ GitMonitor.gitmonitor.stop();
+
+
+ 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.begin((obj, syncres) => {
+
+ var res = fetch_webpage.end(syncres);
+ 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(
+ "Pull completed ",
+ str,
+ "dialog-information"
+ );
+ notification.set_timeout(20);
+ notification.show();
+ statusicon.set_tooltip_text("Gitlive");
+
+
+ GitMonitor.gitmonitor.start();
+ }
+ });
+ // do not care if it's already in sycn..
+
+
+
+
+ //} catch(Error e) {
+ // print("notification or push errror- probably to many in queue..");
+ // statusicon.set_from_stock( Gtk.Stock.MEDIA_RECORD );
+ // print(e.message);
+
+ // }
+
+ }
+
+
+
+
+ }
+
}
}
-
+
\ No newline at end of file