Commit 1464c5a1 authored by Thomas Haller's avatar Thomas Haller

libnm: add function _nm_setting_get_setting_priority()

Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
parent 68bc95c1
......@@ -60,6 +60,7 @@ gboolean _nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *s
NM_SETTING_SECRET_FLAG_NOT_SAVED | \
NM_SETTING_SECRET_FLAG_NOT_REQUIRED)
guint32 _nm_setting_get_setting_priority (NMSetting *setting);
GSList * _nm_utils_hash_values_to_slist (GHashTable *hash);
......
......@@ -28,6 +28,7 @@
#include "nm-setting-private.h"
#include "nm-setting-connection.h"
#include "nm-utils.h"
#include "nm-core-internal.h"
#include "nm-utils-private.h"
#include "nm-property-compare.h"
......@@ -209,6 +210,17 @@ _get_setting_type_priority (GType type)
return info->priority;
}
guint32
_nm_setting_get_setting_priority (NMSetting *setting)
{
NMSettingPrivate *priv;
g_return_val_if_fail (NM_IS_SETTING (setting), G_MAXUINT32);
priv = NM_SETTING_GET_PRIVATE (setting);
_ensure_setting_info (setting, priv);
return priv->info->priority;
}
gboolean
_nm_setting_type_is_base_type (GType type)
{
......@@ -279,8 +291,8 @@ _nm_setting_compare_priority (gconstpointer a, gconstpointer b)
{
guint32 prio_a, prio_b;
prio_a = _get_setting_type_priority (G_OBJECT_TYPE (a));
prio_b = _get_setting_type_priority (G_OBJECT_TYPE (b));
prio_a = _nm_setting_get_setting_priority ((NMSetting *) a);
prio_b = _nm_setting_get_setting_priority ((NMSetting *) b);
if (prio_a < prio_b)
return -1;
......
......@@ -55,6 +55,7 @@ void _nm_register_setting (const char *name,
gboolean _nm_setting_is_base_type (NMSetting *setting);
gboolean _nm_setting_type_is_base_type (GType type);
guint32 _nm_setting_get_setting_priority (NMSetting *setting);
GType _nm_setting_lookup_setting_type (const char *name);
GType _nm_setting_lookup_setting_type_by_quark (GQuark error_quark);
gint _nm_setting_compare_priority (gconstpointer a, gconstpointer b);
......
......@@ -209,6 +209,17 @@ _get_setting_type_priority (GType type)
return info->priority;
}
guint32
_nm_setting_get_setting_priority (NMSetting *setting)
{
NMSettingPrivate *priv;
g_return_val_if_fail (NM_IS_SETTING (setting), G_MAXUINT32);
priv = NM_SETTING_GET_PRIVATE (setting);
_ensure_setting_info (setting, priv);
return priv->info->priority;
}
gboolean
_nm_setting_type_is_base_type (GType type)
{
......@@ -260,8 +271,8 @@ _nm_setting_compare_priority (gconstpointer a, gconstpointer b)
{
guint32 prio_a, prio_b;
prio_a = _get_setting_type_priority (G_OBJECT_TYPE (a));
prio_b = _get_setting_type_priority (G_OBJECT_TYPE (b));
prio_a = _nm_setting_get_setting_priority ((NMSetting *) a);
prio_b = _nm_setting_get_setting_priority ((NMSetting *) b);
if (prio_a < prio_b)
return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment