X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fui.h;h=af17b78c32156481a6a80dfe783d192220b1ae61;hb=f3b05dae619a7909bd7422b3a82422c9442aa114;hp=24778dd8a89b2f8dbfa40608b6be6d4a7ec0d9e0;hpb=609664bb77874990e10f8073e54bb7f1645c8d72;p=psensor.git diff --git a/src/ui.h b/src/ui.h index 24778dd..af17b78 100644 --- a/src/ui.h +++ b/src/ui.h @@ -1,27 +1,28 @@ /* - Copyright (C) 2010-2011 wpitchoune@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., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - + * Copyright (C) 2010-2014 jeanfi@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., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ #ifndef _PSENSOR_UI_H_ #define _PSENSOR_UI_H_ #include "config.h" +#include + #include #include @@ -31,47 +32,71 @@ #include "psensor.h" +#define PSENSOR_ICON "psensor" + struct ui_psensor { struct psensor **sensors; + /* mutex which MUST be used for accessing sensors.*/ + pthread_mutex_t sensors_mutex; GtkWidget *w_graph; - struct ui_sensorlist *ui_sensorlist; - struct config *config; GtkWidget *main_window; - GtkWidget *main_box; - - GtkWidget *w_sensorlist; + GtkWidget *menu_bar; - int graph_update_interval; + GtkWidget *popup_menu; - GMutex *sensors_mutex; + /* + * The main vertical box, top contains the menubar, bottom + * contains the sensor_box. + */ + GtkWidget *main_box; -#ifdef HAVE_LIBNOTIFY /* - * Time of the last notification + * The box which contains the sensors graph and the sensors + * information list. */ - struct timeval *notification_last_time; -#endif + GtkPaned *sensor_box; -#if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029) - AppIndicator *indicator; -#endif -}; + GtkListStore *sensors_store; + GtkTreeView *sensors_tree; + GtkScrolledWindow *sensors_scrolled_tree; -void ui_main_box_create(struct ui_psensor *); + int graph_update_interval; +}; /* - Must be called to terminate Psensor UI. -*/ -void ui_psensor_exit(); + * Update the window according to the configuration. + * + * Creates or re-creates the sensor_box according to the position of + * the list of sensors in the configuration. + * + * Show or hide the menu bar. + */ +void ui_window_update(struct ui_psensor *); -/* - Creates the main GTK window -*/ -GtkWidget *ui_window_create(struct ui_psensor * ui); +/* Show the main psensor window. */ +void ui_window_show(struct ui_psensor *); + +/* Must be called to terminate Psensor UI. */ +void ui_psensor_quit(struct ui_psensor *ui); + +/* Creates the main GTK window */ +void ui_window_create(struct ui_psensor *ui); + +void ui_menu_bar_show(unsigned int show, struct ui_psensor *ui); + +void ui_show_about_dialog(); + +void ui_enable_alpha_channel(struct ui_psensor *ui); + +void ui_cb_preferences(GtkMenuItem *mi, gpointer data); +void ui_cb_about(GtkMenuItem *mi, gpointer data); +void ui_cb_menu_quit(GtkMenuItem *mi, gpointer data); +void ui_cb_sensor_preferences(GtkMenuItem *mi, gpointer data); +struct psensor **ui_get_sensors_ordered_by_position(const struct ui_psensor *); #endif