<?xml version="1.0" encoding="UTF-8"?>
<interface domain="thinkpad-battery-threshold@marcosdalvarez.org">
    <template class="ThinkpadPrefs" parent="AdwPreferencesPage">
        <property name="name">thinkpad</property>
        <property name="title" translatable="yes">Thresholds</property>
        <property name="icon-name">battery-symbolic</property>

        <child>
            <object class="AdwPreferencesGroup" id="bat0_group">
                <property name="title" translatable="yes">Main battery (BAT0)</property>
                <property name="description" translatable="yes">The changes will be applied by reactivating the thresholds or from the menu</property>
                <property name="header-suffix">
                    <object class="GtkButton" id="apply_bat0">
                        <property name="valign">center</property>
                        <property name="margin-start">6</property>
                        <property name="visible">false</property>
                        <child>
                            <object class="AdwButtonContent">
                                <property name="icon-name">object-select-symbolic</property>
                                <property name="label" translatable="yes">Apply</property>
                            </object>
                        </child>
                        <style>
                            <class name="suggested-action" />
                        </style>
                    </object>
                </property>  
                <child>
                    <object class="AdwSpinRow" id="start_bat0">
                        <property name="title" translatable="yes">Charging start value</property>
                        <property name="subtitle" translatable="yes">Start charging when the level is below this value</property>
                        <property name="snap-to-ticks">true</property>
                        <property name="update-policy">if-valid</property>
                        <property name="adjustment">
                            <object class="GtkAdjustment">
                                <property name="page-increment">5.0</property>
                                <property name="step-increment">1.0</property>
                                <property name="upper">99.0</property>
                                <property name="lower">0.0</property>
                                <property name="value">75.0</property>
                            </object>
                        </property>
                    </object>
                </child>
                <child>
                    <object class="AdwSpinRow" id="end_bat0">
                        <property name="title" translatable="yes">Charging stop value</property>
                        <property name="subtitle" translatable="yes">Stop charging when the level is above this value</property>
                        <property name="snap-to-ticks">true</property>
                        <property name="update-policy">if-valid</property>
                        <property name="adjustment">
                            <object class="GtkAdjustment">
                                <property name="page-increment">5.0</property>
                                <property name="step-increment">1.0</property>
                                <property name="upper">100.0</property>
                                <property name="lower">1.0</property>
                                <property name="value">80.0</property>
                            </object>                        
                        </property>
                    </object>
                </child>
                <child>
                    <object class="AdwSpinRow" id="disabled_start_bat0">
                        <property name="title" translatable="yes">Start value considered disabled</property>
                        <property name="subtitle" translatable="yes">The start threshold value that is considered disabled is not the same on all laptops (usually 0 or 95). We will try to automatically detect this value, but if you can't turn off the thresholds, try changing it manually (use -1 to automatically detect it)</property>
                        <property name="snap-to-ticks">true</property>
                        <property name="update-policy">if-valid</property>
                        <property name="adjustment">
                            <object class="GtkAdjustment">
                                <property name="page-increment">5.0</property>
                                <property name="step-increment">1.0</property>
                                <property name="upper">99.0</property>
                                <property name="lower">-1.0</property>
                                <property name="value">-1.0</property>
                            </object>
                        </property>
                    </object>
                </child>
                <child>
                    <object class="GtkRevealer" id="warn_bat0">
                        <property name="reveal-child">true</property>
                        <child>
                            <object class="GtkBox">
                                <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
                                <property name="spacing">12</property>
                                <property name="margin-start">6</property>
                                <property name="margin-end">6</property>
                                <property name="margin-top">6</property>
                                <property name="margin-bottom">6</property>
                                <child>
                                    <object class="GtkImage">
                                        <property name="icon-name">dialog-warning</property>
                                        <property name="css-classes">warning</property>
                                        <property name="icon-size">GTK_ICON_SIZE_LARGE</property>
                                    </object>
                                </child>
                                <child>
                                    <object class="GtkBox">
                                        <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
                                        <child>
                                            <object class="GtkLabel">
                                                <property name="label" translatable="yes">WARNING</property>
                                                <property name="css-classes">warning</property>
                                                <property name="wrap">true</property>
                                                <property name="hexpand">true</property>
                                                <property name="justify">GTK_JUSTIFY_CENTER</property>
                                                <attributes>
                                                        <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
                                                </attributes>
                                            </object>
                                        </child>
                                        <child>
                                            <object class="GtkLabel">
                                                <property name="wrap">true</property>
                                                <property name="hexpand">true</property>
                                                <property name="justify">GTK_JUSTIFY_CENTER</property>
                                                <property name="label" translatable="yes">The configured threshold values are equal to the values considered "disabled"</property>
                                            </object>
                                        </child>
                                    </object>
                                </child>
                            </object>
                        </child>
                    </object>  
                </child>
            </object>
        </child>

        <child>
            <object class="AdwPreferencesGroup" id="bat1_group">
                <property name="title" translatable="yes">Secondary battery (BAT1)</property>
                <property name="description" translatable="yes">The changes will be applied by reactivating the thresholds or from the menu</property>
                <property name="header-suffix">
                    <object class="GtkButton" id="apply_bat1">
                        <property name="valign">center</property>
                        <property name="margin-start">6</property>
                        <property name="visible">false</property>
                        <child>
                            <object class="AdwButtonContent">
                                <property name="icon-name">object-select-symbolic</property>
                                <property name="label" translatable="yes">Apply</property>
                            </object>
                        </child>
                        <style>
                            <class name="suggested-action" />
                        </style>
                    </object>
                </property>          
                <child>
                    <object class="AdwSpinRow" id="start_bat1">
                        <property name="title" translatable="yes">Charging start value</property>
                        <property name="subtitle" translatable="yes">Start charging when the level is below this value</property>
                        <property name="snap-to-ticks">true</property>
                        <property name="update-policy">if-valid</property>
                        <property name="adjustment">
                            <object class="GtkAdjustment">
                                <property name="page-increment">5.0</property>
                                <property name="step-increment">1.0</property>
                                <property name="upper">99.0</property>
                                <property name="lower">0.0</property>
                                <property name="value">75.0</property>
                            </object>
                        </property>
                    </object>
                </child>
                <child>
                    <object class="AdwSpinRow" id="end_bat1">
                        <property name="title" translatable="yes">Charging stop value</property>
                        <property name="subtitle" translatable="yes">Stop charging when the level is above this value</property>
                        <property name="snap-to-ticks">true</property>
                        <property name="update-policy">if-valid</property>
                        <property name="adjustment">
                            <object class="GtkAdjustment">
                                <property name="page-increment">5.0</property>
                                <property name="step-increment">1.0</property>
                                <property name="upper">100.0</property>
                                <property name="lower">1.0</property>
                                <property name="value">80.0</property>
                            </object>
                        </property>
                    </object>
                </child>
                <child>
                    <object class="AdwSpinRow" id="disabled_start_bat1">
                        <property name="title" translatable="yes">Start value considered disabled</property>
                        <property name="subtitle" translatable="yes">The start threshold value that is considered disabled is not the same on all laptops (usually 0 or 95). We will try to automatically detect this value, but if you can't turn off the thresholds, try changing it manually (use -1 to automatically detect it)</property>
                        <property name="snap-to-ticks">true</property>
                        <property name="update-policy">if-valid</property>
                        <property name="adjustment">
                            <object class="GtkAdjustment">
                                <property name="page-increment">5.0</property>
                                <property name="step-increment">1.0</property>
                                <property name="upper">99.0</property>
                                <property name="lower">-1.0</property>
                                <property name="value">-1.0</property>
                            </object>
                        </property>
                    </object>
                </child>
                <child>
                    <object class="GtkRevealer" id="warn_bat1">
                        <property name="reveal-child">true</property>
                        <child>
                            <object class="GtkBox">
                                <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
                                <property name="spacing">12</property>
                                <property name="margin-start">6</property>
                                <property name="margin-end">6</property>
                                <property name="margin-top">6</property>
                                <property name="margin-bottom">6</property>
                                <child>
                                    <object class="GtkImage">
                                        <property name="icon-name">dialog-warning</property>
                                        <property name="css-classes">warning</property>
                                        <property name="icon-size">GTK_ICON_SIZE_LARGE</property>
                                    </object>
                                </child>
                                <child>
                                    <object class="GtkBox">
                                        <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
                                        <child>
                                            <object class="GtkLabel">
                                                <property name="label" translatable="yes">WARNING</property>
                                                <property name="css-classes">warning</property>
                                                <property name="wrap">true</property>
                                                <property name="hexpand">true</property>
                                                <property name="justify">GTK_JUSTIFY_CENTER</property>
                                                <attributes>
                                                        <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
                                                </attributes>
                                            </object>
                                        </child>
                                        <child>
                                            <object class="GtkLabel">
                                                <property name="wrap">true</property>
                                                <property name="hexpand">true</property>
                                                <property name="justify">GTK_JUSTIFY_CENTER</property>
                                                <property name="label" translatable="yes">The configured threshold values are equal to the values considered "disabled"</property>
                                            </object>
                                        </child>
                                    </object>
                                </child>
                            </object>
                        </child>
                    </object>  
                </child>
            </object>
        </child>

        <child>
            <object class="AdwPreferencesGroup" id="reset_group">
                <property name="title" translatable="yes">Reset thresholds</property>
                <property name="description" translatable="yes">Reset recommended threshold values</property>
                <property name="header-suffix">
                    <object class="GtkButton" id="reset">
                        <property name="halign">start</property>
                        <property name="valign">center</property>
                        <property name="margin-start">6</property>
                        <child>
                            <object class="AdwButtonContent">
                                <property name="icon-name">view-refresh-symbolic</property>
                                <property name="label" translatable="yes">Reset</property>
                            </object>
                        </child>
                        <style>
                            <class name="destructive-action" />
                        </style>
                    </object>
                </property>
            </object>
        </child>
    </template>

    <object class="AdwMessageDialog" id="reset_thresholds_dialog">
        <property name="heading" translatable="yes">Reset thresholds?</property>
        <property name="body" translatable="yes">This action resets the batteries thresholds to the recommended values, do you want to continue?</property>
        <property name="default-response">cancel</property>
        <property name="close-response">cancel</property>
        <property name="hide-on-close">true</property>
        <property name="modal">true</property>
        <property name="destroy-with-parent">true</property>
        <responses>
            <response id="cancel" translatable="yes" appearance="suggested">Cancel</response>
            <response id="reset" translatable="yes" appearance="destructive">Reset</response>
        </responses>
    </object>
</interface>