1 diff -Nrup gnome-system-monitor-2.17.6/src/callbacks.h gnome-system-monitor-2.17.6.mod/src/callbacks.h 2 --- gnome-system-monitor-2.17.6/src/callbacks.h 2007-01-18 07:44:46.000000000 +0800 3 +++ gnome-system-monitor-2.17.6.mod/src/callbacks.h 2007-01-24 17:09:38.201397000 +0800 4 @@ -25,63 +25,62 @@ 5 #include "procman.h" 6 #include <libgnomevfs/gnome-vfs.h> 7 8 - 9 -void cb_show_memory_maps (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 10 -void cb_show_open_files (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 11 -void cb_show_lsof(GtkAction *action, gpointer data) G_GNUC_INTERNAL; 12 -void cb_renice (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 13 -void cb_end_process (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 14 -void cb_kill_process (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 15 -void cb_edit_preferences (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 16 - 17 -void cb_help_contents (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 18 -void cb_about (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 19 - 20 -void cb_app_exit (GtkAction *action, gpointer data) G_GNUC_INTERNAL; 21 -gboolean cb_app_delete (GtkWidget *window, GdkEventAny *event, gpointer data) G_GNUC_INTERNAL; 22 - 23 -void cb_end_process_button_pressed (GtkButton *button, gpointer data) G_GNUC_INTERNAL; 24 -void cb_logout (GtkButton *button, gpointer data) G_GNUC_INTERNAL; 25 - 26 -void cb_info_button_pressed (GtkButton *button, gpointer user_data) G_GNUC_INTERNAL; 27 - 28 -void cb_cpu_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL; 29 -void cb_mem_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL; 30 -void cb_swap_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL; 31 -void cb_net_in_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL; 32 -void cb_net_out_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL; 33 -void cb_bg_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL; 34 -void cb_frame_color_changed (GtkColorButton *widget, gpointer user_data) G_GNUC_INTERNAL; 35 - 36 -void cb_row_selected (GtkTreeSelection *selection, gpointer data) G_GNUC_INTERNAL; 37 - 38 -gboolean cb_tree_popup_menu (GtkWidget *widget, gpointer data) G_GNUC_INTERNAL; 39 -gboolean cb_tree_button_pressed (GtkWidget *widget, GdkEventButton *event, 40 - gpointer data) G_GNUC_INTERNAL; 41 - 42 - 43 -void cb_change_current_page (GtkNotebook *nb, 44 - gint num, gpointer data) G_GNUC_INTERNAL; 45 -void cb_switch_page (GtkNotebook *nb, GtkNotebookPage *page, 46 - gint num, gpointer data) G_GNUC_INTERNAL; 47 - 48 -gint cb_update_disks (gpointer data) G_GNUC_INTERNAL; 49 -gint cb_timeout (gpointer data) G_GNUC_INTERNAL; 50 - 51 -void cb_volume_mounted_or_unmounted(GnomeVFSVolumeMonitor *vfsvolumemonitor, 52 - GnomeVFSVolume *vol, 53 - gpointer procdata) G_GNUC_INTERNAL; 54 - 55 -void cb_radio_processes(GtkAction *action, 56 - GtkRadioAction *current, 57 - gpointer data) G_GNUC_INTERNAL; 58 - 59 - 60 - 61 -void cb_kill_sigstop(GtkAction *action, 62 - gpointer data) G_GNUC_INTERNAL; 63 - 64 -void cb_kill_sigcont(GtkAction *action, 65 - gpointer data) G_GNUC_INTERNAL; 66 - 67 +G_GNUC_INTERNAL void cb_show_memory_maps (GtkAction *action, gpointer data); 68 +G_GNUC_INTERNAL void cb_show_open_files (GtkAction *action, gpointer data); 69 +G_GNUC_INTERNAL void cb_show_lsof(GtkAction *action, gpointer data); 70 +G_GNUC_INTERNAL void cb_renice (GtkAction *action, gpointer data); 71 +G_GNUC_INTERNAL void cb_end_process (GtkAction *action, gpointer data); 72 +G_GNUC_INTERNAL void cb_kill_process (GtkAction *action, gpointer data); 73 +G_GNUC_INTERNAL void cb_hide_process (GtkAction *action, gpointer data); 74 +G_GNUC_INTERNAL void cb_show_hidden_processes (GtkAction *action, gpointer data); 75 +G_GNUC_INTERNAL void cb_edit_preferences (GtkAction *action, gpointer data); 76 + 77 +G_GNUC_INTERNAL void cb_help_contents (GtkAction *action, gpointer data); 78 +G_GNUC_INTERNAL void cb_about (GtkAction *action, gpointer data); 79 + 80 +G_GNUC_INTERNAL void cb_app_exit (GtkAction *action, gpointer data); 81 +G_GNUC_INTERNAL gboolean cb_app_delete (GtkWidget *window, GdkEventAny *event, gpointer data); 82 + 83 +G_GNUC_INTERNAL void cb_end_process_button_pressed (GtkButton *button, gpointer data); 84 +G_GNUC_INTERNAL void cb_logout (GtkButton *button, gpointer data); 85 + 86 +G_GNUC_INTERNAL void cb_info_button_pressed (GtkButton *button, gpointer user_data); 87 + 88 +G_GNUC_INTERNAL void cb_cpu_color_changed (GtkColorButton *widget, gpointer user_data); 89 +G_GNUC_INTERNAL void cb_mem_color_changed (GtkColorButton *widget, gpointer user_data); 90 +G_GNUC_INTERNAL void cb_swap_color_changed (GtkColorButton *widget, gpointer user_data); 91 +G_GNUC_INTERNAL void cb_net_in_color_changed (GtkColorButton *widget, gpointer user_data); 92 +G_GNUC_INTERNAL void cb_net_out_color_changed (GtkColorButton *widget, gpointer user_data); 93 +G_GNUC_INTERNAL void cb_bg_color_changed (GtkColorButton *widget, gpointer user_data); 94 +G_GNUC_INTERNAL void cb_frame_color_changed (GtkColorButton *widget, gpointer user_data); 95 + 96 +G_GNUC_INTERNAL void cb_row_selected (GtkTreeSelection *selection, gpointer data); 97 +G_GNUC_INTERNAL gboolean cb_tree_popup_menu (GtkWidget *widget, gpointer data); 98 +G_GNUC_INTERNAL gboolean cb_tree_button_pressed (GtkWidget *widget, GdkEventButton *event, 99 + gpointer data); 100 + 101 + 102 +G_GNUC_INTERNAL void cb_change_current_page (GtkNotebook *nb, 103 + gint num, gpointer data); 104 +G_GNUC_INTERNAL void cb_switch_page (GtkNotebook *nb, GtkNotebookPage *page, 105 + gint num, gpointer data); 106 + 107 +G_GNUC_INTERNAL gint cb_update_disks (gpointer data); 108 +G_GNUC_INTERNAL gint cb_timeout (gpointer data); 109 + 110 +G_GNUC_INTERNAL void cb_volume_mounted_or_unmounted(GnomeVFSVolumeMonitor *vfsvolumemonitor, 111 + GnomeVFSVolume *vol, 112 + gpointer procdata); 113 + 114 +G_GNUC_INTERNAL void cb_radio_processes(GtkAction *action, 115 + GtkRadioAction *current, 116 + gpointer data); 117 + 118 + 119 +G_GNUC_INTERNAL void cb_kill_sigstop(GtkAction *action, 120 + gpointer data); 121 + 122 +G_GNUC_INTERNAL void cb_kill_sigcont(GtkAction *action, 123 + gpointer data); 124 + 125 #endif /* _PROCMAN_CALLBACKS_H_ */ 126 diff -Nrup gnome-system-monitor-2.17.6/src/interface.cpp gnome-system-monitor-2.17.6.mod/src/interface.cpp 127 --- gnome-system-monitor-2.17.6/src/interface.cpp 2007-01-19 05:14:12.000000000 +0800 128 +++ gnome-system-monitor-2.17.6.mod/src/interface.cpp 2007-01-28 19:07:44.321834000 +0800 129 @@ -231,13 +231,13 @@ create_sys_view (ProcData *procdata) 130 GtkWidget *cpu_box, *mem_box, *net_box; 131 GtkWidget *cpu_hbox, *mem_hbox, *net_hbox; 132 GtkWidget *cpu_graph_box, *mem_graph_box, *net_graph_box; 133 - GtkWidget *label,*cpu_label, *spacer; 134 + GtkWidget *label,*label2,*label3, *label4,*label5, *cpu_label, *spacer; 135 GtkWidget *table; 136 GtkWidget *color_picker; 137 GtkSizeGroup *sizegroup; 138 LoadGraph *cpu_graph, *mem_graph, *net_graph; 139 gint i; 140 - 141 + AtkObject *colorWidget, *label1Widget, *label2Widget, *label3Widget, *label4Widget, *label5Widget; 142 143 vbox = gtk_vbox_new (FALSE, 18); 144 145 @@ -285,6 +285,7 @@ create_sys_view (ProcData *procdata) 146 147 color_picker = gtk_color_button_new_with_color ( 148 &load_graph_get_colors(cpu_graph)[2+i]); 149 + colorWidget = gtk_widget_get_accessible (color_picker); 150 151 g_signal_connect (G_OBJECT (color_picker), "color_set", 152 G_CALLBACK (cb_cpu_color_changed), GINT_TO_POINTER (i)); 153 @@ -297,10 +298,21 @@ create_sys_view (ProcData *procdata) 154 text = g_strdup_printf (_("CPU%d:"), i+1); 155 } 156 label = gtk_label_new (text); 157 + /* in order to support accessibility, add the relationship between label and button */ 158 + label1Widget = gtk_widget_get_accessible (label); 159 + atk_object_add_relationship (label1Widget,ATK_RELATION_LABEL_FOR,colorWidget); 160 + 161 gtk_box_pack_start (GTK_BOX (temp_hbox), label, FALSE, FALSE, 6); 162 g_free (text); 163 164 cpu_label = gtk_label_new (NULL); 165 + /* in order to support accessibility, add the relationship between button and cpu_label */ 166 + label2Widget = gtk_widget_get_accessible (cpu_label); 167 + atk_object_add_relationship (label2Widget, ATK_RELATION_LABEL_FOR, colorWidget); 168 + /* in order to support accessibility, add the relationship between button and label/cpu_label */ 169 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label1Widget); 170 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label2Widget); 171 + 172 gtk_box_pack_start (GTK_BOX (temp_hbox), cpu_label, FALSE, FALSE, 0); 173 load_graph_get_labels(cpu_graph)->cpu[i] = cpu_label; 174 175 @@ -340,22 +352,33 @@ create_sys_view (ProcData *procdata) 176 gtk_table_set_col_spacings (GTK_TABLE (table), 12); 177 gtk_box_pack_start (GTK_BOX (mem_graph_box), table, 178 FALSE, FALSE, 0); 179 + 180 +/* Draw User usage */ 181 182 color_picker = gtk_color_button_new_with_color ( 183 &load_graph_get_colors(mem_graph)[2]); 184 + colorWidget = gtk_widget_get_accessible (color_picker); 185 g_signal_connect (G_OBJECT (color_picker), "color_set", 186 G_CALLBACK (cb_mem_color_changed), procdata); 187 gtk_table_attach (GTK_TABLE (table), color_picker, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 188 189 label = gtk_label_new (_("User memory:")); 190 + label1Widget = gtk_widget_get_accessible (label); 191 + atk_object_add_relationship (label1Widget,ATK_RELATION_LABEL_FOR,colorWidget); 192 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 193 gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 194 195 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->memused), 196 + /* in order to support accessibility, and to promote performance and readable, 197 + let's call the load_graph_get_labels() only once here */ 198 + label2 = load_graph_get_labels(mem_graph)->memused; 199 + label2Widget = gtk_widget_get_accessible (label2); 200 + atk_object_add_relationship (label2Widget,ATK_RELATION_LABEL_FOR,colorWidget); 201 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->memused),*/ 202 + gtk_misc_set_alignment (GTK_MISC (label2), 203 0.0, 204 0.5); 205 gtk_table_attach (GTK_TABLE (table), 206 - load_graph_get_labels(mem_graph)->memused, 207 + label2, 208 2, 209 3, 210 0, 211 @@ -365,17 +388,26 @@ create_sys_view (ProcData *procdata) 212 0, 213 0); 214 215 - label = gtk_label_new (_("of")); 216 - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 217 - gtk_table_attach (GTK_TABLE (table), label, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 218 - 219 - 220 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->memtotal), 221 + /* in order to support accessibility, add the relationship between label and button */ 222 + label3 = gtk_label_new (_("of")); 223 + label3Widget = gtk_widget_get_accessible (label3); 224 + atk_object_add_relationship (label3Widget,ATK_RELATION_LABEL_FOR,colorWidget); 225 + gtk_misc_set_alignment (GTK_MISC (label3), 0.0, 0.5); 226 + gtk_table_attach (GTK_TABLE (table), label3, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 227 + 228 + 229 + /* in order to support accessibility, and to promote performance and readable, 230 + let's call the load_graph_get_labels() only once here */ 231 + label4 = load_graph_get_labels(mem_graph)->memtotal; 232 + label4Widget = gtk_widget_get_accessible (label4); 233 + atk_object_add_relationship (label4Widget,ATK_RELATION_LABEL_FOR,colorWidget); 234 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->memtotal),*/ 235 + gtk_misc_set_alignment (GTK_MISC (label4), 236 0.0, 237 0.5); 238 239 gtk_table_attach (GTK_TABLE (table), 240 - load_graph_get_labels(mem_graph)->memtotal, 241 + label4, 242 4, 243 5, 244 0, 245 @@ -385,12 +417,18 @@ create_sys_view (ProcData *procdata) 246 0, 247 0); 248 249 - 250 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->mempercent), 251 + /* in order to support accessibility, and to promote performance and readable, 252 + let's call the load_graph_get_labels() only once here */ 253 + label5 = load_graph_get_labels(mem_graph)->mempercent; 254 + label5Widget = gtk_widget_get_accessible (label5); 255 + atk_object_add_relationship (label5Widget,ATK_RELATION_LABEL_FOR,colorWidget); 256 + 257 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->mempercent),*/ 258 + gtk_misc_set_alignment (GTK_MISC (label5), 259 1.0, 260 0.5); 261 gtk_table_attach (GTK_TABLE (table), 262 - load_graph_get_labels(mem_graph)->mempercent, 263 + label5, 264 5, 265 6, 266 0, 267 @@ -399,23 +437,40 @@ create_sys_view (ProcData *procdata) 268 GTK_FILL, 269 0, 270 0); 271 - 272 + /* in order to support accessibility, add the relationship between button and label */ 273 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label1Widget); 274 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label2Widget); 275 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label3Widget); 276 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label4Widget); 277 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label5Widget); 278 + 279 +/* Draw the Swap Usage */ 280 color_picker = gtk_color_button_new_with_color ( 281 &load_graph_get_colors(mem_graph)[3]); 282 + colorWidget = gtk_widget_get_accessible (color_picker); 283 g_signal_connect (G_OBJECT (color_picker), "color_set", 284 G_CALLBACK (cb_swap_color_changed), procdata); 285 gtk_table_attach (GTK_TABLE (table), color_picker, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 286 287 label = gtk_label_new (_("Used swap:")); 288 + /* in order to support accessibility, add the relationship between label and button */ 289 + label1Widget = gtk_widget_get_accessible (label); 290 + atk_object_add_relationship (label1Widget,ATK_RELATION_LABEL_FOR,colorWidget); 291 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 292 gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 293 294 295 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->swapused ), 296 + /* in order to support accessibility, and to promote performance and readable, 297 + let's call the load_graph_get_labels() only once here */ 298 + label2 = load_graph_get_labels(mem_graph)->swapused; 299 + label2Widget = gtk_widget_get_accessible (label2); 300 + atk_object_add_relationship (label2Widget,ATK_RELATION_LABEL_FOR,colorWidget); 301 + gtk_misc_set_alignment (GTK_MISC (label2), 302 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->swapused ),*/ 303 0.0, 304 0.5); 305 gtk_table_attach (GTK_TABLE (table), 306 - load_graph_get_labels(mem_graph)->swapused, 307 + label2, 308 2, 309 3, 310 1, 311 @@ -425,16 +480,24 @@ create_sys_view (ProcData *procdata) 312 0, 313 0); 314 315 - label = gtk_label_new (_("of")); 316 - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 317 - gtk_table_attach (GTK_TABLE (table), label, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 318 - 319 - 320 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->swaptotal), 321 + /* in order to support accessibility, add the relationship between label and button */ 322 + label3 = gtk_label_new (_("of")); 323 + label3Widget = gtk_widget_get_accessible (label3); 324 + atk_object_add_relationship (label3Widget,ATK_RELATION_LABEL_FOR,colorWidget); 325 + gtk_misc_set_alignment (GTK_MISC (label3), 0.0, 0.5); 326 + gtk_table_attach (GTK_TABLE (table), label3, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 327 + 328 + /* in order to support accessibility, and to promote performance and readable, 329 + let's call the load_graph_get_labels() only once here */ 330 + label4 = load_graph_get_labels(mem_graph)->swaptotal; 331 + label4Widget = gtk_widget_get_accessible (label4); 332 + atk_object_add_relationship (label4Widget,ATK_RELATION_LABEL_FOR,colorWidget); 333 + gtk_misc_set_alignment (GTK_MISC (label4), 334 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->swaptotal),*/ 335 0.0, 336 0.5); 337 gtk_table_attach (GTK_TABLE (table), 338 - load_graph_get_labels(mem_graph)->swaptotal, 339 + label4, 340 4, 341 5, 342 1, 343 @@ -445,7 +508,7 @@ create_sys_view (ProcData *procdata) 344 0); 345 346 347 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(mem_graph)->swappercent), 348 + gtk_misc_set_alignment (GTK_MISC (label5), 349 1.0, 350 0.5); 351 gtk_table_attach (GTK_TABLE (table), 352 @@ -458,6 +521,13 @@ create_sys_view (ProcData *procdata) 353 GTK_FILL, 354 0, 355 0); 356 + /* in order to support accessibility, add the relationship between button and label */ 357 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label1Widget); 358 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label2Widget); 359 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label3Widget); 360 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label4Widget); 361 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label5Widget); 362 +/* Draw Network */ 363 364 procdata->mem_graph = mem_graph; 365 366 @@ -493,11 +563,15 @@ create_sys_view (ProcData *procdata) 367 368 color_picker = gtk_color_button_new_with_color ( 369 &load_graph_get_colors(net_graph)[2]); 370 + colorWidget = gtk_widget_get_accessible (color_picker); 371 g_signal_connect (G_OBJECT (color_picker), "color_set", 372 G_CALLBACK (cb_net_in_color_changed), procdata); 373 gtk_table_attach (GTK_TABLE (table), color_picker, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 374 375 label = gtk_label_new (_("Received:")); 376 + /* in order to support accessibility, add the relationship between label and button */ 377 + label1Widget = gtk_widget_get_accessible (label); 378 + atk_object_add_relationship (label1Widget,ATK_RELATION_LABEL_FOR,colorWidget); 379 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 380 gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 381 382 @@ -506,26 +580,41 @@ create_sys_view (ProcData *procdata) 383 G_CALLBACK(size_request), &net_size); 384 385 386 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_in), 387 + /* in order to support accessibility, and to promote performance and readable, 388 + let's call the load_graph_get_labels() only once here */ 389 + label2 = load_graph_get_labels(net_graph)->net_in; 390 + label2Widget = gtk_widget_get_accessible (label2); 391 + atk_object_add_relationship (label2Widget,ATK_RELATION_LABEL_FOR,colorWidget); 392 + gtk_misc_set_alignment (GTK_MISC (label2), 393 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_in),*/ 394 0.0, 395 0.5); 396 gtk_box_pack_start (GTK_BOX (hbox), 397 - load_graph_get_labels(net_graph)->net_in, 398 + label2, 399 FALSE, 400 FALSE, 401 0); 402 403 gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 404 405 - label = gtk_label_new (_("Total:")); 406 - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 407 - gtk_table_attach (GTK_TABLE (table), label, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 408 - 409 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_in_total), 410 + /* in order to support accessibility, add the relationship between label and button */ 411 + label3 = gtk_label_new (_("Total:")); 412 + label3Widget = gtk_widget_get_accessible (label3); 413 + atk_object_add_relationship (label3Widget,ATK_RELATION_LABEL_FOR,colorWidget); 414 + gtk_misc_set_alignment (GTK_MISC (label3), 0.0, 0.5); 415 + gtk_table_attach (GTK_TABLE (table), label3, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0); 416 + 417 + /* in order to support accessibility, and to promote performance and readable, 418 + let's call the load_graph_get_labels() only once here */ 419 + label4 = load_graph_get_labels(net_graph)->net_in_total; 420 + label4Widget = gtk_widget_get_accessible (label4); 421 + atk_object_add_relationship (label4Widget,ATK_RELATION_LABEL_FOR,colorWidget); 422 + gtk_misc_set_alignment (GTK_MISC (label4), 423 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_in_total),*/ 424 0.0, 425 0.5); 426 gtk_table_attach (GTK_TABLE (table), 427 - load_graph_get_labels(net_graph)->net_in_total, 428 + label4, 429 4, 430 5, 431 0, 432 @@ -534,14 +623,24 @@ create_sys_view (ProcData *procdata) 433 GTK_FILL, 434 0, 435 0); 436 + 437 + /* in order to support accessibility, add the relationship between button and label */ 438 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label1Widget); 439 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label2Widget); 440 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label3Widget); 441 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label4Widget); 442 443 color_picker = gtk_color_button_new_with_color ( 444 &load_graph_get_colors(net_graph)[3]); 445 + colorWidget = gtk_widget_get_accessible (color_picker); 446 g_signal_connect (G_OBJECT (color_picker), "color_set", 447 G_CALLBACK (cb_net_out_color_changed), procdata); 448 gtk_table_attach (GTK_TABLE (table), color_picker, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 449 450 label = gtk_label_new (_("Sent:")); 451 + /* in order to support accessibility, add the relationship between label and button */ 452 + label1Widget = gtk_widget_get_accessible (label); 453 + atk_object_add_relationship (label1Widget,ATK_RELATION_LABEL_FOR,colorWidget); 454 gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 455 gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 456 457 @@ -549,26 +648,41 @@ create_sys_view (ProcData *procdata) 458 g_signal_connect (G_OBJECT (hbox), "size_request", 459 G_CALLBACK(size_request), &net_size); 460 461 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_out), 462 + /* in order to support accessibility, and to promote performance and readable, 463 + let's call the load_graph_get_labels() only once here */ 464 + label2 = load_graph_get_labels(net_graph)->net_out; 465 + label2Widget = gtk_widget_get_accessible (label2); 466 + atk_object_add_relationship (label2Widget,ATK_RELATION_LABEL_FOR,colorWidget); 467 + gtk_misc_set_alignment (GTK_MISC (label2), 468 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_out),*/ 469 0.0, 470 0.5); 471 gtk_box_pack_start (GTK_BOX (hbox), 472 - load_graph_get_labels(net_graph)->net_out, 473 + label2, 474 FALSE, 475 FALSE, 476 0); 477 478 gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 479 480 - label = gtk_label_new (_("Total:")); 481 - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); 482 - gtk_table_attach (GTK_TABLE (table), label, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 483 - 484 - gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_out_total), 485 + /* in order to support accessibility, add the relationship between label and button */ 486 + label3 = gtk_label_new (_("Total:")); 487 + label3Widget = gtk_widget_get_accessible (label3); 488 + atk_object_add_relationship (label3Widget,ATK_RELATION_LABEL_FOR,colorWidget); 489 + gtk_misc_set_alignment (GTK_MISC (label3), 0.0, 0.5); 490 + gtk_table_attach (GTK_TABLE (table), label3, 3, 4, 1, 2, GTK_FILL, GTK_FILL, 0, 0); 491 + 492 + /* in order to support accessibility, and to promote performance and readable, 493 + let's call the load_graph_get_labels() only once here */ 494 + label4 = load_graph_get_labels(net_graph)->net_out_total; 495 + label4Widget = gtk_widget_get_accessible (label4); 496 + atk_object_add_relationship (label4Widget,ATK_RELATION_LABEL_FOR,colorWidget); 497 + gtk_misc_set_alignment (GTK_MISC (label4), 498 +/* gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_out_total),*/ 499 0.0, 500 0.5); 501 gtk_table_attach (GTK_TABLE (table), 502 - load_graph_get_labels(net_graph)->net_out_total, 503 + label4, 504 4, 505 5, 506 1, 507 @@ -580,6 +580,12 @@ 508 0, 509 0); 510 511 + /* in order to support accessibility, add the relationship between button and label */ 512 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label1Widget); 513 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label2Widget); 514 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label3Widget); 515 + atk_object_add_relationship (colorWidget, ATK_RELATION_LABELLED_BY ,label4Widget); 516 + 517 procdata->net_graph = net_graph; 518 519 return vbox; 520 diff -Nrup gnome-system-monitor-2.17.6/src/interface.h gnome-system-monitor-2.17.6.mod/src/interface.h 521 --- gnome-system-monitor-2.17.6/src/interface.h 2007-01-03 06:15:36.000000000 +0800 522 +++ gnome-system-monitor-2.17.6.mod/src/interface.h 2007-01-24 17:41:55.437494000 +0800 523 @@ -24,9 +24,9 @@ 524 #include <gtk/gtk.h> 525 #include "procman.h" 526 527 -void create_main_window (ProcData *data) G_GNUC_INTERNAL; 528 -void update_sensitivity (ProcData *data) G_GNUC_INTERNAL; 529 -void do_popup_menu(ProcData *data, GdkEventButton *event) G_GNUC_INTERNAL; 530 -GtkWidget * make_title_label (const char *text) G_GNUC_INTERNAL; 531 +G_GNUC_INTERNAL void create_main_window (ProcData *data) ; 532 +G_GNUC_INTERNAL void update_sensitivity (ProcData *data) ; 533 +G_GNUC_INTERNAL void do_popup_menu(ProcData *data, GdkEventButton *event) ; 534 +G_GNUC_INTERNAL GtkWidget * make_title_label (const char *text) ; 535 536 #endif /* _PROCMAN_INTERFACE_H_ */ 537 diff -Nrup gnome-system-monitor-2.18.0/src/load-graph.cpp gnome-system-monitor-2.18.0.mod/src/load-graph.cpp 538 --- gnome-system-monitor-2.18.0/src/load-graph.cpp 2007-01-03 06:15:36.000000000 +0800 539 +++ gnome-system-monitor-2.18.0.mod/src/load-graph.cpp 2007-01-24 17:42:48.619510000 +0800 540 @@ -379,6 +379,24 @@ 541 unsigned din, dout; 542 gchar *text1, *text2; 543 544 + /* we have to optimize the performance of libgtop, because in some low 545 + level machine, to update the information will occupy too much cpu. 546 + 547 + Here I would like to make a little update: 548 + set netlist.flags=1 549 + so as to let glibtop_get_netlist() only return the ones whose first 550 + character of name is the same withthe first one in their module, 551 + glibtop_get_netload() just try to find these devices, for example, 552 + bge0 and bge... 553 + 554 + We do the check in glibtop_get_netlist(), I think this will 555 + accelerate the transaction lots. Also this will not affect the 556 + existing codes, because when nobody set glibtop_netlist.flags, 557 + glibtop_get_netlist() will return all devices with class "net". 558 + */ 559 + 560 + netlist.flags = 1; 561 + 562 ifnames = glibtop_get_netlist(&netlist); 563 564 for (i = 0; i < netlist.number; ++i) 565 diff -Nrup gnome-system-monitor-2.17.6/src/load-graph.h gnome-system-monitor-2.17.6.mod/src/load-graph.h 566 --- gnome-system-monitor-2.17.6/src/load-graph.h 2007-01-03 06:15:36.000000000 +0800 567 +++ gnome-system-monitor-2.17.6.mod/src/load-graph.h 2007-01-24 17:44:34.665872000 +0800 568 @@ -34,34 +34,34 @@ struct _LoadGraphLabels 569 570 571 /* Create new load graph. */ 572 -LoadGraph * 573 -load_graph_new (gint type, ProcData *procdata) G_GNUC_INTERNAL; 574 +G_GNUC_INTERNAL LoadGraph * 575 +load_graph_new (gint type, ProcData *procdata) ; 576 577 /* Force a drawing update */ 578 -void 579 -load_graph_draw (LoadGraph *g) G_GNUC_INTERNAL; 580 +G_GNUC_INTERNAL void 581 +load_graph_draw (LoadGraph *g) ; 582 583 /* Start load graph. */ 584 -void 585 -load_graph_start (LoadGraph *g) G_GNUC_INTERNAL; 586 +G_GNUC_INTERNAL void 587 +load_graph_start (LoadGraph *g) ; 588 589 /* Stop load graph. */ 590 -void 591 -load_graph_stop (LoadGraph *g) G_GNUC_INTERNAL; 592 +G_GNUC_INTERNAL void 593 +load_graph_stop (LoadGraph *g) ; 594 595 /* Change load graph speed and restart it if it has been previously started */ 596 -void 597 +G_GNUC_INTERNAL void 598 load_graph_change_speed (LoadGraph *g, 599 - guint new_speed) G_GNUC_INTERNAL; 600 + guint new_speed) ; 601 602 -GdkColor* 603 -load_graph_get_colors (LoadGraph *g) G_GNUC_INTERNAL G_GNUC_CONST; 604 +G_GNUC_INTERNAL GdkColor* 605 +load_graph_get_colors (LoadGraph *g) G_GNUC_CONST; 606 607 -LoadGraphLabels* 608 -load_graph_get_labels (LoadGraph *g) G_GNUC_INTERNAL G_GNUC_CONST; 609 +G_GNUC_INTERNAL LoadGraphLabels* 610 +load_graph_get_labels (LoadGraph *g) G_GNUC_CONST; 611 612 613 -GtkWidget* 614 -load_graph_get_widget (LoadGraph *g) G_GNUC_INTERNAL G_GNUC_CONST; 615 +G_GNUC_INTERNAL GtkWidget* 616 +load_graph_get_widget (LoadGraph *g) G_GNUC_CONST; 617 618 #endif /* _PROCMAN_LOAD_GRAPH_H_ */ 619 diff -Nrup gnome-system-monitor-2.17.6/src/memmaps.h gnome-system-monitor-2.17.6.mod/src/memmaps.h 620 --- gnome-system-monitor-2.17.6/src/memmaps.h 2007-01-03 06:15:36.000000000 +0800 621 +++ gnome-system-monitor-2.17.6.mod/src/memmaps.h 2007-01-24 17:45:14.957958000 +0800 622 @@ -4,6 +4,6 @@ 623 #include <glib.h> 624 #include "procman.h" 625 626 -void create_memmaps_dialog (ProcData *procdata) G_GNUC_INTERNAL; 627 +G_GNUC_INTERNAL void create_memmaps_dialog (ProcData *procdata) ; 628 629 #endif /* _PROCMAN_MEMMAPS_H_ */ 630 diff -Nrup gnome-system-monitor-2.17.6/src/openfiles.h gnome-system-monitor-2.17.6.mod/src/openfiles.h 631 --- gnome-system-monitor-2.17.6/src/openfiles.h 2007-01-03 06:15:36.000000000 +0800 632 +++ gnome-system-monitor-2.17.6.mod/src/openfiles.h 2007-01-24 17:45:46.513294000 +0800 633 @@ -5,6 +5,6 @@ 634 635 #include "procman.h" 636 637 -void create_openfiles_dialog (ProcData *procdata) G_GNUC_INTERNAL; 638 +G_GNUC_INTERNAL void create_openfiles_dialog (ProcData *procdata) ; 639 640 #endif 641 diff -Nrup gnome-system-monitor-2.17.6/src/procactions.cpp gnome-system-monitor-2.17.6.mod/src/procactions.cpp 642 --- gnome-system-monitor-2.17.6/src/procactions.cpp 2007-01-03 06:15:36.000000000 +0800 643 +++ gnome-system-monitor-2.17.6.mod/src/procactions.cpp 2007-01-24 17:46:53.540932000 +0800 644 @@ -127,6 +127,14 @@ kill_single_process (GtkTreeModel *model 645 646 if (!info) 647 return; 648 + /* 649 + * If the process 0 is a system process, we can't control it even as root 650 + */ 651 + if ((args->signal == SIGTERM) || (args->signal == SIGKILL)){ 652 + if (info->pid == 0) 653 + return; 654 + } 655 + /* if it is not a system process, we can kill it now */ 656 657 error = kill (info->pid, args->signal); 658 659 diff -Nrup gnome-system-monitor-2.17.6/src/procactions.h gnome-system-monitor-2.17.6.mod/src/procactions.h 660 --- gnome-system-monitor-2.17.6/src/procactions.h 2007-01-03 06:15:36.000000000 +0800 661 +++ gnome-system-monitor-2.17.6.mod/src/procactions.h 2007-01-24 19:30:38.684435000 +0800 662 @@ -21,8 +21,8 @@ 663 664 #include "procman.h" 665 666 -void renice (ProcData *procdata, int nice) G_GNUC_INTERNAL; 667 -void kill_process (ProcData *procdata, int sig) G_GNUC_INTERNAL; 668 +G_GNUC_INTERNAL void renice (ProcData *procdata, int nice) ; 669 +G_GNUC_INTERNAL void kill_process (ProcData *procdata, int sig) ; 670 671 #endif 672 673 diff -Nrup gnome-system-monitor-2.17.6/src/procdialogs.cpp gnome-system-monitor-2.17.6.mod/src/procdialogs.cpp 674 --- gnome-system-monitor-2.17.6/src/procdialogs.cpp 2007-01-18 07:50:28.000000000 +0800 675 +++ gnome-system-monitor-2.17.6.mod/src/procdialogs.cpp 2007-01-24 17:48:59.927166000 +0800 676 @@ -629,7 +629,10 @@ procdialog_create_preferences_dialog (Pr 677 gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, TRUE, 0); 678 679 update = (gfloat) procdata->config.graph_update_interval; 680 - adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 0.25, 681 + /* The interval is too small, and in some low level machine, 682 + cause gconf can't work, so set its min value 1 sec*/ 683 + /*adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 0.25,*/ 684 + adjustment = (GtkAdjustment *) gtk_adjustment_new(update / 1000.0, 1, 685 100.0, 0.25, 1.0, 1.0); 686 spin_button = gtk_spin_button_new (adjustment, 1.0, 2); 687 g_signal_connect (G_OBJECT (spin_button), "focus_out_event", 688 diff -Nrup gnome-system-monitor-2.17.6/src/procdialogs.h gnome-system-monitor-2.17.6.mod/src/procdialogs.h 689 --- gnome-system-monitor-2.17.6/src/procdialogs.h 2007-01-18 07:47:42.000000000 +0800 690 +++ gnome-system-monitor-2.17.6.mod/src/procdialogs.h 2007-01-24 17:51:27.419745000 +0800 691 @@ -42,13 +42,13 @@ typedef enum 692 } ProcmanActionType; 693 694 695 -void procdialog_create_kill_dialog (ProcData *data, int signal) G_GNUC_INTERNAL; 696 -void procdialog_create_renice_dialog (ProcData *data) G_GNUC_INTERNAL; 697 -gboolean procdialog_create_root_password_dialog (ProcmanActionType type, 698 +G_GNUC_INTERNAL void procdialog_create_kill_dialog (ProcData *data, int signal) ; 699 +G_GNUC_INTERNAL void procdialog_create_renice_dialog (ProcData *data) ; 700 +G_GNUC_INTERNAL gboolean procdialog_create_root_password_dialog (ProcmanActionType type, 701 ProcData *procdata, 702 - gint pid, gint extra_value) G_GNUC_INTERNAL; 703 -void procdialog_create_memmaps_dialog (ProcData *data) G_GNUC_INTERNAL; 704 -void procdialog_create_preferences_dialog (ProcData *data) G_GNUC_INTERNAL; 705 + gint pid, gint extra_value) ; 706 +G_GNUC_INTERNAL void procdialog_create_memmaps_dialog (ProcData *data) ; 707 +G_GNUC_INTERNAL void procdialog_create_preferences_dialog (ProcData *data) ; 708 709 #endif 710 711 diff -Nrup gnome-system-monitor-2.17.6/src/procman.cpp gnome-system-monitor-2.17.6.mod/src/procman.cpp 712 --- gnome-system-monitor-2.17.6/src/procman.cpp 2007-01-18 07:53:25.000000000 +0800 713 +++ gnome-system-monitor-2.17.6.mod/src/procman.cpp 2007-01-28 19:19:17.263672000 +0800 714 @@ -110,7 +110,10 @@ timeouts_changed_cb (GConfClient *client 715 procdata->config.graph_update_interval = gconf_value_get_int (value); 716 procdata->config.graph_update_interval = 717 MAX (procdata->config.graph_update_interval, 718 - 250); 719 + /* The interval is too small, and in some low level machine, 720 + cause gconf can't work, so set its min value 1 sec*/ 721 + /* 250);*/ 722 + 1000); 723 load_graph_change_speed(procdata->cpu_graph, 724 procdata->config.graph_update_interval); 725 load_graph_change_speed(procdata->mem_graph, 726 @@ -349,10 +352,14 @@ procman_data_new (GConfClient *client) 727 /* Sanity checks */ 728 swidth = gdk_screen_width (); 729 sheight = gdk_screen_height (); 730 - pd->config.width = CLAMP (pd->config.width, 50, swidth); 731 - pd->config.height = CLAMP (pd->config.height, 50, sheight); 732 + pd->config.width = CLAMP (pd->config.width, 50, swidth-2); /* there is a bug in gtk I think, when the width/height 733 + become the biggest, the windows alway biggest, so -2 */ 734 + pd->config.height = CLAMP (pd->config.height, 50, sheight-2); 735 pd->config.update_interval = MAX (pd->config.update_interval, 1000); 736 - pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 250); 737 + /* The interval is too small, and in some low level machine, 738 + cause gconf can't work, so set its min value 1 sec*/ 739 + /*pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 250);*/ 740 + pd->config.graph_update_interval = MAX (pd->config.graph_update_interval, 1000); 741 pd->config.disks_update_interval = MAX (pd->config.disks_update_interval, 1000); 742 pd->config.whose_process = CLAMP (pd->config.whose_process, 0, 2); 743 pd->config.current_tab = CLAMP(pd->config.current_tab, 744 diff -Nrup gnome-system-monitor-2.17.6/src/procman.h gnome-system-monitor-2.17.6.mod/src/procman.h 745 --- gnome-system-monitor-2.17.6/src/procman.h 2007-01-22 00:58:39.000000000 +0800 746 +++ gnome-system-monitor-2.17.6.mod/src/procman.h 2007-01-24 17:57:36.918021000 +0800 747 @@ -199,9 +199,9 @@ struct ProcData 748 SmoothRefresh *smooth_refresh; 749 }; 750 751 -void procman_save_config (ProcData *data) G_GNUC_INTERNAL; 752 -void procman_save_tree_state (GConfClient *client, GtkWidget *tree, const gchar *prefix) G_GNUC_INTERNAL; 753 -gboolean procman_get_tree_state (GConfClient *client, GtkWidget *tree, const gchar *prefix) G_GNUC_INTERNAL; 754 +G_GNUC_INTERNAL void procman_save_config (ProcData *data) ; 755 +G_GNUC_INTERNAL void procman_save_tree_state (GConfClient *client, GtkWidget *tree, const gchar *prefix) ; 756 +G_GNUC_INTERNAL gboolean procman_get_tree_state (GConfClient *client, GtkWidget *tree, const gchar *prefix) ; 757 758 759 760 diff -Nrup gnome-system-monitor-2.17.6/src/proctable.cpp gnome-system-monitor-2.17.6.mod/src/proctable.cpp 761 --- gnome-system-monitor-2.17.6/src/proctable.cpp 2007-01-21 08:57:08.000000000 +0800 762 +++ gnome-system-monitor-2.17.6.mod/src/proctable.cpp 2007-01-24 19:43:59.958896000 +0800 763 @@ -549,7 +549,18 @@ static void get_process_memory_writable( 764 unsigned i; 765 766 info->memwritable = 0; 767 - 768 + /* we have to optimize the performance of libgtop, because update the information will occupy too much cpu. 769 + 770 + here I would like to make a little update:set glibtop_proc_map.flags=1,so as to let glibtop_get_proc_map_s() 771 + only return the ones this function need: memwritable 772 + 773 + we do the check in glibtop_get_proc_map_s(), don't run the others part which don't need by this function, 774 + I think this will accelerate the transaction lots, 775 + Also this will not affect the existing codes, because when nobody set glibtop_proc_map.flags, 776 + glibtop_get_proc_map() will return all as before. zhua 777 + */ 778 + buf.flags = 1; 779 + 780 maps = glibtop_get_proc_map(&buf, info->pid); 781 782 for (i = 0; i < buf.number; ++i) { 783 @@ -558,6 +569,9 @@ static void get_process_memory_writable( 784 #else 785 if (maps[i].perm & GLIBTOP_MAP_PERM_WRITE) 786 info->memwritable += maps[i].size; 787 + 788 + if (maps[i].perm & GLIBTOP_MAP_PERM_SHARED) 789 + info->memshared += maps[i].shared_clean; 790 #endif 791 } 792 793 @@ -574,15 +588,19 @@ get_process_memory_info(ProcInfo *info) 794 wnck_pid_read_resource_usage (gdk_screen_get_display (gdk_screen_get_default ()), 795 info->pid, 796 &xresources); 797 + 798 + info->memxserver = xresources.total_bytes_estimate; 799 800 - glibtop_get_proc_mem(&procmem, info->pid); 801 - 802 +/* zhua: use get_process_memory_writable(), because it just call glibtop_get_proc_map_s(), 803 ++ can get shared memory and writable memory, others: vmsize & memres, will be 804 + get in procstate from glibtop_get_proc_state()*/ 805 +/* glibtop_get_proc_mem(&procmem, info->pid); 806 + 807 info->vmsize = procmem.vsize; 808 info->memres = procmem.resident; 809 info->memshared = procmem.share; 810 811 - info->memxserver = xresources.total_bytes_estimate; 812 - 813 +*/ 814 get_process_memory_writable(info); 815 816 info->mem = info->memxserver + info->memwritable; 817 @@ -766,6 +784,30 @@ remove_children_from_tree (ProcData *pro 818 } while (gtk_tree_model_iter_next (model, parent)); 819 } 820 821 +/* place the children process to blacklist if the parent is placed into */ 822 +#if 0 823 +/* Community have delete this function, so maybe not need this patch. */ 824 +static void 825 +blacklist_children_from_tree (ProcData *procdata, GtkTreeModel *model, 826 + GtkTreeIter *parent) 827 +{ 828 + do { 829 + ProcInfo *child_info; 830 + GtkTreeIter child; 831 + 832 + if (gtk_tree_model_iter_children (model, &child, parent)) 833 + blacklist_children_from_tree (procdata, model, &child); 834 + 835 + gtk_tree_model_get (model, parent, COL_POINTER, &child_info, -1); 836 + if (child_info) { 837 + if (procdata->selected_process == child_info) 838 + procdata->selected_process = NULL; 839 + add_to_blacklist (procdata, child_info->name); 840 + child_info->is_visible = FALSE; 841 + } 842 + } while (gtk_tree_model_iter_next (model, parent)); 843 +} 844 +#endif 845 846 void 847 remove_info_from_tree (ProcInfo *info, ProcData *procdata) 848 @@ -781,7 +823,12 @@ remove_info_from_tree (ProcInfo *info, P 849 850 if (procdata->selected_process == info) 851 procdata->selected_process = NULL; 852 - 853 + /* move all children from tree to blacklist */ 854 +/* Community have delete this function, so maybe not need this patch. */ 855 +/* GtkTreeIter child; 856 + if (gtk_tree_model_iter_children (model, &child, &info->node)) 857 + blacklist_children_from_tree (procdata, model, &child); 858 +*/ 859 gtk_tree_store_remove (GTK_TREE_STORE (model), &info->node); 860 861 info->is_visible = FALSE; 862 @@ -846,18 +893,31 @@ update_info (ProcData *procdata, ProcInf 863 glibtop_proc_uid procuid; 864 glibtop_proc_time proctime; 865 866 + /* zhua: let's delete this call, because we can get the value 867 + from glibtop_get_proc_state 868 glibtop_get_proc_uid (&procuid, info->pid); 869 + */ 870 glibtop_get_proc_time (&proctime, info->pid); 871 872 - get_process_memory_info(info); 873 - get_process_user(procdata, info, procstate.uid); 874 + get_process_memory_info(info);/* get shared/writable/xserver memory */ 875 + get_process_user(procdata, info, procstate.uid);/* get user of process */ 876 877 + /* zhua: let's get from file directly 878 info->pcpu = (proctime.rtime - info->cpu_time_last) * 100 / total_time; 879 info->pcpu = MIN(info->pcpu, 100); 880 + */ 881 882 info->cpu_time_last = proctime.rtime; 883 - info->nice = procuid.nice; 884 + /* zhua: get nice/ppid from procstate */ 885 + info->nice = procstate.nice; 886 + 887 + /* zhua: get start_time from procstate */ 888 + info->start_time = procstate.start_time; 889 + 890 + info->vmsize = procstate.vsize; 891 + info->memres = procstate.resident; 892 893 + info->pcpu = procstate.load; 894 895 model = gtk_tree_view_get_model (GTK_TREE_VIEW (procdata->tree)); 896 897 @@ -889,7 +949,9 @@ ProcInfo::ProcInfo(pid_t pid) 898 info->uid = -1; 899 900 glibtop_get_proc_state (&procstate, pid); 901 - glibtop_get_proc_uid (&procuid, pid); 902 + /* zhua: delete this function, because we can get nice/ppid from glibtop_get_proc_state() 903 + dont' need to open/pread/close psinfo, it will save some time 904 + glibtop_get_proc_uid (&procuid, pid);*/ 905 glibtop_get_proc_time (&proctime, pid); 906 arguments = glibtop_get_proc_argv (&procargs, pid, 0); 907 908 @@ -903,16 +965,21 @@ ProcInfo::ProcInfo(pid_t pid) 909 910 info->pcpu = 0; 911 info->cpu_time_last = proctime.rtime; 912 - info->start_time = proctime.start_time; 913 - info->nice = procuid.nice; 914 - 915 + /* zhua: get start_time/nice/ppid from procstate */ 916 + info->start_time = procstate.start_time; 917 + info->nice = procstate.nice; 918 + /* zhua */ 919 + info->vmsize = procstate.vsize; 920 + info->memres = procstate.resident; 921 + info->pcpu = procstate.load; 922 + 923 get_process_memory_info(info); 924 get_process_status (info, &procstate); 925 get_process_selinux_context (info); 926 927 info->pixbuf = ProcData::get_instance()->pretty_table.get_icon(info->name, pid); 928 929 - info->parent = find_parent(ProcData::get_instance(), procuid.ppid); 930 + info->parent = find_parent(ProcData::get_instance(), procstate.ppid); 931 if (info->parent) { 932 info->parent->children = g_slist_prepend (info->parent->children, info); 933 } 934 @@ -999,7 +999,7 @@ 935 936 937 static void 938 -refresh_list (ProcData *procdata, const unsigned *pid_list, const guint n) 939 +refresh_list (ProcData *procdata, const long *pid_list, const guint n) 940 { 941 GHashTable *pid_hash; 942 GList *list; 943 @@ -1011,7 +1071,7 @@ 944 void 945 proctable_update_list (ProcData * const procdata) 946 { 947 - unsigned *pid_list; 948 + long *pid_list; 949 glibtop_proclist proclist; 950 glibtop_cpu cpu; 951 gint which, arg; 952 @@ -1022,9 +1089,11 @@ proctable_update_list (ProcData * const 953 954 /* FIXME: total cpu time elapsed should be calculated on an individual basis here 955 ** should probably have a total_time_last gint in the ProcInfo structure */ 956 + /* zhua: delete these sentences, we can get cpu% from file directly. 957 glibtop_get_cpu (&cpu); 958 total_time = MAX(cpu.total - total_time_last, 1); 959 total_time_last = cpu.total; 960 + */ 961 962 refresh_list (procdata, pid_list, proclist.number); 963 964 diff -Nrup gnome-system-monitor-2.17.6/src/proctable.h gnome-system-monitor-2.17.6.mod/src/proctable.h 965 --- gnome-system-monitor-2.17.6/src/proctable.h 2007-01-03 06:15:36.000000000 +0800 966 +++ gnome-system-monitor-2.17.6.mod/src/proctable.h 2007-01-24 19:49:03.049889000 +0800 967 @@ -48,20 +48,23 @@ enum 968 NUM_COLUMNS 969 }; 970 971 +G_BEGIN_DECLS 972 973 -GtkWidget* proctable_new (ProcData *data) G_GNUC_INTERNAL; 974 -void proctable_update_table (ProcData *data) G_GNUC_INTERNAL; 975 -void proctable_update_list (ProcData *data) G_GNUC_INTERNAL; 976 -void insert_info_to_tree (ProcInfo *info, ProcData *procdata) G_GNUC_INTERNAL; 977 -void remove_info_from_tree (ProcInfo *info, ProcData *procdata) G_GNUC_INTERNAL; 978 -ProcInfo * proctable_find_process (guint pid, ProcData *procdata) G_GNUC_INTERNAL; 979 -void proctable_update_all (ProcData *data) G_GNUC_INTERNAL; 980 -void proctable_clear_tree (ProcData *data) G_GNUC_INTERNAL; 981 -void proctable_free_table (ProcData *data) G_GNUC_INTERNAL; 982 +G_GNUC_INTERNAL GtkWidget* proctable_new (ProcData *data) ; 983 +G_GNUC_INTERNAL void proctable_update_table (ProcData *data) ; 984 +G_GNUC_INTERNAL void proctable_update_list (ProcData *data) ; 985 +G_GNUC_INTERNAL void insert_info_to_tree (ProcInfo *info, ProcData *procdata) ; 986 +G_GNUC_INTERNAL void remove_info_from_tree (ProcInfo *info, ProcData *procdata) ; 987 +G_GNUC_INTERNAL ProcInfo * proctable_find_process (guint pid, ProcData *procdata) ; 988 +G_GNUC_INTERNAL void proctable_update_all (ProcData *data) ; 989 +G_GNUC_INTERNAL void proctable_clear_tree (ProcData *data) ; 990 +G_GNUC_INTERNAL void proctable_free_table (ProcData *data) ; 991 992 -GSList* proctable_get_columns_order(GtkTreeView *treeview) G_GNUC_INTERNAL; 993 -void proctable_set_columns_order(GtkTreeView *treeview, GSList *order) G_GNUC_INTERNAL; 994 +G_GNUC_INTERNAL GSList* proctable_get_columns_order(GtkTreeView *treeview) ; 995 +G_GNUC_INTERNAL void proctable_set_columns_order(GtkTreeView *treeview, GSList *order) ; 996 997 -char* make_loadavg_string(void) G_GNUC_INTERNAL; 998 +G_GNUC_INTERNAL char* make_loadavg_string(void) ; 999 + 1000 +G_END_DECLS 1001 1002 #endif /* _PROCMAN_PROCTABLE_H_ */ 1003 diff -Nrup gnome-system-monitor-2.17.6/src/selinux.h gnome-system-monitor-2.17.6.mod/src/selinux.h 1004 --- gnome-system-monitor-2.17.6/src/selinux.h 2007-01-03 06:15:36.000000000 +0800 1005 +++ gnome-system-monitor-2.17.6.mod/src/selinux.h 2007-01-24 19:18:59.947306000 +0800 1006 @@ -5,10 +5,10 @@ 1007 1008 #include "procman.h" 1009 1010 -void 1011 -get_process_selinux_context (ProcInfo *info) G_GNUC_INTERNAL; 1012 +G_GNUC_INTERNAL void 1013 +get_process_selinux_context (ProcInfo *info) ; 1014 1015 -gboolean 1016 -can_show_security_context_column (void) G_GNUC_INTERNAL G_GNUC_CONST; 1017 +G_GNUC_INTERNAL gboolean 1018 +can_show_security_context_column (void) G_GNUC_CONST; 1019 1020 #endif /* PROCMAN_SELINUX_H_20050525 */ 1021 diff -Nrup gnome-system-monitor-2.17.6/src/util.h gnome-system-monitor-2.17.6.mod/src/util.h 1022 --- gnome-system-monitor-2.17.6/src/util.h 2007-01-23 01:30:48.000000000 +0800 1023 +++ gnome-system-monitor-2.17.6.mod/src/util.h 2007-01-24 19:20:35.141663000 +0800 1024 @@ -25,22 +25,22 @@ inline int procman_cmp(T x, T y) 1025 #define PROCMAN_CMP(X, Y) procman_cmp((X), (Y)) 1026 #define PROCMAN_RCMP(X, Y) procman_cmp((Y), (X)); 1027 1028 -GtkWidget* 1029 +G_GNUC_INTERNAL GtkWidget* 1030 procman_make_label_for_mmaps_or_ofiles(const char *format, 1031 const char *process_name, 1032 - unsigned pid) G_GNUC_INTERNAL; 1033 + unsigned pid) ; 1034 1035 1036 -gchar* 1037 -SI_gnome_vfs_format_file_size_for_display (GnomeVFSFileSize size) G_GNUC_INTERNAL; 1038 +G_GNUC_INTERNAL gchar* 1039 +SI_gnome_vfs_format_file_size_for_display (GnomeVFSFileSize size) ; 1040 1041 1042 -gboolean 1043 -load_symbols(const char *module, ...) G_GNUC_INTERNAL G_GNUC_NULL_TERMINATED; 1044 +G_GNUC_INTERNAL gboolean 1045 +load_symbols(const char *module, ...) G_GNUC_NULL_TERMINATED; 1046 1047 1048 -void 1049 -procman_debug(const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2); 1050 +G_GNUC_INTERNAL void 1051 +procman_debug(const char *format, ...) G_GNUC_PRINTF(1, 2); 1052 1053 1054 inline string make_string(char *c_str) 1055 --- gnome-system-monitor-2.18.2/src/proctable.cpp.orig 2007-06-07 17:28:20.033560302 +0100 1056 +++ gnome-system-monitor-2.18.2/src/proctable.cpp 2007-06-07 17:30:57.359537433 +0100 1057