mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: focus record button by default
Because if we break the "hit enter to launch, escape to stop" workflow some people will be angry.
This commit is contained in:
@ -33,6 +33,7 @@
|
||||
#include "sysprof-display.h"
|
||||
#include "sysprof-empty-state-view.h"
|
||||
#include "sysprof-recording-state-view.h"
|
||||
#include "sysprof-ui-private.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -581,3 +582,13 @@ sysprof_display_stop_recording (SysprofDisplay *self)
|
||||
if (priv->profiler != NULL)
|
||||
sysprof_profiler_stop (priv->profiler);
|
||||
}
|
||||
|
||||
void
|
||||
_sysprof_display_focus_record (SysprofDisplay *self)
|
||||
{
|
||||
SysprofDisplayPrivate *priv = sysprof_display_get_instance_private (self);
|
||||
|
||||
g_return_if_fail (SYSPROF_IS_DISPLAY (self));
|
||||
|
||||
_sysprof_profiler_assistant_focus_record (priv->assistant);
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "sysprof-display.h"
|
||||
#include "sysprof-notebook.h"
|
||||
#include "sysprof-tab.h"
|
||||
#include "sysprof-ui-private.h"
|
||||
|
||||
G_DEFINE_TYPE (SysprofNotebook, sysprof_notebook, GTK_TYPE_NOTEBOOK)
|
||||
|
||||
@ -71,6 +72,9 @@ sysprof_notebook_page_added (GtkNotebook *notebook,
|
||||
g_assert (SYSPROF_IS_NOTEBOOK (notebook));
|
||||
g_assert (GTK_IS_WIDGET (child));
|
||||
|
||||
gtk_notebook_set_show_tabs (notebook,
|
||||
gtk_notebook_get_n_pages (notebook) > 1);
|
||||
|
||||
if (SYSPROF_IS_DISPLAY (child))
|
||||
{
|
||||
GtkWidget *tab = sysprof_tab_new (SYSPROF_DISPLAY (child));
|
||||
@ -86,10 +90,9 @@ sysprof_notebook_page_added (GtkNotebook *notebook,
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_SAVE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CURRENT]);
|
||||
}
|
||||
|
||||
gtk_notebook_set_show_tabs (notebook,
|
||||
gtk_notebook_get_n_pages (notebook) > 1);
|
||||
_sysprof_display_focus_record (SYSPROF_DISPLAY (child));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include "sysprof-profiler-assistant.h"
|
||||
#include "sysprof-proxy-aid.h"
|
||||
#include "sysprof-process-model-row.h"
|
||||
#include "sysprof-ui-private.h"
|
||||
|
||||
struct _SysprofProfilerAssistant
|
||||
{
|
||||
@ -314,3 +315,11 @@ sysprof_profiler_assistant_init (SysprofProfilerAssistant *self)
|
||||
|
||||
sysprof_environ_editor_set_environ (self->environ_editor, environ);
|
||||
}
|
||||
|
||||
void
|
||||
_sysprof_profiler_assistant_focus_record (SysprofProfilerAssistant *self)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_PROFILER_ASSISTANT (self));
|
||||
|
||||
gtk_widget_grab_focus (GTK_WIDGET (self->record_button));
|
||||
}
|
||||
|
||||
@ -21,7 +21,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "sysprof-callgraph-view.h"
|
||||
#include "sysprof-display.h"
|
||||
#include "sysprof-marks-view.h"
|
||||
#include "sysprof-profiler-assistant.h"
|
||||
#include "sysprof-visualizer-view.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -36,18 +38,20 @@ typedef struct
|
||||
guint64 avg_count;
|
||||
} SysprofMarkStat;
|
||||
|
||||
SysprofMarkStat *_sysprof_mark_stat_new (const gchar *name);
|
||||
void _sysprof_mark_stat_free (SysprofMarkStat *self);
|
||||
void _sysprof_marks_view_set_hadjustment (SysprofMarksView *self,
|
||||
GtkAdjustment *hadjustment);
|
||||
void _sysprof_visualizer_view_set_hadjustment (SysprofVisualizerView *self,
|
||||
GtkAdjustment *hadjustment);
|
||||
void _sysprof_rounded_rectangle (cairo_t *cr,
|
||||
const GdkRectangle *rect,
|
||||
gint x_radius,
|
||||
gint y_radius);
|
||||
gchar *_sysprof_format_duration (gint64 duration);
|
||||
void _sysprof_callgraph_view_set_failed (SysprofCallgraphView *self);
|
||||
SysprofMarkStat *_sysprof_mark_stat_new (const gchar *name);
|
||||
void _sysprof_mark_stat_free (SysprofMarkStat *self);
|
||||
void _sysprof_marks_view_set_hadjustment (SysprofMarksView *self,
|
||||
GtkAdjustment *hadjustment);
|
||||
void _sysprof_visualizer_view_set_hadjustment (SysprofVisualizerView *self,
|
||||
GtkAdjustment *hadjustment);
|
||||
void _sysprof_rounded_rectangle (cairo_t *cr,
|
||||
const GdkRectangle *rect,
|
||||
gint x_radius,
|
||||
gint y_radius);
|
||||
gchar *_sysprof_format_duration (gint64 duration);
|
||||
void _sysprof_callgraph_view_set_failed (SysprofCallgraphView *self);
|
||||
void _sysprof_display_focus_record (SysprofDisplay *self);
|
||||
void _sysprof_profiler_assistant_focus_record (SysprofProfilerAssistant *self);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofMarkStat, _sysprof_mark_stat_free)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user