Пример #1
0
static void
create_chart(GtkWidget *vbox, Reader *reader, gint first_create)
{
    if (first_create)
	    reader->chart = gkrellm_chart_new0();

//    gkrellm_set_chart_height_default(reader->chart, 20);

    gkrellm_chart_create(vbox, mon, reader->chart, &reader->chart_config);

    gkrellm_chartconfig_grid_resolution_adjustment(reader->chart_config,
                /*map*/TRUE, /*spin_factor*/1.0, /*low*/1, /*high*/100000000,
			/*step0*/0, /*step1*/0, /*digits*/0, /*width*/50);

    reader->chart_data = gkrellm_add_default_chartdata(reader->chart, "Plugin Data");
    
    gkrellm_monotonic_chartdata(reader->chart_data, FALSE);

    gkrellm_set_chartdata_draw_style_default(reader->chart_data, CHARTDATA_LINE);
    gkrellm_set_chartdata_flags(reader->chart_data, CHARTDATA_ALLOW_HIDE);

    gkrellm_alloc_chartdata(reader->chart);

    if (first_create)
    {
            gkrellm_set_draw_chart_function(reader->chart, cb_draw_chart, reader);
	    gtk_signal_connect(GTK_OBJECT(reader->chart->drawing_area),
			       "expose_event", (GtkSignalFunc) chart_expose_event, NULL);
	    gtk_signal_connect(GTK_OBJECT(reader->chart->drawing_area),
			       "button_press_event", (GtkSignalFunc) cb_chart_click, reader->chart);
	    reader->tooltip=gtk_tooltips_new();
    }
    else
    {
	    gkrellm_draw_chartdata(reader->chart);
	    gkrellm_draw_chart_to_screen(reader->chart);
    }

}
Пример #2
0
static void
create_proc_monitor(GtkWidget *vbox, gint first_create)
	{
	GkrellmChart		*cp;
	GkrellmChartdata	*cd;
	GkrellmChartconfig	*cf;
	GkrellmPanel		*p;
	GkrellmStyle		*style;

	if (first_create)
		{
		proc.chart = gkrellm_chart_new0();
		proc.chart->panel = gkrellm_panel_new0();
		}
	cp = proc.chart;
	p = cp->panel;

	style = gkrellm_panel_style(style_id);
	gkrellm_create_krell(p, gkrellm_krell_panel_piximage(style_id), style);

	gkrellm_chart_create(proc.vbox, mon_proc, cp, &proc.chart_config);
	gkrellm_set_draw_chart_function(cp, refresh_proc_chart, proc.chart);
	cd = gkrellm_add_default_chartdata(cp, _("Load"));
	gkrellm_monotonic_chartdata(cd, FALSE);
	gkrellm_set_chartdata_draw_style_default(cd, CHARTDATA_LINE);
	proc.forks_cd = gkrellm_add_default_chartdata(cp, _("Forks"));
	gkrellm_set_chartdata_flags(proc.forks_cd, CHARTDATA_ALLOW_HIDE);

	cf = cp->config;
	gkrellm_chartconfig_fixed_grids_connect(cf, setup_proc_scaling, NULL);
	gkrellm_chartconfig_grid_resolution_connect(cf, setup_proc_scaling, NULL);
	gkrellm_chartconfig_grid_resolution_adjustment(cf, FALSE,
			LOAD_SCALING, 0.5, 5.0, 0.5, 0.5, 1, 50);
	gkrellm_chartconfig_grid_resolution_label(cf,
					_("Average process load per minute"));

	gkrellm_alloc_chartdata(cp);
	setup_proc_scaling();

	/* I put motherboard temp on Proc panel (if temperature sensors found)
	*/
	gkrellm_sensors_create_decals(p, style_id,
					&proc.sensor_decal, &proc.fan_decal);

	gkrellm_panel_configure(p, proc.panel_label, style);

	gkrellm_panel_create(proc.vbox, mon_proc, p);

	proc.save_label_position = p->label->position;
	if (proc.sensor_decal)
		adjust_sensors_display(TRUE);

	new_text_format = TRUE;
	if (first_create)
		{
		g_signal_connect(G_OBJECT(cp->drawing_area), "expose_event",
				G_CALLBACK(proc_expose_event), NULL);
		g_signal_connect(G_OBJECT(p->drawing_area), "expose_event",
				G_CALLBACK(proc_expose_event), NULL);
		g_signal_connect(G_OBJECT(cp->drawing_area),"button_press_event",
				G_CALLBACK(cb_proc_extra), NULL);
		g_signal_connect(G_OBJECT(p->drawing_area), "button_press_event",
				G_CALLBACK(cb_panel_press), NULL);
		}
	else
		refresh_proc_chart(cp);
	gkrellm_setup_launcher(p, &proc_launch, CHART_PANEL_TYPE, 4);
	}