Commit ecec03c8 authored by Thomas Haller's avatar Thomas Haller

cli: merge branch 'th/cli-meta-3'

parents 8b52e506 275ab5fb
This diff is collapsed.
......@@ -77,7 +77,7 @@ complete_field_setting (GHashTable *h, NMMetaSettingType setting_type)
for (i = 0; i < setting_info->properties_num; i++) {
g_hash_table_add (h, g_strdup_printf ("%s.%s",
setting_info->general->setting_name,
setting_info->properties[i].property_name));
setting_info->properties[i]->property_name));
}
}
......
This diff is collapsed.
......@@ -61,31 +61,11 @@ void set_val_color_all (NmcOutputField fields_array[], NMMetaTermColor color);
void set_val_color_fmt_all (NmcOutputField fields_array[], NMMetaTermFormat format);
void nmc_free_output_field_values (NmcOutputField fields_array[]);
typedef struct {
const NMMetaAbstractInfo *info;
const char *self_selection;
const char *sub_selection;
guint idx;
} NmcOutputSelectionItem;
typedef struct {
const guint num;
const NmcOutputSelectionItem items[];
} NmcOutputSelection;
NmcOutputSelection *nmc_output_selection_create (const NMMetaAbstractInfo *const* fields_array,
const char *fields_prefix,
const char *fields_str,
gboolean validate_nested,
GError **error);
GArray *parse_output_fields (const char *fields_str,
const NMMetaAbstractInfo *const* fields_array,
gboolean parse_groups,
GPtrArray **group_fields,
GError **error);
char *nmc_get_allowed_fields_nested (const NMMetaAbstractInfo *abstract_info, const char *name_prefix);
char *nmc_get_allowed_fields (const NMMetaAbstractInfo *const*fields_array, const char *name_prefix);
NmcOutputField *nmc_dup_fields_array (const NMMetaAbstractInfo *const*fields, NmcOfFlags flags);
void nmc_empty_output_fields (NmcOutputData *output_data);
void print_required_fields (const NmcConfig *nmc_config,
......
This diff is collapsed.
......@@ -41,8 +41,6 @@ const NMMetaPropertyInfo *nm_meta_property_info_find_by_setting (NMSetting *sett
/*****************************************************************************/
const NMMetaPropertyInfo *const*nm_property_infos_for_setting_type (NMMetaSettingType setting_type);
const NMMetaSettingInfoEditor *const*nm_meta_setting_infos_editor_p (void);
/*****************************************************************************/
......@@ -71,4 +69,33 @@ const char *const*nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abst
/*****************************************************************************/
char *nm_meta_abstract_info_get_nested_names_str (const NMMetaAbstractInfo *abstract_info, const char *name_prefix);
char *nm_meta_abstract_infos_get_names_str (const NMMetaAbstractInfo *const*fields_array, const char *name_prefix);
/*****************************************************************************/
typedef struct {
const NMMetaAbstractInfo *info;
const char *self_selection;
const char *sub_selection;
guint idx;
} NMMetaSelectionItem;
typedef struct {
const guint num;
const NMMetaSelectionItem items[];
} NMMetaSelectionResultList;
NMMetaSelectionResultList *nm_meta_selection_create_all (const NMMetaAbstractInfo *const* fields_array);
NMMetaSelectionResultList *nm_meta_selection_create_parse_one (const NMMetaAbstractInfo *const* fields_array,
const char *fields_prefix,
const char *fields_str,
gboolean validate_nested,
GError **error);
NMMetaSelectionResultList *nm_meta_selection_create_parse_list (const NMMetaAbstractInfo *const* fields_array,
const char *fields_prefix,
const char *fields_str,
gboolean validate_nested,
GError **error);
#endif /* _NM_META_SETTING_ACCESS_H__ */
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -174,6 +174,8 @@ typedef struct _NMMetaPropertyInfo NMMetaPropertyInfo;
typedef struct _NMMetaPropertyType NMMetaPropertyType;
typedef struct _NMMetaPropertyTypData NMMetaPropertyTypData;
typedef struct _NMMetaOperationContext NMMetaOperationContext;
typedef struct _NMMetaNestedPropertyInfo NMMetaNestedPropertyInfo;
typedef struct _NMMetaPropertyTypDataNested NMMetaPropertyTypDataNested;
/* this gives some context information for virtual functions.
* This command actually violates layering, and should be considered
......@@ -221,8 +223,6 @@ struct _NMMetaPropertyType {
struct _NMUtilsEnumValueInfo;
struct _NMMetaPropertyTypDataNested;
struct _NMMetaPropertyTypData {
union {
struct {
......@@ -240,11 +240,9 @@ struct _NMMetaPropertyTypData {
struct {
NMMetaPropertyTypeMacMode mode;
} mac;
struct {
const struct _NMMetaPropertyTypDataNested *data;
} nested;
} subtype;
const char *const*values_static;
const NMMetaPropertyTypDataNested *nested;
NMMetaPropertyTypFlags typ_flags;
};
......@@ -260,8 +258,8 @@ enum {
_NM_META_PROPERTY_TYPE_CONNECTION_TYPE = 4,
};
#define nm_meta_property_info_connection_type (&nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION].properties[_NM_META_PROPERTY_TYPE_CONNECTION_TYPE])
#define nm_meta_property_info_vpn_service_type (&nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_VPN].properties[_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE])
#define nm_meta_property_info_connection_type (nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION].properties[_NM_META_PROPERTY_TYPE_CONNECTION_TYPE])
#define nm_meta_property_info_vpn_service_type (nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_VPN].properties[_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE])
struct _NMMetaPropertyInfo {
const NMMetaType *meta_type;
......@@ -299,9 +297,7 @@ struct _NMMetaSettingInfoEditor {
const NMMetaSettingInfo *general;
const char *alias;
const char *pretty_name;
/* the order of the properties matter. The first *must* be the
* "name", and then the order is as they are listed by default. */
const NMMetaPropertyInfo *properties;
const NMMetaPropertyInfo *const*properties;
guint properties_num;
/* a NMConnection has a main type (connection.type), which is a
......@@ -394,19 +390,18 @@ struct _NMMetaEnvironment {
extern const NMMetaType nm_meta_type_nested_property_info;
typedef struct _NMMetaNestedPropertyTypeInfo {
const NMMetaType *meta_type;
struct _NMMetaNestedPropertyInfo {
union {
const NMMetaType *meta_type;
NMMetaPropertyInfo base;
};
const NMMetaPropertyInfo *parent_info;
const char *field_name;
NMMetaPropertyInfFlags inf_flags;
const char *prompt;
const char *def_hint;
} NMMetaNestedPropertyTypeInfo;
};
typedef struct _NMMetaPropertyTypDataNested {
const NMMetaNestedPropertyTypeInfo *nested;
struct _NMMetaPropertyTypDataNested {
const NMMetaNestedPropertyInfo *nested;
guint nested_len;
} NMMetaPropertyTypDataNested;
};
const NMMetaPropertyTypDataNested nm_meta_property_typ_data_bond;
......
......@@ -74,13 +74,16 @@ test_client_meta_check (void)
g_assert_cmpstr (info->general->setting_name, ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, FALSE));
g_assert_cmpstr ("name", ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, TRUE));
g_assert (info->properties_num == NM_PTRARRAY_LEN (info->properties));
if (info->properties_num) {
gs_unref_hashtable GHashTable *property_names = g_hash_table_new (g_str_hash, g_str_equal);
g_assert (info->properties);
for (p = 0; p < info->properties_num; p++) {
const NMMetaPropertyInfo *pi = &info->properties[p];
const NMMetaPropertyInfo *pi = info->properties[p];
g_assert (pi);
g_assert (pi->meta_type == &nm_meta_type_property_info);
g_assert (pi->setting_info == info);
g_assert (pi->property_name);
......@@ -93,6 +96,7 @@ test_client_meta_check (void)
g_assert (pi->property_type);
g_assert (pi->property_type->get_fcn);
}
g_assert (!info->properties[info->properties_num]);
} else
g_assert (!info->properties);
......@@ -120,18 +124,6 @@ test_client_meta_check (void)
}
}
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
const NMMetaPropertyInfo *const*pis;
const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
pis = nm_property_infos_for_setting_type (m);
g_assert (pis);
for (p = 0; p < info->properties_num; p++)
g_assert (pis[p] == &info->properties[p]);
g_assert (!pis[p]);
}
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
......@@ -139,7 +131,7 @@ test_client_meta_check (void)
g_assert (nm_meta_setting_info_editor_find_by_gtype (info->general->get_setting_gtype ()) == info);
for (p = 0; p < info->properties_num; p++) {
const NMMetaPropertyInfo *pi = &info->properties[p];
const NMMetaPropertyInfo *pi = info->properties[p];
g_assert (nm_meta_setting_info_editor_get_property_info (info, pi->property_name) == pi);
g_assert (nm_meta_property_info_find_by_name (info->general->setting_name, pi->property_name) == pi);
......
......@@ -11,6 +11,7 @@ clients/cli/polkit-agent.c
clients/cli/settings.c
clients/cli/utils.c
clients/common/nm-client-utils.c
clients/common/nm-meta-setting-access.c
clients/common/nm-meta-setting-desc.c
clients/common/nm-polkit-listener.c
clients/common/nm-secret-agent-simple.c
......
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