summaryrefslogtreecommitdiff
path: root/sensors-applet/active-sensor.h
blob: 2d4674b74fb7b18496e19e23edd82dbe104f44f5 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright (C) 2005-2009 Alex Murray <murray.alex@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef ACTIVE_SENSOR_H
#define ACTIVE_SENSOR_H

#ifdef HAVE_LIBNOTIFY
#include <libnotify/notify.h>
#include "active-sensor-libnotify.h"
#endif

#include "sensors-applet.h"

struct _ActiveSensor {
        SensorsApplet *sensors_applet;

	/* widgets to render to display the sensor */
	GtkWidget *label;
	GtkWidget *icon;
	GtkWidget *value;
        GtkWidget *graph;
        GtkWidget *graph_frame;

        GdkColor graph_color;

	GtkTreeRowReference *sensor_row;

#ifdef HAVE_LIBNOTIFY
        NotifyNotification *notification[NUM_NOTIFS];
#endif

        gboolean updated;

	/* alarm related stuff */
	gint alarm_timeout_id[NUM_ALARMS];
	gchar *alarm_command[NUM_ALARMS];
        gint alarm_timeout;

	/* buffer of sensor values */
        gdouble *sensor_values;

        /* length of sensor_values buffer */
        gint num_samples;
        
	gdouble sensor_low_value;
	gdouble sensor_high_value;	
};

ActiveSensor *active_sensor_new(SensorsApplet *sensors_applet,
                                GtkTreeRowReference *sensor_row);
void active_sensor_destroy(ActiveSensor *active_sensor);
gint active_sensor_compare(ActiveSensor *a, ActiveSensor *b);
void active_sensor_update(ActiveSensor *sensor, SensorsApplet *sensors_applet);
void active_sensor_icon_changed(ActiveSensor *sensor, SensorsApplet *sensors_applet);
void active_sensor_update_graph_dimensions(ActiveSensor *as,
                                           gint dimensions[2]);
void active_sensor_alarm_off(ActiveSensor *active_sensor, NotifType notif_type);
#endif /* ACTIVE_SENSOR_H */