-
Notifications
You must be signed in to change notification settings - Fork 2
/
gkrellm-wifi-alert.c
85 lines (64 loc) · 2.43 KB
/
gkrellm-wifi-alert.c
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
74
75
76
77
78
79
80
81
82
83
84
85
/* gkrellm-wifi - A wireless link monitor plug-in for GKrellM2
*
* Copyright (C) 2003 Henrik Brix Andersen <brix@gimp.org>
*
* 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.
*/
#include "gkrellm-wifi.h"
#include "gkrellm-wifi-alert.h"
#define ALERT_MAX 100
#define ALERT_MIN 0
#define ALERT_STEP0 5
#define ALERT_STEP1 10
#define ALERT_DIGITS 0
#define DELAY_MIN 0
#define DELAY_MAX 3600
#define DELAY_STEP 1
/* prototypes */
static void alert_trigger_callback (GkrellmAlert *alert,
gpointer user_data);
/* public functions */
void
gkrellm_wifi_alert_create (GkrellmWifiMonitor *wifimon)
{
g_assert (wifimon != NULL);
wifimon->alert = gkrellm_alert_create (NULL,
wifimon->interface,
_("Link Quality Percentage"),
FALSE, TRUE, TRUE,
ALERT_MAX,
ALERT_MIN,
ALERT_STEP0,
ALERT_STEP1,
ALERT_DIGITS);
gkrellm_alert_delay_config (wifimon->alert,
DELAY_STEP,
DELAY_MAX,
DELAY_MIN);
gkrellm_alert_trigger_connect (wifimon->alert,
alert_trigger_callback,
wifimon);
}
/* private functions */
static void
alert_trigger_callback (GkrellmAlert *alert,
gpointer user_data)
{
GkrellmWifiMonitor *wifimon;
g_assert (alert != NULL);
g_assert (user_data != NULL);
wifimon = user_data;
alert->panel = wifimon->chart->panel;
}