static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { NMSettingVlan *setting = NM_SETTING_VLAN (object); NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting); switch (prop_id) { case PROP_IFACE_NAME: g_value_set_string (value, priv->iface_name); break; case PROP_PARENT: g_value_set_string (value, priv->parent); break; case PROP_ID: g_value_set_uint (value, priv->id); break; case PROP_FLAGS: g_value_set_uint (value, priv->flags); break; case PROP_INGRESS_PRIORITY_MAP: g_value_take_boxed (value, priority_maplist_to_stringlist (priv->ingress_priority_map)); break; case PROP_EGRESS_PRIORITY_MAP: g_value_take_boxed (value, priority_maplist_to_stringlist (priv->egress_priority_map)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { NMSettingVlan *setting = NM_SETTING_VLAN (object); NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting); switch (prop_id) { case PROP_PARENT: g_free (priv->parent); priv->parent = g_value_dup_string (value); break; case PROP_ID: priv->id = g_value_get_uint (value); break; case PROP_FLAGS: priv->flags = g_value_get_flags (value); break; case PROP_INGRESS_PRIORITY_MAP: g_slist_free_full (priv->ingress_priority_map, g_free); priv->ingress_priority_map = priority_strv_to_maplist (NM_VLAN_INGRESS_MAP, g_value_get_boxed (value)); break; case PROP_EGRESS_PRIORITY_MAP: g_slist_free_full (priv->egress_priority_map, g_free); priv->egress_priority_map = priority_strv_to_maplist (NM_VLAN_EGRESS_MAP, g_value_get_boxed (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void finalize (GObject *object) { NMSettingVlan *setting = NM_SETTING_VLAN (object); NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting); g_free (priv->iface_name); g_free (priv->parent); nm_utils_slist_free (priv->ingress_priority_map, g_free); nm_utils_slist_free (priv->egress_priority_map, g_free); }
static void finalize (GObject *object) { NMSettingVlan *setting = NM_SETTING_VLAN (object); NMSettingVlanPrivate *priv = NM_SETTING_VLAN_GET_PRIVATE (setting); g_free (priv->parent); g_slist_free_full (priv->ingress_priority_map, g_free); g_slist_free_full (priv->egress_priority_map, g_free); G_OBJECT_CLASS (nm_setting_vlan_parent_class)->finalize (object); }
CEPage * ce_page_vlan_new (NMConnection *connection, GtkWindow *parent_window, NMClient *client, NMRemoteSettings *settings, const char **out_secrets_setting_name, GError **error) { CEPageVlan *self; CEPageVlanPrivate *priv; self = CE_PAGE_VLAN (ce_page_new (CE_TYPE_PAGE_VLAN, connection, parent_window, client, settings, UIDIR "/ce-page-vlan.ui", "VlanPage", _("VLAN"))); if (!self) { g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Could not load vlan user interface.")); return NULL; } vlan_private_init (self); priv = CE_PAGE_VLAN_GET_PRIVATE (self); priv->setting = nm_connection_get_setting_vlan (connection); if (!priv->setting) { priv->setting = NM_SETTING_VLAN (nm_setting_vlan_new ()); nm_connection_add_setting (connection, NM_SETTING (priv->setting)); } priv->s_hw = nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED); g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL); return CE_PAGE (self); }
static const char * get_virtual_iface_name (NMSetting *setting) { return nm_setting_vlan_get_interface_name (NM_SETTING_VLAN (setting)); }