[sysprof/wip/chergert/sysprof-3] libsysprof-ui: allow creating aid instance



commit 2c4291f7f95c75c183d9c7e5d486f4a7bbde1248
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 24 15:43:41 2019 -0700

    libsysprof-ui: allow creating aid instance

 src/libsysprof-ui/sysprof-aid.c | 16 +++++++++++++---
 src/libsysprof-ui/sysprof-aid.h |  3 +++
 2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-aid.c b/src/libsysprof-ui/sysprof-aid.c
index 196a043..c1461f2 100644
--- a/src/libsysprof-ui/sysprof-aid.c
+++ b/src/libsysprof-ui/sysprof-aid.c
@@ -35,9 +35,9 @@ typedef struct
 
 static void buildable_iface_init (GtkBuildableIface *iface);
 
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (SysprofAid, sysprof_aid, G_TYPE_OBJECT,
-                                  G_ADD_PRIVATE (SysprofAid)
-                                  G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init))
+G_DEFINE_TYPE_WITH_CODE (SysprofAid, sysprof_aid, G_TYPE_OBJECT,
+                         G_ADD_PRIVATE (SysprofAid)
+                         G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init))
 
 enum {
   PROP_0,
@@ -288,3 +288,13 @@ buildable_iface_init (GtkBuildableIface *iface)
 {
   iface->add_child = sysprof_aid_add_child;
 }
+
+SysprofAid *
+sysprof_aid_new (const gchar *display_name,
+                 const gchar *icon_name)
+{
+  return g_object_new (SYSPROF_TYPE_AID,
+                       "display-aid", display_name,
+                       "icon-name", icon_name,
+                       NULL);
+}
diff --git a/src/libsysprof-ui/sysprof-aid.h b/src/libsysprof-ui/sysprof-aid.h
index a84328d..ba8dfe3 100644
--- a/src/libsysprof-ui/sysprof-aid.h
+++ b/src/libsysprof-ui/sysprof-aid.h
@@ -45,6 +45,9 @@ struct _SysprofAidClass
   gpointer _reserved[16];
 };
 
+SYSPROF_AVAILABLE_IN_ALL
+SysprofAid  *sysprof_aid_new              (const gchar     *display_name,
+                                           const gchar     *icon_name);
 SYSPROF_AVAILABLE_IN_ALL
 const gchar *sysprof_aid_get_display_name (SysprofAid      *self);
 SYSPROF_AVAILABLE_IN_ALL


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