| 1 | /* This file is part of the Linux Trace Toolkit viewer |
| 2 | * Copyright (C) 2003-2004 Mathieu Desnoyers |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License Version 2 as |
| 6 | * published by the Free Software Foundation; |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 16 | * MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #include <gtk/gtk.h> |
| 20 | #include <glib.h> |
| 21 | |
| 22 | #include "processlist.h" |
| 23 | #include "drawitem.h" |
| 24 | |
| 25 | /***************************************************************************** |
| 26 | * Methods to synchronize process list * |
| 27 | *****************************************************************************/ |
| 28 | |
| 29 | /* Enumeration of the columns */ |
| 30 | enum |
| 31 | { |
| 32 | PROCESS_COLUMN, |
| 33 | PID_COLUMN, |
| 34 | BIRTH_S_COLUMN, |
| 35 | BIRTH_NS_COLUMN, |
| 36 | TRACE_COLUMN, |
| 37 | N_COLUMNS |
| 38 | }; |
| 39 | |
| 40 | |
| 41 | gint process_sort_func ( GtkTreeModel *model, |
| 42 | GtkTreeIter *it_a, |
| 43 | GtkTreeIter *it_b, |
| 44 | gpointer user_data) |
| 45 | { |
| 46 | GValue a, b; |
| 47 | |
| 48 | memset(&a, 0, sizeof(GValue)); |
| 49 | memset(&b, 0, sizeof(GValue)); |
| 50 | |
| 51 | /* Order by PID */ |
| 52 | gtk_tree_model_get_value( model, |
| 53 | it_a, |
| 54 | PID_COLUMN, |
| 55 | &a); |
| 56 | |
| 57 | gtk_tree_model_get_value( model, |
| 58 | it_b, |
| 59 | PID_COLUMN, |
| 60 | &b); |
| 61 | |
| 62 | if(G_VALUE_TYPE(&a) == G_TYPE_UINT |
| 63 | && G_VALUE_TYPE(&b) == G_TYPE_UINT ) |
| 64 | { |
| 65 | if(g_value_get_uint(&a) > g_value_get_uint(&b)) |
| 66 | { |
| 67 | g_value_unset(&a); |
| 68 | g_value_unset(&b); |
| 69 | return 1; |
| 70 | } |
| 71 | if(g_value_get_uint(&a) < g_value_get_uint(&b)) |
| 72 | { |
| 73 | g_value_unset(&a); |
| 74 | g_value_unset(&b); |
| 75 | return 0; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | g_value_unset(&a); |
| 80 | g_value_unset(&b); |
| 81 | |
| 82 | |
| 83 | /* Order by birth second */ |
| 84 | gtk_tree_model_get_value( model, |
| 85 | it_a, |
| 86 | BIRTH_S_COLUMN, |
| 87 | &a); |
| 88 | |
| 89 | gtk_tree_model_get_value( model, |
| 90 | it_b, |
| 91 | BIRTH_S_COLUMN, |
| 92 | &b); |
| 93 | |
| 94 | |
| 95 | if(G_VALUE_TYPE(&a) == G_TYPE_ULONG |
| 96 | && G_VALUE_TYPE(&b) == G_TYPE_ULONG ) |
| 97 | { |
| 98 | if(g_value_get_ulong(&a) > g_value_get_ulong(&b)) |
| 99 | { |
| 100 | g_value_unset(&a); |
| 101 | g_value_unset(&b); |
| 102 | return 1; |
| 103 | } |
| 104 | if(g_value_get_ulong(&a) < g_value_get_ulong(&b)) |
| 105 | { |
| 106 | g_value_unset(&a); |
| 107 | g_value_unset(&b); |
| 108 | return 0; |
| 109 | } |
| 110 | |
| 111 | } |
| 112 | |
| 113 | g_value_unset(&a); |
| 114 | g_value_unset(&b); |
| 115 | |
| 116 | /* Order by birth nanosecond */ |
| 117 | gtk_tree_model_get_value( model, |
| 118 | it_a, |
| 119 | BIRTH_NS_COLUMN, |
| 120 | &a); |
| 121 | |
| 122 | gtk_tree_model_get_value( model, |
| 123 | it_b, |
| 124 | BIRTH_NS_COLUMN, |
| 125 | &b); |
| 126 | |
| 127 | |
| 128 | if(G_VALUE_TYPE(&a) == G_TYPE_ULONG |
| 129 | && G_VALUE_TYPE(&b) == G_TYPE_ULONG ) |
| 130 | { |
| 131 | if(g_value_get_ulong(&a) > g_value_get_ulong(&b)) |
| 132 | { |
| 133 | g_value_unset(&a); |
| 134 | g_value_unset(&b); |
| 135 | return 1; |
| 136 | } |
| 137 | // Final condition |
| 138 | //if(g_value_get_ulong(&a) < g_value_get_ulong(&b)) |
| 139 | //{ |
| 140 | // g_value_unset(&a); |
| 141 | // g_value_unset(&b); |
| 142 | // return 0; |
| 143 | //} |
| 144 | |
| 145 | } |
| 146 | |
| 147 | g_value_unset(&a); |
| 148 | g_value_unset(&b); |
| 149 | |
| 150 | /* Order by trace_num */ |
| 151 | gtk_tree_model_get_value( model, |
| 152 | it_a, |
| 153 | TRACE_COLUMN, |
| 154 | &a); |
| 155 | |
| 156 | gtk_tree_model_get_value( model, |
| 157 | it_b, |
| 158 | TRACE_COLUMN, |
| 159 | &b); |
| 160 | |
| 161 | if(G_VALUE_TYPE(&a) == G_TYPE_ULONG |
| 162 | && G_VALUE_TYPE(&b) == G_TYPE_ULONG ) |
| 163 | { |
| 164 | if(g_value_get_ulong(&a) > g_value_get_ulong(&b)) |
| 165 | { |
| 166 | g_value_unset(&a); |
| 167 | g_value_unset(&b); |
| 168 | return 1; |
| 169 | } |
| 170 | if(g_value_get_ulong(&a) < g_value_get_ulong(&b)) |
| 171 | { |
| 172 | g_value_unset(&a); |
| 173 | g_value_unset(&b); |
| 174 | return 0; |
| 175 | } |
| 176 | |
| 177 | } |
| 178 | |
| 179 | |
| 180 | |
| 181 | return 0; |
| 182 | |
| 183 | } |
| 184 | |
| 185 | guint hash_fct(gconstpointer key) |
| 186 | { |
| 187 | return ((ProcessInfo*)key)->pid; |
| 188 | } |
| 189 | |
| 190 | gboolean equ_fct(gconstpointer a, gconstpointer b) |
| 191 | { |
| 192 | if(((ProcessInfo*)a)->pid != ((ProcessInfo*)b)->pid) |
| 193 | return 0; |
| 194 | // g_critical("compare %u and %u",((ProcessInfo*)a)->pid,((ProcessInfo*)b)->pid); |
| 195 | if(((ProcessInfo*)a)->birth.tv_sec != ((ProcessInfo*)b)->birth.tv_sec) |
| 196 | return 0; |
| 197 | // g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_sec,((ProcessInfo*)b)->birth.tv_sec); |
| 198 | |
| 199 | if(((ProcessInfo*)a)->birth.tv_nsec != ((ProcessInfo*)b)->birth.tv_nsec) |
| 200 | return 0; |
| 201 | // g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_nsec,((ProcessInfo*)b)->birth.tv_nsec); |
| 202 | |
| 203 | if(((ProcessInfo*)a)->trace_num != ((ProcessInfo*)b)->trace_num) |
| 204 | return 0; |
| 205 | |
| 206 | return 1; |
| 207 | } |
| 208 | |
| 209 | void destroy_hash_key(gpointer key); |
| 210 | |
| 211 | void destroy_hash_data(gpointer data); |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | ProcessList *processlist_construct(void) |
| 217 | { |
| 218 | GtkTreeViewColumn *column; |
| 219 | GtkCellRenderer *renderer; |
| 220 | |
| 221 | ProcessList* process_list = g_new(ProcessList,1); |
| 222 | |
| 223 | process_list->number_of_process = 0; |
| 224 | |
| 225 | /* Create the Process list */ |
| 226 | process_list->list_store = gtk_list_store_new ( N_COLUMNS, |
| 227 | G_TYPE_STRING, |
| 228 | G_TYPE_UINT, |
| 229 | G_TYPE_ULONG, |
| 230 | G_TYPE_ULONG, |
| 231 | G_TYPE_ULONG); |
| 232 | |
| 233 | |
| 234 | process_list->process_list_widget = |
| 235 | gtk_tree_view_new_with_model |
| 236 | (GTK_TREE_MODEL (process_list->list_store)); |
| 237 | |
| 238 | g_object_unref (G_OBJECT (process_list->list_store)); |
| 239 | |
| 240 | gtk_tree_sortable_set_sort_func( |
| 241 | GTK_TREE_SORTABLE(process_list->list_store), |
| 242 | PID_COLUMN, |
| 243 | process_sort_func, |
| 244 | NULL, |
| 245 | NULL); |
| 246 | |
| 247 | gtk_tree_sortable_set_sort_column_id( |
| 248 | GTK_TREE_SORTABLE(process_list->list_store), |
| 249 | PID_COLUMN, |
| 250 | GTK_SORT_ASCENDING); |
| 251 | |
| 252 | process_list->process_hash = g_hash_table_new_full( |
| 253 | hash_fct, equ_fct, |
| 254 | destroy_hash_key, destroy_hash_data |
| 255 | ); |
| 256 | |
| 257 | |
| 258 | gtk_tree_view_set_headers_visible( |
| 259 | GTK_TREE_VIEW(process_list->process_list_widget), TRUE); |
| 260 | |
| 261 | /* Create a column, associating the "text" attribute of the |
| 262 | * cell_renderer to the first column of the model */ |
| 263 | /* Columns alignment : 0.0 : Left 0.5 : Center 1.0 : Right */ |
| 264 | renderer = gtk_cell_renderer_text_new (); |
| 265 | column = gtk_tree_view_column_new_with_attributes ( "Process", |
| 266 | renderer, |
| 267 | "text", |
| 268 | PROCESS_COLUMN, |
| 269 | NULL); |
| 270 | gtk_tree_view_column_set_alignment (column, 0.0); |
| 271 | gtk_tree_view_column_set_fixed_width (column, 45); |
| 272 | gtk_tree_view_append_column ( |
| 273 | GTK_TREE_VIEW (process_list->process_list_widget), column); |
| 274 | |
| 275 | column = gtk_tree_view_column_new_with_attributes ( "PID", |
| 276 | renderer, |
| 277 | "text", |
| 278 | PID_COLUMN, |
| 279 | NULL); |
| 280 | gtk_tree_view_append_column ( |
| 281 | GTK_TREE_VIEW (process_list->process_list_widget), column); |
| 282 | |
| 283 | |
| 284 | column = gtk_tree_view_column_new_with_attributes ( "Birth sec", |
| 285 | renderer, |
| 286 | "text", |
| 287 | BIRTH_S_COLUMN, |
| 288 | NULL); |
| 289 | gtk_tree_view_append_column ( |
| 290 | GTK_TREE_VIEW (process_list->process_list_widget), column); |
| 291 | |
| 292 | //gtk_tree_view_column_set_visible(column, 0); |
| 293 | // |
| 294 | column = gtk_tree_view_column_new_with_attributes ( "Birth nsec", |
| 295 | renderer, |
| 296 | "text", |
| 297 | BIRTH_NS_COLUMN, |
| 298 | NULL); |
| 299 | gtk_tree_view_append_column ( |
| 300 | GTK_TREE_VIEW (process_list->process_list_widget), column); |
| 301 | |
| 302 | column = gtk_tree_view_column_new_with_attributes ( "TRACE", |
| 303 | renderer, |
| 304 | "text", |
| 305 | TRACE_COLUMN, |
| 306 | NULL); |
| 307 | gtk_tree_view_append_column ( |
| 308 | GTK_TREE_VIEW (process_list->process_list_widget), column); |
| 309 | |
| 310 | |
| 311 | //gtk_tree_view_column_set_visible(column, 0); |
| 312 | |
| 313 | g_object_set_data_full( |
| 314 | G_OBJECT(process_list->process_list_widget), |
| 315 | "process_list_Data", |
| 316 | process_list, |
| 317 | (GDestroyNotify)processlist_destroy); |
| 318 | |
| 319 | return process_list; |
| 320 | } |
| 321 | void processlist_destroy(ProcessList *process_list) |
| 322 | { |
| 323 | g_hash_table_destroy(process_list->process_hash); |
| 324 | process_list->process_hash = NULL; |
| 325 | |
| 326 | g_free(process_list); |
| 327 | } |
| 328 | |
| 329 | GtkWidget *processlist_get_widget(ProcessList *process_list) |
| 330 | { |
| 331 | return process_list->process_list_widget; |
| 332 | } |
| 333 | |
| 334 | |
| 335 | |
| 336 | gint get_cell_height(GtkTreeView *tree_view) |
| 337 | { |
| 338 | gint height; |
| 339 | GtkTreeViewColumn *Column = gtk_tree_view_get_column(tree_view, 0); |
| 340 | //GList *Render_List = gtk_tree_view_column_get_cell_renderers(Column); |
| 341 | //GtkCellRenderer *Renderer = g_list_first(Render_List)->data; |
| 342 | |
| 343 | //g_list_free(Render_List); |
| 344 | gtk_tree_view_column_cell_get_size(Column, NULL, NULL, NULL, NULL, &height); |
| 345 | //g_critical("cell 0 height : %u",height); |
| 346 | |
| 347 | return height; |
| 348 | } |
| 349 | |
| 350 | void destroy_hash_key(gpointer key) |
| 351 | { |
| 352 | g_free(key); |
| 353 | } |
| 354 | |
| 355 | void destroy_hash_data(gpointer data) |
| 356 | { |
| 357 | g_free(data); |
| 358 | } |
| 359 | |
| 360 | int processlist_add( ProcessList *process_list, |
| 361 | guint pid, |
| 362 | LttTime *birth, |
| 363 | guint trace_num, |
| 364 | gchar *name, |
| 365 | guint *height, |
| 366 | HashedProcessData **pm_hashed_process_data) |
| 367 | { |
| 368 | GtkTreeIter iter ; |
| 369 | ProcessInfo *Process_Info = g_new(ProcessInfo, 1); |
| 370 | HashedProcessData *hashed_process_data = g_new(HashedProcessData, 1); |
| 371 | *pm_hashed_process_data = hashed_process_data; |
| 372 | |
| 373 | Process_Info->pid = pid; |
| 374 | Process_Info->birth = *birth; |
| 375 | Process_Info->trace_num = trace_num; |
| 376 | |
| 377 | hashed_process_data->draw_context = g_new(DrawContext, 1); |
| 378 | hashed_process_data->draw_context->drawable = NULL; |
| 379 | hashed_process_data->draw_context->gc = NULL; |
| 380 | hashed_process_data->draw_context->pango_layout = NULL; |
| 381 | hashed_process_data->draw_context->current = g_new(DrawInfo,1); |
| 382 | hashed_process_data->draw_context->current->over = g_new(ItemInfo,1); |
| 383 | hashed_process_data->draw_context->current->over->x = -1; |
| 384 | hashed_process_data->draw_context->current->over->y = -1; |
| 385 | hashed_process_data->draw_context->current->middle = g_new(ItemInfo,1); |
| 386 | hashed_process_data->draw_context->current->middle->x = -1; |
| 387 | hashed_process_data->draw_context->current->middle->y = -1; |
| 388 | hashed_process_data->draw_context->current->under = g_new(ItemInfo,1); |
| 389 | hashed_process_data->draw_context->current->under->x = -1; |
| 390 | hashed_process_data->draw_context->current->under->y = -1; |
| 391 | hashed_process_data->draw_context->current->modify_over = g_new(ItemInfo,1); |
| 392 | hashed_process_data->draw_context->current->modify_over->x = -1; |
| 393 | hashed_process_data->draw_context->current->modify_over->y = -1; |
| 394 | hashed_process_data->draw_context->current->modify_middle = g_new(ItemInfo,1); |
| 395 | hashed_process_data->draw_context->current->modify_middle->x = -1; |
| 396 | hashed_process_data->draw_context->current->modify_middle->y = -1; |
| 397 | hashed_process_data->draw_context->current->modify_under = g_new(ItemInfo,1); |
| 398 | hashed_process_data->draw_context->current->modify_under->x = -1; |
| 399 | hashed_process_data->draw_context->current->modify_under->y = -1; |
| 400 | hashed_process_data->draw_context->current->status = LTTV_STATE_UNNAMED; |
| 401 | hashed_process_data->draw_context->previous = g_new(DrawInfo,1); |
| 402 | hashed_process_data->draw_context->previous->over = g_new(ItemInfo,1); |
| 403 | hashed_process_data->draw_context->previous->over->x = -1; |
| 404 | hashed_process_data->draw_context->previous->over->y = -1; |
| 405 | hashed_process_data->draw_context->previous->middle = g_new(ItemInfo,1); |
| 406 | hashed_process_data->draw_context->previous->middle->x = -1; |
| 407 | hashed_process_data->draw_context->previous->middle->y = -1; |
| 408 | hashed_process_data->draw_context->previous->under = g_new(ItemInfo,1); |
| 409 | hashed_process_data->draw_context->previous->under->x = -1; |
| 410 | hashed_process_data->draw_context->previous->under->y = -1; |
| 411 | hashed_process_data->draw_context->previous->modify_over = g_new(ItemInfo,1); |
| 412 | hashed_process_data->draw_context->previous->modify_over->x = -1; |
| 413 | hashed_process_data->draw_context->previous->modify_over->y = -1; |
| 414 | hashed_process_data->draw_context->previous->modify_middle = g_new(ItemInfo,1); |
| 415 | hashed_process_data->draw_context->previous->modify_middle->x = -1; |
| 416 | hashed_process_data->draw_context->previous->modify_middle->y = -1; |
| 417 | hashed_process_data->draw_context->previous->modify_under = g_new(ItemInfo,1); |
| 418 | hashed_process_data->draw_context->previous->modify_under->x = -1; |
| 419 | hashed_process_data->draw_context->previous->modify_under->y = -1; |
| 420 | hashed_process_data->draw_context->previous->status = LTTV_STATE_UNNAMED; |
| 421 | |
| 422 | /* Add a new row to the model */ |
| 423 | gtk_list_store_append ( process_list->list_store, &iter); |
| 424 | //g_critical ( "iter before : %s", gtk_tree_path_to_string ( |
| 425 | // gtk_tree_model_get_path ( |
| 426 | // GTK_TREE_MODEL(process_list->list_store), |
| 427 | // &iter))); |
| 428 | gtk_list_store_set ( process_list->list_store, &iter, |
| 429 | PROCESS_COLUMN, name, |
| 430 | PID_COLUMN, pid, |
| 431 | BIRTH_S_COLUMN, birth->tv_sec, |
| 432 | BIRTH_NS_COLUMN, birth->tv_nsec, |
| 433 | TRACE_COLUMN, trace_num, |
| 434 | -1); |
| 435 | hashed_process_data->row_ref = gtk_tree_row_reference_new ( |
| 436 | GTK_TREE_MODEL(process_list->list_store), |
| 437 | gtk_tree_model_get_path( |
| 438 | GTK_TREE_MODEL(process_list->list_store), |
| 439 | &iter)); |
| 440 | g_hash_table_insert( process_list->process_hash, |
| 441 | (gpointer)Process_Info, |
| 442 | (gpointer)hashed_process_data); |
| 443 | |
| 444 | //g_critical ( "iter after : %s", gtk_tree_path_to_string ( |
| 445 | // gtk_tree_model_get_path ( |
| 446 | // GTK_TREE_MODEL(process_list->list_store), |
| 447 | // &iter))); |
| 448 | process_list->number_of_process++; |
| 449 | |
| 450 | *height = get_cell_height(GTK_TREE_VIEW(process_list->process_list_widget)) |
| 451 | * process_list->number_of_process ; |
| 452 | |
| 453 | |
| 454 | return 0; |
| 455 | |
| 456 | } |
| 457 | |
| 458 | int processlist_remove( ProcessList *process_list, |
| 459 | guint pid, |
| 460 | LttTime *birth, |
| 461 | guint trace_num) |
| 462 | { |
| 463 | ProcessInfo Process_Info; |
| 464 | gint *path_indices; |
| 465 | HashedProcessData *hashed_process_data; |
| 466 | GtkTreeIter iter; |
| 467 | |
| 468 | Process_Info.pid = pid; |
| 469 | Process_Info.birth = *birth; |
| 470 | Process_Info.trace_num = trace_num; |
| 471 | |
| 472 | |
| 473 | if(hashed_process_data = |
| 474 | (HashedProcessData*)g_hash_table_lookup( |
| 475 | process_list->process_hash, |
| 476 | &Process_Info)) |
| 477 | { |
| 478 | gtk_tree_model_get_iter ( |
| 479 | GTK_TREE_MODEL(process_list->list_store), |
| 480 | &iter, |
| 481 | gtk_tree_row_reference_get_path( |
| 482 | (GtkTreeRowReference*)hashed_process_data->row_ref) |
| 483 | ); |
| 484 | |
| 485 | gtk_list_store_remove (process_list->list_store, &iter); |
| 486 | |
| 487 | g_free(hashed_process_data->draw_context->previous->modify_under); |
| 488 | g_free(hashed_process_data->draw_context->previous->modify_middle); |
| 489 | g_free(hashed_process_data->draw_context->previous->modify_over); |
| 490 | g_free(hashed_process_data->draw_context->previous->under); |
| 491 | g_free(hashed_process_data->draw_context->previous->middle); |
| 492 | g_free(hashed_process_data->draw_context->previous->over); |
| 493 | g_free(hashed_process_data->draw_context->previous); |
| 494 | g_free(hashed_process_data->draw_context->current->modify_under); |
| 495 | g_free(hashed_process_data->draw_context->current->modify_middle); |
| 496 | g_free(hashed_process_data->draw_context->current->modify_over); |
| 497 | g_free(hashed_process_data->draw_context->current->under); |
| 498 | g_free(hashed_process_data->draw_context->current->middle); |
| 499 | g_free(hashed_process_data->draw_context->current->over); |
| 500 | g_free(hashed_process_data->draw_context->current); |
| 501 | g_free(hashed_process_data->draw_context); |
| 502 | g_free(hashed_process_data); |
| 503 | |
| 504 | g_hash_table_remove(process_list->process_hash, |
| 505 | &Process_Info); |
| 506 | |
| 507 | process_list->number_of_process--; |
| 508 | |
| 509 | return 0; |
| 510 | } else { |
| 511 | return 1; |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | |
| 516 | guint processlist_get_height(ProcessList *process_list) |
| 517 | { |
| 518 | return get_cell_height(GTK_TREE_VIEW(process_list->process_list_widget)) |
| 519 | * process_list->number_of_process ; |
| 520 | } |
| 521 | |
| 522 | |
| 523 | gint processlist_get_process_pixels( ProcessList *process_list, |
| 524 | guint pid, LttTime *birth, guint trace_num, |
| 525 | guint *y, |
| 526 | guint *height, |
| 527 | HashedProcessData **pm_hashed_process_data) |
| 528 | { |
| 529 | ProcessInfo Process_Info; |
| 530 | gint *path_indices; |
| 531 | GtkTreePath *tree_path; |
| 532 | HashedProcessData *hashed_process_data = NULL; |
| 533 | |
| 534 | Process_Info.pid = pid; |
| 535 | Process_Info.birth = *birth; |
| 536 | Process_Info.trace_num = trace_num; |
| 537 | |
| 538 | if(hashed_process_data = |
| 539 | (HashedProcessData*)g_hash_table_lookup( |
| 540 | process_list->process_hash, |
| 541 | &Process_Info)) |
| 542 | { |
| 543 | tree_path = gtk_tree_row_reference_get_path( |
| 544 | hashed_process_data->row_ref); |
| 545 | path_indices = gtk_tree_path_get_indices (tree_path); |
| 546 | |
| 547 | *height = get_cell_height( |
| 548 | GTK_TREE_VIEW(process_list->process_list_widget)); |
| 549 | *y = *height * path_indices[0]; |
| 550 | *pm_hashed_process_data = hashed_process_data; |
| 551 | return 0; |
| 552 | } else { |
| 553 | *pm_hashed_process_data = hashed_process_data; |
| 554 | return 1; |
| 555 | } |
| 556 | |
| 557 | } |
| 558 | |
| 559 | |
| 560 | gint processlist_get_pixels_from_data( ProcessList *process_list, |
| 561 | ProcessInfo *process_info, |
| 562 | HashedProcessData *hashed_process_data, |
| 563 | guint *y, |
| 564 | guint *height) |
| 565 | { |
| 566 | gint *path_indices; |
| 567 | GtkTreePath *tree_path; |
| 568 | |
| 569 | tree_path = gtk_tree_row_reference_get_path( |
| 570 | hashed_process_data->row_ref); |
| 571 | path_indices = gtk_tree_path_get_indices (tree_path); |
| 572 | |
| 573 | *height = get_cell_height( |
| 574 | GTK_TREE_VIEW(process_list->process_list_widget)); |
| 575 | *y = *height * path_indices[0]; |
| 576 | |
| 577 | return 0; |
| 578 | |
| 579 | } |