updated copyright to 2013
[psensor.git] / src / ui_graph.c
index 2edd8c7..cb58ca2 100644 (file)
@@ -1,22 +1,21 @@
 /*
-    Copyright (C) 2010-2011 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
-*/
-
+ * Copyright (C) 2010-2013 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
+ */
 #include "graph.h"
 #include "ui_graph.h"
 #include "ui_pref.h"
@@ -58,25 +57,25 @@ static const char *menu_desc =
 "</ui>";
 
 static GtkActionEntry entries[] = {
-  { "PsensorMenuAction", NULL, "_Psensor" }, /* name, stock id, label */
+       { "PsensorMenuAction", NULL, "_Psensor" },
 
-  { "PreferencesAction", GTK_STOCK_PREFERENCES,     /* name, stock id */
-    "_Preferences", NULL,                           /* label, accelerator */
-    "Preferences",                                  /* tooltip */
-    G_CALLBACK(cb_preferences) },
+       { "PreferencesAction", GTK_STOCK_PREFERENCES,
+         "_Preferences", NULL,
+         "Preferences",
+         G_CALLBACK(cb_preferences) },
 
-  { "SensorPreferencesAction", GTK_STOCK_PREFERENCES,/* name, stock id */
-    "_Sensor Preferences", NULL,                     /* label, accelerator */
-    "Sensor Preferences",                            /* tooltip */
-    G_CALLBACK(cb_sensor_preferences) },
+       { "SensorPreferencesAction", GTK_STOCK_PREFERENCES,
+         "S_ensor Preferences", NULL,
+         "Sensor Preferences",
+         G_CALLBACK(cb_sensor_preferences) },
 
-  { "AboutAction", NULL,
-    "_About", NULL,
-    "About",
-    G_CALLBACK(cb_about) },
+       { "AboutAction", NULL,
+         "_About", NULL,
+         "About",
+         G_CALLBACK(cb_about) },
 
-  { "QuitAction",
-    GTK_STOCK_QUIT, "_Quit", NULL, "Quit", G_CALLBACK(cb_menu_quit) }
+       { "QuitAction",
+         GTK_STOCK_QUIT, "_Quit", NULL, "Quit", G_CALLBACK(cb_menu_quit) }
 };
 static guint n_entries = G_N_ELEMENTS(entries);
 
@@ -125,19 +124,29 @@ on_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
        struct ui_psensor *ui_psensor = (struct ui_psensor *)data;
 
        graph_update(ui_psensor->sensors,
-                    ui_psensor->w_graph, ui_psensor->config);
+                    ui_psensor->w_graph,
+                    ui_psensor->config,
+                    ui_psensor->main_window);
 
        return FALSE;
 }
 
-GtkWidget *ui_graph_create(struct ui_psensor * ui)
+GtkWidget *ui_graph_create(struct ui_psensor *ui)
 {
        GtkWidget *w_graph;
 
        w_graph = gtk_drawing_area_new();
 
-       g_signal_connect(GTK_WIDGET(w_graph),
-                        "expose-event", G_CALLBACK(on_expose_event), ui);
+       if (GTK_MAJOR_VERSION == 2)
+               g_signal_connect(GTK_WIDGET(w_graph),
+                                "expose-event",
+                                G_CALLBACK(on_expose_event),
+                                ui);
+       else
+               g_signal_connect(GTK_WIDGET(w_graph),
+                                "draw",
+                                G_CALLBACK(on_expose_event),
+                                ui);
 
        gtk_widget_add_events(w_graph, GDK_BUTTON_PRESS_MASK);