// Created with MonoDevelop
//
//    QuickStep: Acquire, view and identify spectra 
//    Copyright (C) 2018 Thomas Klose & Torsten Schache, Hiperscan GmbH Dresden, Germany
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.


//
using System;
using Glade;
using Gtk;

namespace Hiperscan.Extensions.ApoIdent
{
    public partial class FinderWindow
    {
        [Widget] Gtk.ComboBox config_combo      = null;
        [Widget] Gtk.Button config_label_button = null;
        [Widget] Gtk.Alignment config_alignment = null;


        private void UpdateConfigSection()
        {
            this.SetButtonStyle(WindowSections.ConfigSection, true);
            this.UpdateConfigCombo();
        }

        private void UpdateConfigCombo()
        {
            this.config_combo.Clear();
            if (this.Config.Profiles.Count > 0)
            {
                ListStore config_store = new ListStore(typeof(string));
                CellRendererText config_text = new CellRendererText();
                config_text.Scale = Pango.Scale.Large;
                this.config_combo.PackStart(config_text, false);
                this.config_combo.SetAttributes(config_text, "text", 0);
                this.config_combo.Model = config_store;
                foreach (Profile item in this.Config.Profiles.Values)
                    this.config_combo.AppendText(item.Name);

                this.config_combo.Active = this.Config.Profiles.CurrentIndex(this.Config.Profiles.Current);
            }

            this.config_combo.Sensitive = this.Config.Profiles.Count > 1;
        }
    }
}
