Exemple #1
0
        public IntPtr GetStream(string mime_type)
        {
            if (mime_type != "text/plain")
            {
                return(IntPtr.Zero);
            }

            GLib.IOChannel gio = null;

            StringBuilder filename = new StringBuilder("streamXXXXXX");
            int           fd       = Syscall.mkstemp(filename);

            if (fd < 0)
            {
                Log.Error("TextBoxEntryView: Unable to create temporary file.  Are you out of disk space?");
                return(IntPtr.Zero);
            }

            gio          = new GLib.IOChannel(fd);
            gio.Encoding = null;

            string written;

            gio.WriteChars(TextContents, out written);

            gio.SeekPosition(0, GLib.SeekType.Set);
            gio.Flush();

            Syscall.unlink(filename.ToString());

            return(gio.Handle);
        }
Exemple #2
0
		public IntPtr GetStream (string mime_type)
		{
			if (mime_type != "text/plain") {
				return IntPtr.Zero;
			}

			GLib.IOChannel gio = null;

			StringBuilder filename = new StringBuilder ("streamXXXXXX");
			int fd = Syscall.mkstemp (filename);
			if (fd < 0) {
				Log.Error ("TextBoxEntryView: Unable to create temporary file.  Are you out of disk space?");
				return IntPtr.Zero;
			}

			gio = new GLib.IOChannel (fd);
			gio.Encoding = null;
			
			string written;
			gio.WriteChars (TextContents, out written);

			gio.SeekPosition (0, GLib.SeekType.Set);
			gio.Flush ();

			Syscall.unlink (filename.ToString ());

			return gio.Handle;
		}