Ejemplo n.º 1
0
        private List <MenuItem> LoadMenuFromExtensionPoint()
        {
            Log.Debug("Entering");

            List <MenuItem> addinItems = new List <MenuItem>();

            Mono.Addins.ExtensionNodeList nodes = Mono.Addins.AddinManager.GetExtensionNodes(ExtensionPath.SystemTray);

            Log.Debug($"Found '{nodes.Count}' items ...");
            foreach (Mono.Addins.ExtensionNode node in nodes)
            {
                Mono.Addins.TypeExtensionNode typeNode = node as Mono.Addins.TypeExtensionNode;
                try
                {
                    SysTrayAddin addin = typeNode.CreateInstance() as SysTrayAddin;
                    Log.Debug($"SysTrayAdd-in [{addin.ToString()}]");

                    addinItems = addin.MenuItems();
                }
                catch (Exception ex)
                {
                    Log.Error("Couldn't create SysTrayAddin instance: " + ex.Message);
                }
            }

            return(addinItems);
        }
Ejemplo n.º 2
0
        public void LoadAddinsForNote(Note note)
        {
            Mono.Addins.ExtensionNodeList list = Mono.Addins.AddinManager.GetExtensionNodes("/Tomboy/NoteAddins");
            foreach (Mono.Addins.ExtensionNode node in list)
            {
                Mono.Addins.TypeExtensionNode type_node =
                    node as Mono.Addins.TypeExtensionNode;

                try {
                    NoteAddin n_addin = type_node.CreateInstance() as NoteAddin;

                    // Keep track of the addins added to each note
                    AttachAddin(type_node.Id, note, n_addin);
                } catch (Exception e) {
                    Logger.Warn("Couldn't create a NoteAddin instance: {0}", e.Message);
                }
            }

            // Make sure we remove addins when a note is deleted
            note.Manager.NoteDeleted += OnNoteDeleted;
        }
Ejemplo n.º 3
0
        void OnNoteAddinEnabled(Mono.Addins.ExtensionNodeEventArgs args)
        {
            // Load NoteAddins
            if (Tomboy.DefaultNoteManager == null)
            {
                return;                 // too early -- YUCK!  Bad hack
            }

            foreach (Note note in Tomboy.DefaultNoteManager.Notes)
            {
                // Create a new NoteAddin
                Mono.Addins.TypeExtensionNode type_node =
                    args.ExtensionNode as Mono.Addins.TypeExtensionNode;

                try {
                    NoteAddin n_addin = type_node.CreateInstance() as NoteAddin;

                    // Keep track of the addins added to each note
                    AttachAddin(type_node.Id, note, n_addin);
                } catch (Exception e) {
                    Logger.Debug("Couldn't create a NoteAddin instance: {0}", e.Message);
                }
            }
        }