示例#1
0
        private void DragDataReceivedHandler(object o, DragDataReceivedArgs args)
        {
            //args.Context.
            switch (args.Info)
            {
            case (uint)DragTargetType.UriList:
            {
                UriList  uriList = new UriList(args.SelectionData);
                string[] paths   = uriList.ToLocalPaths();

                if (paths.Length > 0)
                {
                    if (!isManual)
                    {
                        Application.EnqueueFileSend(serviceInfo, uriList.ToLocalPaths());
                    }
                    else
                    {
                        // Prompt for the info to send here
                    }
                }
                else
                {
                    // check for a tomboy notes
                    foreach (Uri uri in uriList)
                    {
                        if ((uri.Scheme.CompareTo("note") == 0) &&
                            (uri.Host.CompareTo("tomboy") == 0))
                        {
                            string[] files    = new string[1];
                            string   tomboyID = uri.AbsolutePath.Substring(1);

                            string homeFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                            string path       = System.IO.Path.Combine(homeFolder, ".tomboy");
                            path     = System.IO.Path.Combine(path, tomboyID + ".note");
                            files[0] = path;
                            Logger.Debug("Go and get the tomboy note {0}", path);
                            Application.EnqueueFileSend(serviceInfo, files);
                        }
                        else if (uri.Scheme.CompareTo("tasque") == 0)
                        {
                            string[] files    = new string[1];
                            string   taskFile = uri.AbsolutePath.Substring(1);

                            string path = System.IO.Path.Combine("/", taskFile);
                            files[0] = path;
                            Logger.Debug("Go and get the task file {0}", path);
                            Application.EnqueueFileSend(serviceInfo, files);
                        }
                    }
                }
                break;
            }

            default:
                break;
            }

            //Logger.Debug("DragDataReceivedHandler called");
            Gtk.Drag.Finish(args.Context, true, false, args.Time);
        }
示例#2
0
		private void DragDataReceivedHandler (object o, DragDataReceivedArgs args)
		{
			//args.Context.
			switch(args.Info) {
				case (uint) DragTargetType.UriList:
				{
                    UriList uriList = new UriList(args.SelectionData);
					string[] paths = uriList.ToLocalPaths();

					if(paths.Length > 0)
					{
						if(!isManual) {
							Application.EnqueueFileSend(serviceInfo, uriList.ToLocalPaths());
						} else {
							// Prompt for the info to send here
						}
					} else {
						// check for a tomboy notes
						foreach(Uri uri in uriList) {
							if( (uri.Scheme.CompareTo("note") == 0) &&
								(uri.Host.CompareTo("tomboy") == 0) ) {
								string[] files = new string[1];
								string tomboyID = uri.AbsolutePath.Substring(1);

								string homeFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
								string path = System.IO.Path.Combine(homeFolder, ".tomboy");
								path = System.IO.Path.Combine(path, tomboyID + ".note");
								files[0] = path;
								Logger.Debug("Go and get the tomboy note {0}", path);
								Application.EnqueueFileSend(serviceInfo, files);
							}
							else if(uri.Scheme.CompareTo("tasque") == 0) {
								string[] files = new string[1];
								string taskFile = uri.AbsolutePath.Substring(1);

								string path = System.IO.Path.Combine("/", taskFile);
								files[0] = path;
								Logger.Debug("Go and get the task file {0}", path);
								Application.EnqueueFileSend(serviceInfo, files);
							}
						}
					}
					break;
				}
				default:
					break;
			}

			//Logger.Debug("DragDataReceivedHandler called");
            Gtk.Drag.Finish (args.Context, true, false, args.Time);
		}