libsysprof-ui: add accelerator keys

This commit is contained in:
Christian Hergert
2019-05-15 16:03:56 -07:00
parent de06c0da45
commit 6437dba247
2 changed files with 26 additions and 4 deletions

View File

@ -50,6 +50,7 @@ typedef struct
SysprofMarksView *marks_view;
SysprofVisualizerView *visualizer_view;
SysprofZoomManager *zoom_manager;
GtkStackSwitcher *stack_switcher;
guint busy;
} SysprofCaptureViewPrivate;
@ -530,6 +531,19 @@ fit_zoom_cb (GSimpleAction *action,
sysprof_capture_view_fit_to_width (self);
}
static void
set_use_underline_cb (GtkWidget *widget,
gpointer user_data)
{
if (GTK_IS_RADIO_BUTTON (widget))
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
if (GTK_IS_LABEL (child))
gtk_label_set_use_underline (GTK_LABEL (child), TRUE);
}
}
static void
sysprof_capture_view_finalize (GObject *object)
{
@ -591,6 +605,7 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, callgraph_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, details_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, marks_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack_switcher);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, visualizer_view);
gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, zoom_manager);
@ -618,6 +633,10 @@ sysprof_capture_view_init (SysprofCaptureView *self)
gtk_widget_init_template (GTK_WIDGET (self));
gtk_container_foreach (GTK_CONTAINER (priv->stack_switcher),
set_use_underline_cb,
NULL);
selection = sysprof_visualizer_view_get_selection (priv->visualizer_view);
g_signal_connect_object (selection,
"changed",

View File

@ -69,7 +69,7 @@
</object>
</child>
<child type="center">
<object class="GtkStackSwitcher">
<object class="GtkStackSwitcher" id="stack_switcher">
<property name="stack">sections_stack</property>
<property name="halign">center</property>
<property name="visible">true</property>
@ -114,7 +114,8 @@
<property name="visible">true</property>
</object>
<packing>
<property name="title" translatable="yes">Callgraph</property>
<!-- translators: the _ is used to denote the accelerator key -->
<property name="title" translatable="yes">_Callgraph</property>
</packing>
</child>
<child>
@ -123,7 +124,8 @@
<property name="visible">true</property>
</object>
<packing>
<property name="title" translatable="yes">Timings</property>
<!-- translators: the _ is used to denote the accelerator key -->
<property name="title" translatable="yes">_Timings</property>
</packing>
</child>
<child>
@ -132,7 +134,8 @@
<property name="visible">true</property>
</object>
<packing>
<property name="title" translatable="yes">Details</property>
<!-- translators: the _ is used to denote the accelerator key -->
<property name="title" translatable="yes">_Details</property>
</packing>
</child>
</object>