gnome-power-manager r3104 - in trunk: . data src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3104 - in trunk: . data src
- Date: Mon, 1 Dec 2008 12:08:41 +0000 (UTC)
Author: rhughes
Date: Mon Dec 1 12:08:41 2008
New Revision: 3104
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3104&view=rev
Log:
2008-12-01 Richard Hughes <richard hughsie com>
* data/gpm-statistics.glade:
* src/gpm-common.h:
* src/gpm-statistics.c: (gpm_stats_update_smooth_data),
(gpm_stats_set_graph_data), (gpm_stats_update_info_page_history),
(gpm_stats_update_info_page_stats),
(gpm_stats_points_checkbox_history_cb),
(gpm_stats_points_checkbox_stats_cb), (main):
Show the smoothed graph seporately to the data points.
* src/gpm-graph-widget.c: (gpm_graph_widget_key_data_clear),
(gpm_graph_widget_key_data_add), (gpm_graph_widget_init),
(gpm_graph_widget_finalize), (gpm_graph_widget_data_clear),
(gpm_graph_widget_data_assign), (gpm_graph_widget_auto_range),
(gpm_graph_widget_draw_line),
(gpm_graph_widget_legend_calculate_size):
* src/gpm-graph-widget.h:
Allow more than one graph to be displayed on the widget.
Modified:
trunk/ChangeLog
trunk/data/gpm-statistics.glade
trunk/src/gpm-common.h
trunk/src/gpm-graph-widget.c
trunk/src/gpm-graph-widget.h
trunk/src/gpm-statistics.c
Modified: trunk/data/gpm-statistics.glade
==============================================================================
--- trunk/data/gpm-statistics.glade (original)
+++ trunk/data/gpm-statistics.glade Mon Dec 1 12:08:41 2008
@@ -73,26 +73,26 @@
<property name="border_width">9</property>
<property name="spacing">9</property>
<child>
- <widget class="GtkVBox" id="vbox3">
+ <widget class="GtkHBox" id="hbox4">
<property name="visible">True</property>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkHBox" id="hbox7">
+ <widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label_axis_history_y">
+ <widget class="GtkLabel" id="label5">
<property name="visible">True</property>
- <property name="label">y-axis</property>
- <property name="angle">90</property>
+ <property name="label" translatable="yes">Graph type:</property>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
- <widget class="Custom" id="custom_graph_history">
+ <widget class="GtkComboBox" id="combobox_history_type">
<property name="visible">True</property>
- <property name="creation_function">gpm_graph_widget_new</property>
+ <property name="items"></property>
</widget>
<packing>
<property name="position">1</property>
@@ -101,25 +101,9 @@
</widget>
</child>
<child>
- <widget class="GtkLabel" id="label_axis_history_x">
- <property name="visible">True</property>
- <property name="label">x-axis</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <child>
<widget class="GtkHBox" id="hbox5">
<property name="visible">True</property>
- <property name="spacing">3</property>
+ <property name="spacing">6</property>
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
@@ -139,47 +123,88 @@
</packing>
</child>
</widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
<child>
- <widget class="GtkHBox" id="hbox2">
+ <widget class="GtkHBox" id="hbox7">
<property name="visible">True</property>
- <property name="spacing">3</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label5">
+ <widget class="GtkLabel" id="label_axis_history_y">
<property name="visible">True</property>
- <property name="label" translatable="yes">Data type:</property>
+ <property name="label">y-axis</property>
+ <property name="angle">90</property>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="combobox_history_type">
+ <widget class="Custom" id="custom_graph_history">
<property name="visible">True</property>
- <property name="items"></property>
+ <property name="creation_function">gpm_graph_widget_new</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label_axis_history_x">
+ <property name="visible">True</property>
+ <property name="label">x-axis</property>
+ </widget>
<packing>
+ <property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
- <property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="checkbutton_smooth_history">
+ <widget class="GtkHBox" id="hbox9">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Smooth data before plotting</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
+ <property name="spacing">6</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_smooth_history">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use smoothed line</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_points_history">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show data points</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -209,6 +234,33 @@
<property name="border_width">9</property>
<property name="spacing">9</property>
<child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Graph type:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="combobox_stats_type">
+ <property name="visible">True</property>
+ <property name="items"></property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<child>
@@ -249,17 +301,19 @@
</widget>
<packing>
<property name="padding">3</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox3">
+ <widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
- <property name="spacing">15</property>
+ <property name="spacing">6</property>
+ <property name="homogeneous">True</property>
<child>
<widget class="GtkCheckButton" id="checkbutton_smooth_stats">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Smooth data before plotting</property>
+ <property name="label" translatable="yes">Use smoothed line</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
@@ -268,36 +322,22 @@
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox6">
+ <widget class="GtkCheckButton" id="checkbutton_points_stats">
<property name="visible">True</property>
- <property name="spacing">3</property>
- <child>
- <widget class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Data type:</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkComboBox" id="combobox_stats_type">
- <property name="visible">True</property>
- <property name="items"></property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Show data points</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
+ <property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
Modified: trunk/src/gpm-common.h
==============================================================================
--- trunk/src/gpm-common.h (original)
+++ trunk/src/gpm-common.h Mon Dec 1 12:08:41 2008
@@ -166,8 +166,10 @@
#define GPM_CONF_INFO_HISTORY_TIME "/apps/gnome-power-manager/info/history_time"
#define GPM_CONF_INFO_HISTORY_TYPE "/apps/gnome-power-manager/info/history_type"
#define GPM_CONF_INFO_HISTORY_GRAPH_SMOOTH "/apps/gnome-power-manager/info/history_graph_smooth"
+#define GPM_CONF_INFO_HISTORY_GRAPH_POINTS "/apps/gnome-power-manager/info/history_graph_points"
#define GPM_CONF_INFO_STATS_TYPE "/apps/gnome-power-manager/info/stats_type"
#define GPM_CONF_INFO_STATS_GRAPH_SMOOTH "/apps/gnome-power-manager/info/stats_graph_smooth"
+#define GPM_CONF_INFO_STATS_GRAPH_POINTS "/apps/gnome-power-manager/info/stats_graph_points"
#define GPM_CONF_INFO_PAGE_NUMBER "/apps/gnome-power-manager/info/page_number"
#define GPM_CONF_INFO_LAST_DEVICE "/apps/gnome-power-manager/info/last_device"
Modified: trunk/src/gpm-graph-widget.c
==============================================================================
--- trunk/src/gpm-graph-widget.c (original)
+++ trunk/src/gpm-graph-widget.c Mon Dec 1 12:08:41 2008
@@ -63,7 +63,8 @@
cairo_t *cr;
PangoLayout *layout;
- EggObjList *data_list;
+ GPtrArray *data_list;
+ GPtrArray *plot_list;
};
static gboolean gpm_graph_widget_expose (GtkWidget *graph, GdkEventExpose *event);
@@ -78,7 +79,6 @@
GpmGraphWidgetKeyData *keyitem;
guint a;
- g_return_val_if_fail (graph != NULL, FALSE);
g_return_val_if_fail (GPM_IS_GRAPH_WIDGET (graph), FALSE);
/* remove items in list and free */
@@ -101,7 +101,6 @@
{
GpmGraphWidgetKeyData *keyitem;
- g_return_val_if_fail (graph != NULL, FALSE);
g_return_val_if_fail (GPM_IS_GRAPH_WIDGET (graph), FALSE);
egg_debug ("add to list %s", desc);
@@ -190,7 +189,8 @@
graph->priv->stop_y = 100;
graph->priv->use_grid = TRUE;
graph->priv->use_legend = FALSE;
- graph->priv->data_list = egg_obj_list_new ();
+ graph->priv->data_list = g_ptr_array_new ();
+ graph->priv->plot_list = g_ptr_array_new ();
graph->priv->key_data = NULL;
graph->priv->axis_type_x = GPM_GRAPH_WIDGET_TYPE_TIME;
graph->priv->axis_type_y = GPM_GRAPH_WIDGET_TYPE_PERCENTAGE;
@@ -220,7 +220,9 @@
gpm_graph_widget_key_data_clear (graph);
/* free data */
- g_object_unref (graph->priv->data_list);
+ g_ptr_array_foreach (graph->priv->data_list, (GFunc) g_object_unref, NULL);
+ g_ptr_array_free (graph->priv->data_list, TRUE);
+ g_ptr_array_free (graph->priv->plot_list, TRUE);
context = pango_layout_get_context (graph->priv->layout);
g_object_unref (graph->priv->layout);
@@ -229,21 +231,35 @@
}
/**
+ * gpm_graph_widget_data_clear:
+ **/
+gboolean
+gpm_graph_widget_data_clear (GpmGraphWidget *graph)
+{
+ g_return_val_if_fail (GPM_IS_GRAPH_WIDGET (graph), FALSE);
+
+ g_ptr_array_foreach (graph->priv->data_list, (GFunc) g_object_unref, NULL);
+ g_ptr_array_set_size (graph->priv->data_list, 0);
+ g_ptr_array_set_size (graph->priv->plot_list, 0);
+
+ return TRUE;
+}
+
+/**
* gpm_graph_widget_data_assign:
* @graph: This class instance
*
- * Sets the data for the graph. You MUST NOT free the list before the widget.
+ * Sets the data for the graph
**/
gboolean
-gpm_graph_widget_data_assign (GpmGraphWidget *graph, EggObjList *array)
+gpm_graph_widget_data_assign (GpmGraphWidget *graph, GpmGraphWidgetPlot plot, EggObjList *data)
{
- g_return_val_if_fail (array != NULL, FALSE);
- g_return_val_if_fail (graph != NULL, FALSE);
+ g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (GPM_IS_GRAPH_WIDGET (graph), FALSE);
/* get the new data */
- g_object_unref (graph->priv->data_list);
- graph->priv->data_list = g_object_ref (array);
+ g_ptr_array_add (graph->priv->data_list, g_object_ref (data));
+ g_ptr_array_add (graph->priv->plot_list, GUINT_TO_POINTER(plot));
/* refresh */
gtk_widget_queue_draw (GTK_WIDGET (graph));
@@ -482,11 +498,24 @@
gfloat smallest_y = G_MAXFLOAT;
guint rounding_x = 1;
guint rounding_y = 1;
- EggObjList *array;
+ EggObjList *data;
GpmPointObj *point;
- guint i;
+ guint i, j;
+ guint len = 0;
+ GPtrArray *array;
- if (graph->priv->data_list->len == 0) {
+ array = graph->priv->data_list;
+
+ /* find out if we have no data */
+ for (j=0; j<array->len; j++) {
+ data = g_ptr_array_index (array, j);
+ len = data->len;
+ if (len > 0)
+ break;
+ }
+
+ /* no data in any array */
+ if (len == 0) {
egg_debug ("no data");
graph->priv->start_x = 0;
graph->priv->start_y = 0;
@@ -496,17 +525,19 @@
}
/* get the range for the graph */
- array = graph->priv->data_list;
- for (i=0; i < array->len; i++) {
- point = (GpmPointObj *) egg_obj_list_index (array, i);
- if (point->x > biggest_x)
- biggest_x = point->x;
- if (point->y > biggest_y)
- biggest_y = point->y;
- if (point->x < smallest_x)
- smallest_x = point->x;
- if (point->y < smallest_y)
- smallest_y = point->y;
+ for (j=0; j<array->len; j++) {
+ data = g_ptr_array_index (array, j);
+ for (i=0; i < data->len; i++) {
+ point = (GpmPointObj *) egg_obj_list_index (data, i);
+ if (point->x > biggest_x)
+ biggest_x = point->x;
+ if (point->y > biggest_y)
+ biggest_y = point->y;
+ if (point->x < smallest_x)
+ smallest_x = point->x;
+ if (point->y < smallest_y)
+ smallest_y = point->y;
+ }
}
egg_debug ("Data range is %f<x<%f, %f<y<%f", smallest_x, biggest_x, smallest_y, biggest_y);
/* don't allow no difference */
@@ -678,9 +709,11 @@
{
gfloat oldx, oldy;
gfloat newx, newy;
- EggObjList *array;
+ EggObjList *data;
+ GPtrArray *array;
+ GpmGraphWidgetPlot plot;
GpmPointObj *point;
- guint i;
+ guint i, j;
if (graph->priv->data_list->len == 0) {
egg_debug ("no data");
@@ -688,41 +721,51 @@
}
cairo_save (cr);
- /* do all the line on the graph */
array = graph->priv->data_list;
- /* get the very first point so we can work out the old */
- point = (GpmPointObj *) egg_obj_list_index (array, 0);
- oldx = 0;
- oldy = 0;
- gpm_graph_widget_get_pos_on_graph (graph, point->x, point->y, &oldx, &oldy);
- gpm_graph_widget_draw_dot (cr, oldx, oldy, point->color);
+ /* do each line */
+ for (j=0; j<array->len; j++) {
+ data = g_ptr_array_index (array, j);
+ if (data->len == 0)
+ continue;
+ plot = GPOINTER_TO_UINT (g_ptr_array_index (graph->priv->plot_list, j));
- for (i=1; i < array->len; i++) {
- point = (GpmPointObj *) egg_obj_list_index (array, i);
+ /* get the very first point so we can work out the old */
+ point = (GpmPointObj *) egg_obj_list_index (data, 0);
+ oldx = 0;
+ oldy = 0;
+ gpm_graph_widget_get_pos_on_graph (graph, point->x, point->y, &oldx, &oldy);
+ gpm_graph_widget_draw_dot (cr, oldx, oldy, point->color);
+
+ for (i=1; i < data->len; i++) {
+ point = (GpmPointObj *) egg_obj_list_index (data, i);
+
+ gpm_graph_widget_get_pos_on_graph (graph, point->x, point->y, &newx, &newy);
+
+ /* ignore white lines */
+ if (point->color == 0xffffff) {
+ oldx = newx;
+ oldy = newy;
+ continue;
+ }
- gpm_graph_widget_get_pos_on_graph (graph, point->x, point->y, &newx, &newy);
+ /* draw line */
+ if (plot == GPM_GRAPH_WIDGET_PLOT_LINE || plot == GPM_GRAPH_WIDGET_PLOT_BOTH) {
+ cairo_move_to (cr, oldx, oldy);
+ cairo_line_to (cr, newx, newy);
+ cairo_set_line_width (cr, 1.5);
+ gpm_graph_widget_set_color (cr, point->color);
+ cairo_stroke (cr);
+ }
- /* ignore white lines */
- if (point->color == 0xffffff) {
+ /* draw data dot */
+ if (plot == GPM_GRAPH_WIDGET_PLOT_POINTS || plot == GPM_GRAPH_WIDGET_PLOT_BOTH)
+ gpm_graph_widget_draw_dot (cr, newx, newy, point->color);
+
+ /* save old */
oldx = newx;
oldy = newy;
- continue;
}
-
- /* draw line */
- cairo_move_to (cr, oldx, oldy);
- cairo_line_to (cr, newx, newy);
- cairo_set_line_width (cr, 1.5);
- gpm_graph_widget_set_color (cr, point->color);
- cairo_stroke (cr);
-
- /* draw data dot */
- gpm_graph_widget_draw_dot (cr, newx, newy, point->color);
-
- /* save old */
- oldx = newx;
- oldy = newy;
}
cairo_restore (cr);
@@ -804,7 +847,6 @@
PangoRectangle ink_rect, logical_rect;
GpmGraphWidgetKeyData *keydataitem;
- g_return_val_if_fail (graph != NULL, FALSE);
g_return_val_if_fail (GPM_IS_GRAPH_WIDGET (graph), FALSE);
/* set defaults */
Modified: trunk/src/gpm-graph-widget.h
==============================================================================
--- trunk/src/gpm-graph-widget.h (original)
+++ trunk/src/gpm-graph-widget.h Mon Dec 1 12:08:41 2008
@@ -51,6 +51,12 @@
GPM_GRAPH_WIDGET_TYPE_UNKNOWN
} GpmGraphWidgetType;
+typedef enum {
+ GPM_GRAPH_WIDGET_PLOT_LINE,
+ GPM_GRAPH_WIDGET_PLOT_POINTS,
+ GPM_GRAPH_WIDGET_PLOT_BOTH
+} GpmGraphWidgetPlot;
+
/* the different kinds of lines in the key */
typedef struct {
guint32 color;
@@ -75,6 +81,7 @@
gboolean enable);
gboolean gpm_graph_widget_data_clear (GpmGraphWidget *graph);
gboolean gpm_graph_widget_data_assign (GpmGraphWidget *graph,
+ GpmGraphWidgetPlot plot,
EggObjList *array);
void gpm_graph_widget_set_type_x (GpmGraphWidget *graph,
GpmGraphWidgetType axis);
Modified: trunk/src/gpm-statistics.c
==============================================================================
--- trunk/src/gpm-statistics.c (original)
+++ trunk/src/gpm-statistics.c Mon Dec 1 12:08:41 2008
@@ -173,11 +173,13 @@
/**
* gpm_stats_update_smooth_data:
**/
-static void
+static EggObjList *
gpm_stats_update_smooth_data (EggObjList *list)
{
guint i;
GpmPointObj *point;
+ GpmPointObj point_new;
+ EggObjList *new;
EggArrayFloat *raw;
EggArrayFloat *convolved;
@@ -192,15 +194,23 @@
/* convolve with gaussian */
convolved = egg_array_float_convolve (raw, gaussian);
- /* push the smoothed data back into y data */
+ /* add the smoothed data back into a new array */
+ new = egg_obj_list_new ();
+ egg_obj_list_set_copy (new, (EggObjListCopyFunc) dkp_point_obj_copy);
+ egg_obj_list_set_free (new, (EggObjListFreeFunc) dkp_point_obj_free);
for (i=0; i<list->len; i++) {
point = (GpmPointObj *) egg_obj_list_index (list, i);
- point->y = egg_array_float_get (convolved, i);
+ point_new.color = point->color;
+ point_new.x = point->x;
+ point_new.y = egg_array_float_get (convolved, i);
+ egg_obj_list_add (new, &point_new);
}
/* free data */
egg_array_float_free (raw);
egg_array_float_free (convolved);
+
+ return new;
}
/**
@@ -342,6 +352,34 @@
}
/**
+ * gpm_stats_set_graph_data:
+ **/
+static void
+gpm_stats_set_graph_data (GtkWidget *widget, EggObjList *data, gboolean use_smoothed, gboolean use_points)
+{
+ EggObjList *smoothed;
+
+ gpm_graph_widget_data_clear (GPM_GRAPH_WIDGET (widget));
+
+ /* add correct data */
+ if (!use_smoothed) {
+ if (use_points)
+ gpm_graph_widget_data_assign (GPM_GRAPH_WIDGET (widget), GPM_GRAPH_WIDGET_PLOT_BOTH, data);
+ else
+ gpm_graph_widget_data_assign (GPM_GRAPH_WIDGET (widget), GPM_GRAPH_WIDGET_PLOT_LINE, data);
+ } else {
+ smoothed = gpm_stats_update_smooth_data (data);
+ if (use_points)
+ gpm_graph_widget_data_assign (GPM_GRAPH_WIDGET (widget), GPM_GRAPH_WIDGET_PLOT_POINTS, data);
+ gpm_graph_widget_data_assign (GPM_GRAPH_WIDGET (widget), GPM_GRAPH_WIDGET_PLOT_LINE, smoothed);
+ g_object_unref (smoothed);
+ }
+
+ /* show */
+ gtk_widget_show (widget);
+}
+
+/**
* gpm_stats_update_info_page_history:
**/
static void
@@ -352,6 +390,7 @@
DkpHistoryObj *hobj;
GtkWidget *widget;
gboolean checked;
+ gboolean points;
GpmPointObj *point;
EggObjList *new;
gint32 offset = 0;
@@ -406,13 +445,12 @@
widget = glade_xml_get_widget (glade_xml, "checkbutton_smooth_history");
checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ widget = glade_xml_get_widget (glade_xml, "checkbutton_points_history");
+ points = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- /* smooth */
- if (checked)
- gpm_stats_update_smooth_data (new);
-
+ /* present data to graph */
widget = glade_xml_get_widget (glade_xml, "custom_graph_history");
- gpm_graph_widget_data_assign (GPM_GRAPH_WIDGET (widget), new);
+ gpm_stats_set_graph_data (widget, new, checked, points);
g_object_unref (array);
g_object_unref (new);
@@ -431,6 +469,7 @@
DkpStatsObj *sobj;
GtkWidget *widget;
gboolean checked;
+ gboolean points;
GpmPointObj *point;
EggObjList *new;
gboolean use_data = FALSE;
@@ -485,14 +524,12 @@
/* render */
widget = glade_xml_get_widget (glade_xml, "checkbutton_smooth_stats");
checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ widget = glade_xml_get_widget (glade_xml, "checkbutton_points_stats");
+ points = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- /* smooth */
- if (checked)
- gpm_stats_update_smooth_data (new);
-
+ /* present data to graph */
widget = glade_xml_get_widget (glade_xml, "custom_graph_stats");
- gpm_graph_widget_data_assign (GPM_GRAPH_WIDGET (widget), new);
- gtk_widget_show (widget);
+ gpm_stats_set_graph_data (widget, new, checked, points);
g_object_unref (array);
g_object_unref (new);
@@ -890,6 +927,32 @@
}
/**
+ * gpm_stats_points_checkbox_history_cb:
+ * @widget: The GtkWidget object
+ **/
+static void
+gpm_stats_points_checkbox_history_cb (GtkWidget *widget, gpointer data)
+{
+ gboolean checked;
+ checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ gconf_client_set_bool (gconf_client, GPM_CONF_INFO_HISTORY_GRAPH_POINTS, checked, NULL);
+ gpm_stats_button_update_ui ();
+}
+
+/**
+ * gpm_stats_points_checkbox_stats_cb:
+ * @widget: The GtkWidget object
+ **/
+static void
+gpm_stats_points_checkbox_stats_cb (GtkWidget *widget, gpointer data)
+{
+ gboolean checked;
+ checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ gconf_client_set_bool (gconf_client, GPM_CONF_INFO_STATS_GRAPH_POINTS, checked, NULL);
+ gpm_stats_button_update_ui ();
+}
+
+/**
* main:
**/
int
@@ -993,6 +1056,18 @@
g_signal_connect (widget, "clicked",
G_CALLBACK (gpm_stats_smooth_checkbox_stats_cb), NULL);
+ widget = glade_xml_get_widget (glade_xml, "checkbutton_points_history");
+ checked = gconf_client_get_bool (gconf_client, GPM_CONF_INFO_HISTORY_GRAPH_POINTS, NULL);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked);
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (gpm_stats_points_checkbox_history_cb), NULL);
+
+ widget = glade_xml_get_widget (glade_xml, "checkbutton_points_stats");
+ checked = gconf_client_get_bool (gconf_client, GPM_CONF_INFO_STATS_GRAPH_POINTS, NULL);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked);
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (gpm_stats_points_checkbox_stats_cb), NULL);
+
widget = glade_xml_get_widget (glade_xml, "notebook1");
page = gconf_client_get_int (gconf_client, GPM_CONF_INFO_PAGE_NUMBER, NULL);
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), page);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]