/*
- * Copyright (C) 2010-2013 jeanfi@gmail.com
+ * 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
*/
#include "graph.h"
#include "ui_graph.h"
-#include "ui_pref.h"
-#include "ui_sensorpref.h"
static int
on_graph_clicked(GtkWidget *widget, GdkEventButton *event, gpointer data)
return FALSE;
}
-GtkWidget *ui_graph_create(struct ui_psensor *ui)
+void smooth_curves_enabled_changed_cbk(void *data)
+{
+ is_smooth_curves_enabled = config_is_smooth_curves_enabled();
+}
+
+void ui_graph_create(struct ui_psensor *ui)
{
GtkWidget *w_graph;
- w_graph = gtk_drawing_area_new();
+ log_debug("ui_graph_create()");
- 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);
+ w_graph = ui->w_graph;
+
+ is_smooth_curves_enabled = config_is_smooth_curves_enabled();
+ g_signal_connect_after(config_get_GSettings(),
+ "changed::graph-smooth-curves-enabled",
+ G_CALLBACK(smooth_curves_enabled_changed_cbk),
+ NULL);
+
+ g_signal_connect(GTK_WIDGET(w_graph),
+ "draw",
+ G_CALLBACK(on_expose_event),
+ ui);
gtk_widget_add_events(w_graph, GDK_BUTTON_PRESS_MASK);
g_signal_connect(GTK_WIDGET(w_graph),
- "button_press_event",
- (GCallback) on_graph_clicked, ui);
+ "button_press_event",
+ (GCallback) on_graph_clicked, ui);
- return w_graph;
+ log_debug("ui_graph_create() ends");
}