Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorあく <alleteam@gmail.com>2020-12-14 13:50:32 +0300
committerGitHub <noreply@github.com>2020-12-14 13:50:32 +0300
commitd3ff7878645569698d8a0947a3087e552eefe81c (patch)
tree8cdfdbdc2847ee8be10a3ff386402ca8a3e563f9 /applications/power
parentff7ce6f00fe8d3ebba39c6963539267192acec38 (diff)
GUI: abolish API injection into instances. (#265)
* GUI: abolish API injection into instances. Update usage by 3rd party apps. * GUI: update documentation. Cleanup api usage. Adjust status bar item spacing.
Diffstat (limited to 'applications/power')
-rw-r--r--applications/power/power.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/applications/power/power.c b/applications/power/power.c
index 15c26db2..dc19b754 100644
--- a/applications/power/power.c
+++ b/applications/power/power.c
@@ -24,18 +24,18 @@ struct Power {
uint8_t charge;
};
-void power_draw_usb_callback(CanvasApi* canvas, void* context) {
+void power_draw_usb_callback(Canvas* canvas, void* context) {
assert(context);
Power* power = context;
- canvas->draw_icon(canvas, 0, 0, power->usb_icon);
+ canvas_draw_icon(canvas, 0, 0, power->usb_icon);
}
-void power_draw_battery_callback(CanvasApi* canvas, void* context) {
+void power_draw_battery_callback(Canvas* canvas, void* context) {
assert(context);
Power* power = context;
- canvas->draw_icon(canvas, 0, 0, power->battery_icon);
- canvas->draw_box(canvas, 2, 2, (float)power->charge / 100 * 14, 4);
+ canvas_draw_icon(canvas, 0, 0, power->battery_icon);
+ canvas_draw_box(canvas, 2, 2, (float)power->charge / 100 * 14, 4);
}
void power_off_callback(void* context) {
@@ -134,13 +134,9 @@ void power_task(void* p) {
cli_add_command(power->cli, "power_otg_off", power_cli_otg_off, power);
}
- FuriRecordSubscriber* gui_record = furi_open_deprecated("gui", false, false, NULL, NULL, NULL);
- assert(gui_record);
- GuiApi* gui = furi_take(gui_record);
- assert(gui);
- gui->add_widget(gui, power->usb_widget, GuiLayerStatusBarLeft);
- gui->add_widget(gui, power->battery_widget, GuiLayerStatusBarRight);
- furi_commit(gui_record);
+ Gui* gui = furi_open("gui");
+ gui_add_widget(gui, power->usb_widget, GuiLayerStatusBarLeft);
+ gui_add_widget(gui, power->battery_widget, GuiLayerStatusBarRight);
with_value_mutex(
power->menu_vm, (Menu * menu) { menu_item_add(menu, power->menu); });