added missing comma
[psensor-pkg-ubuntu.git] / src / ui.h
1 /*
2  * Copyright (C) 2010-2014 jeanfi@gmail.com
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19 #ifndef _PSENSOR_UI_H_
20 #define _PSENSOR_UI_H_
21
22 #include "config.h"
23
24 #include <pthread.h>
25
26 #include <glib/gi18n.h>
27 #include <gtk/gtk.h>
28
29 #if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
30 #include <libappindicator/app-indicator.h>
31 #endif
32
33 #include "psensor.h"
34
35 #define PSENSOR_ICON "psensor"
36
37 struct ui_psensor {
38         struct psensor **sensors;
39         /* mutex which MUST be used for accessing sensors.*/
40         pthread_mutex_t sensors_mutex;
41
42         GtkWidget *w_graph;
43
44         struct config *config;
45
46         GtkWidget *main_window;
47
48         GtkWidget *menu_bar;
49
50         GtkWidget *popup_menu;
51
52         /*
53          * The main vertical box, top contains the menubar, bottom
54          * contains the sensor_box.
55          */
56         GtkWidget *main_box;
57
58         /*
59          * The box which contains the sensors graph and the sensors
60          * information list.
61          */
62         GtkPaned *sensor_box;
63
64         GtkListStore *sensors_store;
65         GtkTreeView *sensors_tree;
66         GtkScrolledWindow *sensors_scrolled_tree;
67
68         int graph_update_interval;
69 };
70
71 /*
72  * Update the window according to the configuration.
73  *
74  * Creates or re-creates the sensor_box according to the position of
75  * the list of sensors in the configuration.
76  *
77  * Show or hide the menu bar.
78  */
79 void ui_window_update(struct ui_psensor *);
80
81 /* Show the main psensor window. */
82 void ui_window_show(struct ui_psensor *);
83
84 /* Must be called to terminate Psensor UI. */
85 void ui_psensor_quit(struct ui_psensor *ui);
86
87 /* Creates the main GTK window */
88 void ui_window_create(struct ui_psensor *ui);
89
90 void ui_menu_bar_show(unsigned int show, struct ui_psensor *ui);
91
92 void ui_show_about_dialog();
93
94 void ui_enable_alpha_channel(struct ui_psensor *ui);
95
96 void ui_cb_preferences(GtkMenuItem *mi, gpointer data);
97 void ui_cb_about(GtkMenuItem *mi, gpointer data);
98 void ui_cb_menu_quit(GtkMenuItem *mi, gpointer data);
99 void ui_cb_sensor_preferences(GtkMenuItem *mi, gpointer data);
100
101 struct psensor **ui_get_sensors_ordered_by_position(const struct ui_psensor *);
102 #endif