mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
Make the tree tree-shapeed.
Mon Dec 19 17:39:09 2005 Søren Sandmann <sandmann@redhat.com> * sysprof.c (add_text): Make the tree tree-shapeed.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
6d7d972654
commit
02242d500b
@ -1,3 +1,7 @@
|
|||||||
|
Mon Dec 19 17:39:09 2005 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
|
* sysprof.c (add_text): Make the tree tree-shapeed.
|
||||||
|
|
||||||
Mon Dec 19 15:15:48 2005 Søren Sandmann <sandmann@redhat.com>
|
Mon Dec 19 15:15:48 2005 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* module/sysprof-module.c (timer_notify): A few formatting
|
* module/sysprof-module.c (timer_notify): A few formatting
|
||||||
|
|||||||
24
sysprof.c
24
sysprof.c
@ -1044,6 +1044,12 @@ get_data (GtkTreeView *view,
|
|||||||
-1);
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
get_indent (GtkTreePath *path)
|
||||||
|
{
|
||||||
|
return 2 * (gtk_tree_path_get_depth (path) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compute_text_width (GtkTreeView *view,
|
compute_text_width (GtkTreeView *view,
|
||||||
GtkTreePath *path,
|
GtkTreePath *path,
|
||||||
@ -1051,11 +1057,12 @@ compute_text_width (GtkTreeView *view,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
int *width = data;
|
int *width = data;
|
||||||
char *name;
|
char *name;
|
||||||
|
int indent;
|
||||||
|
|
||||||
|
get_data (view, iter, &name, NULL, NULL);
|
||||||
|
|
||||||
get_data (view, iter, &name, NULL, NULL);
|
*width = MAX (g_utf8_strlen (name, -1) + get_indent (path), *width);
|
||||||
|
|
||||||
*width = MAX (g_utf8_strlen (name, -1), *width);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -1074,10 +1081,17 @@ add_text (GtkTreeView *view,
|
|||||||
char *name;
|
char *name;
|
||||||
double self;
|
double self;
|
||||||
double cumulative;
|
double cumulative;
|
||||||
|
int indent;
|
||||||
|
int i;
|
||||||
|
|
||||||
get_data (view, iter, &name, &self, &cumulative);
|
get_data (view, iter, &name, &self, &cumulative);
|
||||||
|
|
||||||
|
indent = get_indent (path);
|
||||||
|
|
||||||
|
for (i = 0; i < indent; ++i)
|
||||||
|
g_string_append_c (info->text, ' ');
|
||||||
|
|
||||||
g_string_append_printf (info->text, "%-*s %6.2f %6.2f\n", info->max_width, name, self, cumulative);
|
g_string_append_printf (info->text, "%-*s %6.2f %6.2f\n", info->max_width - indent, name, self, cumulative);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user