Exemple #1
0
static J4statusPluginContext *
_j4status_mem_init(J4statusCoreInterface *core)
{
    const gchar MEM[]= "Memory";
    GKeyFile *key_file = j4status_config_get_key_file(MEM);
    guint period = 0;
    guint good_threshold = 0;
    guint bad_threshold = 0;
    if (key_file) {
        period = g_key_file_get_integer(key_file, MEM, "Frequency", NULL);
        good_threshold = g_key_file_get_integer(
            key_file, MEM, "GoodThreshold", NULL);
        bad_threshold = g_key_file_get_integer(
            key_file, MEM, "BadThreshold", NULL);
        g_key_file_free(key_file);
    }

    J4statusSection *section = j4status_section_new(core);
    j4status_section_set_name(section, "mem");
    if (!j4status_section_insert(section)) {
        j4status_section_free(section);
        return NULL;
    }

    J4statusPluginContext *context = g_new(J4statusPluginContext, 1);
    context->section = section;
    context->good_threshold = good_threshold > 0 ? good_threshold : 50;
    context->bad_threshold = bad_threshold > context->good_threshold ?
        bad_threshold : 90;
    context->period = MAX(period, 1);
    return context;
}
static void
_j4status_i3focus_uninit(J4statusPluginContext *context)
{
    j4status_section_free(context->section);

    g_object_unref(context->connection);

    g_free(context);
}
Exemple #3
0
static void
_j4status_sensors_feature_free(gpointer data)
{
    J4statusSensorsFeature *feature = data;

    j4status_section_free(feature->section);

    g_free(feature);
}
Exemple #4
0
static void
_j4status_nl_section_free(gpointer data)
{
    J4statusNlSection *self = data;

    j4status_section_free(self->section);

    _j4status_nl_section_free_addresses(self);

    rtnl_link_put(self->link);

    g_free(self);
}
Exemple #5
0
static void
_j4status_alsa_section_free(gpointer data)
{
    J4statusAlsaSection *section = data;

    j4status_section_free(section->section);

    snd_mixer_free(section->mixer);
    g_water_alsa_mixer_source_free(section->source);

    g_free(section->card);

    g_free(section);
}