| 1 | #ifndef _PROCESS_LIST_H |
| 2 | #define _PROCESS_LIST_H |
| 3 | |
| 4 | #include <gtk/gtk.h> |
| 5 | #include <lttv/state.h> |
| 6 | #include <ltt/ltt.h> |
| 7 | |
| 8 | /* The process list |
| 9 | * |
| 10 | * Tasks : |
| 11 | * Create a process list |
| 12 | * contains the data for the process list |
| 13 | * tells the height of the process list widget |
| 14 | * provides methods to add/remove process from the list |
| 15 | * note : the sync with drawing is left to the caller. |
| 16 | * provides helper function to convert a process unique identifier to |
| 17 | * pixels (in height). |
| 18 | * |
| 19 | * //FIXME : connect the scrolled window adjustment with the list. |
| 20 | */ |
| 21 | |
| 22 | typedef struct _ProcessInfo { |
| 23 | |
| 24 | guint pid; |
| 25 | LttTime birth; |
| 26 | |
| 27 | } ProcessInfo; |
| 28 | |
| 29 | |
| 30 | |
| 31 | struct _ProcessList { |
| 32 | |
| 33 | GtkWidget *Process_List_VC; |
| 34 | GtkListStore *Store_M; |
| 35 | |
| 36 | /* A hash table by PID to speed up process position find in the list */ |
| 37 | GHashTable *Process_Hash; |
| 38 | |
| 39 | guint Number_Of_Process; |
| 40 | gboolean Test_Process_Sent; |
| 41 | |
| 42 | }; |
| 43 | |
| 44 | |
| 45 | typedef struct _ProcessList ProcessList; |
| 46 | |
| 47 | ProcessList *ProcessList_construct(void); |
| 48 | void ProcessList_destroy(ProcessList *Process_List); |
| 49 | GtkWidget *ProcessList_getWidget(ProcessList *Process_List); |
| 50 | |
| 51 | // out : success (0) and height |
| 52 | int ProcessList_add(ProcessList *Process_List, guint pid, LttTime *birth, |
| 53 | guint *height); |
| 54 | // out : success (0) and height |
| 55 | int ProcessList_remove(ProcessList *Process_List, guint pid, LttTime *birth); |
| 56 | |
| 57 | guint ProcessList_get_height(ProcessList *Process_List); |
| 58 | |
| 59 | // Returns 0 on success |
| 60 | gint ProcessList_get_process_pixels(ProcessList *Process_List, |
| 61 | guint pid, LttTime *birth, |
| 62 | guint *y, guint *height); |
| 63 | #endif // _PROCESS_LIST_H |