[libosinfo][PATCH 5/5] media: Add 'network-installer' parameter

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

 



Apps can take advantage of this parameter in order to find out (and
correctly display to their users) whether network is needed during
the installation process.

Signed-off-by: Fabiano Fidêncio <fabiano@xxxxxxxxxxxx>
---
 osinfo/libosinfo.syms |  5 +++++
 osinfo/osinfo_media.c | 27 +++++++++++++++++++++++++++
 osinfo/osinfo_media.h |  2 ++
 3 files changed, 34 insertions(+)

diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index 64c6f79..3bad468 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -525,6 +525,11 @@ LIBOSINFO_0.2.13 {
     osinfo_media_get_eject_after_install;
 } LIBOSINFO_0.2.12;
 
+LIBOSINFO_0.2.14 {
+    global:
+    osinfo_media_get_network_installer;
+} LIBOSINFO_0.2.13;
+
 /* Symbols in next release...
 
   LIBOSINFO_0.0.2 {
diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index 293732d..740ddcb 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -604,6 +604,19 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
                                  G_PARAM_READWRITE |
                                  G_PARAM_STATIC_STRINGS);
     g_object_class_install_property(g_klass, PROP_EJECT_AFTER_INSTALL, pspec);
+
+    /**
+     * OsinfoMedia:network-installer:
+     *
+     * Whether media is a network installer or not.
+     */
+    pspec = g_param_spec_boolean("network-installer",
+                                 "NetworkInstaller",
+                                 _("Media is a network installer"),
+                                 FALSE /* default value */,
+                                 G_PARAM_READWRITE |
+                                 G_PARAM_STATIC_STRINGS);
+    g_object_class_install_property(g_klass, PROP_LIVE, pspec);
 }
 
 static void
@@ -1152,6 +1165,20 @@ gboolean osinfo_media_get_live(OsinfoMedia *media)
             (OSINFO_ENTITY(media), OSINFO_MEDIA_PROP_LIVE, FALSE);
 }
 
+/**
+ * osinfo_media_get_network_installer:
+ * @media: an #OsinfoMedia instance
+ *
+ * Whether @media is a network installer or not.
+ *
+ * Returns: #TRUE if media is a network installer, #FALSE otherwise
+ */
+gboolean osinfo_media_get_network_installer(OsinfoMedia *media)
+{
+    return osinfo_entity_get_param_value_boolean_with_default
+            (OSINFO_ENTITY(media), OSINFO_MEDIA_PROP_NETWORK_INSTALLER, FALSE);
+}
+
 /**
  * osinfo_media_get_installer_reboots:
  * @media: an #OsinfoMedia instance
diff --git a/osinfo/osinfo_media.h b/osinfo/osinfo_media.h
index 6df7b60..38ae637 100644
--- a/osinfo/osinfo_media.h
+++ b/osinfo/osinfo_media.h
@@ -91,6 +91,7 @@ typedef struct _OsinfoMediaPrivate OsinfoMediaPrivate;
 #define OSINFO_MEDIA_PROP_VARIANT        "variant"
 #define OSINFO_MEDIA_PROP_VOLUME_SIZE    "volume-size"
 #define OSINFO_MEDIA_PROP_EJECT_AFTER_INSTALL "eject-after-install"
+#define OSINFO_MEDIA_PROP_NETWORK_INSTALLER   "network-installer"
 
 /* object */
 struct _OsinfoMedia
@@ -142,6 +143,7 @@ gboolean osinfo_media_get_live(OsinfoMedia *media);
 gint osinfo_media_get_installer_reboots(OsinfoMedia *media);
 gint64 osinfo_media_get_volume_size(OsinfoMedia *media);
 gboolean osinfo_media_get_eject_after_install(OsinfoMedia *media);
+gboolean osinfo_media_get_network_installer(OsinfoMedia *media);
 
 #endif /* __OSINFO_MEDIA_H__ */
 /*
-- 
2.14.3

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux