1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* GNOME cpuload/memload panel applet
* (C) 1997 The Free Software Foundation
*
* Authors: Tim P. Gerla
* Martin Baulig
*
* With code from wmload.c, v0.9.2, apparently by Ryan Land, rland@bc1.com.
*
*/
#include <stdio.h>
#include <config.h>
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#include <dirent.h>
#include <string.h>
#include <time.h>
#include <config.h>
#include <gnome.h>
#include <gdk/gdkx.h>
#include <applet-widget.h>
#include "global.h"
/* start a new instance of the memload applet */
GtkWidget *
make_memload_applet (const gchar *goad_id)
{
GtkWidget *applet;
LoadGraphProperties *prop_data;
LoadGraph *g;
/* create a new applet_widget */
applet = applet_widget_new(goad_id);
/* in the rare case that the communication with the panel
failed, error out */
if (!applet)
g_error ("Can't create applet!\n");
prop_data = g_memdup (&multiload_properties, sizeof (LoadGraphProperties));
g = load_graph_new (APPLET_WIDGET (applet), 4, N_("Memory Load"),
&multiload_properties.memload, prop_data,
multiload_properties.memload.adj_data[0],
multiload_properties.memload.adj_data[1], GetMemory);
applet_widget_add (APPLET_WIDGET(applet), g->frame);
gtk_widget_show (applet);
load_graph_start (g);
applet_widget_register_stock_callback (APPLET_WIDGET(applet),
"properties",
GNOME_STOCK_MENU_PROP,
_("Default Properties..."),
multiload_properties_cb,
g);
applet_widget_register_stock_callback (APPLET_WIDGET(applet),
"local_properties",
GNOME_STOCK_MENU_PROP,
_("Properties..."),
multiload_local_properties_cb,
g);
applet_widget_register_stock_callback (APPLET_WIDGET(applet),
"run_gtop",
GNOME_STOCK_MENU_INDEX,
_("Run gtop..."),
start_gtop_cb, NULL);
applet_widget_set_tooltip(APPLET_WIDGET(applet), "Memory Load");
return applet;
}
|