added dbus support
[monky] / src / common.h
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
2  * vim: ts=4 sw=4 noet ai cindent syntax=c
3  */
4
5 #ifndef _COMMON_H
6 #define _COMMON_H
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <sys/socket.h>
12 #include "text_object.h"
13
14 void add_update_callback(int (*func)(void));
15 void free_update_callbacks(void);
16 void start_update_threading(void);
17
18
19 void strfold(char *start, int count);
20 int check_mount(char *s);
21 void prepare_update(void);
22 int update_uptime(void);
23 int update_meminfo(void);
24 int update_net_stats(void);
25 int update_cpu_usage(void);
26 int update_total_processes(void);
27 int update_uname(void);
28 int update_threads(void);
29 int update_running_processes(void);
30 void update_stuff(void);
31 char get_freq(char *, size_t, const char *, int, unsigned int);
32 void print_voltage_mv(struct text_object *, char *, int);
33 void print_voltage_v(struct text_object *, char *, int);
34 int update_load_average(void);
35 int update_top(void);
36 void free_all_processes(void);
37 struct process *get_first_process(void);
38 void get_cpu_count(void);
39 double get_time(void);
40
41 /* Converts '~/...' paths to '/home/blah/...' assumes that 'dest' is at least
42  * DEFAULT_TEXT_BUFFER_SIZE.  It's similar to variable_substitute, except only
43  * cheques for $HOME and ~/ in path */
44 void to_real_path(char *dest, const char *source);
45 FILE *open_file(const char *file, int *reported);
46 int open_fifo(const char *file, int *reported);
47 void variable_substitute(const char *s, char *dest, unsigned int n);
48
49 void format_seconds(char *buf, unsigned int n, long t);
50 void format_seconds_short(char *buf, unsigned int n, long t);
51
52 #ifdef X11
53 int update_x11info(void);
54 #endif
55
56 int round_to_int_temp(float);
57
58 unsigned int round_to_int(float);
59
60 extern int no_buffers;
61
62 int open_acpi_temperature(const char *name);
63 double get_acpi_temperature(int fd);
64 void get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size, const char *adapter);
65 void get_acpi_fan(char *, size_t);
66 void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
67 void get_dbus_stuff(char *buffer,unsigned int intMax_length, int item);
68 int get_battery_perct(const char *bat);
69 int get_battery_perct_bar(const char *bat);
70 void get_battery_short_status(char *buf, unsigned int n, const char *bat);
71
72 void scan_loadavg_arg(struct text_object *, const char *);
73 void print_loadavg(struct text_object *, char *, int);
74 #ifdef X11
75 void scan_loadgraph_arg(struct text_object *, const char *);
76 void print_loadgraph(struct text_object *, char *, int);
77 #endif /* X11 */
78
79 #endif /* _COMMON_H */