Esempio n. 1
0
        /// <summary>
        /// Construct a task object.
        /// </summary>
        Task(TaskData data, string filepath, TaskManager manager)
        {
            this.data     = data;
            this.filepath = filepath;
            this.manager  = manager;

            FillDataFromSumary();

            save_timeout          = new InterruptableTimeout();
            save_timeout.Timeout += SaveTimeout;

            // If an OriginNoteUri exists, make sure the note
            // actually exists.  If it doesn't, clean it up
            string origin_note_uri = OriginNoteUri;

            if (origin_note_uri != null && origin_note_uri != string.Empty)
            {
                Note note =
                    Tomboy.DefaultNoteManager.FindByUri(origin_note_uri);
                if (note == null)
                {
                    OriginNoteUri = String.Empty;
                }
            }
        }
		public override void Shutdown ()
		{
			if (timeout_owner) {
				NoteOfTheDay.CleanupOld (manager);
				timeout.Timeout -= CheckNewDay;
				timeout.Cancel();
				timeout = null;
			}

			initialized = false;
		}
		public override void Initialize ()
		{
			if (timeout == null) {
				timeout = new InterruptableTimeout ();
				timeout.Timeout += CheckNewDay;
				timeout.Reset (0);
				timeout_owner = true;
			}
			manager = Tomboy.DefaultNoteManager;
			initialized = true;
		}
 public override void Initialize()
 {
     if (timeout == null)
     {
         timeout          = new InterruptableTimeout();
         timeout.Timeout += CheckNewDay;
         timeout.Reset(0);
         timeout_owner = true;
     }
     manager     = Tomboy.DefaultNoteManager;
     initialized = true;
 }
        public override void Shutdown()
        {
            if (timeout_owner)
            {
                NoteOfTheDay.CleanupOld(manager);
                timeout.Timeout -= CheckNewDay;
                timeout.Cancel();
                timeout = null;
            }

            initialized = false;
        }
		public override void Initialize ()
		{
			// TODO: When/how best to handle this?  Okay to install wdfs while Tomboy is running?  When set up mount path, timer, etc, then?
			if (IsSupported) {
				// Determine mount path, etc
				SetUpMountPath ();

				// Setup unmount timer
				unmountTimeout = new InterruptableTimeout ();
				unmountTimeout.Timeout += UnmountTimeout;
				Tomboy.ExitingEvent += TomboyExitHandler;
			}
			initialized = true;
		}
Esempio n. 7
0
        public override void Initialize()
        {
            // TODO: When/how best to handle this?  Okay to install wdfs while Tomboy is running?  When set up mount path, timer, etc, then?
            if (IsSupported)
            {
                // Determine mount path, etc
                SetUpMountPath();

                // Setup unmount timer
                unmountTimeout          = new InterruptableTimeout();
                unmountTimeout.Timeout += UnmountTimeout;
                Tomboy.ExitingEvent    += TomboyExitHandler;
            }
            initialized = true;
        }
        public EncryptedFileSystemSyncServer(string localSyncPath, byte[] _password, object _initParam)
        {
            myKey = _password;
                serverPath = localSyncPath;

                cachePath = Services.NativeApplication.CacheDirectory;
                cachePath = Path.Combine(cachePath, "sync_temp");
                lockPath = Path.Combine(serverPath, "lock");
                manifestPath = Path.Combine(serverPath, "manifest.xml");

                // setup sync-temp-folder
                if (!Directory.Exists(cachePath))
                {
                    Directory.CreateDirectory(cachePath);
                }
                else
                {
                    // Empty the temp dir
                    Logger.Debug("purging directory " + cachePath);
                    foreach (string oldFile in Directory.GetFiles(cachePath))
                    {
                        try
                        {
                            File.Delete(oldFile);
                        }
                        catch { }
                    }
                    Logger.Debug("purging done");
                }

                Logger.Debug("setupWorkDir");
                SetupWorkDirectory(_initParam);
                Logger.Debug("setupWorkDir done");

                Logger.Debug("getRevision");
                newRevision = LatestRevision + 1;
                newRevisionPath = GetRevisionDirPath(newRevision);
                Logger.Debug("getRevision done");

                Logger.Debug("final stuff");
                lockTimeout = new InterruptableTimeout();
                lockTimeout.Timeout += LockTimeout;
                syncLock = new SyncLockInfo();
                Logger.Debug("final stuff done");
        }
Esempio n. 9
0
        public EncryptedFileSystemSyncServer(string localSyncPath, byte[] _password, object _initParam)
        {
            myKey      = _password;
            serverPath = localSyncPath;

            cachePath    = Services.NativeApplication.CacheDirectory;
            cachePath    = Path.Combine(cachePath, "sync_temp");
            lockPath     = Path.Combine(serverPath, "lock");
            manifestPath = Path.Combine(serverPath, "manifest.xml");

            // setup sync-temp-folder
            if (!Directory.Exists(cachePath))
            {
                Directory.CreateDirectory(cachePath);
            }
            else
            {
                // Empty the temp dir
                Logger.Debug("purging directory " + cachePath);
                foreach (string oldFile in Directory.GetFiles(cachePath))
                {
                    try
                    {
                        File.Delete(oldFile);
                    }
                    catch { }
                }
                Logger.Debug("purging done");
            }

            Logger.Debug("setupWorkDir");
            SetupWorkDirectory(_initParam);
            Logger.Debug("setupWorkDir done");

            Logger.Debug("getRevision");
            newRevision     = LatestRevision + 1;
            newRevisionPath = GetRevisionDirPath(newRevision);
            Logger.Debug("getRevision done");

            Logger.Debug("final stuff");
            lockTimeout          = new InterruptableTimeout();
            lockTimeout.Timeout += LockTimeout;
            syncLock             = new SyncLockInfo();
            Logger.Debug("final stuff done");
        }
		public FileSystemSyncServer (string localSyncPath)
		{
			serverPath = localSyncPath;

			if (!Directory.Exists (serverPath))
				throw new DirectoryNotFoundException (serverPath);

			cachePath = Services.NativeApplication.CacheDirectory;
			lockPath = Path.Combine (serverPath, "lock");
			manifestPath = Path.Combine (serverPath, "manifest.xml");

			newRevision = LatestRevision + 1;
			newRevisionPath = GetRevisionDirPath (newRevision);

			lockTimeout = new InterruptableTimeout ();
			lockTimeout.Timeout += LockTimeout;
			syncLock = new SyncLockInfo ();
		}
Esempio n. 11
0
		/// <summary>
		/// Construct a task object.
		/// </summary>
		Task (TaskData data, string filepath, TaskManager manager)
		{
			this.data = data;
			this.filepath = filepath;
			this.manager = manager;

			save_timeout = new InterruptableTimeout ();
			save_timeout.Timeout += SaveTimeout;

			// If an OriginNoteUri exists, make sure the note
			// actually exists.  If it doesn't, clean it up
			string origin_note_uri = OriginNoteUri;
			if (origin_note_uri != null && origin_note_uri != string.Empty) {
				Note note =
				        Tomboy.DefaultNoteManager.FindByUri (origin_note_uri);
				if (note == null)
					OriginNoteUri = String.Empty;
			}
		}
Esempio n. 12
0
        public FileSystemSyncServer(string localSyncPath)
        {
            serverPath = localSyncPath;

            if (!Directory.Exists(serverPath))
            {
                throw new DirectoryNotFoundException(serverPath);
            }

            cachePath    = Services.NativeApplication.CacheDirectory;
            lockPath     = Path.Combine(serverPath, "lock");
            manifestPath = Path.Combine(serverPath, "manifest.xml");

            newRevision     = LatestRevision + 1;
            newRevisionPath = GetRevisionDirPath(newRevision);

            lockTimeout          = new InterruptableTimeout();
            lockTimeout.Timeout += LockTimeout;
            syncLock             = new SyncLockInfo();
        }
Esempio n. 13
0
        public override void OnNoteOpened()
        {
            voice_note_path = Note.FilePath + ".ogg";
            has_voice_note  = VoiceNoteExists();

            if (has_voice_note)
            {
                Window.Icon = icon;
            }

            AddToolItem(separator, -1);
            AddToolItem(record_button, -1);
            AddToolItem(play_button, -1);
            AddToolItem(stop_button, -1);
            AddPluginMenuItem(delete_item);

            play_button.Sensitive   = has_voice_note;
            stop_button.Sensitive   = false;
            Window.Hidden          += OnStopButtonClicked;
            button_manager          = new InterruptableTimeout();
            button_manager.Timeout += UpdateButtons;
        }
Esempio n. 14
0
		public override void OnNoteOpened ()
		{
			menu = new Gtk.Menu ();
			menu.Hidden += OnMenuHidden;
			menu.ShowAll ();
			
			Gtk.Image tasqueImage = new Gtk.Image (TasqueIcon);
			tasqueImage.Show ();
			menuToolButton =
				new Gtk.MenuToolButton (tasqueImage, Catalog.GetString ("Tasque"));
			menuToolButton.Menu = menu;
			menuToolButton.Clicked += OnMenuToolButtonClicked;
			menuToolButton.ShowMenu += OnMenuItemActivated;
			menuToolButton.Sensitive = false;
			menuToolButton.Show ();
			AddToolItem (menuToolButton, -1);
			
			// Sensitize the Task button on text selection
			markSetTimeout = new InterruptableTimeout();
			markSetTimeout.Timeout += UpdateTaskButtonSensitivity;
			Note.Buffer.MarkSet += OnSelectionMarkSet;
		}
Esempio n. 15
0
        public override void OnNoteOpened()
        {
            menu         = new Gtk.Menu();
            menu.Hidden += OnMenuHidden;
            menu.ShowAll();

            Gtk.Image tasqueImage = new Gtk.Image(TasqueIcon);
            tasqueImage.Show();
            menuToolButton =
                new Gtk.MenuToolButton(tasqueImage, Catalog.GetString("Tasque"));
            menuToolButton.Menu      = menu;
            menuToolButton.Clicked  += OnMenuToolButtonClicked;
            menuToolButton.ShowMenu += OnMenuItemActivated;
            menuToolButton.Sensitive = false;
            menuToolButton.Show();
            AddToolItem(menuToolButton, -1);

            // Sensitize the Task button on text selection
            markSetTimeout          = new InterruptableTimeout();
            markSetTimeout.Timeout += UpdateTaskButtonSensitivity;
            Note.Buffer.MarkSet    += OnSelectionMarkSet;
        }
Esempio n. 16
0
File: Note.cs Progetto: GNOME/tomboy
		Note (NoteData data, string filepath, NoteManager manager)
		{
			this.data = new NoteDataBufferSynchronizer (data);
			this.filepath = filepath;
			this.manager = manager;

			// Make sure each of the tags that NoteData found point to the
			// instance of this note.
			foreach (Tag tag in data.Tags.Values) {
				AddTag (tag);
			}

			save_timeout = new InterruptableTimeout ();
			save_timeout.Timeout += SaveTimeout;

			childWidgetQueue = new Queue <ChildWidgetData> ();
			
			is_deleting = false;
			save_errordlg_active = false;
		}
Esempio n. 17
0
		void UpdateSearch ()
		{
			if (note_changed_timeout == null) {
				note_changed_timeout = new InterruptableTimeout ();
				note_changed_timeout.Timeout += NoteChangedTimeout;
			}

			if (SearchText == null) {
				PerformSearch (false);
			} else {
				note_changed_timeout.Reset (500);
			}
		}
Esempio n. 18
0
		public override void OnNoteOpened ()
		{
			voice_note_path = Note.FilePath + ".ogg";
			has_voice_note = VoiceNoteExists ();
			
			if (has_voice_note)
				Window.Icon = icon;
			
			AddToolItem (separator, -1);
			AddToolItem (record_button, -1);
			AddToolItem (play_button, -1);
			AddToolItem (stop_button, -1);
			AddPluginMenuItem (delete_item);			
			
			play_button.Sensitive = has_voice_note; 
			stop_button.Sensitive = false;
			Window.Hidden += OnStopButtonClicked;
			button_manager = new InterruptableTimeout ();
			button_manager.Timeout += UpdateButtons;
		}
Esempio n. 19
0
		void OnEntryChanged (object sender, EventArgs args)
		{
			if (entry_changed_timeout == null) {
				entry_changed_timeout = new InterruptableTimeout ();
				entry_changed_timeout.Timeout += EntryChangedTimeout;
			}

			if (SearchText == null) {
				clear_search_button.Sensitive = false;
				PerformSearch ();
			} else {
				entry_changed_timeout.Reset (500);
				clear_search_button.Sensitive = true;
			}
			
			RestoreMatchesWindow ();
		}
Esempio n. 20
0
		// Called after .5 seconds of typing inactivity to update
		// the search when the text of a note changes.  This prevents
		// the search from running on every single change made in a
		// note.
		void NoteChangedTimeout (object sender, EventArgs args)
		{
			note_changed_timeout = null;

			if (SearchText == null)
				return;

			PerformSearch (false);
		}
Esempio n. 21
0
		//
		// Construct a window to display a note
		//
		// Currently a toolbar with Link, Search, Text, Delete buttons
		// and a Gtk.TextView as the body.
		//

		public NoteWindow (Note note)
			: base (note.Title)
		{
			this.note = note;
			this.IconName = "tomboy";
			this.SetDefaultSize (450, 360);
			Resizable = true;

			accel_group = new Gtk.AccelGroup ();
			AddAccelGroup (accel_group);

			text_menu = new NoteTextMenu (accel_group, note.Buffer, note.Buffer.Undoer);

			// Add the Find menu item to the toolbar Text menu.  It
			// should only show up in the toplevel Text menu, since
			// the context menu already has a Find submenu.

			Gtk.SeparatorMenuItem spacer = new Gtk.SeparatorMenuItem ();
			spacer.Show ();
			text_menu.Append (spacer);

			Gtk.ImageMenuItem find_item =
			        new Gtk.ImageMenuItem (Catalog.GetString("Find in This Note"));
			find_item.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu);
			find_item.Activated += FindActivate;
			find_item.AddAccelerator ("activate",
			                          accel_group,
			                          (uint) Gdk.Key.f,
			                          Gdk.ModifierType.ControlMask,
			                          Gtk.AccelFlags.Visible);
			find_item.Show ();
			text_menu.Append (find_item);

			plugin_menu = MakePluginMenu ();

			toolbar = MakeToolbar ();
			toolbar.Show ();


			template_widget = MakeTemplateBar ();

			// The main editor widget
			editor = new NoteEditor (note.Buffer);
			editor.PopulatePopup += OnPopulatePopup;
			editor.Show ();

			// Sensitize the Link toolbar button on text selection
			mark_set_timeout = new InterruptableTimeout();
			mark_set_timeout.Timeout += UpdateLinkButtonSensitivity;
			note.Buffer.MarkSet += OnSelectionMarkSet;

			// FIXME: I think it would be really nice to let the
			//        window get bigger up till it grows more than
			//        60% of the screen, and then show scrollbars.
			editor_window = new Gtk.ScrolledWindow ();
			editor_window.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			editor_window.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			editor_window.Add (editor);
			editor_window.Show ();

			FocusChild = editor;

			find_bar = new NoteFindBar (note);
			find_bar.Visible = false;
			find_bar.NoShowAll = true;
			find_bar.Hidden += FindBarHidden;

			Gtk.VBox box = new Gtk.VBox (false, 2);
			box.PackStart (toolbar, false, false, 0);
			box.PackStart (template_widget, false, false, 0);
			box.PackStart (editor_window, true, true, 0);
			box.PackStart (find_bar, false, false, 0);

			box.Show ();

			// Don't set up Ctrl-W or Ctrl-N if Emacs is in use
			bool using_emacs = false;
			string gtk_key_theme = (string)
				Preferences.Get ("/desktop/gnome/interface/gtk_key_theme");
			if (gtk_key_theme != null && gtk_key_theme.CompareTo ("Emacs") == 0)
				using_emacs = true;

			// NOTE: Since some of our keybindings are only
			// available in the context menu, and the context menu
			// is created on demand, register them with the
			// global keybinder
			global_keys = new GlobalKeybinder (accel_group);

			// Close window (Ctrl-W)
			if (!using_emacs)
				global_keys.AddAccelerator (new EventHandler (CloseWindowHandler),
				                            (uint) Gdk.Key.w,
				                            Gdk.ModifierType.ControlMask,
				                            Gtk.AccelFlags.Visible);

			// Escape has been moved to be handled by a KeyPress Handler so that
			// Escape can be used to close the FindBar.

			// Close all windows on current Desktop (Ctrl-Q)
			global_keys.AddAccelerator (new EventHandler (CloseAllWindowsHandler),
			                            (uint) Gdk.Key.q,
			                            Gdk.ModifierType.ControlMask,
			                            Gtk.AccelFlags.Visible);

			// Find Next (Ctrl-G)
			global_keys.AddAccelerator (new EventHandler (FindNextActivate),
			                            (uint) Gdk.Key.g,
			                            Gdk.ModifierType.ControlMask,
			                            Gtk.AccelFlags.Visible);

			// Find Previous (Ctrl-Shift-G)
			global_keys.AddAccelerator (new EventHandler (FindPreviousActivate),
			                            (uint) Gdk.Key.g,
			                            (Gdk.ModifierType.ControlMask |
			                             Gdk.ModifierType.ShiftMask),
			                            Gtk.AccelFlags.Visible);

			// Open Help (F1)
			global_keys.AddAccelerator (new EventHandler (OpenHelpActivate),
			                            (uint) Gdk.Key.F1,
			                            0,
			                            0);

			// Create a new note
			if (!using_emacs)
				global_keys.AddAccelerator (new EventHandler (CreateNewNote),
				                            (uint) Gdk.Key.n,
				                            Gdk.ModifierType.ControlMask,
				                            Gtk.AccelFlags.Visible);

			// Have Esc key close the find bar or note window
			KeyPressEvent += KeyPressed;

			// Increase Indent
			global_keys.AddAccelerator (new EventHandler (ChangeDepthRightHandler),
			                            (uint) Gdk.Key.Right,
			                            Gdk.ModifierType.Mod1Mask,
			                            Gtk.AccelFlags.Visible);

			// Decrease Indent
			global_keys.AddAccelerator (new EventHandler (ChangeDepthLeftHandler),
			                            (uint) Gdk.Key.Left,
			                            Gdk.ModifierType.Mod1Mask,
			                            Gtk.AccelFlags.Visible);

			this.Add (box);
		}
Esempio n. 22
0
		void OnFindEntryActivated (object sender, EventArgs args)
		{
			if (entry_changed_timeout != null) {
				entry_changed_timeout.Cancel ();
				entry_changed_timeout = null;
			}

			if (prev_search_text != null &&
			                SearchText != null &&
			                prev_search_text.CompareTo (SearchText) == 0)
				next_button.Click ();
			else
				PerformSearch (true);
		}
Esempio n. 23
0
		void OnFindEntryChanged (object sender, EventArgs args)
		{
			if (entry_changed_timeout == null) {
				entry_changed_timeout = new InterruptableTimeout ();
				entry_changed_timeout.Timeout += EntryChangedTimeout;
			}

			if (SearchText == null) {
				PerformSearch (false);
			} else {
				entry_changed_timeout.Reset (500);
			}
		}
Esempio n. 24
0
		// Called after .5 seconds of typing inactivity, or on explicit
		// activate.  Redo the search and update the results...
		void EntryChangedTimeout (object sender, EventArgs args)
		{
			entry_changed_timeout = null;

			if (SearchText == null)
				return;

			PerformSearch (true);
		}