[sysprof] Delete trailing whitespace
- From: Søren Sandmann Pedersen <ssp src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [sysprof] Delete trailing whitespace
- Date: Tue, 18 Aug 2009 08:53:21 +0000 (UTC)
commit d65e0e57bba11fc821e04951c2ed2df908e8a68f
Author: Søren Sandmann Pedersen <sandmann daimi au dk>
Date: Mon Aug 17 09:40:08 2009 -0400
Delete trailing whitespace
sysprof.c | 544 ++++++++++++++++++++++++++++++------------------------------
1 files changed, 272 insertions(+), 272 deletions(-)
---
diff --git a/sysprof.c b/sysprof.c
index 0f457d1..794f587 100644
--- a/sysprof.c
+++ b/sysprof.c
@@ -47,22 +47,22 @@ typedef enum
struct Application
{
Collector * collector;
-
+
State state;
GdkPixbuf * icon;
-
+
GtkWidget * main_window;
-
+
GtkTreeView * object_view;
GtkTreeView * callers_view;
GtkTreeView * descendants_view;
-
+
GtkWidget * start_button;
GtkWidget * profile_button;
GtkWidget * reset_button;
GtkWidget * save_as_button;
GtkWidget * dummy_button;
-
+
GtkWidget * start_item;
GtkWidget * profile_item;
GtkWidget * reset_item;
@@ -75,22 +75,22 @@ struct Application
GtkWidget * vpaned;
GtkTreeSelection * object_selection;
-
+
GtkWidget * samples_label;
GtkWidget * samples_hbox;
-
+
gboolean screenshot_window_visible;
GtkWidget * screenshot_textview;
GtkWidget * screenshot_close_button;
GtkWidget * screenshot_window;
-
+
Profile * profile;
ProfileDescendant * descendants;
ProfileCaller * callers;
-
+
int timeout_id;
int update_screenshot_id;
-
+
char * loaded_profile;
gboolean inhibit_forced_redraw;
@@ -118,30 +118,30 @@ show_samples (Application *app)
{
char *label;
int n_samples;
-
+
switch (app->state)
{
case INITIAL:
n_samples = 0;
break;
-
+
case PROFILING:
n_samples = collector_get_n_samples (app->collector);
break;
-
+
case DISPLAYING:
n_samples = profile_get_size (app->profile);
break;
-
+
default:
g_assert_not_reached();
break;
}
-
+
label = g_strdup_printf ("%d", n_samples);
-
+
gtk_label_set_label (GTK_LABEL (app->samples_label), label);
-
+
g_free (label);
}
@@ -151,9 +151,9 @@ show_samples_timeout (gpointer data)
Application *app = data;
show_samples (app);
-
+
app->timeout_id = 0;
-
+
return FALSE;
}
@@ -173,11 +173,11 @@ update_sensitivity (Application *app)
gboolean sensitive_tree_views;
gboolean sensitive_samples_hbox;
gboolean sensitive_reset_button;
-
+
GtkWidget *active_radio_button;
-
+
gboolean has_samples;
-
+
switch (app->state)
{
case INITIAL:
@@ -189,10 +189,10 @@ update_sensitivity (Application *app)
sensitive_samples_hbox = FALSE;
active_radio_button = app->dummy_button;
break;
-
+
case PROFILING:
has_samples = (collector_get_n_samples (app->collector) > 0);
-
+
sensitive_profile_button = has_samples;
sensitive_save_as_button = has_samples;
sensitive_reset_button = has_samples;
@@ -201,7 +201,7 @@ update_sensitivity (Application *app)
sensitive_samples_hbox = TRUE;
active_radio_button = app->start_button;
break;
-
+
case DISPLAYING:
sensitive_profile_button = TRUE;
sensitive_save_as_button = TRUE;
@@ -211,35 +211,35 @@ update_sensitivity (Application *app)
sensitive_samples_hbox = FALSE;
active_radio_button = app->profile_button;
break;
-
+
default:
g_assert_not_reached();
break;
}
-
+
gtk_toggle_tool_button_set_active (
GTK_TOGGLE_TOOL_BUTTON (active_radio_button), TRUE);
-
+
/* "profile" widgets */
gtk_widget_set_sensitive (GTK_WIDGET (app->profile_button),
sensitive_profile_button);
gtk_widget_set_sensitive (GTK_WIDGET (app->profile_item),
sensitive_profile_button);
-
+
/* "save as" widgets */
gtk_widget_set_sensitive (GTK_WIDGET (app->save_as_button),
sensitive_save_as_button);
gtk_widget_set_sensitive (app->save_as_item,
sensitive_save_as_button);
-
+
/* "start" widgets */
gtk_widget_set_sensitive (GTK_WIDGET (app->start_button),
sensitive_start_button);
gtk_widget_set_sensitive (GTK_WIDGET (app->start_item),
sensitive_start_button);
-
+
#if 0
- /* FIXME - not10: gtk+ doesn't handle changes in sensitivity in response
+ /* FIXME - not10: gtk+ doesn't handle changes in sensitivity in response
* to a click on the same button very well
*/
gtk_widget_set_sensitive (GTK_WIDGET (app->reset_button),
@@ -247,20 +247,20 @@ update_sensitivity (Application *app)
gtk_widget_set_sensitive (GTK_WIDGET (app->reset_item),
sensitive_reset_button);
#endif
-
+
gtk_widget_set_sensitive (GTK_WIDGET (app->object_view), sensitive_tree_views);
gtk_widget_set_sensitive (GTK_WIDGET (app->callers_view), sensitive_tree_views);
gtk_widget_set_sensitive (GTK_WIDGET (app->descendants_view), sensitive_tree_views);
gtk_widget_set_sensitive (GTK_WIDGET (app->samples_hbox), sensitive_samples_hbox);
-
+
if (app->screenshot_window_visible)
gtk_widget_show (app->screenshot_window);
else
gtk_widget_hide (app->screenshot_window);
-
+
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (app->screenshot_item),
app->screenshot_window_visible);
-
+
show_samples (app);
}
@@ -270,7 +270,7 @@ set_busy (GtkWidget *widget,
{
GdkCursor *cursor;
GdkWindow *window;
-
+
if (busy)
cursor = gdk_cursor_new (GDK_WATCH);
else
@@ -280,9 +280,9 @@ set_busy (GtkWidget *widget,
window = gtk_text_view_get_window (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_TEXT);
else
window = widget->window;
-
+
gdk_window_set_cursor (window, cursor);
-
+
if (cursor)
gdk_cursor_unref (cursor);
@@ -298,12 +298,12 @@ set_application_title (Application *app,
new_name = g_path_get_basename (name);
else
new_name = NULL;
-
+
if (app->loaded_profile)
g_free (app->loaded_profile);
-
+
app->loaded_profile = new_name;
-
+
if (app->loaded_profile)
{
gtk_window_set_title (GTK_WINDOW (app->main_window),
@@ -323,14 +323,14 @@ delete_data (Application *app)
{
profile_free (app->profile);
app->profile = NULL;
-
+
gtk_tree_view_set_model (GTK_TREE_VIEW (app->object_view), NULL);
gtk_tree_view_set_model (GTK_TREE_VIEW (app->callers_view), NULL);
gtk_tree_view_set_model (GTK_TREE_VIEW (app->descendants_view), NULL);
}
-
+
collector_reset (app->collector);
-
+
app->profile_from_file = FALSE;
set_application_title (app, NULL);
}
@@ -343,19 +343,19 @@ sorry (GtkWidget *parent_window,
va_list args;
char *message;
GtkWidget *dialog;
-
+
va_start (args, format);
g_vasprintf (&message, format, args);
va_end (args);
-
+
dialog = gtk_message_dialog_new (parent_window ? GTK_WINDOW (parent_window) : NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK, message);
g_free (message);
-
+
gtk_window_set_title (GTK_WINDOW (dialog), APPLICATION_NAME " Warning");
-
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
@@ -364,7 +364,7 @@ static void
on_menu_item_activated (GtkWidget *menu_item, GtkWidget *tool_button)
{
GtkToggleToolButton *button = GTK_TOGGLE_TOOL_BUTTON (tool_button);
-
+
if (!gtk_toggle_tool_button_get_active (button))
gtk_toggle_tool_button_set_active (button, TRUE);
}
@@ -380,11 +380,11 @@ on_start_toggled (GtkWidget *widget, gpointer data)
{
return;
}
-
+
if (collector_start (app->collector, &err))
{
delete_data (app);
-
+
app->state = PROFILING;
}
else
@@ -428,7 +428,7 @@ get_current_object (Application *app)
GtkTreeModel *model;
GtkTreeIter selected;
char *object;
-
+
if (gtk_tree_selection_get_selected (app->object_selection, &model, &selected))
{
gtk_tree_model_get (model, &selected,
@@ -449,7 +449,7 @@ fill_main_list (Application *app)
GtkListStore *list_store;
Profile *profile = app->profile;
GList *objects;
-
+
if (profile)
{
list_store = gtk_list_store_new (4,
@@ -457,16 +457,16 @@ fill_main_list (Application *app)
G_TYPE_DOUBLE,
G_TYPE_DOUBLE,
G_TYPE_POINTER);
-
+
objects = profile_get_objects (profile);
for (list = objects; list != NULL; list = list->next)
{
ProfileObject *object = list->data;
GtkTreeIter iter;
double profile_size = profile_get_size (profile);
-
+
gtk_list_store_append (list_store, &iter);
-
+
gtk_list_store_set (list_store, &iter,
OBJECT_NAME, object->name,
OBJECT_SELF, 100.0 * object->self / profile_size,
@@ -483,10 +483,10 @@ fill_main_list (Application *app)
tree_view_set_model_with_default_sort (app->object_view, GTK_TREE_MODEL (list_store),
OBJECT_TOTAL, GTK_SORT_DESCENDING);
-
+
g_object_unref (G_OBJECT (list_store));
}
-
+
gtk_tree_view_columns_autosize (app->object_view);
}
@@ -497,12 +497,12 @@ add_node (GtkTreeStore *store,
ProfileDescendant *node)
{
GtkTreeIter iter;
-
+
if (!node)
return;
-
+
gtk_tree_store_insert (store, &iter, (GtkTreeIter *)parent, 0);
-
+
gtk_tree_store_set (store, &iter,
DESCENDANTS_NAME, node->name,
DESCENDANTS_SELF, 100 * (node->self)/(double)size,
@@ -513,7 +513,7 @@ add_node (GtkTreeStore *store,
#endif
DESCENDANTS_OBJECT, node->name,
-1);
-
+
add_node (store, size, parent, node->siblings);
add_node (store, size, &iter, node->children);
}
@@ -522,20 +522,20 @@ static void
fill_descendants_tree (Application *app)
{
GtkTreeStore *tree_store;
-
+
if (app->descendants)
{
profile_descendant_free (app->descendants);
app->descendants = NULL;
}
-
+
tree_store =
gtk_tree_store_new (4,
G_TYPE_STRING,
G_TYPE_DOUBLE,
G_TYPE_DOUBLE,
G_TYPE_POINTER);
-
+
if (app->profile)
{
char *object = get_current_object (app);
@@ -547,12 +547,12 @@ fill_descendants_tree (Application *app)
profile_get_size (app->profile), NULL, app->descendants);
}
}
-
+
tree_view_set_model_with_default_sort (app->descendants_view, GTK_TREE_MODEL (tree_store),
DESCENDANTS_CUMULATIVE, GTK_SORT_DESCENDING);
g_object_unref (G_OBJECT (tree_store));
-
+
gtk_tree_view_columns_autosize (app->descendants_view);
}
@@ -566,12 +566,12 @@ add_callers (GtkListStore *list_store,
gchar *name;
GtkTreeIter iter;
double profile_size = profile_get_size (profile);
-
+
if (callers->name)
name = callers->name;
else
name = "<spontaneous>";
-
+
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (
list_store, &iter,
@@ -584,7 +584,7 @@ add_callers (GtkListStore *list_store,
#endif
CALLERS_OBJECT, callers->name,
-1);
-
+
callers = callers->next;
}
}
@@ -593,20 +593,20 @@ static void
fill_callers_list (Application *app)
{
GtkListStore *list_store;
-
+
if (app->callers)
{
profile_caller_free (app->callers);
app->callers = NULL;
}
-
+
list_store =
gtk_list_store_new (4,
G_TYPE_STRING,
G_TYPE_DOUBLE,
G_TYPE_DOUBLE,
G_TYPE_POINTER);
-
+
if (app->profile)
{
char *object = get_current_object (app);
@@ -616,12 +616,12 @@ fill_callers_list (Application *app)
add_callers (list_store, app->profile, app->callers);
}
}
-
+
tree_view_set_model_with_default_sort (app->callers_view, GTK_TREE_MODEL (list_store),
CALLERS_TOTAL, GTK_SORT_DESCENDING);
-
+
g_object_unref (G_OBJECT (list_store));
-
+
gtk_tree_view_columns_autosize (app->callers_view);
}
@@ -641,14 +641,14 @@ enter_display_mode (Application *app)
update_sensitivity (app);
app->inhibit_forced_redraw = TRUE;
-
+
fill_main_list (app);
/* This has the side effect of selecting the first row, which in turn causes
* the other lists to be filled out
*/
gtk_widget_grab_focus (GTK_WIDGET (app->object_view));
-
+
app->inhibit_forced_redraw = FALSE;
}
@@ -659,7 +659,7 @@ ensure_profile (Application *app)
return;
app->profile = collector_create_profile (app->collector);
-
+
collector_stop (app->collector);
collector_reset (app->collector);
@@ -677,7 +677,7 @@ on_about_activated (GtkWidget *widget, gpointer data)
name_property = "program-name";
else
name_property = "name";
-
+
gtk_show_about_dialog (GTK_WINDOW (app->main_window),
"logo", app->icon,
name_property, APPLICATION_NAME,
@@ -703,19 +703,19 @@ static void
on_reset_clicked (gpointer widget, gpointer data)
{
Application *app = data;
-
+
set_busy (app->main_window, TRUE);
-
+
delete_data (app);
-
+
if (app->state == DISPLAYING)
{
app->state = INITIAL;
collector_stop (app->collector);
}
-
+
update_sensitivity (app);
-
+
set_busy (app->main_window, FALSE);
}
@@ -727,7 +727,7 @@ overwrite_file (GtkWindow *window,
gchar *utf8_file_name;
AtkObject *obj;
gint ret;
-
+
utf8_file_name = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
msgbox = gtk_message_dialog_new (window,
(GtkDialogFlags)GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -736,28 +736,28 @@ overwrite_file (GtkWindow *window,
_("A file named \"%s\" already exists."),
utf8_file_name);
g_free (utf8_file_name);
-
+
gtk_message_dialog_format_secondary_text (
GTK_MESSAGE_DIALOG (msgbox),
_("Do you want to replace it with the one you are saving?"));
-
+
gtk_dialog_add_button (GTK_DIALOG (msgbox),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-
+
gtk_dialog_add_button (GTK_DIALOG (msgbox),
_("_Replace"), GTK_RESPONSE_YES);
-
+
gtk_dialog_set_default_response (GTK_DIALOG (msgbox),
GTK_RESPONSE_CANCEL);
-
+
obj = gtk_widget_get_accessible (msgbox);
-
+
if (GTK_IS_ACCESSIBLE (obj))
atk_object_set_name (obj, _("Question"));
-
+
ret = gtk_dialog_run (GTK_DIALOG (msgbox));
gtk_widget_destroy (msgbox);
-
+
return (ret == GTK_RESPONSE_YES);
}
@@ -767,44 +767,44 @@ on_save_as_clicked (gpointer widget,
{
Application *app = data;
GtkWidget *dialog;
-
+
ensure_profile (app);
-
+
set_busy (app->main_window, TRUE);
-
+
dialog = gtk_file_chooser_dialog_new ("Save As",
GTK_WINDOW (app->main_window),
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
-
+
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-
+
set_busy (app->main_window, FALSE);
-
+
retry:
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
GError *err = NULL;
gchar *filename;
-
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
+
if (g_file_test (filename, G_FILE_TEST_EXISTS) &&
!overwrite_file (GTK_WINDOW (app->main_window), filename))
{
g_free (filename);
goto retry;
}
-
+
set_busy (dialog, TRUE);
if (!profile_save (app->profile, filename, &err))
{
sorry (app->main_window, "Could not save %s: %s",
filename, err->message);
-
+
set_busy (dialog, FALSE);
g_free (filename);
goto retry;
@@ -813,7 +813,7 @@ retry:
set_busy (dialog, FALSE);
g_free (filename);
}
-
+
gtk_widget_destroy (dialog);
}
@@ -824,11 +824,11 @@ set_loaded_profile (Application *app,
{
g_return_if_fail (name != NULL);
g_return_if_fail (profile != NULL);
-
+
collector_stop (app->collector);
-
+
delete_data (app);
-
+
app->profile = profile;
app->profile_from_file = TRUE;
@@ -856,53 +856,53 @@ on_open_clicked (gpointer widget,
gchar *filename = NULL;
Profile *profile = NULL;
GtkWidget *dialog;
-
+
set_busy (app->main_window, TRUE);
-
+
dialog = gtk_file_chooser_dialog_new ("Open",
GTK_WINDOW (app->main_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
-
+
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-
+
set_busy (app->main_window, FALSE);
-
+
retry:
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
GError *err = NULL;
-
+
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
+
set_busy (dialog, TRUE);
-
+
profile = profile_load (filename, &err);
-
+
if (!profile)
{
set_busy (dialog, FALSE);
-
+
show_could_not_open (app, filename, err);
g_error_free (err);
g_free (filename);
-
+
filename = NULL;
goto retry;
}
-
+
set_busy (dialog, FALSE);
}
-
+
gtk_widget_destroy (dialog);
-
+
if (profile)
{
g_assert (filename);
set_loaded_profile (app, filename, profile);
-
+
g_free (filename);
}
}
@@ -918,7 +918,7 @@ on_delete (GtkWidget *window,
*/
while (gtk_main_iteration ())
;
-
+
gtk_main_quit ();
}
@@ -933,18 +933,18 @@ expand_descendants_tree (Application *app)
double top_value = 0.0;
GtkTreePath *first_path;
GList *list;
-
+
first_path = gtk_tree_path_new_first();
-
+
all_paths = g_list_prepend (all_paths, first_path);
-
+
n_rows = 1;
-
+
gtk_tree_model_get_iter (model, &iter, first_path);
gtk_tree_model_get (model, &iter,
OBJECT_TOTAL, &top_value,
-1);
-
+
while (all_paths && n_rows < max_rows)
{
GtkTreeIter best_iter;
@@ -952,10 +952,10 @@ expand_descendants_tree (Application *app)
double best_value;
int n_children;
int i;
-
+
best_value = 0.0;
best_path = NULL;
-
+
for (list = all_paths; list != NULL; list = list->next)
{
GtkTreePath *path = list->data;
@@ -980,7 +980,7 @@ expand_descendants_tree (Application *app)
}
n_children = gtk_tree_model_iter_n_children (model, &best_iter);
-
+
if (n_children && (best_value / top_value) > 0.04 &&
(n_children + gtk_tree_path_get_depth (best_path)) /
(double)max_rows < (best_value / top_value) )
@@ -988,39 +988,39 @@ expand_descendants_tree (Application *app)
gtk_tree_view_expand_row (
GTK_TREE_VIEW (app->descendants_view), best_path, FALSE);
n_rows += n_children;
-
+
if (gtk_tree_path_get_depth (best_path) < 4)
{
GtkTreePath *path = gtk_tree_path_copy (best_path);
gtk_tree_path_down (path);
-
+
for (i = 0; i < n_children; ++i)
{
all_paths = g_list_prepend (all_paths, path);
-
+
path = gtk_tree_path_copy (path);
gtk_tree_path_next (path);
}
-
+
gtk_tree_path_free (path);
}
}
-
+
all_paths = g_list_remove (all_paths, best_path);
-
+
if (!all_paths && n_rows == 1)
{
/* Always expand at least once */
gtk_tree_view_expand_row (GTK_TREE_VIEW (app->descendants_view),
best_path, FALSE);
}
-
+
gtk_tree_path_free (best_path);
}
-
+
for (list = all_paths; list != NULL; list = list->next)
gtk_tree_path_free (list->data);
-
+
g_list_free (all_paths);
}
@@ -1034,7 +1034,7 @@ get_data (GtkTreeView *view,
char *dummy1;
double dummy2;
double dummy3;
-
+
GtkTreeModel *model = gtk_tree_view_get_model (view);
gtk_tree_model_get (
model, iter,
@@ -1056,14 +1056,14 @@ compute_text_width (GtkTreeView *view,
GtkTreeIter *iter,
gpointer data)
{
- int *width = data;
- char *name;
-
- get_data (view, iter, &name, NULL, NULL);
+ int *width = data;
+ char *name;
+
+ 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) + get_indent (path), *width);
- g_free (name);
+ g_free (name);
}
typedef struct
@@ -1077,9 +1077,9 @@ set_monospace (GtkWidget *widget)
{
PangoFontDescription *desc =
pango_font_description_from_string ("monospace");
-
+
gtk_widget_modify_font (widget, desc);
-
+
pango_font_description_free (desc);
}
@@ -1102,7 +1102,7 @@ add_text (GtkTreeView *view,
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 - indent, name, self, cumulative);
@@ -1117,19 +1117,19 @@ update_screenshot_window_idle (gpointer data)
if (!app->screenshot_window_visible)
return FALSE;
-
+
text_buffer =
gtk_text_view_get_buffer (GTK_TEXT_VIEW (app->screenshot_textview));
gtk_text_buffer_set_text (text_buffer, "", -1);
-
+
if (app->descendants)
{
AddTextInfo info;
-
+
info.max_width = 0;
info.text = g_string_new ("");
-
+
tree_view_foreach_visible (app->descendants_view,
compute_text_width,
&info.max_width);
@@ -1141,7 +1141,7 @@ update_screenshot_window_idle (gpointer data)
gtk_text_buffer_set_text (text_buffer, info.text->str, -1);
set_monospace (app->screenshot_textview);
-
+
g_string_free (info.text, TRUE);
}
@@ -1152,7 +1152,7 @@ update_screenshot_window_idle (gpointer data)
set_busy (app->screenshot_window, FALSE);
set_busy (app->screenshot_textview, FALSE);
}
-
+
return FALSE;
}
@@ -1177,7 +1177,7 @@ update_screenshot_window (Application *app)
set_busy (app->screenshot_textview, TRUE);
}
}
-
+
app->update_screenshot_id = g_idle_add (
update_screenshot_window_idle, app);
}
@@ -1198,18 +1198,18 @@ on_object_selection_changed (GtkTreeSelection *selection,
Application *app = data;
set_busy (app->main_window, TRUE);
-
+
update_screenshot_window (app);
if (!app->inhibit_forced_redraw)
gdk_window_process_all_updates (); /* Display updated selection */
-
+
fill_descendants_tree (app);
fill_callers_list (app);
-
+
if (get_current_object (app))
expand_descendants_tree (app);
-
+
set_busy (app->main_window, FALSE);
}
@@ -1220,19 +1220,19 @@ really_goto_object (Application *app,
GtkTreeModel *profile_objects;
GtkTreeIter iter;
gboolean found = FALSE;
-
+
profile_objects = gtk_tree_view_get_model (app->object_view);
-
+
if (gtk_tree_model_get_iter_first (profile_objects, &iter))
{
do
{
char *list_object;
-
+
gtk_tree_model_get (profile_objects, &iter,
OBJECT_OBJECT, &list_object,
-1);
-
+
if (list_object == object)
{
found = TRUE;
@@ -1241,12 +1241,12 @@ really_goto_object (Application *app,
}
while (gtk_tree_model_iter_next (profile_objects, &iter));
}
-
+
if (found)
{
GtkTreePath *path =
gtk_tree_model_get_path (profile_objects, &iter);
-
+
gtk_tree_view_set_cursor (app->object_view, path, 0, FALSE);
}
}
@@ -1260,15 +1260,15 @@ goto_object (Application *app,
GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
char *object;
-
+
if (!gtk_tree_model_get_iter (model, &iter, path))
return;
-
+
gtk_tree_model_get (model, &iter, column, &object, -1);
-
+
if (!object)
return;
-
+
really_goto_object (app, object);
}
@@ -1279,9 +1279,9 @@ on_descendants_row_activated (GtkTreeView *tree_view,
gpointer data)
{
Application *app = data;
-
+
goto_object (app, tree_view, path, DESCENDANTS_OBJECT);
-
+
gtk_widget_grab_focus (GTK_WIDGET (app->descendants_view));
}
@@ -1292,9 +1292,9 @@ on_callers_row_activated (GtkTreeView *tree_view,
gpointer data)
{
Application *app = data;
-
+
goto_object (app, tree_view, path, CALLERS_OBJECT);
-
+
gtk_widget_grab_focus (GTK_WIDGET (app->callers_view));
}
@@ -1305,7 +1305,7 @@ on_screenshot_activated (GtkCheckMenuItem *menu_item,
app->screenshot_window_visible = gtk_check_menu_item_get_active (menu_item);
update_screenshot_window (app);
-
+
update_sensitivity (app);
}
@@ -1315,7 +1315,7 @@ on_screenshot_window_delete (GtkWidget *window,
Application *app)
{
app->screenshot_window_visible = FALSE;
-
+
update_sensitivity (app);
}
@@ -1324,7 +1324,7 @@ on_screenshot_close_button_clicked (GtkWidget *widget,
Application *app)
{
app->screenshot_window_visible = FALSE;
-
+
update_sensitivity (app);
}
@@ -1339,23 +1339,23 @@ set_sizes (GtkWindow *window,
GdkRectangle monitor;
int width, height;
GtkWidget *widget = GTK_WIDGET (window);
-
+
screen = gtk_widget_get_screen (widget);
monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
-
+
gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-
+
width = monitor.width * 3 / 4;
height = monitor.height * 3 / 4;
-
+
gtk_window_resize (window, width, height);
-
+
gtk_paned_set_position (GTK_PANED (vpaned), height / 2);
gtk_paned_set_position (GTK_PANED (hpaned), width * 3 / 8);
-
+
width = monitor.width * 5 / 8;
height = monitor.height * 5 / 8;
-
+
gtk_window_resize (screenshot_window, width, height);
}
@@ -1371,32 +1371,32 @@ gather_widgets (Application *app)
} WidgetInfo;
const WidgetInfo widgets[] =
- {
- { &app->main_window, "main_window" },
- { &app->start_button, "start_button" },
- { &app->profile_button, "profile_button" },
- { &app->reset_button, "reset_button" },
- { &app->save_as_button, "save_as_button" },
- { &app->dummy_button, "dummy_button" },
- { &app->samples_label, "samples_label" },
- { &app->samples_hbox, "samples_hbox" },
- { &app->start_item, "start_item" },
- { &app->profile_item, "profile_item" },
- { &app->reset_item, "reset_item" },
- { &app->open_item, "open_item" },
- { &app->save_as_item, "save_as_item" },
- { &app->screenshot_item, "screenshot_item" },
- { &app->quit_item, "quit" },
- { &app->about_item, "about" },
- { &app->object_view, "object_view" },
- { &app->callers_view, "callers_view" },
- { &app->descendants_view, "descendants_view" },
- { &app->screenshot_window, "screenshot_window" },
- { &app->screenshot_textview, "screenshot_textview" },
- { &app->screenshot_close_button, "screenshot_close_button" },
- { &app->vpaned, "vpaned" },
- { &app->hpaned, "hpaned" },
- };
+ {
+ { &app->main_window, "main_window" },
+ { &app->start_button, "start_button" },
+ { &app->profile_button, "profile_button" },
+ { &app->reset_button, "reset_button" },
+ { &app->save_as_button, "save_as_button" },
+ { &app->dummy_button, "dummy_button" },
+ { &app->samples_label, "samples_label" },
+ { &app->samples_hbox, "samples_hbox" },
+ { &app->start_item, "start_item" },
+ { &app->profile_item, "profile_item" },
+ { &app->reset_item, "reset_item" },
+ { &app->open_item, "open_item" },
+ { &app->save_as_item, "save_as_item" },
+ { &app->screenshot_item, "screenshot_item" },
+ { &app->quit_item, "quit" },
+ { &app->about_item, "about" },
+ { &app->object_view, "object_view" },
+ { &app->callers_view, "callers_view" },
+ { &app->descendants_view, "descendants_view" },
+ { &app->screenshot_window, "screenshot_window" },
+ { &app->screenshot_textview, "screenshot_textview" },
+ { &app->screenshot_close_button, "screenshot_close_button" },
+ { &app->vpaned, "vpaned" },
+ { &app->hpaned, "hpaned" },
+ };
GladeXML *xml = glade_xml_new (GLADE_FILE, NULL, NULL);
int i;
@@ -1425,35 +1425,35 @@ connect_signals (Application *app)
} SignalInfo;
const SignalInfo signals[] =
- {
- { app->main_window, "delete_event", on_delete, NULL },
- { app->start_button, "toggled", on_start_toggled, app },
- { app->profile_button, "toggled", on_profile_toggled, app },
- { app->reset_button, "clicked", on_reset_clicked, app },
- { app->save_as_button, "clicked", on_save_as_clicked, app },
- { app->start_item, "activate", on_menu_item_activated, app->start_button },
- { app->profile_item, "activate", on_menu_item_activated, app->profile_button },
- { app->reset_item, "activate", on_reset_clicked, app },
- { app->open_item, "activate", on_open_clicked, app },
- { app->save_as_item, "activate", on_save_as_clicked, app },
- { app->screenshot_item, "activate", on_screenshot_activated, app },
- { app->quit_item, "activate", on_delete, NULL },
- { app->about_item, "activate", on_about_activated, app },
- { app->object_selection, "changed", on_object_selection_changed, app },
- { app->callers_view, "row-activated", on_callers_row_activated, app },
- { app->descendants_view, "row-activated", on_descendants_row_activated, app },
- { app->descendants_view, "row-expanded", on_descendants_row_expanded_or_collapsed, app },
- { app->descendants_view, "row-collapsed", on_descendants_row_expanded_or_collapsed, app },
- { app->screenshot_window, "delete_event", on_screenshot_window_delete, app },
- { app->screenshot_close_button, "clicked", on_screenshot_close_button_clicked, app },
- };
+ {
+ { app->main_window, "delete_event", on_delete, NULL },
+ { app->start_button, "toggled", on_start_toggled, app },
+ { app->profile_button, "toggled", on_profile_toggled, app },
+ { app->reset_button, "clicked", on_reset_clicked, app },
+ { app->save_as_button, "clicked", on_save_as_clicked, app },
+ { app->start_item, "activate", on_menu_item_activated, app->start_button },
+ { app->profile_item, "activate", on_menu_item_activated, app->profile_button },
+ { app->reset_item, "activate", on_reset_clicked, app },
+ { app->open_item, "activate", on_open_clicked, app },
+ { app->save_as_item, "activate", on_save_as_clicked, app },
+ { app->screenshot_item, "activate", on_screenshot_activated, app },
+ { app->quit_item, "activate", on_delete, NULL },
+ { app->about_item, "activate", on_about_activated, app },
+ { app->object_selection, "changed", on_object_selection_changed, app },
+ { app->callers_view, "row-activated", on_callers_row_activated, app },
+ { app->descendants_view, "row-activated", on_descendants_row_activated, app },
+ { app->descendants_view, "row-expanded", on_descendants_row_expanded_or_collapsed, app },
+ { app->descendants_view, "row-collapsed", on_descendants_row_expanded_or_collapsed, app },
+ { app->screenshot_window, "delete_event", on_screenshot_window_delete, app },
+ { app->screenshot_close_button, "clicked", on_screenshot_close_button_clicked, app },
+ };
int i;
-
+
for (i = 0; i < G_N_ELEMENTS (signals); ++i)
{
const SignalInfo *info = &(signals[i]);
-
+
g_signal_connect (info->object, info->signal, info->callback, info->data);
}
}
@@ -1517,34 +1517,34 @@ static gboolean
build_gui (Application *app)
{
GtkTreeViewColumn *col;
-
+
set_shadows ();
-
+
if (!g_file_test (GLADE_FILE, G_FILE_TEST_EXISTS))
{
sorry (NULL,
"Sysprof was not compiled or installed correctly.\n"
"\n"
"Running \"make install\" may solve this problem.\n");
-
+
return FALSE;
}
-
+
gather_widgets (app);
g_assert (app->main_window);
-
+
/* Main Window */
set_icons (app);
gtk_widget_realize (GTK_WIDGET (app->main_window));
-
+
/* Tool items */
gtk_toggle_tool_button_set_active (
GTK_TOGGLE_TOOL_BUTTON (app->profile_button), FALSE);
-
+
/* TreeViews */
-
+
/* object view */
gtk_tree_view_set_enable_search (app->object_view, FALSE);
col = add_plain_text_column (app->object_view, _("Functions"),
@@ -1555,7 +1555,7 @@ build_gui (Application *app)
OBJECT_TOTAL, PCT_FORMAT);
app->object_selection = gtk_tree_view_get_selection (app->object_view);
gtk_tree_view_column_set_expand (col, TRUE);
-
+
/* callers view */
gtk_tree_view_set_enable_search (app->callers_view, FALSE);
col = add_plain_text_column (app->callers_view, _("Callers"),
@@ -1565,7 +1565,7 @@ build_gui (Application *app)
add_double_format_column (app->callers_view, _("Total"),
CALLERS_TOTAL, PCT_FORMAT);
gtk_tree_view_column_set_expand (col, TRUE);
-
+
/* descendants view */
gtk_tree_view_set_enable_search (app->descendants_view, FALSE);
col = add_plain_text_column (app->descendants_view, _("Descendants"),
@@ -1575,24 +1575,24 @@ build_gui (Application *app)
add_double_format_column (app->descendants_view, _("Cumulative"),
DESCENDANTS_CUMULATIVE, PCT_FORMAT);
gtk_tree_view_column_set_expand (col, TRUE);
-
+
/* screenshot window */
-
+
/* set sizes */
set_sizes (GTK_WINDOW (app->main_window),
GTK_WINDOW (app->screenshot_window),
app->hpaned, app->vpaned);
-
+
/* hide/show widgets */
gtk_widget_show_all (app->main_window);
gtk_widget_hide (app->dummy_button);
gtk_widget_hide (app->screenshot_window);
-
+
gtk_widget_grab_focus (GTK_WIDGET (app->object_view));
queue_show_samples (app);
connect_signals (app);
-
+
return TRUE;
}
@@ -1601,7 +1601,7 @@ on_new_sample (gboolean first_sample,
gpointer data)
{
Application *app = data;
-
+
if (app->state == PROFILING && first_sample)
update_sensitivity (app);
else
@@ -1612,10 +1612,10 @@ static Application *
application_new (void)
{
Application *app = g_new0 (Application, 1);
-
+
app->collector = collector_new (on_new_sample, app);
app->state = INITIAL;
-
+
return app;
}
@@ -1635,9 +1635,9 @@ load_file (gpointer data)
Profile *profile;
set_busy (app->main_window, TRUE);
-
+
profile = profile_load (filename, &err);
-
+
if (profile)
{
set_loaded_profile (app, filename, profile);
@@ -1648,13 +1648,13 @@ load_file (gpointer data)
else
{
set_busy (app->main_window, FALSE);
-
+
show_could_not_open (app, filename, err);
g_error_free (err);
}
-
+
g_free (file_open_data);
-
+
return FALSE;
}
@@ -1665,11 +1665,11 @@ process_options (int argc,
int i;
gboolean show_version = FALSE;
const char *filename = NULL;
-
+
for (i = 1; i < argc; ++i)
{
char *option = argv[i];
-
+
if (strcmp (option, "--version") == 0)
{
show_version = TRUE;
@@ -1683,7 +1683,7 @@ process_options (int argc,
if (show_version)
{
g_print ("%s %s\n", APPLICATION_NAME, PACKAGE_VERSION);
-
+
exit (1);
}
@@ -1693,7 +1693,7 @@ process_options (int argc,
static void
disable_g_slice (void)
{
-
+
/* Disable gslice, since it
*
* - confuses valgrind
@@ -1717,24 +1717,24 @@ main (int argc,
const char *filename;
disable_g_slice();
-
+
filename = process_options (argc, argv);
-
+
gtk_init (&argc, &argv);
-
+
app = application_new ();
if (!build_gui (app))
return -1;
-
+
update_sensitivity (app);
-
+
if (filename)
{
FileOpenData *file_open_data = g_new0 (FileOpenData, 1);
file_open_data->filename = filename;
file_open_data->app = app;
-
+
/* This has to run at G_PRIORITY_LOW because of bug 350517
*/
g_idle_add_full (G_PRIORITY_LOW, load_file, file_open_data, NULL);
@@ -1743,8 +1743,8 @@ main (int argc,
#if 0
g_idle_add (gtk_main_quit, NULL);
#endif
-
+
gtk_main ();
-
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]