public void LeavingGeneralPage()
 {
     if (oneMinuteLimitNotifyWindow != null)
        {
     oneMinuteLimitNotifyWindow.Hide();
     oneMinuteLimitNotifyWindow.Destroy();
     oneMinuteLimitNotifyWindow = null;
        }
 }
Example #2
0
        private void OnAutoSyncButton(object o, EventArgs args)
        {
            if (AutoSyncCheckButton.Active == true)
            {
                SyncSpinButton.Sensitive    = true;
                SyncUnitsComboBox.Sensitive = true;

                SyncUnitsComboBox.Changed -= new EventHandler(OnSyncUnitsChanged);
                SyncUnitsComboBox.Active   = (int)SyncUnit.Minutes;
                currentSyncUnit            = SyncUnit.Minutes;
                SaveSyncUnitConfig();
                SyncUnitsComboBox.Changed += new EventHandler(OnSyncUnitsChanged);

                SyncSpinButton.Value = 5;
            }
            else
            {
                if (oneMinuteLimitNotifyWindow != null)
                {
                    oneMinuteLimitNotifyWindow.Hide();
                    oneMinuteLimitNotifyWindow.Destroy();
                    oneMinuteLimitNotifyWindow = null;
                }

                try
                {
                    ifws.SetDefaultSyncInterval(-1);
                }
                catch (Exception e)
                {
                    iFolderExceptionDialog ied = new iFolderExceptionDialog(
                        topLevelWindow, e);
                    ied.Run();
                    ied.Hide();
                    ied.Destroy();
                    return;
                }

                SyncSpinButton.ValueChanged -= new EventHandler(OnSyncIntervalChanged);
                SyncSpinButton.Value         = 0;
                SyncSpinButton.Sensitive     = false;
                SyncUnitsComboBox.Sensitive  = false;
                SyncSpinButton.ValueChanged += new EventHandler(OnSyncIntervalChanged);
            }
        }
Example #3
0
        private void OnSyncIntervalChanged(object o, EventArgs args)
        {
            if ((currentSyncUnit == SyncUnit.Seconds) && (SyncSpinButton.Value < 5))
            {
                if (oneMinuteLimitNotifyWindow != null)
                {
                    oneMinuteLimitNotifyWindow.Hide();
                    oneMinuteLimitNotifyWindow.Destroy();
                    oneMinuteLimitNotifyWindow = null;
                }
                SyncSpinButton.Value       = 5;
                oneMinuteLimitNotifyWindow =
                    new NotifyWindow(
                        SyncSpinButton, Util.GS("Synchronization Interval Limit"),
                        Util.GS("The synchronization interval cannot be set to less than 5 Seconds.  It will automatically change to 5 seconds."), Gtk.MessageType.Info, 10000);
                oneMinuteLimitNotifyWindow.ShowAll();
            }

            int syncSpinValue =
                CalculateActualSyncInterval((int)SyncSpinButton.Value,
                                            currentSyncUnit);

            try
            {
                lastSyncInterval = syncSpinValue;
                if (lastSyncInterval <= 0)
                {
                    ifws.SetDefaultSyncInterval(-1);
                }
                else
                {
                    ifws.SetDefaultSyncInterval(lastSyncInterval);
                }
            }
            catch (Exception e)
            {
                iFolderExceptionDialog ied = new iFolderExceptionDialog(
                    topLevelWindow, e);
                ied.Run();
                ied.Hide();
                ied.Destroy();
                return;
            }
        }
 private void OnSyncIntervalChanged(object o, EventArgs args)
 {
     if (oneMinuteLimitNotifyWindow != null)
        {
     oneMinuteLimitNotifyWindow.Hide();
     oneMinuteLimitNotifyWindow.Destroy();
     oneMinuteLimitNotifyWindow = null;
        }
        int syncSpinValue =
     CalculateActualSyncInterval((int)SyncSpinButton.Value,
        currentSyncUnit);
        try
        {
     lastSyncInterval = syncSpinValue;
     if(lastSyncInterval <= 0)
     {
      ifws.SetDefaultSyncInterval(-1);
     }
     else
     {
      ifws.SetDefaultSyncInterval(lastSyncInterval);
     }
        }
        catch(Exception e)
        {
     iFolderExceptionDialog ied = new iFolderExceptionDialog(
      topLevelWindow, e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
     return;
        }
 }
 private void OnAutoSyncButton(object o, EventArgs args)
 {
     if(AutoSyncCheckButton.Active == true)
        {
     SyncSpinButton.Sensitive = true;
     SyncUnitsComboBox.Sensitive = true;
     SyncUnitsComboBox.Changed -= new EventHandler(OnSyncUnitsChanged);
     SyncUnitsComboBox.Active = (int)SyncUnit.Minutes;
     currentSyncUnit = SyncUnit.Minutes;
     SaveSyncUnitConfig();
     SyncUnitsComboBox.Changed += new EventHandler(OnSyncUnitsChanged);
     SyncSpinButton.Value = 5;
        }
        else
        {
     if (oneMinuteLimitNotifyWindow != null)
     {
      oneMinuteLimitNotifyWindow.Hide();
      oneMinuteLimitNotifyWindow.Destroy();
      oneMinuteLimitNotifyWindow = null;
     }
     try
     {
      ifws.SetDefaultSyncInterval(-1);
     }
     catch(Exception e)
     {
      iFolderExceptionDialog ied = new iFolderExceptionDialog(
       topLevelWindow, e);
      ied.Run();
      ied.Hide();
      ied.Destroy();
      return;
     }
     SyncSpinButton.Value = 0;
     SyncSpinButton.Sensitive = false;
     SyncUnitsComboBox.Sensitive = false;
        }
 }
 public iFolderApplication(string[] args)
     : base("ifolder", "1.0", Modules.UI, args)
 {
     Util.InitCatalog();
        Util.SetQuitiFolderDelegate(new QuitiFolderDelegate(QuitiFolder));
        tIcon = new Egg.TrayIcon("iFolder");
        currentIconAnimationDirection = 0;
        this.ClientUpgradeStatus = null;
        this.NewClientVersion = null;
        this.NewClientDomainID = null;
        eBox = new EventBox();
        eBox.ButtonPressEvent +=
     new ButtonPressEventHandler(trayapp_clicked);
                 quitDlg = new iFolderMsgDialog(
                 null,
                 iFolderMsgDialog.DialogType.Question,
                 iFolderMsgDialog.ButtonSet.YesNo,
                 Util.GS("Exit Novell iFolder"),
                  Util.GS("If you exit the Novell iFolder application, changes in your iFolder will no longer be tracked.\nThe next time you login, Novell iFolder will reconcile any differences between your iFolder and Server.\n\nAre you sure you want to exit the Application ?"),
                 " ");
                  quitDlg.Response += new ResponseHandler(YesNo_Clicked);
        RunningPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder16.png"));
        StartingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-waiting16.png"));
        StoppingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-waiting16.png"));
        DownloadingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-download16.png"));
        UploadingPixbuf =
      new Pixbuf(Util.ImagesPath("ifolder-upload16.png"));
        gAppIcon = new Gtk.Image(RunningPixbuf);
        eBox.Add(gAppIcon);
        tIcon.Add(eBox);
        tIcon.ShowAll();
        LoginDialog = null;
        collectionSynchronizing = null;
        synchronizationErrors = new Hashtable();
        iFolderAppStateChanged = new Gtk.ThreadNotify(
        new Gtk.ReadyEvent(OniFolderAppStateChanged));
        simiasManager = Util.CreateSimiasManager(args);
        startingUpNotifyWindow = null;
        shuttingDownNotifyWindow = null;
        forceShutdown = false;
        ClientUpgradeDialog = null;
 }
 private void OnStartingUpNotifyWindowHidden(object o, EventArgs args)
 {
     startingUpNotifyWindow = null;
 }
 private void OnShuttingDownNotifyWindowHidden(object o, EventArgs args)
 {
     shuttingDownNotifyWindow = null;
 }
 private void OniFolderUserAddedEvent(object o,
  iFolderUserAddedEventArgs args)
 {
     if (args == null || args.iFolderID == null || args.iFolderUser == null)
     return;
        if((bool)ClientConfig.Get(ClientConfig.KEY_NOTIFY_USERS))
        {
     string username;
     iFolderHolder ifHolder = ifdata.GetiFolder(args.iFolderID);
     if( (args.iFolderUser.FN != null) &&
      (args.iFolderUser.FN.Length > 0) )
      username = args.iFolderUser.FN;
     else
      username = args.iFolderUser.Name;
     NotifyWindow notifyWin = new NotifyWindow(
      tIcon, Util.GS("New iFolder User"),
      string.Format(Util.GS("{0} has joined the iFolder \"{1}\""), username, ifHolder.iFolder.Name),
      Gtk.MessageType.Info, 10000);
     notifyWin.LinkClicked +=
      new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
     notifyWin.ShowAll();
        }
 }
 private void OniFolderSyncEvent(object o, CollectionSyncEventArgs args)
 {
     if (args == null || args.ID == null || args.Name == null)
     return;
        switch(args.Action)
        {
     case Simias.Client.Event.Action.StartSync:
     {
      bCollectionIsSynchronizing = true;
      collectionSynchronizing = args.ID;
      break;
     }
     case Simias.Client.Event.Action.StopSync:
     {
      bCollectionIsSynchronizing = false;
      currentIconAnimationDirection = 0;
      gAppIcon.Pixbuf = RunningPixbuf;
       if (collectionSynchronizing != null)
       {
        iFolderHolder ifHolder = ifdata.GetiFolder(collectionSynchronizing);
        if (ifHolder != null)
        {
     if (synchronizationErrors.ContainsKey(ifHolder.iFolder.ID))
     {
      Hashtable collectionSyncErrors = (Hashtable)synchronizationErrors[ifHolder.iFolder.ID];
      ICollection errors = collectionSyncErrors.Keys;
      ArrayList keysToClear = new ArrayList();
      foreach(SyncStatus syncStatusKey in errors)
      {
       string errMsg = (string) collectionSyncErrors[syncStatusKey];
       if (errMsg != null && errMsg.Length > 0)
       {
        NotifyWindow notifyWin = new NotifyWindow(
     tIcon, string.Format(Util.GS("Incomplete Synchronization: {0}"), ifHolder.iFolder.Name),
     errMsg,
     Gtk.MessageType.Warning, 10000);
        notifyWin.LinkClicked +=
     new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
        notifyWin.ShowAll();
        keysToClear.Add(syncStatusKey);
       }
      }
      foreach(SyncStatus syncStatusKey in keysToClear)
      {
       collectionSyncErrors[syncStatusKey] = "";
      }
     }
        }
       }
      collectionSynchronizing = null;
      break;
     }
        }
        try
        {
     iFolderWindow ifwin = Util.GetiFolderWindow();
     if(ifwin != null)
      ifwin.HandleSyncEvent(args);
     LogWindow logwin = Util.GetLogWindow(simiasManager);
     if(logwin != null)
      logwin.HandleSyncEvent(args);
        }
        catch {}
 }
 private void OniFolderAddedEvent(object o, iFolderAddedEventArgs args)
 {
     if (args == null || args.iFolderID == null)
     return;
        iFolderHolder ifHolder = ifdata.GetiFolder(args.iFolderID);
        if (ifHolder == null)
     return;
        if (ifHolder.iFolder == null)
     return;
        if(!ifdata.IsCurrentUser(ifHolder.iFolder.OwnerID))
        {
     if(ifHolder.iFolder.IsSubscription &&
      ((bool)ClientConfig.Get(ClientConfig.KEY_NOTIFY_IFOLDERS)))
     {
      NotifyWindow notifyWin = new NotifyWindow(
        tIcon,
        string.Format(Util.GS("New iFolder \"{0}\""),
     ifHolder.iFolder.Name),
        string.Format(Util.GS("{0} has invited you to participate in this shared iFolder.\n\nClick <a href=\"SetUpiFolder:{1}\">here</a> to set up this iFolder."),
     ifHolder.iFolder.Owner, ifHolder.iFolder.CollectionID),
        Gtk.MessageType.Info, 10000);
      notifyWin.LinkClicked +=
       new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
      notifyWin.ShowAll();
     }
        }
 }
 private void trayapp_clicked(object obj, ButtonPressEventArgs args)
 {
     if (CurrentState == iFolderAppState.Starting)
        {
     if (startingUpNotifyWindow == null)
     {
      startingUpNotifyWindow = new NotifyWindow(
       tIcon, Util.GS("iFolder is starting"),
       Util.GS("Please wait for iFolder to start...\n\nPress <a href=\"CancelStartup\">here</a> to cancel."),
       Gtk.MessageType.Info, 0);
      startingUpNotifyWindow.LinkClicked +=
       new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
      startingUpNotifyWindow.Hidden +=
       new EventHandler(OnStartingUpNotifyWindowHidden);
      startingUpNotifyWindow.ShowAll();
     }
     return;
        }
        else if (CurrentState == iFolderAppState.Stopping)
        {
     if (shuttingDownNotifyWindow == null)
     {
      shuttingDownNotifyWindow = new NotifyWindow(
       tIcon, Util.GS("iFolder is shutting down"),
       "",
       Gtk.MessageType.Info, 0);
      shuttingDownNotifyWindow.Hidden +=
       new EventHandler(OnShuttingDownNotifyWindowHidden);
      shuttingDownNotifyWindow.ShowAll();
     }
     return;
        }
        if (Util.CurrentModalWindow != null)
        {
     try
     {
      Util.CurrentModalWindow.Present();
      return;
     }
     catch{}
        }
        switch(args.Event.Button)
        {
     case 1:
      DomainInformation[] domains = domainController.GetDomains();
      if (domains.Length < 1)
      {
       ShowAddAccountWizard();
      }
      else
      {
       iFolderWindow ifwin = Util.GetiFolderWindow();
       if (ifwin == null || !ifwin.IsActive)
        Util.ShowiFolderWindow();
       else
        ifwin.CloseWindow();
      }
      break;
     case 2:
      break;
     case 3:
      show_tray_menu();
      break;
        }
 }
Example #13
0
 private void OnSyncIntervalChanged(object o, EventArgs args)
 {
     if ((currentSyncUnit == SyncUnit.Seconds) && (SyncSpinButton.Value < 5) )
        {
        if (oneMinuteLimitNotifyWindow != null)
        {
       oneMinuteLimitNotifyWindow.Hide();
        oneMinuteLimitNotifyWindow.Destroy();
        oneMinuteLimitNotifyWindow = null;
        }
        SyncSpinButton.Value = 5;
        oneMinuteLimitNotifyWindow =
      new NotifyWindow(
       SyncSpinButton, Util.GS("Synchronization Interval Limit"),
       Util.GS("The synchronization interval cannot be set to less than 5 Seconds.  It will automatically change to 5 seconds."), Gtk.MessageType.Info, 10000);
       oneMinuteLimitNotifyWindow.ShowAll();
        }
        int syncSpinValue =
     CalculateActualSyncInterval((int)SyncSpinButton.Value,
        currentSyncUnit);
        try
        {
     lastSyncInterval = syncSpinValue;
     if(lastSyncInterval <= 0)
     {
      ifws.SetDefaultSyncInterval(-1);
     }
     else
     {
      ifws.SetDefaultSyncInterval(lastSyncInterval);
     }
        }
        catch(Exception e)
        {
     iFolderExceptionDialog ied = new iFolderExceptionDialog(
      topLevelWindow, e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
     return;
        }
 }
 private void trayapp_clicked(object obj, ButtonPressEventArgs args)
 {
     if (CurrentState == iFolderState.Starting)
        {
     if (startingUpNotifyWindow == null)
     {
      startingUpNotifyWindow = new NotifyWindow(
       tIcon, Util.GS("iFolder is starting"),
       Util.GS("Please wait for iFolder to start...\n\nPress <a href=\"CancelStartup\">here</a> to cancel."),
       Gtk.MessageType.Info, 0);
      startingUpNotifyWindow.LinkClicked +=
       new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
      startingUpNotifyWindow.ShowAll();
     }
     return;
        }
        else if (CurrentState == iFolderState.Stopping)
        {
     if (shuttingDownNotifyWindow == null)
     {
      shuttingDownNotifyWindow = new NotifyWindow(
       tIcon, Util.GS("iFolder is shutting down"),
       Util.GS("Press <a href=\"ForceShutdown\">here</a> to force iFolder to shut down now."),
       Gtk.MessageType.Info, 0);
      shuttingDownNotifyWindow.LinkClicked +=
       new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
      shuttingDownNotifyWindow.ShowAll();
     }
     return;
        }
        if (Util.CurrentModalWindow != null)
        {
     Console.WriteLine("Modal present");
     try
     {
      Util.CurrentModalWindow.Present();
      return;
     }
     catch{}
        }
        switch(args.Event.Button)
        {
     case 1:
      iFolderWindow ifwin = Util.GetiFolderWindow();
      if (ifwin == null || !ifwin.IsActive)
       Util.ShowiFolderWindow();
      else
       ifwin.Hide();
      break;
     case 2:
      break;
     case 3:
      show_tray_menu();
      break;
        }
 }
Example #15
0
 private void OnSyncUnitsChanged(object o, EventArgs args)
 {
     if (oneMinuteLimitNotifyWindow != null)
        {
     oneMinuteLimitNotifyWindow.Hide();
     oneMinuteLimitNotifyWindow.Destroy();
     oneMinuteLimitNotifyWindow = null;
        }
        int syncSpinValue = (int)SyncSpinButton.Value;
        currentSyncUnit = (SyncUnit)SyncUnitsComboBox.Active;
        if (currentSyncUnit == SyncUnit.Seconds)
        {
     SyncSpinButton.Adjustment.Lower = 60;
     if (syncSpinValue < 60)
     {
      oneMinuteLimitNotifyWindow =
       new NotifyWindow(
       SyncSpinButton, Util.GS("Synchronization Interval Limit"),
       Util.GS("The synchronization interval cannot be set to less than one minute.  It was automatically changed to 60 seconds."),
       Gtk.MessageType.Info, 10000);
      oneMinuteLimitNotifyWindow.ShowAll();
      SyncSpinButton.ValueChanged -=
       new EventHandler(OnSyncIntervalChanged);
      SyncSpinButton.Value = 60;
      syncSpinValue = 60;
      SyncSpinButton.ValueChanged +=
       new EventHandler(OnSyncIntervalChanged);
     }
        }
        else
        {
     SyncSpinButton.Adjustment.Lower = 1;
        }
        int syncInterval =
     CalculateActualSyncInterval(syncSpinValue,
        currentSyncUnit);
        try
        {
     lastSyncInterval = syncInterval;
     if(lastSyncInterval <= 0)
     {
      ifws.SetDefaultSyncInterval(-1);
     }
     else
     {
      ifws.SetDefaultSyncInterval(lastSyncInterval);
     }
     SaveSyncUnitConfig();
        }
        catch(Exception e)
        {
     iFolderExceptionDialog ied = new iFolderExceptionDialog(
      topLevelWindow, e);
     ied.Run();
     ied.Hide();
     ied.Destroy();
     return;
        }
 }
 private void OniFolderSyncEvent(object o, CollectionSyncEventArgs args)
 {
     if (args == null || args.ID == null || args.Name == null)
     return;
        switch(args.Action)
        {
     case Simias.Client.Event.Action.StartSync:
     {
      collectionSynchronizing = args.ID;
      break;
     }
     case Simias.Client.Event.Action.StopSync:
     {
      currentIconAnimationDirection = 0;
       if (collectionSynchronizing != null)
       {
        iFolderHolder ifHolder = ifdata.GetiFolder(collectionSynchronizing);
        if (ifHolder != null)
        {
     if (synchronizationErrors.ContainsKey(ifHolder.iFolder.ID))
     {
      Hashtable collectionSyncErrors = (Hashtable)synchronizationErrors[ifHolder.iFolder.ID];
      ICollection errors = collectionSyncErrors.Keys;
      Debug.PrintLine(String.Format("Number of errors: {0}", errors.Count));
      ArrayList keysToClear = new ArrayList();
      bool showErrorBaloon = false;
      bool showGenericBaloon = true;
      foreach(SyncStatus syncStatusKey in errors)
      {
       string errMsg = (string) collectionSyncErrors[syncStatusKey];
       if (errMsg != null && errMsg.Length > 0)
       {
     showErrorBaloon = true;
     NotifyWindow notifyWin = new NotifyWindow(
     tIcon, string.Format(Util.GS("Incomplete Synchronization: {0}"), ifHolder.iFolder.Name),
     errMsg,
     Gtk.MessageType.Warning, 5000);
     notifyWin.LinkClicked +=
     new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
     notifyWin.ShowAll();
     showGenericBaloon = false;
     keysToClear.Add(syncStatusKey);
       }
      }
      if( showErrorBaloon == true)
      {
       if( showGenericBaloon )
       {
        NotifyWindow notifyWin = new NotifyWindow(
        tIcon, string.Format(Util.GS("Incomplete Synchronization: {0}"), ifHolder.iFolder.Name),
        Util.GS("Synchronization log contains the information regarding the files that are not synchronized"),
        Gtk.MessageType.Warning, 5000);
        notifyWin.LinkClicked +=
        new LinkClickedEventHandler(OnNotifyWindowLinkClicked);
        notifyWin.ShowAll();
       }
      }
      foreach(SyncStatus syncStatusKey in keysToClear)
      {
       collectionSyncErrors.Remove( syncStatusKey);
      }
      Debug.PrintLine(String.Format("After removing keys count: {0}", collectionSyncErrors.Count));
     }
        }
       }
      collectionSynchronizing = null;
      break;
     }
        }
        gAppIcon.Pixbuf = RunningPixbuf;
 }
 private void OniFolderStateChanged()
 {
     switch(CurrentState)
        {
     case iFolderState.Starting:
      gAppIcon.Pixbuf = StartingPixbuf;
      break;
     case iFolderState.Running:
      if(simiasEventBroker != null)
      {
       simiasEventBroker.iFolderAdded +=
        new iFolderAddedEventHandler(
     OniFolderAddedEvent);
       simiasEventBroker.iFolderChanged +=
        new iFolderChangedEventHandler(
     OniFolderChangedEvent);
       simiasEventBroker.iFolderDeleted +=
        new iFolderDeletedEventHandler(
     OniFolderDeletedEvent);
       simiasEventBroker.iFolderUserAdded +=
        new iFolderUserAddedEventHandler(
     OniFolderUserAddedEvent);
       simiasEventBroker.CollectionSyncEventFired +=
        new CollectionSyncEventHandler(
     OniFolderSyncEvent);
       simiasEventBroker.FileSyncEventFired +=
        new FileSyncEventHandler(
     OniFolderFileSyncEvent);
      }
      if (domainController != null)
      {
       domainController.DomainNeedsCredentials +=
        new DomainNeedsCredentialsEventHandler(OnDomainNeedsCredentialsEvent);
      }
      if (startingUpNotifyWindow != null)
      {
       startingUpNotifyWindow.Hide();
       startingUpNotifyWindow.Destroy();
       startingUpNotifyWindow = null;
      }
      gAppIcon.Pixbuf = RunningPixbuf;
      iFolderWindow ifwin = Util.GetiFolderWindow();
      LogWindow logwin = Util.GetLogWindow(simiasManager);
      GLib.Timeout.Add(100, new GLib.TimeoutHandler(ShowiFolderWindows));
      break;
     case iFolderState.Stopping:
      gAppIcon.Pixbuf = StoppingPixbuf;
      break;
     case iFolderState.Stopped:
      System.Threading.Thread th = new System.Threading.Thread (new System.Threading.ThreadStart (GuaranteeShutdown));
      th.IsBackground = true;
      th.Start ();
      try
      {
     Console.WriteLine("iFolderApplication.OniFolderStateChanged:Stopped calling SimiasManager.Stop()...");
       simiasManager.Stop();
     Console.WriteLine("\tdone calling SimiasManager.Stop()");
      }
      catch(Exception e)
      {
       Console.WriteLine(e);
      }
      Application.Quit();
      break;
        }
 }