mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 07:30:54 +00:00
window: expand for visualizers as necessary
We want the paned to expand for the visualizers so that the UI looks natural as often as possible without scrolling.
This commit is contained in:
@ -160,9 +160,10 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkPaned">
|
<object class="GtkPaned" id="paned">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
|
<property name="vexpand">true</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="SpVisualizerView" id="visualizers">
|
<object class="SpVisualizerView" id="visualizers">
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
@ -177,11 +178,20 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="shrink">false</property>
|
||||||
|
<property name="resize">false</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="SpCallgraphView" id="callgraph_view">
|
<object class="SpCallgraphView" id="callgraph_view">
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
|
<property name="vexpand">true</property>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="shrink">false</property>
|
||||||
|
<property name="resize">true</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|||||||
@ -42,6 +42,7 @@ struct _SpWindow
|
|||||||
GtkInfoBar *info_bar;
|
GtkInfoBar *info_bar;
|
||||||
GtkLabel *info_bar_label;
|
GtkLabel *info_bar_label;
|
||||||
GtkRevealer *info_bar_revealer;
|
GtkRevealer *info_bar_revealer;
|
||||||
|
GtkPaned *paned;
|
||||||
SpProfilerMenuButton *profiler_menu_button;
|
SpProfilerMenuButton *profiler_menu_button;
|
||||||
SpRecordingStateView *recording_view;
|
SpRecordingStateView *recording_view;
|
||||||
GtkButton *record_button;
|
GtkButton *record_button;
|
||||||
@ -701,6 +702,18 @@ sp_window_delete_event (GtkWidget *widget,
|
|||||||
return GDK_EVENT_PROPAGATE;
|
return GDK_EVENT_PROPAGATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sp_window_reset_paned (SpWindow *self)
|
||||||
|
{
|
||||||
|
gint min_height;
|
||||||
|
gint nat_height;
|
||||||
|
|
||||||
|
g_assert (SP_IS_WINDOW (self));
|
||||||
|
|
||||||
|
gtk_widget_get_preferred_height (GTK_WIDGET (self->visualizers), &min_height, &nat_height);
|
||||||
|
gtk_paned_set_position (self->paned, MAX (min_height, MIN (nat_height, 300)));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sp_window_destroy (GtkWidget *widget)
|
sp_window_destroy (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
@ -763,6 +776,7 @@ sp_window_class_init (SpWindowClass *klass)
|
|||||||
gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar);
|
gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar_label);
|
gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar_label);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar_revealer);
|
gtk_widget_class_bind_template_child (widget_class, SpWindow, info_bar_revealer);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, SpWindow, paned);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SpWindow, profiler_menu_button);
|
gtk_widget_class_bind_template_child (widget_class, SpWindow, profiler_menu_button);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SpWindow, record_button);
|
gtk_widget_class_bind_template_child (widget_class, SpWindow, record_button);
|
||||||
gtk_widget_class_bind_template_child (widget_class, SpWindow, recording_view);
|
gtk_widget_class_bind_template_child (widget_class, SpWindow, recording_view);
|
||||||
@ -810,10 +824,21 @@ sp_window_init (SpWindow *self)
|
|||||||
self,
|
self,
|
||||||
G_CONNECT_SWAPPED);
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
|
g_signal_connect_object (self->visualizers,
|
||||||
|
"visualizer-added",
|
||||||
|
G_CALLBACK (sp_window_reset_paned),
|
||||||
|
self,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
|
g_signal_connect_object (self->visualizers,
|
||||||
|
"visualizer-removed",
|
||||||
|
G_CALLBACK (sp_window_reset_paned),
|
||||||
|
self,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup actions for the window.
|
* Setup actions for the window.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_action_map_add_action_entries (G_ACTION_MAP (self),
|
g_action_map_add_action_entries (G_ACTION_MAP (self),
|
||||||
action_entries,
|
action_entries,
|
||||||
G_N_ELEMENTS (action_entries),
|
G_N_ELEMENTS (action_entries),
|
||||||
@ -822,7 +847,6 @@ sp_window_init (SpWindow *self)
|
|||||||
/*
|
/*
|
||||||
* Setup our gear (hamburger) menu.
|
* Setup our gear (hamburger) menu.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
app = GTK_APPLICATION (g_application_get_default ());
|
app = GTK_APPLICATION (g_application_get_default ());
|
||||||
menu = gtk_application_get_menu_by_id (app, "gear-menu");
|
menu = gtk_application_get_menu_by_id (app, "gear-menu");
|
||||||
gtk_menu_button_set_menu_model (self->gear_menu_button, G_MENU_MODEL (menu));
|
gtk_menu_button_set_menu_model (self->gear_menu_button, G_MENU_MODEL (menu));
|
||||||
@ -837,7 +861,6 @@ sp_window_init (SpWindow *self)
|
|||||||
/*
|
/*
|
||||||
* Restore previous window settings.
|
* Restore previous window settings.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sp_window_settings_register (GTK_WINDOW (self));
|
sp_window_settings_register (GTK_WINDOW (self));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -845,6 +868,12 @@ sp_window_init (SpWindow *self)
|
|||||||
* launch, enter, escape, view.
|
* launch, enter, escape, view.
|
||||||
*/
|
*/
|
||||||
gtk_window_set_focus (GTK_WINDOW (self), GTK_WIDGET (self->record_button));
|
gtk_window_set_focus (GTK_WINDOW (self), GTK_WIDGET (self->record_button));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* And finally ensure we have proper placement of our paned taking
|
||||||
|
* into account the size of the visualizers.
|
||||||
|
*/
|
||||||
|
sp_window_reset_paned (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user