resourceview: fix new icon errors
[lttv.git] / ltt / branches / poly / lttv / modules / gui / resourceview / processlist.c
index ebe1fe3925d7a707109181c1e1e41ec1179674ac..940369f8e10319b419a720563b5648bc7d867d33 100644 (file)
  *****************************************************************************/
 
 
-//gint process_sort_func  ( GtkTreeModel *model,
-//        GtkTreeIter *it_a,
-//        GtkTreeIter *it_b,
-//        gpointer user_data)
-//{
-//  gchar *a_name;
-//  gchar *a_brand;
-//  guint a_pid, a_tgid, a_ppid, a_cpu;
-//  gulong a_birth_s, a_birth_ns;
-//  guint a_trace;
-//
-//  gchar *b_name;
-//  gchar *b_brand;
-//  guint b_pid, b_tgid, b_ppid, b_cpu;
-//  gulong b_birth_s, b_birth_ns;
-//  guint b_trace;
-//
-//  gtk_tree_model_get(model,
-//           it_a,
-//           PROCESS_COLUMN, &a_name,
-//           BRAND_COLUMN, &a_brand,
-//           PID_COLUMN, &a_pid,
-//           TGID_COLUMN, &a_tgid,
-//           PPID_COLUMN, &a_ppid,
-//           CPU_COLUMN, &a_cpu,
-//           BIRTH_S_COLUMN, &a_birth_s,
-//           BIRTH_NS_COLUMN, &a_birth_ns,
-//           TRACE_COLUMN, &a_trace,
-//           -1);
-//
-//  gtk_tree_model_get(model,
-//           it_b,
-//           PROCESS_COLUMN, &b_name,
-//           BRAND_COLUMN, &b_brand,
-//           PID_COLUMN, &b_pid,
-//           TGID_COLUMN, &b_tgid,
-//           PPID_COLUMN, &b_ppid,
-//           CPU_COLUMN, &b_cpu,
-//           BIRTH_S_COLUMN, &b_birth_s,
-//           BIRTH_NS_COLUMN, &b_birth_ns,
-//           TRACE_COLUMN, &b_trace,
-//           -1);
-//
-//  
-//  /* Order by PID */
-//  if(a_pid == 0 &&  b_pid == 0) {
-//    /* If 0, order by CPU */
-//    if(a_cpu > b_cpu) return 1;
-//    if(a_cpu < b_cpu) return -1;
-//
-//  } else { /* if not 0, order by pid */
-//
-//    if(a_pid > b_pid) return 1;
-//    if(a_pid < b_pid) return -1;
-//  }
-//
-//  /* Order by birth second */
-//
-//  if(a_birth_s > b_birth_s) return 1;
-//  if(a_birth_s < b_birth_s) return -1;
-//  
-//
-//  /* Order by birth nanosecond */
-//  if(a_birth_ns > b_birth_ns) return 1;
-//  if(a_birth_ns < b_birth_ns) return -1;
-//  
-//  /* Order by trace_num */
-//  if(a_trace > b_trace) return 1;
-//  if(a_trace < b_trace) return -1;
-//
-//  return 0;
-//
-//}
+gint resource_sort_func  ( GtkTreeModel *model,
+        GtkTreeIter *it_a,
+        GtkTreeIter *it_b,
+        gpointer user_data)
+{
+  gchar *a_name;
+  gchar *b_name;
+
+  gtk_tree_model_get(model, it_a, NAME_COLUMN, &a_name, -1);
+
+  gtk_tree_model_get(model, it_b, NAME_COLUMN, &b_name, -1);
+
+  return strcmp(a_name, b_name);
+}
 
 //static guint process_list_hash_fct(gconstpointer key)
 //{
@@ -367,16 +308,7 @@ ProcessList *processlist_construct(void)
   process_list->current_hash_data = NULL;
 
   /* Create the Process list */
-  process_list->list_store = gtk_list_store_new (  N_COLUMNS,
-              G_TYPE_STRING,
-              G_TYPE_STRING,
-              G_TYPE_UINT,
-              G_TYPE_UINT,
-              G_TYPE_UINT,
-              G_TYPE_UINT,
-              G_TYPE_ULONG,
-              G_TYPE_ULONG,
-              G_TYPE_UINT);
+  process_list->list_store = gtk_list_store_new (  N_COLUMNS, G_TYPE_STRING);
 
 
   process_list->process_list_widget = 
@@ -385,17 +317,17 @@ ProcessList *processlist_construct(void)
 
   g_object_unref (G_OBJECT (process_list->list_store));
 
-//  gtk_tree_sortable_set_default_sort_func(
-//      GTK_TREE_SORTABLE(process_list->list_store),
-//      process_sort_func,
-//      NULL,
-//      NULL);
-// 
-//
-//  gtk_tree_sortable_set_sort_column_id(
-//      GTK_TREE_SORTABLE(process_list->list_store),
-//      GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
-//      GTK_SORT_ASCENDING);
+  gtk_tree_sortable_set_default_sort_func(
+      GTK_TREE_SORTABLE(process_list->list_store),
+      resource_sort_func,
+      NULL,
+      NULL);
+
+  gtk_tree_sortable_set_sort_column_id(
+      GTK_TREE_SORTABLE(process_list->list_store),
+      GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
+      GTK_SORT_ASCENDING);
 
 
   process_list->process_hash = g_hash_table_new_full(
@@ -626,14 +558,10 @@ void destroy_hash_data(gpointer data)
 
 int resourcelist_add(  ProcessList *process_list,
       Drawing_t *drawing,
-//      guint pid,
-//      guint tgid,
-//      guint cpu,
-//      guint ppid,
-//      LttTime *birth,
       guint trace_num,
       GQuark name,
-//      GQuark brand,
+      guint type,
+      guint id,
       guint *height,
       ResourceInfo **pm_resource_info,
       HashedResourceData **pm_hashed_resource_data)
@@ -654,6 +582,8 @@ int resourcelist_add(  ProcessList *process_list,
 //  Process_Info->ppid = ppid;
 //  Process_Info->birth = *birth;
   Resource_Info->trace_num = trace_num;
+  Resource_Info->type = type;
+  Resource_Info->id = id;
 
   /* When we create it from before state update, we are sure that the
    * last event occured before the beginning of the global area.
This page took 0.02896 seconds and 4 git commands to generate.