+gint process_sort_func ( GtkTreeModel *model,
+ GtkTreeIter *it_a,
+ GtkTreeIter *it_b,
+ gpointer user_data)
+{
+ GValue a, b;
+
+ memset(&a, 0, sizeof(GValue));
+ memset(&b, 0, sizeof(GValue));
+
+ /* Order by PID */
+ gtk_tree_model_get_value( model,
+ it_a,
+ PID_COLUMN,
+ &a);
+
+ gtk_tree_model_get_value( model,
+ it_b,
+ PID_COLUMN,
+ &b);
+
+ if(G_VALUE_TYPE(&a) == G_TYPE_UINT
+ && G_VALUE_TYPE(&b) == G_TYPE_UINT )
+ {
+ if(g_value_get_uint(&a) > g_value_get_uint(&b))
+ {
+ g_value_unset(&a);
+ g_value_unset(&b);
+ return 1;
+ }
+ if(g_value_get_uint(&a) < g_value_get_uint(&b))
+ {
+ g_value_unset(&a);
+ g_value_unset(&b);
+ return 0;
+ }
+ }
+
+ g_value_unset(&a);
+ g_value_unset(&b);
+
+
+ /* Order by birth second */
+ gtk_tree_model_get_value( model,
+ it_a,
+ BIRTH_S_COLUMN,
+ &a);
+
+ gtk_tree_model_get_value( model,
+ it_b,
+ BIRTH_S_COLUMN,
+ &b);
+
+
+ if(G_VALUE_TYPE(&a) == G_TYPE_ULONG
+ && G_VALUE_TYPE(&b) == G_TYPE_ULONG )
+ {
+ if(g_value_get_ulong(&a) > g_value_get_ulong(&b))
+ {
+ g_value_unset(&a);
+ g_value_unset(&b);
+ return 1;
+ }
+ if(g_value_get_ulong(&a) < g_value_get_ulong(&b))
+ {
+ g_value_unset(&a);
+ g_value_unset(&b);
+ return 0;
+ }
+
+ }
+
+ g_value_unset(&a);
+ g_value_unset(&b);
+
+ /* Order by birth nanosecond */
+ gtk_tree_model_get_value( model,
+ it_a,
+ BIRTH_NS_COLUMN,
+ &a);
+
+ gtk_tree_model_get_value( model,
+ it_b,
+ BIRTH_NS_COLUMN,
+ &b);
+
+
+ if(G_VALUE_TYPE(&a) == G_TYPE_ULONG
+ && G_VALUE_TYPE(&b) == G_TYPE_ULONG )
+ {
+ if(g_value_get_ulong(&a) > g_value_get_ulong(&b))
+ {
+ g_value_unset(&a);
+ g_value_unset(&b);
+ return 1;
+ }
+ // Final condition
+ //if(g_value_get_ulong(&a) < g_value_get_ulong(&b))
+ //{
+ // g_value_unset(&a);
+ // g_value_unset(&b);
+ // return 0;
+ //}
+
+ }
+
+ g_value_unset(&a);
+ g_value_unset(&b);
+
+ return 0;
+
+}
+
+guint hash_fct(gconstpointer key)
+{
+ return ((ProcessInfo*)key)->pid;
+}
+
+gboolean equ_fct(gconstpointer a, gconstpointer b)
+{
+ if(((ProcessInfo*)a)->pid != ((ProcessInfo*)b)->pid)
+ return 0;
+// g_critical("compare %u and %u",((ProcessInfo*)a)->pid,((ProcessInfo*)b)->pid);
+ if(((ProcessInfo*)a)->birth.tv_sec != ((ProcessInfo*)b)->birth.tv_sec)
+ return 0;
+// g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_sec,((ProcessInfo*)b)->birth.tv_sec);
+
+ if(((ProcessInfo*)a)->birth.tv_nsec != ((ProcessInfo*)b)->birth.tv_nsec)
+ return 0;
+// g_critical("compare %u and %u",((ProcessInfo*)a)->birth.tv_nsec,((ProcessInfo*)b)->birth.tv_nsec);
+
+ return 1;
+}
+
+void Destroy_hash_key(gpointer key);
+
+void Destroy_hash_data(gpointer data);
+
+
+
+
+ProcessList *ProcessList_construct(void)