`set_primary()` and `add_primary()` had a lot of redundant code. This unifies them, and moves them to a custom widget called `CcBatteryRow`. This also decreases the somewhat excessive size of `cc-power-panel.c`, and makes it easier to see the layout of widgets, now that it's specified in xml. Before this, `warning-battery-offset` was set to `0.03` for a "primary" battery, and `0.05` otherwise. I expect this is a bug, so I've changed both to `0.03`. No other style or behavior change is intended.
98 lines
3.8 KiB
XML
98 lines
3.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<interface>
|
|
<!-- interface-requires gtk+ 3.0 -->
|
|
<template class="CcBatteryRow" parent="GtkListBoxRow">
|
|
<property name="visible">True</property>
|
|
<property name="selectable">False</property>
|
|
<property name="activatable">False</property>
|
|
<child>
|
|
<object class="GtkBox">
|
|
<property name="visible">True</property>
|
|
<property name="orientation">vertical</property>
|
|
<property name="valign">center</property>
|
|
<property name="margin-start">12</property>
|
|
<property name="margin-end">12</property>
|
|
<property name="margin-top">16</property>
|
|
<property name="margin-bottom">14</property>
|
|
<property name="spacing">10</property>
|
|
<child>
|
|
<object class="GtkBox">
|
|
<property name="visible">True</property>
|
|
<property name="orientation">horizontal</property>
|
|
<property name="spacing">12</property>
|
|
<child>
|
|
<object class="GtkBox" id="battery_box">
|
|
<property name="visible">True</property>
|
|
<property name="orientation">horizontal</property>
|
|
<property name="spacing">12</property>
|
|
<child>
|
|
<object class="GtkLabel" id="name_label">
|
|
<property name="visible">True</property>
|
|
</object>
|
|
</child>
|
|
<child>
|
|
<object class="GtkImage" id="icon">
|
|
<property name="visible">True</property>
|
|
<property name="halign">end</property>
|
|
<property name="valign">center</property>
|
|
<style>
|
|
<class name="dim-label"/>
|
|
</style>
|
|
</object>
|
|
<packing>
|
|
<property name="pack-type">end</property>
|
|
</packing>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
<child>
|
|
<object class="GtkLabel" id="percentage_label">
|
|
<property name="visible">True</property>
|
|
<property name="halign">end</property>
|
|
<style>
|
|
<class name="dim-label"/>
|
|
</style>
|
|
</object>
|
|
</child>
|
|
<child>
|
|
<object class="GtkLevelBar" id="levelbar">
|
|
<property name="visible">True</property>
|
|
<property name="hexpand">True</property>
|
|
<property name="halign">fill</property>
|
|
<property name="valign">center</property>
|
|
<offsets>
|
|
<offset name="warning-battery-offset" value="0.03"/>
|
|
<offset name="low-battery-offset" value="0.1"/>
|
|
<offset name="high-battery-offset" value="1.0"/>
|
|
</offsets>
|
|
</object>
|
|
<packing>
|
|
<property name="expand">True</property>
|
|
</packing>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
<child>
|
|
<object class="GtkBox" id="primary_bottom_box">
|
|
<property name="visible">True</property>
|
|
<property name="orientation">horizontal</property>
|
|
<child>
|
|
<object class="GtkLabel" id="details_label">
|
|
<property name="visible">True</property>
|
|
</object>
|
|
</child>
|
|
<child>
|
|
<object class="GtkLabel" id="primary_percentage_label">
|
|
<property name="visible">True</property>
|
|
</object>
|
|
<packing>
|
|
<property name="pack-type">end</property>
|
|
</packing>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
</template>
|
|
</interface>
|
|
|