2 * Copyright (C) 2010-2013 jeanfi@gmail.com
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.
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.
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
22 #include "ui_sensorpref.h"
25 on_graph_clicked(GtkWidget *widget, GdkEventButton *event, gpointer data)
27 if (event->type != GDK_BUTTON_PRESS)
30 gtk_menu_popup(GTK_MENU(((struct ui_psensor *)data)->popup_menu),
31 NULL, NULL, NULL, NULL,
32 event->button, event->time);
38 on_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
40 struct ui_psensor *ui_psensor = (struct ui_psensor *)data;
42 graph_update(ui_psensor->sensors,
45 ui_psensor->main_window);
50 GtkWidget *ui_graph_create(struct ui_psensor *ui)
54 w_graph = gtk_drawing_area_new();
56 if (GTK_MAJOR_VERSION == 2)
57 g_signal_connect(GTK_WIDGET(w_graph),
59 G_CALLBACK(on_expose_event),
62 g_signal_connect(GTK_WIDGET(w_graph),
64 G_CALLBACK(on_expose_event),
67 gtk_widget_add_events(w_graph, GDK_BUTTON_PRESS_MASK);
69 g_signal_connect(GTK_WIDGET(w_graph),
71 (GCallback) on_graph_clicked, ui);