Clear screenshot window when start is toggled.

Fri Feb 24 02:09:33 2006  Soeren Sandmann  <sandmann@redhat.com>

        * sysprof.c (on_start_toggled): Clear screenshot window when start
        is toggled.

        * TODO: Add some notes about stack handling on the x86
This commit is contained in:
Soeren Sandmann
2006-02-24 07:10:42 +00:00
committed by Søren Sandmann Pedersen
parent 894d9ee400
commit dc51fea3b4
2 changed files with 42 additions and 17 deletions

View File

@ -105,6 +105,8 @@ struct Application
*/
};
static void update_screenshot_window (Application *app);
static gboolean
show_samples_timeout (gpointer data)
{
@ -361,7 +363,7 @@ static void
on_start_toggled (GtkWidget *widget, gpointer data)
{
Application *app = data;
if (!gtk_toggle_tool_button_get_active (
GTK_TOGGLE_TOOL_BUTTON (app->start_button)))
{
@ -385,7 +387,8 @@ on_start_toggled (GtkWidget *widget, gpointer data)
"\n"
"as root.");
}
update_screenshot_window (app);
update_sensitivity (app);
}
@ -1085,6 +1088,17 @@ typedef struct
GString *text;
} AddTextInfo;
static void
set_monospace (GtkWidget *widget)
{
PangoFontDescription *desc =
pango_font_description_from_string ("monospace");
gtk_widget_modify_font (widget, desc);
pango_font_description_free (desc);
}
static void
add_text (GtkTreeView *view,
GtkTreePath *path,
@ -1108,21 +1122,13 @@ add_text (GtkTreeView *view,
g_string_append_printf (info->text, "%-*s %6.2f %6.2f\n", info->max_width - indent, name, self, cumulative);
}
static void
set_monospace (GtkWidget *widget)
{
PangoFontDescription *desc =
pango_font_description_from_string ("monospace");
gtk_widget_modify_font (widget, desc);
pango_font_description_free (desc);
}
static void
update_screenshot_window (Application *app)
{
/* FIXME: clear the text buffer here */
GtkTextBuffer *text_buffer =
gtk_text_view_get_buffer (GTK_TEXT_VIEW (app->screenshot_textview));
gtk_text_buffer_set_text (text_buffer, "", -1);
if (app->descendants)
{
@ -1139,9 +1145,7 @@ update_screenshot_window (Application *app)
add_text,
&info);
gtk_text_buffer_set_text (
gtk_text_view_get_buffer (GTK_TEXT_VIEW (app->screenshot_textview)),
info.text->str, -1);
gtk_text_buffer_set_text (text_buffer, info.text->str, -1);
set_monospace (app->screenshot_textview);