Exemple #1
0
        private void SetupTrayIcon()
        {
//			Logger.Debug ("Creating TrayIcon");

            onPixBuf  = Utilities.GetIcon("giver-24", 24);
            offPixBuf = Utilities.GetIcon("giveroff-24", 24);

            tray_icon            = new Gtk.StatusIcon();
            tray_icon.Pixbuf     = offPixBuf;
            tray_icon.Activate  += delegate { TargetWindow.ShowWindow(locator); };
            tray_icon.PopupMenu += OnPopupMenu;
        }
Exemple #2
0
        ///<summary>
        ///	WindowDeleted
        /// Cleans up the conversation object with the ConversationManager
        ///</summary>
        private void WindowDeleted(object sender, DeleteEventArgs args)
        {
            int x;
            int y;

            this.GetPosition(out x, out y);

            lastXPos = x;
            lastYPos = y;

            Application.Instance.TransferStarted -= TransferStartedHandler;

            Logger.Debug("WindowDeleted was called");
            TearDownLocatorEvents();
            targetWindow = null;
            Application.Instance.Quit();
        }
Exemple #3
0
        ///<summary>
        ///	Present
        /// Presents the window
        ///</summary>

/*		public new void Present ()
 *              {
 *                      if (everShown == false) {
 *                              Show ();
 *                              everShown = true;
 *                      } else {
 *                              base.Present ();
 *                      }
 *              }
 */
        #endregion


        #region Public Properties
        #endregion

        public static void ShowWindow(ServiceLocator serviceLocator)
        {
            if (targetWindow != null)
            {
                if (targetWindow.IsActive)
                {
                    int x;
                    int y;

                    targetWindow.GetPosition(out x, out y);

                    lastXPos = x;
                    lastYPos = y;

                    targetWindow.Hide();
                }
                else
                {
                    if (!targetWindow.Visible)
                    {
                        int x = lastXPos;
                        int y = lastYPos;

                        if (x >= 0 && y >= 0)
                        {
                            targetWindow.Move(x, y);
                        }
                    }
                    targetWindow.Present();
                }
            }
            else
            {
                TargetWindow.targetWindow = new TargetWindow(serviceLocator);
                int x = lastXPos;
                int y = lastYPos;

                if (x >= 0 && y >= 0)
                {
                    targetWindow.Move(x, y);
                }

                targetWindow.ShowAll();
            }
        }
Exemple #4
0
 private void OnShowTargets(object sender, EventArgs args)
 {
     TargetWindow.ShowWindow(locator);
 }
Exemple #5
0
        private bool InitializeIdle()
        {
            requestHandler = new RequestHandler();
            sendingHandler = new SendingHandler();
            sendingHandler.Start();

            sendingHandler.TransferStarted     += TransferStartedHandler;
            sendingHandler.FileTransferStarted += FileTransferStartedHandler;
            sendingHandler.TransferProgress    += TransferProgressHandler;
            sendingHandler.TransferEnded       += TransferEndedHandler;

            try {
                photoService = new Giver.PhotoService();
                photoService.PhotoResolved += OnPhotoResolved;
                photoService.Start();
            } catch (Exception e) {
                Logger.Fatal("Failed to start the Photo Service");
                throw e;
            }


            try {
                locator = new ServiceLocator();
            } catch (Exception e) {
                if (e.Message.CompareTo("Daemon not running") == 0)
                {
                    Logger.Fatal("The Avahi Daemon is not running... start it before running Giver");
                }
                else
                {
                    Logger.Debug("Error starting ServiceLocator: {0}", e.Message);
                }

                throw e;
            }
            try {
                service = new GiverService();
            } catch (Exception e) {
                if (e.Message.CompareTo("Daemon not running") == 0)
                {
                    Logger.Fatal("The Avahi Daemon is not running... start it before running Giver");
                }
                else
                {
                    Logger.Debug("Error starting GiverService: {0}", e.Message);
                }

                throw e;
            }

            locator.ServiceRemoved  += OnServicesChanged;
            locator.ServiceAdded    += OnServicesChanged;
            service.ClientConnected += OnClientConnected;

            //tray = new NotificationArea("RtcApplication");
            SetupTrayIcon();

            if (!quiet)
            {
                TargetWindow.ShowWindow(locator);
            }

            return(false);
        }
Exemple #6
0
		///<summary>
		///	Present
		/// Presents the window
		///</summary>			
/*		public new void Present ()
		{
			if (everShown == false) {
				Show ();
				everShown = true;
			} else {
				base.Present ();
			}
		}
*/
		#endregion


		#region Public Properties
		#endregion

		public static void ShowWindow(ServiceLocator serviceLocator)
		{
			if(targetWindow != null) {
				if(targetWindow.IsActive) {
		            int x;
		            int y;

		            targetWindow.GetPosition(out x, out y);
		            
		            lastXPos = x;
		            lastYPos = y;

					targetWindow.Hide();
				} else {
					if(!targetWindow.Visible) {
			        	int x = lastXPos;
						int y = lastYPos;

						if (x >= 0 && y >= 0)
							targetWindow.Move(x, y);						
					}
					targetWindow.Present();
				}
			} else {
				TargetWindow.targetWindow = new TargetWindow(serviceLocator);
	        	int x = lastXPos;
				int y = lastYPos;

				if (x >= 0 && y >= 0)
					targetWindow.Move(x, y);						

				targetWindow.ShowAll();
			}
		}
Exemple #7
0
		///<summary>
		///	WindowDeleted
		/// Cleans up the conversation object with the ConversationManager
		///</summary>	
		private void WindowDeleted (object sender, DeleteEventArgs args)
		{
            int x;
            int y;

            this.GetPosition(out x, out y);
            
            lastXPos = x;
            lastYPos = y;

			Application.Instance.TransferStarted -= TransferStartedHandler;
            
			Logger.Debug("WindowDeleted was called");
			TearDownLocatorEvents();
			targetWindow = null;
			Application.Instance.Quit ();
		}