[sysprof] libsysprof-ui: add SysprofNotebook:current property



commit c15586f4394b5c0a3f012755a4caff897b2ed9e4
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 20 12:16:30 2019 -0700

    libsysprof-ui: add SysprofNotebook:current property

 src/libsysprof-ui/sysprof-notebook.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/libsysprof-ui/sysprof-notebook.c b/src/libsysprof-ui/sysprof-notebook.c
index a13f0d8..d0ddaa0 100644
--- a/src/libsysprof-ui/sysprof-notebook.c
+++ b/src/libsysprof-ui/sysprof-notebook.c
@@ -31,6 +31,7 @@ G_DEFINE_TYPE (SysprofNotebook, sysprof_notebook, GTK_TYPE_NOTEBOOK)
 enum {
   PROP_0,
   PROP_CAN_SAVE,
+  PROP_CURRENT,
   N_PROPS
 };
 
@@ -84,6 +85,7 @@ sysprof_notebook_page_added (GtkNotebook *notebook,
                                G_CONNECT_SWAPPED);
 
       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,
@@ -112,6 +114,7 @@ sysprof_notebook_page_removed (GtkNotebook *notebook,
                                             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,
@@ -129,6 +132,7 @@ sysprof_notebook_switch_page (GtkNotebook *notebook,
   GTK_NOTEBOOK_CLASS (sysprof_notebook_parent_class)->switch_page (notebook, widget, page);
 
   g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CAN_SAVE]);
+  g_object_notify_by_pspec (G_OBJECT (notebook), properties [PROP_CURRENT]);
 }
 
 static void
@@ -145,6 +149,10 @@ sysprof_notebook_get_property (GObject    *object,
       g_value_set_boolean (value, sysprof_notebook_get_can_save (self));
       break;
 
+    case PROP_CURRENT:
+      g_value_set_object (value, sysprof_notebook_get_current (self));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -168,6 +176,15 @@ sysprof_notebook_class_init (SysprofNotebookClass *klass)
                           "If the current display can save a recording",
                           FALSE,
                           (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  properties [PROP_CURRENT] =
+    g_param_spec_object ("current",
+                         "Current",
+                         "The current display",
+                         SYSPROF_TYPE_DISPLAY,
+                         (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_properties (object_class, N_PROPS, properties);
 }
 
 static void


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