Ejemplo n.º 1
0
static void
nmt_newt_entry_set_property (GObject      *object,
                             guint         prop_id,
                             const GValue *value,
                             GParamSpec   *pspec)
{
    NmtNewtEntry *entry = NMT_NEWT_ENTRY (object);
    NmtNewtEntryPrivate *priv = NMT_NEWT_ENTRY_GET_PRIVATE (entry);

    switch (prop_id) {
    case PROP_TEXT:
        nmt_newt_entry_set_text (entry, g_value_get_string (value));
        break;
    case PROP_WIDTH:
        nmt_newt_entry_set_width (entry, g_value_get_int (value));
        break;
    case PROP_FLAGS:
        priv->flags = g_value_get_uint (value);
        nmt_newt_widget_needs_rebuild (NMT_NEWT_WIDGET (entry));
        break;
    case PROP_PASSWORD:
        if (g_value_get_boolean (value))
            priv->flags |= NMT_NEWT_ENTRY_PASSWORD;
        else
            priv->flags &= ~NMT_NEWT_ENTRY_PASSWORD;
        nmt_newt_widget_needs_rebuild (NMT_NEWT_WIDGET (entry));
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}
Ejemplo n.º 2
0
static void
nmt_password_fields_set_property (GObject      *object,
                                  guint         prop_id,
                                  const GValue *value,
                                  GParamSpec   *pspec)
{
	NmtPasswordFields *fields = NMT_PASSWORD_FIELDS (object);
	NmtPasswordFieldsPrivate *priv = NMT_PASSWORD_FIELDS_GET_PRIVATE (fields);

	switch (prop_id) {
	case PROP_WIDTH:
		nmt_newt_entry_set_width (priv->entry, g_value_get_int (value));
		break;
	case PROP_EXTRAS:
		priv->extras = g_value_get_uint (value);
		nmt_newt_widget_needs_rebuild (NMT_NEWT_WIDGET (fields));
		break;
	case PROP_PASSWORD:
		nmt_password_fields_set_password (fields, g_value_get_string (value));
		break;
	case PROP_ALWAYS_ASK:
		if (priv->always_ask)
			nmt_newt_checkbox_set_active (priv->always_ask, g_value_get_boolean (value));
		break;
	case PROP_SHOW_PASSWORD:
		if (priv->show_password)
			nmt_newt_checkbox_set_active (priv->show_password, g_value_get_boolean (value));
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
Ejemplo n.º 3
0
static void
nmt_device_entry_set_property (GObject      *object,
                               guint         prop_id,
                               const GValue *value,
                               GParamSpec   *pspec)
{
    NmtDeviceEntry *deventry = NMT_DEVICE_ENTRY (object);
    NmtDeviceEntryPrivate *priv = NMT_DEVICE_ENTRY_GET_PRIVATE (deventry);
    const char *interface_name;
    const char *mac_address;

    switch (prop_id) {
    case PROP_LABEL:
        priv->label = g_value_dup_string (value);
        break;
    case PROP_WIDTH:
        nmt_newt_entry_set_width (priv->entry, g_value_get_int (value));
        break;
    case PROP_HARDWARE_TYPE:
        priv->hardware_type = g_value_get_gtype (value);
        priv->arptype = (priv->hardware_type == NM_TYPE_DEVICE_INFINIBAND) ? ARPHRD_INFINIBAND : ARPHRD_ETHER;
        break;
    case PROP_INTERFACE_NAME:
        interface_name = g_value_get_string (value);
        if (nmt_device_entry_set_interface_name (deventry, interface_name))
            update_entry (deventry);
        break;
    case PROP_MAC_ADDRESS:
        mac_address = g_value_get_string (value);
        if (nmt_device_entry_set_mac_address (deventry, mac_address))
            update_entry (deventry);
        break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}