sysprof: bind current title to window title

This commit is contained in:
Christian Hergert
2019-05-20 12:09:38 -07:00
parent c15586f439
commit cacbd4fa6e
2 changed files with 13 additions and 29 deletions

View File

@ -23,6 +23,7 @@
#include "config.h"
#include <glib/gi18n.h>
#include <dazzle.h>
#include <sysprof-ui.h>
#include "sysprof-window.h"
@ -31,6 +32,8 @@ struct _SysprofWindow
{
GtkApplicationWindow parent_instance;
DzlBindingGroup *bindings;
SysprofNotebook *notebook;
GtkMenuButton *menu_button;
};
@ -134,6 +137,11 @@ save_capture_cb (GSimpleAction *action,
static void
sysprof_window_finalize (GObject *object)
{
SysprofWindow *self = (SysprofWindow *)object;
dzl_binding_group_set_source (self->bindings, NULL);
g_clear_object (&self->bindings);
G_OBJECT_CLASS (sysprof_window_parent_class)->finalize (object);
}
@ -177,6 +185,11 @@ sysprof_window_init (SysprofWindow *self)
self,
G_CONNECT_SWAPPED);
self->bindings = dzl_binding_group_new ();
dzl_binding_group_bind (self->bindings, "title", self, "title", G_BINDING_SYNC_CREATE);
g_object_bind_property (self->notebook, "current", self->bindings, "source",
G_BINDING_SYNC_CREATE);
dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "save-capture",
"enabled", FALSE,
NULL);

View File

@ -24,35 +24,6 @@
<property name="pack-type">end</property>
</packing>
</child>
<child type="title">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="visible">true</property>
<child>
<object class="GtkLabel" id="title">
<property name="visible">true</property>
<property name="label" translatable="yes">Sysprof</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="0.8"/>
</attributes>
</object>
</child>
<child>
<object class="GtkLabel" id="subtitle">
<property name="visible">true</property>
<property name="label" translatable="yes">Not running</property>
<property name="ellipsize">start</property>
<style>
<class name="dim-label"/>
</style>
<attributes>
<attribute name="scale" value="0.8"/>
</attributes>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel" id="stat_label">
<property name="margin-end">12</property>