1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use crate::{
    core::i18n,
    plugins::{
        calories::{DataProvider, PluginCaloriesDetails},
        Plugin, PluginDetails, PluginName,
    },
};
use gtk::prelude::*;

#[derive(Clone, Debug)]
pub struct CaloriesPlugin;

impl CaloriesPlugin {
    pub fn new() -> Self {
        Self {}
    }
}

impl Plugin for CaloriesPlugin {
    fn details(&self, mocked: bool) -> PluginDetails {
        let data_provider = if mocked {
            DataProvider::mocked()
        } else {
            DataProvider::actual()
        };

        PluginCaloriesDetails::new(data_provider).upcast()
    }

    fn name(&self) -> PluginName {
        PluginName::Calories
    }

    fn icon_name(&self) -> &'static str {
        "calories-thin-symbolic"
    }

    fn localised_name(&self) -> String {
        i18n("Calories")
    }
}