sysprof: ctrl+n to go record again from greeter

This commit is contained in:
Christian Hergert
2023-07-10 13:47:20 -07:00
parent d47a7b0791
commit 0a342c7d26
2 changed files with 33 additions and 13 deletions

View File

@ -54,11 +54,9 @@ G_DEFINE_FINAL_TYPE (SysprofWindow, sysprof_window, ADW_TYPE_APPLICATION_WINDOW)
static GParamSpec *properties [N_PROPS];
static void
sysprof_window_open_capture_action (GtkWidget *widget,
const char *action_name,
GVariant *param)
show_greeter (SysprofWindow *self,
SysprofGreeterPage page)
{
SysprofWindow *self = (SysprofWindow *)widget;
SysprofGreeter *greeter;
g_assert (SYSPROF_IS_WINDOW (self));
@ -66,10 +64,26 @@ sysprof_window_open_capture_action (GtkWidget *widget,
greeter = g_object_new (SYSPROF_TYPE_GREETER,
"transient-for", self,
NULL);
sysprof_greeter_set_page (greeter, SYSPROF_GREETER_PAGE_OPEN);
sysprof_greeter_set_page (greeter, page);
gtk_window_present (GTK_WINDOW (greeter));
}
static void
sysprof_window_open_capture_action (GtkWidget *widget,
const char *action_name,
GVariant *param)
{
show_greeter (SYSPROF_WINDOW (widget), SYSPROF_GREETER_PAGE_OPEN);
}
static void
sysprof_window_record_capture_action (GtkWidget *widget,
const char *action_name,
GVariant *param)
{
show_greeter (SYSPROF_WINDOW (widget), SYSPROF_GREETER_PAGE_RECORD);
}
static void
sysprof_window_set_document (SysprofWindow *self,
SysprofDocument *document)
@ -179,6 +193,7 @@ sysprof_window_class_init (SysprofWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-window.ui");
gtk_widget_class_install_action (widget_class, "win.open-capture", NULL, sysprof_window_open_capture_action);
gtk_widget_class_install_action (widget_class, "win.record-capture", NULL, sysprof_window_record_capture_action);
g_type_ensure (SYSPROF_TYPE_DOCUMENT);
g_type_ensure (SYSPROF_TYPE_FILES_SECTION);

View File

@ -8,6 +8,12 @@
<property name="default-height">750</property>
<child>
<object class="GtkShortcutController">
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;ctrl&gt;n</property>
<property name="action">action(win.record-capture)</property>
</object>
</child>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;ctrl&gt;o</property>
@ -158,19 +164,18 @@
</template>
<menu id="primary_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Record Again…</attribute>
<attribute name="action">win.record-capture</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Open Recording…</attribute>
<attribute name="action" translatable="yes">win.open-capture</attribute>
<attribute name="action">win.open-capture</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save As…</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Record Again…</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Preferences</attribute>
@ -193,11 +198,11 @@
<attribute name="label" translatable="yes">Callgraph</attribute>
<item>
<attribute name="label" translatable="yes">Hide System Libraries</attribute>
<attribute name="action" translatable="yes">win.callgraph.hide-system-libraries</attribute>
<attribute name="action">win.callgraph.hide-system-libraries</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Include Threads</attribute>
<attribute name="action" translatable="yes">win.callgraph.include-threads</attribute>
<attribute name="action">win.callgraph.include-threads</attribute>
</item>
</section>
</menu>