[sysprof/wip/chergert/sysprof-3] sysprof: bind current title to window title



commit 887bc32bb6bf9e81a361c8de0a865aa5217221ca
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 20 12:09:38 2019 -0700

    sysprof: bind current title to window title

 src/sysprof/sysprof-window.c     | 13 +++++++++++++
 src/sysprof/ui/sysprof-window.ui | 29 -----------------------------
 2 files changed, 13 insertions(+), 29 deletions(-)
---
diff --git a/src/sysprof/sysprof-window.c b/src/sysprof/sysprof-window.c
index b4c7a27..9440fde 100644
--- a/src/sysprof/sysprof-window.c
+++ b/src/sysprof/sysprof-window.c
@@ -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);
diff --git a/src/sysprof/ui/sysprof-window.ui b/src/sysprof/ui/sysprof-window.ui
index 63110d2..a1c8b7b 100644
--- a/src/sysprof/ui/sysprof-window.ui
+++ b/src/sysprof/ui/sysprof-window.ui
@@ -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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]