Example #1
0
        //destroy everything but our tray icon, main window, and our notification bubble
        private void DestroyMostlyEverything()
        {
            if (hbox != null)
            {
                hbox.Destroy();
            }

            if (vbox != null)
            {
                vbox.Destroy();
            }

            if (newi != null)
            {
                newi.Destroy();
            }

            if (menuBar != null)
            {
                menuBar.Destroy();
            }

            if (filemenu != null)
            {
                filemenu.Destroy();
            }

            if (file != null)
            {
                file.Destroy();
            }

            if (sep != null)
            {
                sep.Destroy();
            }

            if (exit != null)
            {
                exit.Destroy();
            }

            if (uploadButton != null)
            {
                uploadButton.Destroy();
            }

            if (toCropBox != null)
            {
                toCropBox.Destroy();
            }

            if (agr != null)
            {
                agr.Dispose();
            }
        }
Example #2
0
 private void _mainWidget_Destroyed(object sender, EventArgs e)
 {
     //listview.CursorChanged -= OnSelectionChanged;
     Listview.SelectionChanged -= OnSelectionChanged;
     Listview.ButtonPressEvent -= OnDoubleClick;
     ClearPopup();
     popup.Destroy();
     listmodel.Dispose();
     accel.Dispose();
     mainWidget.Destroyed -= _mainWidget_Destroyed;
     owner = null;
 }
Example #3
0
        private void _mainWidget_Destroyed(object sender, EventArgs e)
        {
            textEditor.Document.LineChanged   -= OnTextHasChanged;
            textEditor.TextArea.FocusInEvent  -= OnTextBoxEnter;
            textEditor.TextArea.FocusOutEvent -= OnTextBoxLeave;
            _mainWidget.Destroyed             -= _mainWidget_Destroyed;
            textEditor.TextArea.KeyPressEvent -= OnKeyPress;
            CompletionForm.FocusOutEvent      -= OnLeaveCompletion;
            CompletionView.ButtonPressEvent   -= OnContextListMouseDoubleClick;
            CompletionView.KeyReleaseEvent    -= CompletionView_KeyReleaseEvent;
            if (CompletionForm.IsRealized)
            {
                CompletionForm.Destroy();
            }
            // It's good practice to disconnect all event handlers, as it makes memory leaks
            // less likely. However, we may not "own" the event handlers, so how do we
            // know what to disconnect?
            // We can do this via reflection. Here's how it currently can be done in Gtk#.
            // Windows.Forms would do it differently.
            // This may break if Gtk# changes the way they implement event handlers.
            foreach (Widget w in Popup)
            {
                if (w is MenuItem)
                {
                    PropertyInfo pi = w.GetType().GetProperty("AfterSignals", BindingFlags.NonPublic | BindingFlags.Instance);
                    if (pi != null)
                    {
                        System.Collections.Hashtable handlers = (System.Collections.Hashtable)pi.GetValue(w);
                        if (handlers != null && handlers.ContainsKey("activate"))
                        {
                            EventHandler handler = (EventHandler)handlers["activate"];
                            (w as MenuItem).Activated -= handler;
                        }
                    }
                }
            }

            Popup.Destroy();
            accel.Dispose();
            completionModel.Dispose();
            functionPixbuf.Dispose();
            propertyPixbuf.Dispose();
            CompletionView.Dispose();
            CompletionForm.Destroy();
            CompletionForm = null;
            textEditor.Destroy();
            textEditor = null;
            _findForm.Destroy();
            _owner = null;
        }
Example #4
0
        /// <summary>
        /// Cleanup events
        /// </summary>
        /// <param name="sender">The sending object</param>
        /// <param name="e">The event arguments</param>
        private void _mainWidget_Destroyed(object sender, EventArgs e)
        {
            try
            {
                textEditor.Document.LineChanged   -= OnTextHasChanged;
                textEditor.TextArea.FocusInEvent  -= OnTextBoxEnter;
                textEditor.TextArea.FocusOutEvent -= OnTextBoxLeave;
                textEditor.TextArea.KeyPressEvent -= OnKeyPress;
                scroller.Hadjustment.Changed      -= Hadjustment_Changed;
                scroller.Vadjustment.Changed      -= Vadjustment_Changed;
                textEditor.Options.Changed        -= EditorOptionsChanged;
                mainWidget.Destroyed -= _mainWidget_Destroyed;

                // It's good practice to disconnect all event handlers, as it makes memory leaks
                // less likely. However, we may not "own" the event handlers, so how do we
                // know what to disconnect?
                // We can do this via reflection. Here's how it currently can be done in Gtk#.
                // Windows.Forms would do it differently.
                // This may break if Gtk# changes the way they implement event handlers.
                foreach (Widget w in popupMenu)
                {
                    if (w is MenuItem)
                    {
                        PropertyInfo pi = w.GetType().GetProperty("AfterSignals", BindingFlags.NonPublic | BindingFlags.Instance);
                        if (pi != null)
                        {
                            System.Collections.Hashtable handlers = (System.Collections.Hashtable)pi.GetValue(w);
                            if (handlers != null && handlers.ContainsKey("activate"))
                            {
                                EventHandler handler = (EventHandler)handlers["activate"];
                                (w as MenuItem).Activated -= handler;
                            }
                        }
                    }
                }

                popupMenu.Destroy();
                accel.Dispose();
                textEditor.Destroy();
                textEditor = null;
                findForm.Destroy();
                owner = null;
            }
            catch (Exception err)
            {
                ShowError(err);
            }
        }
Example #5
0
        private void _mainWidget_Destroyed(object sender, EventArgs e)
        {
            textEditor.Document.LineChanged   -= OnTextHasChanged;
            textEditor.TextArea.FocusInEvent  -= OnTextBoxEnter;
            textEditor.TextArea.FocusOutEvent -= OnTextBoxLeave;
            _mainWidget.Destroyed             -= _mainWidget_Destroyed;
            textEditor.TextArea.KeyPressEvent -= OnKeyPress;

            intellisense.ContextItemsNeeded -= ContextItemsNeeded;
            intellisense.ItemSelected       -= InsertCompletionItemIntoTextBox;
            intellisense.LoseFocus          -= HideCompletionWindow;
            intellisense.Cleanup();

            // It's good practice to disconnect all event handlers, as it makes memory leaks
            // less likely. However, we may not "own" the event handlers, so how do we
            // know what to disconnect?
            // We can do this via reflection. Here's how it currently can be done in Gtk#.
            // Windows.Forms would do it differently.
            // This may break if Gtk# changes the way they implement event handlers.
            foreach (Widget w in Popup)
            {
                if (w is MenuItem)
                {
                    PropertyInfo pi = w.GetType().GetProperty("AfterSignals", BindingFlags.NonPublic | BindingFlags.Instance);
                    if (pi != null)
                    {
                        System.Collections.Hashtable handlers = (System.Collections.Hashtable)pi.GetValue(w);
                        if (handlers != null && handlers.ContainsKey("activate"))
                        {
                            EventHandler handler = (EventHandler)handlers["activate"];
                            (w as MenuItem).Activated -= handler;
                        }
                    }
                }
            }

            Popup.Destroy();
            accel.Dispose();
            textEditor.Destroy();
            textEditor = null;
            _findForm.Destroy();
            _owner = null;
        }
Example #6
0
 private void _mainWidget_Destroyed(object sender, EventArgs e)
 {
     try
     {
         //listview.CursorChanged -= OnSelectionChanged;
         Listview.SelectionChanged -= OnSelectionChanged;
         Listview.ButtonPressEvent -= OnDoubleClick;
         popup.Clear();
         popup.Dispose();
         listmodel.Dispose();
         accel.Dispose();
         mainWidget.Destroyed -= _mainWidget_Destroyed;
         owner = null;
     }
     catch (Exception err)
     {
         ShowError(err);
     }
 }
Example #7
0
        /// <summary>Destroy the toolstrip</summary>
        public void Destroy()
        {
            if (accelerators != null)
            {
                Window mainWindow = GetMainWindow();
                if (mainWindow != null)
                {
                    mainWindow.RemoveAccelGroup(accelerators);
                }
                accelerators.Dispose();
                accelerators = null;
            }

            foreach (Widget child in toolStrip.Children)
            {
                if (child is ToolButton)
                {
                    child.DetachHandlers();
                }
                toolStrip.Remove(child);
                child.Dispose();
            }
        }