summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoren Sandmann <sandmann@daimi.au.dk>2008-04-26 08:31:23 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2008-04-26 08:31:23 +0000
commit3e465571bb810f025096d4bacfab4ae6f5d66f75 (patch)
treecff1055fd50a4a9ec304f0fb8e3cdac9d248c42c
parentb7619004e60069eff1263172ee7ccf6c2cca9c95 (diff)
Get rid of all calls to glade_xml_get_widget(). (gather_widgets): Instead
2008-04-26 Soren Sandmann <sandmann@daimi.au.dk> * sysprof.c (build_gui): Get rid of all calls to glade_xml_get_widget(). (gather_widgets): Instead get all the widgets here. * TODO: updates svn path=/trunk/; revision=414
-rw-r--r--ChangeLog8
-rw-r--r--TODO7
-rw-r--r--sysprof.c102
3 files changed, 73 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index dc201a5..f0be5ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2008-04-26 Soren Sandmann <sandmann@daimi.au.dk>
+ * sysprof.c (build_gui): Get rid of all calls to
+ glade_xml_get_widget().
+ (gather_widgets): Instead get all the widgets here.
+
+ * TODO: Update
+
+2008-04-26 Soren Sandmann <sandmann@daimi.au.dk>
+
* sysprof.c (build_gui): Remove all calls to g_signal_connect()
* sysprof.c (connect_signals): Instead connect all signals here
diff --git a/TODO b/TODO
index f22ad1c..818e1aa 100644
--- a/TODO
+++ b/TODO
@@ -22,6 +22,13 @@ Before 1.0.4:
kernels.
Before 1.2:
+* Find out what is going on with kernel threads:
+
+ [(ksoftirqd/0)] 0.00 0.03
+ No map ([(ksoftirqd/0)]) 0.00 0.03
+ kernel 0.00 0.03
+ do_softirq 0.00 0.03
+ __do_softirq 0.00 0.03
* Make sure there aren't leftover stacktraces from last time when
profiling begins.
diff --git a/sysprof.c b/sysprof.c
index a256e81..f012d75 100644
--- a/sysprof.c
+++ b/sysprof.c
@@ -71,6 +71,8 @@ struct Application
GtkWidget * screenshot_item;
GtkWidget * about_item;
GtkWidget * quit_item;
+ GtkWidget * hpaned;
+ GtkWidget * vpaned;
GtkTreeSelection * object_selection;
@@ -1378,6 +1380,57 @@ set_sizes (GtkWindow *window,
gtk_window_resize (screenshot_window, width, height);
}
+#define GLADE_FILE DATADIR "/sysprof.glade"
+
+static void
+gather_widgets (Application *app)
+{
+ typedef struct
+ {
+ void *location;
+ const char *name;
+ } 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->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;
+
+ for (i = 0; i < G_N_ELEMENTS (widgets); ++i)
+ {
+ const WidgetInfo *info = &(widgets[i]);
+
+ *(GtkWidget **)(info->location) = glade_xml_get_widget (xml, info->name);
+
+ g_assert (GTK_IS_WIDGET (*(GtkWidget **)info->location));
+ }
+}
+
static void
connect_signals (Application *app)
{
@@ -1408,7 +1461,7 @@ connect_signals (Application *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, "row0collapsed", 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->samples_label, "size-request", on_samples_label_size_request, app },
@@ -1441,8 +1494,6 @@ set_shadows (void)
);
}
-#define GLADE_FILE DATADIR "/sysprof.glade"
-
static void
set_icons (Application *app)
{
@@ -1483,7 +1534,6 @@ set_icons (Application *app)
static gboolean
build_gui (Application *app)
{
- GladeXML *xml;
GtkTreeViewColumn *col;
set_shadows ();
@@ -1498,47 +1548,22 @@ build_gui (Application *app)
return FALSE;
}
-
- xml = glade_xml_new (GLADE_FILE, NULL, NULL);
+ gather_widgets (app);
+
+ g_assert (app->main_window);
/* Main Window */
- app->main_window = glade_xml_get_widget (xml, "main_window");
set_icons (app);
gtk_widget_realize (GTK_WIDGET (app->main_window));
/* Tool items */
- app->start_button = glade_xml_get_widget (xml, "start_button");
- app->profile_button = glade_xml_get_widget (xml, "profile_button");
- app->reset_button = glade_xml_get_widget (xml, "reset_button");
- app->save_as_button = glade_xml_get_widget (xml, "save_as_button");
- app->dummy_button = glade_xml_get_widget (xml, "dummy_button");
-
gtk_toggle_tool_button_set_active (
GTK_TOGGLE_TOOL_BUTTON (app->profile_button), FALSE);
- app->samples_label = glade_xml_get_widget (xml, "samples_label");
-
- /* Menu items */
- app->start_item = glade_xml_get_widget (xml, "start_item");
- app->profile_item = glade_xml_get_widget (xml, "profile_item");
- app->reset_item = glade_xml_get_widget (xml, "reset_item");
- app->open_item = glade_xml_get_widget (xml, "open_item");
- app->save_as_item = glade_xml_get_widget (xml, "save_as_item");
- app->screenshot_item = glade_xml_get_widget (xml, "screenshot_item");
- app->quit_item = glade_xml_get_widget (xml, "quit");
- app->about_item = glade_xml_get_widget (xml, "about");
-
- g_assert (app->start_item);
- g_assert (app->profile_item);
- g_assert (app->save_as_item);
- g_assert (app->open_item);
-
/* TreeViews */
/* object view */
- app->object_view =
- (GtkTreeView *)glade_xml_get_widget (xml, "object_view");
gtk_tree_view_set_enable_search (app->object_view, FALSE);
col = add_plain_text_column (app->object_view, _("Functions"),
OBJECT_NAME);
@@ -1550,8 +1575,6 @@ build_gui (Application *app)
gtk_tree_view_column_set_expand (col, TRUE);
/* callers view */
- app->callers_view =
- (GtkTreeView *)glade_xml_get_widget (xml, "callers_view");
gtk_tree_view_set_enable_search (app->callers_view, FALSE);
col = add_plain_text_column (app->callers_view, _("Callers"),
CALLERS_NAME);
@@ -1562,8 +1585,6 @@ build_gui (Application *app)
gtk_tree_view_column_set_expand (col, TRUE);
/* descendants view */
- app->descendants_view =
- (GtkTreeView *)glade_xml_get_widget (xml, "descendants_view");
gtk_tree_view_set_enable_search (app->descendants_view, FALSE);
col = add_plain_text_column (app->descendants_view, _("Descendants"),
DESCENDANTS_NAME);
@@ -1574,18 +1595,11 @@ build_gui (Application *app)
gtk_tree_view_column_set_expand (col, TRUE);
/* screenshot window */
- app->screenshot_window =
- glade_xml_get_widget (xml, "screenshot_window");
- app->screenshot_textview =
- glade_xml_get_widget (xml, "screenshot_textview");
- app->screenshot_close_button =
- glade_xml_get_widget (xml, "screenshot_close_button");
/* set sizes */
set_sizes (GTK_WINDOW (app->main_window),
GTK_WINDOW (app->screenshot_window),
- glade_xml_get_widget (xml, "hpaned"),
- glade_xml_get_widget (xml, "vpaned"));
+ app->hpaned, app->vpaned);
/* hide/show widgets */
gtk_widget_show_all (app->main_window);