示例#1
0
 public void RemoveButton(int npage)
 {
     if (npage >= toolbar.Children.Length)
     {
         return;
     }
     notebook.RemovePage(npage);
     Gtk.Widget cw = toolbar.Children [npage];
     toolbar.Remove(cw);
     cw.Destroy();
     ShowPage(0);
 }
示例#2
0
        public TabWidget(string tabName, Notebook nb, int index)
        {
            tabLabel = new Label(tabName);
            this.PackStart (tabLabel, true, true, 3);
            Button b = new Button (new Gtk.Image ("gtk-close", IconSize.Menu));
            b.Relief = Gtk.ReliefStyle.None;
            b.WidthRequest = b.HeightRequest = 24;

            b.Clicked += delegate (object s, EventArgs a) {
                if (CloseRequested != null)
                    CloseRequested(this, EventArgs.Empty);

                nb.RemovePage(index);
            };

            this.PackStart (b, false, false, 0);
            this.ShowAll();
        }
        public void DataSetChanged()
        {
            // Clear data
            for (uint i = 0; i < tabs; i++)
            {
                tabView.RemovePage(0);
            }
            tabList.Clear();
            tabs = 0;

            foreach (var content in contentList)
            {
                content.tree.Dispose();
            }
            contentList.Clear();

            // Repopulate
            PopulateTabView();
            tabView.ShowAll();
        }
示例#4
0
        public void RemovePage(BaseContextPage page)
        {
            Hyena.Log.DebugFormat("Removing context page {0}", page.Id);
            // Remove the notebook page
            notebook.RemovePage(notebook.PageNum(pane_pages[page]));
            pane_pages.Remove(page);

            // Remove the tab button
            bool was_active = pane_tabs[page].Active;

            vbox.Remove(pane_tabs[page]);
            pane_tabs.Remove(page);

            pages.Remove(page);

            // Set a new page as the default
            if (was_active)
            {
                ActivateFirstPage();
            }

            UpdateVisibility();
        }
示例#5
0
        private void OnBackendComboBoxChanged(object sender, EventArgs args)
        {
            if (selectedBackend >= 0)
            {
                // TODO: Prompt the user and make sure they really want to change
                // which backend they are using.

                // Remove the existing backend's preference page
                if (backendPageId >= 0)
                {
                    notebook.RemovePage(backendPageId);
                    backendPageId = -1;
                    backendPage   = null;
                }

                // if yes (replace backend)
                if (backendComboMap.ContainsKey(selectedBackend))
                {
                    selectedBackend = -1;
                }
            }

            string newBackend = null;

            if (backendComboMap.ContainsKey(backendComboBox.Active))
            {
                newBackend = backendComboMap [backendComboBox.Active];
            }
            application.BackendManager.SetBackend(newBackend);

            if (newBackend == null)
            {
                return;
            }

            selectedBackend = backendComboBox.Active;

            // Add a backend prefs page if one exists
            backendPage = (Widget)application.BackendManager.GetBackendPreferencesWidget();
            if (backendPage != null)
            {
                backendPage.Show();
                var l = new Label(GLib.Markup.EscapeText(
                                      application.BackendManager.AvailableBackends [newBackend]));
                l.UseMarkup    = false;
                l.UseUnderline = false;
                l.Show();
                backendPageId = notebook.AppendPage(backendPage, l);

                // TODO: If the new backend is not configured, automatically switch
                // to the backend's preferences page
            }

            // Save the user preference
            application.Preferences.Set(PreferencesKeys.CurrentBackend,
                                        newBackend);

            //taskListsToHide = BuildNewTaskListList ();
            //Application.Preferences.SetStringList (IPreferences.HideInAllTaskList,
            //									   taskListsToHide);
            RebuildTaskListTree();
        }
示例#6
0
        /// <summary>
        /// Closes the tab of the notebook and removes it from the 	<see cref="cTerminus.Files"/> List.
        /// </summary>
        /// <param name='_nb'>
        /// The notebook
        /// </param>
        /// <param name='_index'>
        /// The index of the current page, which should be deleted.
        /// </param>
        public static void CloseTab(Notebook _nb, int _index)
        {
            try {
                if (((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).Saved) {
                    _nb.RemovePage (_index);
                    g_files.RemoveAt (_index);
                } else if (((libTerminus.cRegex)_nb.GetNthPage (_nb.Page)).GetExpressionBuffer () == "") {
                    _nb.RemovePage (_index);
                    g_files.RemoveAt (_index);
                } else {
                    if (AskForClosingLastTab () == ResponseType.Yes) {
                        _nb.RemovePage (_index);
                        g_files.RemoveAt (_index);
                    }
                }
            } catch (Exception ex) {

                if (_nb.GetNthPage (_nb.Page) is cConfig) {
                    cTerminus.isConfigTabOpen = false;
                    cTerminus.ConfigTabIndex = -1;
                } else if (_nb.GetNthPage (_nb.Page) is cPool) {
                    cTerminus.isLibTabOpen = false;
                    LibTabIndex = -1;

                    //Remove the tab

                }
                _nb.RemovePage (_index);
                _nb.ParentWindow.Title = cTerminus.getTitle (_nb, _nb.Page);
            }
        }
示例#7
0
        private void OnBackendComboBoxChanged(object sender, EventArgs args)
        {
            if (selectedBackend >= 0)
            {
                // TODO: Prompt the user and make sure they really want to change
                // which backend they are using.

                // Remove the existing backend's preference page
                if (backendPageId >= 0)
                {
                    notebook.RemovePage(backendPageId);
                    backendPageId = -1;
                    backendPage   = null;
                }

                // if yes (replace backend)
                if (backendComboMap.ContainsKey(selectedBackend))
                {
                    // Cleanup old backend
                    IBackend oldBackend = backendComboMap [selectedBackend];
                    Logger.Info("Cleaning up '{0}'...", oldBackend.Name);
                    try {
                        oldBackend.Cleanup();
                    } catch (Exception e) {
                        Logger.Warn("Exception cleaning up '{0}': {2}",
                                    oldBackend.Name,
                                    e.Message);
                    }

                    selectedBackend = -1;
                }
            }

            IBackend newBackend = null;

            if (backendComboMap.ContainsKey(backendComboBox.Active))
            {
                newBackend = backendComboMap [backendComboBox.Active];
            }

            // TODO: Set the new backend
            Application.Backend = newBackend;

            if (newBackend == null)
            {
                return;
            }

            selectedBackend = backendComboBox.Active;

            // Add a backend prefs page if one exists
            backendPage = newBackend.GetPreferencesWidget();
            if (backendPage != null)
            {
                backendPage.Show();
                Label l = new Label(GLib.Markup.EscapeText(newBackend.Name));
                l.UseMarkup    = false;
                l.UseUnderline = false;
                l.Show();
                backendPageId =
                    notebook.AppendPage(backendPage, l);

                // If the new backend is not configured, automatically switch
                // to the backend's preferences page
                if (!newBackend.Configured)
                {
                    notebook.Page = backendPageId;
                }
            }

            // Save the user preference
            Application.Preferences.Set(Preferences.CurrentBackend,
                                        newBackend.GetType().ToString());

            //categoriesToHide = BuildNewCategoryList ();
            //Application.Preferences.SetStringList (Preferences.HideInAllCategory,
            //									   categoriesToHide);
            RebuildCategoryTree();
        }