mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Reserve space in the samples label for large numbers.
This way, we don't need to reallocate the label every time it changes.
This commit is contained in:
23
sysprof.c
23
sysprof.c
@ -77,7 +77,7 @@ struct Application
|
||||
GtkTreeSelection * object_selection;
|
||||
|
||||
GtkWidget * samples_label;
|
||||
int samples_label_width;
|
||||
GtkWidget * samples_hbox;
|
||||
|
||||
gboolean screenshot_window_visible;
|
||||
GtkWidget * screenshot_textview;
|
||||
@ -138,7 +138,7 @@ show_samples (Application *app)
|
||||
break;
|
||||
}
|
||||
|
||||
label = g_strdup_printf ("Samples: %d", n_samples);
|
||||
label = g_strdup_printf ("%d", n_samples);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (app->samples_label), label);
|
||||
|
||||
@ -171,7 +171,7 @@ update_sensitivity (Application *app)
|
||||
gboolean sensitive_save_as_button;
|
||||
gboolean sensitive_start_button;
|
||||
gboolean sensitive_tree_views;
|
||||
gboolean sensitive_samples_label;
|
||||
gboolean sensitive_samples_hbox;
|
||||
gboolean sensitive_reset_button;
|
||||
|
||||
GtkWidget *active_radio_button;
|
||||
@ -186,7 +186,7 @@ update_sensitivity (Application *app)
|
||||
sensitive_start_button = TRUE;
|
||||
sensitive_reset_button = FALSE;
|
||||
sensitive_tree_views = FALSE;
|
||||
sensitive_samples_label = FALSE;
|
||||
sensitive_samples_hbox = FALSE;
|
||||
active_radio_button = app->dummy_button;
|
||||
break;
|
||||
|
||||
@ -198,7 +198,7 @@ update_sensitivity (Application *app)
|
||||
sensitive_reset_button = has_samples;
|
||||
sensitive_start_button = TRUE;
|
||||
sensitive_tree_views = FALSE;
|
||||
sensitive_samples_label = TRUE;
|
||||
sensitive_samples_hbox = TRUE;
|
||||
active_radio_button = app->start_button;
|
||||
break;
|
||||
|
||||
@ -208,7 +208,7 @@ update_sensitivity (Application *app)
|
||||
sensitive_start_button = TRUE;
|
||||
sensitive_tree_views = TRUE;
|
||||
sensitive_reset_button = TRUE;
|
||||
sensitive_samples_label = FALSE;
|
||||
sensitive_samples_hbox = FALSE;
|
||||
active_radio_button = app->profile_button;
|
||||
break;
|
||||
|
||||
@ -251,7 +251,7 @@ update_sensitivity (Application *app)
|
||||
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_label), sensitive_samples_label);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (app->samples_hbox), sensitive_samples_hbox);
|
||||
|
||||
if (app->screenshot_window_visible)
|
||||
gtk_widget_show (app->screenshot_window);
|
||||
@ -1328,14 +1328,6 @@ on_screenshot_close_button_clicked (GtkWidget *widget,
|
||||
update_sensitivity (app);
|
||||
}
|
||||
|
||||
static void
|
||||
on_samples_label_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style,
|
||||
Application *app)
|
||||
{
|
||||
app->samples_label_width = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
set_sizes (GtkWindow *window,
|
||||
GtkWindow *screenshot_window,
|
||||
@ -1387,6 +1379,7 @@ gather_widgets (Application *app)
|
||||
{ &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" },
|
||||
|
||||
153
sysprof.glade
153
sysprof.glade
@ -425,22 +425,145 @@
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="samples_label">
|
||||
<widget class="GtkHBox" id="samples_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Samples: 0</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_RIGHT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">6</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Samples: </property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notebook1">
|
||||
<property name="visible">True</property>
|
||||
<property name="show_tabs">False</property>
|
||||
<property name="show_border">False</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">False</property>
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="samples_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">0</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">label6</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">888888</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">label7</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
|
||||
Reference in New Issue
Block a user