[gtk+] inspector: Don't lie with statistics
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: Don't lie with statistics
- Date: Fri, 15 Apr 2016 02:53:47 +0000 (UTC)
commit 8a2061f581d3dcb3928ccd5aeac77f6127c52cf4
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Apr 14 22:52:59 2016 -0400
inspector: Don't lie with statistics
If we don't have statistics, despite GOBJECT_DEBUG being set,
explain how to fix this.
gtk/inspector/statistics.c | 11 +++++++++++
gtk/inspector/statistics.ui | 2 +-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtk/inspector/statistics.c b/gtk/inspector/statistics.c
index fe33d18..42b315c 100644
--- a/gtk/inspector/statistics.c
+++ b/gtk/inspector/statistics.c
@@ -26,6 +26,7 @@
#include "gtkcellrenderertext.h"
#include "gtkcelllayout.h"
#include "gtksearchbar.h"
+#include "gtklabel.h"
enum
{
@@ -36,6 +37,7 @@ enum
struct _GtkInspectorStatisticsPrivate
{
GtkWidget *stack;
+ GtkWidget *excuse;
GtkTreeModel *model;
GtkTreeView *view;
GtkWidget *button;
@@ -169,6 +171,12 @@ toggle_record (GtkToggleButton *button,
static gboolean
has_instance_counts (void)
{
+ return g_type_get_instance_count (GTK_TYPE_LABEL) > 0;
+}
+
+static gboolean
+instance_counts_enabled (void)
+{
const gchar *string;
guint flags = 0;
@@ -365,6 +373,8 @@ constructed (GObject *object)
update_type_counts (sl);
else
{
+ if (instance_counts_enabled ())
+ gtk_label_set_text (GTK_LABEL (sl->priv->excuse), _("GLib must be configured with --enable-debug"));
gtk_stack_set_visible_child_name (GTK_STACK (sl->priv->stack), "excuse");
gtk_widget_set_sensitive (sl->priv->button, FALSE);
}
@@ -452,6 +462,7 @@ gtk_inspector_statistics_class_init (GtkInspectorStatisticsClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, renderer_cumulative2);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, search_entry);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, search_bar);
+ gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStatistics, excuse);
}
diff --git a/gtk/inspector/statistics.ui b/gtk/inspector/statistics.ui
index 82672db..b1ceefc 100644
--- a/gtk/inspector/statistics.ui
+++ b/gtk/inspector/statistics.ui
@@ -159,7 +159,7 @@
<property name="halign">center</property>
<property name="valign">center</property>
<child>
- <object class="GtkLabel">
+ <object class="GtkLabel" id="excuse">
<property name="visible">True</property>
<property name="selectable">True</property>
<property name="label" translatable="yes">Enable statistics with
GOBJECT_DEBUG=instance-count</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]