1 | /* Procman |
---|
2 | * Copyright (C) 2001 Kevin Vandersloot |
---|
3 | * |
---|
4 | * This program is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU General Public License |
---|
6 | * as published by the Free Software Foundation; either version 2 |
---|
7 | * of the License, or (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU Library General Public |
---|
15 | * License along with this program; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
---|
17 | * |
---|
18 | */ |
---|
19 | #ifndef _PROCMAN_H_ |
---|
20 | #define _PROCMAN_H_ |
---|
21 | |
---|
22 | #include <gdk-pixbuf/gdk-pixbuf.h> |
---|
23 | #include <gnome.h> |
---|
24 | #include <gconf/gconf-client.h> |
---|
25 | |
---|
26 | typedef struct _ProcConfig ProcConfig; |
---|
27 | typedef struct _PrettyTable PrettyTable; |
---|
28 | typedef struct _LoadGraph LoadGraph; |
---|
29 | typedef struct _ProcInfo ProcInfo; |
---|
30 | typedef struct _ProcData ProcData; |
---|
31 | |
---|
32 | enum |
---|
33 | { |
---|
34 | ALL_PROCESSES, |
---|
35 | MY_PROCESSES, |
---|
36 | RUNNING_PROCESSES, |
---|
37 | FAVORITE_PROCESSES, |
---|
38 | }; |
---|
39 | |
---|
40 | #define NCPUSTATES 4 |
---|
41 | |
---|
42 | struct _ProcConfig |
---|
43 | { |
---|
44 | gint width; |
---|
45 | gint height; |
---|
46 | gboolean show_more_info; |
---|
47 | gboolean show_kill_warning; |
---|
48 | gboolean show_hide_message; |
---|
49 | gboolean show_tree; |
---|
50 | gboolean show_threads; |
---|
51 | gint update_interval; |
---|
52 | gint graph_update_interval; |
---|
53 | gint disks_update_interval; |
---|
54 | gint whose_process; |
---|
55 | gint current_tab; |
---|
56 | GdkColor cpu_color; |
---|
57 | GdkColor mem_color; |
---|
58 | GdkColor swap_color; |
---|
59 | GdkColor bg_color; |
---|
60 | GdkColor frame_color; |
---|
61 | gboolean simple_view; |
---|
62 | gint pane_pos; |
---|
63 | }; |
---|
64 | |
---|
65 | struct _PrettyTable { |
---|
66 | GHashTable *app_hash; /* apps gotten from libwnck */ |
---|
67 | GHashTable *default_hash; /* defined in defaulttable.h */ |
---|
68 | }; |
---|
69 | |
---|
70 | struct _LoadGraph { |
---|
71 | |
---|
72 | guint n; |
---|
73 | gint type; |
---|
74 | guint speed; |
---|
75 | guint draw_width, draw_height; |
---|
76 | guint num_points; |
---|
77 | |
---|
78 | guint allocated; |
---|
79 | |
---|
80 | GdkColor *colors; |
---|
81 | gfloat **data, **odata; |
---|
82 | guint data_size; |
---|
83 | guint *pos; |
---|
84 | |
---|
85 | gint colors_allocated; |
---|
86 | GtkWidget *main_widget; |
---|
87 | GtkWidget *disp; |
---|
88 | GtkWidget *label; |
---|
89 | GtkWidget *memused_label; |
---|
90 | GtkWidget *memtotal_label; |
---|
91 | GtkWidget *swapused_label; |
---|
92 | GtkWidget *swaptotal_label; |
---|
93 | GdkPixmap *pixmap; |
---|
94 | GdkGC *gc; |
---|
95 | int timer_index; |
---|
96 | |
---|
97 | gboolean draw; |
---|
98 | |
---|
99 | long cpu_time [NCPUSTATES]; |
---|
100 | long cpu_last [NCPUSTATES]; |
---|
101 | int cpu_initialized; |
---|
102 | }; |
---|
103 | |
---|
104 | struct _ProcInfo |
---|
105 | { |
---|
106 | GtkTreeIter node; |
---|
107 | GtkTreeIter parent_node; |
---|
108 | gboolean visible; |
---|
109 | gboolean has_parent; |
---|
110 | GdkPixbuf *pixbuf; |
---|
111 | gchar *name; |
---|
112 | gchar *user; |
---|
113 | gchar *arguments; |
---|
114 | gint mem; |
---|
115 | gint cpu; |
---|
116 | gint pid; |
---|
117 | gint parent_pid; |
---|
118 | gint cpu_time_last; |
---|
119 | gint nice; |
---|
120 | gint vmsize; |
---|
121 | gint memres; |
---|
122 | gint memshared; |
---|
123 | gint memrss; |
---|
124 | gchar *status; |
---|
125 | gboolean running; |
---|
126 | gboolean is_thread; |
---|
127 | gboolean is_blacklisted; |
---|
128 | }; |
---|
129 | |
---|
130 | struct _ProcData |
---|
131 | { |
---|
132 | GtkWidget *tree; |
---|
133 | GtkWidget *infobox; |
---|
134 | GtkWidget *disk_list; |
---|
135 | ProcConfig config; |
---|
136 | LoadGraph *cpu_graph; |
---|
137 | LoadGraph *mem_graph; |
---|
138 | ProcInfo *selected_process; |
---|
139 | GtkTreeSelection *selection; |
---|
140 | gint timeout; |
---|
141 | gint disk_timeout; |
---|
142 | GList *info; |
---|
143 | PrettyTable *pretty_table; |
---|
144 | GList *blacklist; |
---|
145 | gint blacklist_num; |
---|
146 | GConfClient *client; |
---|
147 | }; |
---|
148 | |
---|
149 | void procman_save_config (ProcData *data); |
---|
150 | void procman_save_tree_state (GConfClient *client, GtkWidget *tree, gchar *prefix); |
---|
151 | gboolean procman_get_tree_state (GConfClient *client, GtkWidget *tree, gchar *prefix); |
---|
152 | |
---|
153 | #endif |
---|